Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
5fefff89
Commit
5fefff89
authored
3 years ago
by
Timo Koch
Browse files
Options
Downloads
Patches
Plain Diff
[couplingmapper] Improve locality of variable scope
parent
62f0a694
No related branches found
No related tags found
1 merge request
!2650
[couplingmapper] Improve locality of variable scope
Pipeline
#4489
passed
3 years ago
Stage: trigger
Stage: downstream modules
Pipeline: dumux-lecture
#4493
Pipeline: dumux
#4492
Pipeline: dumux
#4491
+1
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/multidomain/facet/box/couplingmapper.hh
+31
-26
31 additions, 26 deletions
dumux/multidomain/facet/box/couplingmapper.hh
with
31 additions
and
26 deletions
dumux/multidomain/facet/box/couplingmapper.hh
+
31
−
26
View file @
5fefff89
...
...
@@ -121,37 +121,42 @@ public:
const
auto
bulkRefElem
=
referenceElement
(
bulkElement
);
// find the bulk element facet that lies on this low dim element (assumes conformity!)
bool
found
=
false
;
unsigned
int
coupledFacetIndex
=
0
;
std
::
vector
<
unsigned
int
>
handledFacets
;
for
(
const
auto
&
is
:
intersections
(
bulkFvGridGeometry
.
gridView
(),
bulkElement
))
const
auto
coupledFacetIndex
=
[
&
]
{
// skip already handled facets (necessary for e.g. Dune::FoamGrid)
if
(
std
::
count
(
handledFacets
.
begin
(),
handledFacets
.
end
(),
is
.
indexInInside
()))
continue
;
handledFacets
.
push_back
(
is
.
indexInInside
());
// determine if it lies on low dim element by comparing corner indices
const
auto
numCorners
=
is
.
geometry
().
corners
();
std
::
vector
<
BulkIndexType
>
facetIndices
(
numCorners
);
for
(
int
i
=
0
;
i
<
numCorners
;
++
i
)
bool
found
=
false
;
unsigned
int
coupledFacetIndex
=
0
;
std
::
vector
<
unsigned
int
>
handledFacets
;
for
(
const
auto
&
is
:
intersections
(
bulkFvGridGeometry
.
gridView
(),
bulkElement
))
{
const
auto
vIdxLocal
=
bulkRefElem
.
subEntity
(
is
.
indexInInside
(),
1
,
i
,
bulkDim
);
facetIndices
[
i
]
=
bulkFvGridGeometry
.
vertexMapper
().
vertexIndex
(
bulkElement
.
template
subEntity
<
bulkDim
>(
vIdxLocal
));
// skip already handled facets (necessary for e.g. Dune::FoamGrid)
if
(
std
::
count
(
handledFacets
.
begin
(),
handledFacets
.
end
(),
is
.
indexInInside
()))
continue
;
handledFacets
.
push_back
(
is
.
indexInInside
());
// determine if it lies on low dim element by comparing corner indices
const
auto
numCorners
=
is
.
geometry
().
corners
();
std
::
vector
<
BulkIndexType
>
facetIndices
(
numCorners
);
for
(
int
i
=
0
;
i
<
numCorners
;
++
i
)
{
const
auto
vIdxLocal
=
bulkRefElem
.
subEntity
(
is
.
indexInInside
(),
1
,
i
,
bulkDim
);
facetIndices
[
i
]
=
bulkFvGridGeometry
.
vertexMapper
().
vertexIndex
(
bulkElement
.
template
subEntity
<
bulkDim
>(
vIdxLocal
));
}
std
::
sort
(
facetIndices
.
begin
(),
facetIndices
.
end
());
if
(
std
::
equal
(
facetIndices
.
begin
(),
facetIndices
.
end
(),
elementCorners
.
begin
(),
elementCorners
.
end
())
)
{
coupledFacetIndex
=
is
.
indexInInside
();
found
=
true
;
break
;
}
}
std
::
sort
(
facetIndices
.
begin
(),
facetIndices
.
end
());
if
(
std
::
equal
(
facetIndices
.
begin
(),
facetIndices
.
end
(),
elementCorners
.
begin
(),
elementCorners
.
end
())
)
{
coupledFacetIndex
=
is
.
indexInInside
();
found
=
true
;
break
;
}
}
// ensure that we found the facet!
if
(
!
found
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Could not find the bulk element coupling facet!"
);
// ensure that we found the facet!
if
(
!
found
)
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Could not find the bulk element coupling facet!"
);
return
coupledFacetIndex
;
}();
// we should always find numElementCorners coupling scvfs
auto
fvGeometry
=
localView
(
bulkFvGridGeometry
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment