Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
3104b34d
Commit
3104b34d
authored
Jul 30, 2021
by
Martin Schneider
Browse files
[md][ffpm][box] Fix iterator for coupling facets
parent
004c3cd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/multidomain/boundary/stokesdarcy/box/couplingmapper.hh
View file @
3104b34d
...
...
@@ -51,8 +51,8 @@ class FacetIterator : public Dune::ForwardIteratorFacade<FacetIterator<CouplingF
{
using
ThisType
=
FacetIterator
<
CouplingFacet
,
Container
,
IndexSet
,
Iterator
>
;
public:
FacetIterator
(
const
Iterator
&
it
,
const
Container
&
container
,
const
IndexSet
&
indices
)
:
it_
(
it
),
container_
(
&
container
),
indices_
(
&
indices
)
{}
FacetIterator
(
const
Iterator
&
it
,
const
Container
&
container
,
const
IndexSet
&
indices
,
std
::
size_t
localIdx
)
:
it_
(
it
),
container_
(
&
container
),
indices_
(
&
indices
)
,
localIdx_
(
localIdx
)
{}
FacetIterator
()
:
it_
(
Iterator
()),
container_
(
nullptr
),
indices_
(
nullptr
)
{}
...
...
@@ -67,26 +67,28 @@ public:
return
it_
==
other
.
it_
;
}
template
<
bool
enable
=
std
::
is_integral
<
IndexSet
>
::
value
,
std
::
enable_if_t
<!
enable
,
int
>
=
0
>
void
increment
()
{
it_
++
;
if
(
it_
==
(
*
indices_
)[
localIdx_
].
end
())
// Case where the index container contains the indices
if
constexpr
(
std
::
is_integral_v
<
typename
IndexSet
::
value_type
>
)
it_
++
;
// Case where the index container contains sub-containers which store the indices
else
{
localIdx_
++
;
auto
it
=
std
::
find_if
(
indices_
->
begin
()
+
localIdx_
,
indices_
->
end
(),
[]
(
const
auto
&
idx
)
{
return
idx
.
size
()
>
0
;
});
it_
++
;
if
(
it_
==
(
*
indices_
)[
localIdx_
].
end
())
{
auto
it
=
std
::
find_if
(
indices_
->
begin
()
+
localIdx_
+
1
,
indices_
->
end
(),
[]
(
const
auto
&
idx
)
{
return
idx
.
size
()
>
0
;
});
if
(
it
!=
indices_
->
end
())
it_
=
it
->
begin
();
if
(
it
!=
indices_
->
end
())
{
it_
=
it
->
begin
();
localIdx_
=
std
::
distance
(
indices_
->
begin
(),
it
);
}
}
}
}
template
<
bool
enable
=
std
::
is_integral
<
IndexSet
>
::
value
,
std
::
enable_if_t
<
enable
,
int
>
=
0
>
void
increment
()
{
it_
++
;
}
private:
Iterator
it_
;
const
Container
*
container_
;
...
...
@@ -107,8 +109,8 @@ auto couplingFacets(Dune::index_constant<i> domainI, const Mapper& mapper, std::
std
::
reverse_iterator
(
indexSet
.
begin
()),
[]
(
const
auto
&
idx
)
{
return
idx
.
size
()
>
0
;
});
return
Dune
::
IteratorRange
<
FacetIterator
>
(
FacetIterator
(
itBegin
->
begin
(),
mapper
.
couplingFacets
(),
indexSet
),
FacetIterator
(
itEnd
->
end
(),
mapper
.
couplingFacets
(),
indexSet
));
return
Dune
::
IteratorRange
<
FacetIterator
>
(
FacetIterator
(
itBegin
->
begin
(),
mapper
.
couplingFacets
(),
indexSet
,
std
::
distance
(
indexSet
.
begin
(),
itBegin
)
),
FacetIterator
(
itEnd
->
end
(),
mapper
.
couplingFacets
(),
indexSet
,
std
::
distance
(
itEnd
,
std
::
reverse_iterator
(
indexSet
.
begin
()))
));
}
template
<
class
Mapper
,
std
::
size_t
i
>
...
...
@@ -117,9 +119,10 @@ auto couplingFacets(Dune::index_constant<i> domainI, const Mapper& mapper, std::
using
FacetContainer
=
typename
Mapper
::
FacetContainer
;
using
IndexContainerScvf
=
typename
Mapper
::
IndexContainerScvf
;
using
FacetIterator
=
FacetIterator
<
typename
FacetContainer
::
value_type
,
FacetContainer
,
IndexContainerScvf
,
typename
IndexContainerScvf
::
const_iterator
>
;
const
auto
&
indexSet
=
mapper
.
couplingFacetIdxMap
(
domainI
).
at
(
eIdx
)[
localScvfIdx
];
return
Dune
::
IteratorRange
<
FacetIterator
>
(
FacetIterator
(
indexSet
->
begin
(),
mapper
.
couplingFacets
(),
indexSet
),
FacetIterator
(
indexSet
->
end
(),
mapper
.
couplingFacets
(),
indexSet
));
const
auto
&
indexSet
=
mapper
.
couplingFacetIdxMap
(
domainI
).
at
(
eIdx
);
const
auto
&
indexSetScvf
=
indexSet
[
localScvfIdx
];
return
Dune
::
IteratorRange
<
FacetIterator
>
(
FacetIterator
(
indexSetScvf
.
begin
(),
mapper
.
couplingFacets
(),
indexSetScvf
,
localScvfIdx
),
FacetIterator
(
indexSetScvf
.
end
(),
mapper
.
couplingFacets
(),
indexSetScvf
,
localScvfIdx
));
}
/*!
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment