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
121bba76
Commit
121bba76
authored
Jul 11, 2018
by
Dennis Gläser
Committed by
Timo Koch
Jul 12, 2018
Browse files
[multidomain][facet] introduce grid manager and pull out grid data
parent
370b660e
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
dumux/multidomain/facet/CMakeLists.txt
View file @
121bba76
...
...
@@ -8,6 +8,6 @@ couplingmapper.hh
couplingmapperbase.hh
enrichmenthelper.hh
gmshreader.hh
grid
creato
r.hh
grid
manage
r.hh
vertexmapper.hh
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dumux/multidomain/facet
)
dumux/multidomain/facet/box/couplingmapper.hh
View file @
121bba76
...
...
@@ -69,16 +69,16 @@ public:
*
* \param bulkFvGridGeometry The finite-volume grid geometry of the bulk grid
* \param lowDimFvGridGeometry The finite-volume grid geometry of the lower-dimensional grid
* \param grid
Creato
r Class that contains the
grid factories and embedment
s
* \param grid
Manage
r Class that contains the
embedments and allows obtaining entity insertion indice
s
*/
template
<
class
Grid
Creato
r
>
template
<
class
Grid
Manage
r
>
void
update
(
const
BulkFVG
&
bulkFvGridGeometry
,
const
LowDimFVG
&
lowDimFvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
)
const
Grid
Manage
r
&
grid
Manage
r
)
{
// forward to update function with instantiated vertex adapter
using
GridAdapter
=
CodimOneGridAdapter
<
Grid
Creato
r
,
bulkGridId
,
facetGridId
>
;
update
(
bulkFvGridGeometry
,
lowDimFvGridGeometry
,
grid
Creato
r
,
GridAdapter
{
grid
Creato
r
});
using
GridAdapter
=
CodimOneGridAdapter
<
Grid
Manage
r
,
bulkGridId
,
facetGridId
>
;
update
(
bulkFvGridGeometry
,
lowDimFvGridGeometry
,
grid
Manage
r
,
GridAdapter
{
grid
Manage
r
});
}
/*!
* \brief Update coupling maps. This is the standard
...
...
@@ -86,13 +86,13 @@ public:
*
* \param bulkFvGridGeometry The finite-volume grid geometry of the bulk grid
* \param lowDimFvGridGeometry The finite-volume grid geometry of the lower-dimensional grid
* \param grid
Creato
r Class that contains the
grid factories and embedment
s
* \param grid
Manage
r Class that contains the
embedments and allows obtaining entity insertion indice
s
* \param codimOneGridAdapter Allows direct access to data on the bulk grid for lowdim grid entities
*/
template
<
class
Grid
Creato
r
,
class
CodimOneGridAdapter
>
template
<
class
Grid
Manage
r
,
class
CodimOneGridAdapter
>
void
update
(
const
BulkFVG
&
bulkFvGridGeometry
,
const
LowDimFVG
&
lowDimFvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
,
const
Grid
Manage
r
&
grid
Manage
r
,
const
CodimOneGridAdapter
&
codimOneGridAdapter
)
{
// define the execution policy how to add map entries from an embedment
...
...
@@ -204,7 +204,7 @@ public:
};
// let the parent do the update subject to the execution policy defined above
ParentType
::
update_
(
bulkFvGridGeometry
,
lowDimFvGridGeometry
,
grid
Creato
r
,
addEmbedmentPolicy
);
ParentType
::
update_
(
bulkFvGridGeometry
,
lowDimFvGridGeometry
,
grid
Manage
r
,
addEmbedmentPolicy
);
// coupling stencils might not be unique with the policy above
auto
makeStencilUnique
=
[]
(
auto
&
data
)
...
...
dumux/multidomain/facet/cellcentered/tpfa/couplingmapper.hh
View file @
121bba76
...
...
@@ -62,12 +62,12 @@ public:
*
* \param bulkFvGridGeometry The finite-volume grid geometry of the bulk grid
* \param lowDimFvGridGeometry The finite-volume grid geometry of the lower-dimensional grid
* \param grid
Creato
r Class that contains the
grid factories and embedment
s
* \param grid
Manage
r Class that contains the
embedments and allows obtaining entity insertion indice
s
*/
template
<
class
Grid
Creato
r
>
template
<
class
Grid
Manage
r
>
void
update
(
const
BulkFVG
&
bulkFvGridGeometry
,
const
LowDimFVG
&
lowDimFvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
)
const
Grid
Manage
r
&
grid
Manage
r
)
{
// define the execution policy how to add map entries from an embedment
auto
addEmbedmentPolicy
=
[
&
]
(
auto
&&
embedments
,
...
...
@@ -150,7 +150,7 @@ public:
};
// let the parent do the update subject to the execution policy defined above
ParentType
::
update_
(
bulkFvGridGeometry
,
lowDimFvGridGeometry
,
grid
Creato
r
,
addEmbedmentPolicy
);
ParentType
::
update_
(
bulkFvGridGeometry
,
lowDimFvGridGeometry
,
grid
Manage
r
,
addEmbedmentPolicy
);
// coupling stencils might not be unique if box is used in lowdim domain
if
(
LowDimFVG
::
discMethod
==
DiscretizationMethod
::
box
)
...
...
dumux/multidomain/facet/codimonegridadapter.hh
View file @
121bba76
...
...
@@ -40,22 +40,22 @@ namespace Dumux {
* d-dimensional grid. This class can be used in the context of models where
* a sub-domain lives on the facets of a bulk grid.
*
* \tparam Grid
Creato
r A grid
creato
r containing a hierarchy of facet-conforming grids.
* \tparam Grid
Manage
r A grid
manage
r containing a hierarchy of facet-conforming grids.
* \tparam bulkGridId The grid id of the d-dimensional grid within the hierarchy
* \tparam facetGridId The grid id of the (d-1)-dimensional grid within the hierarchy
*/
template
<
class
Grid
Creato
r
,
int
bulkGridId
=
0
,
int
facetGridId
=
1
>
template
<
class
Grid
Manage
r
,
int
bulkGridId
=
0
,
int
facetGridId
=
1
>
class
CodimOneGridAdapter
{
// Extract some types of the facet-conforming grid of codimension one
using
FacetGrid
=
typename
Grid
Creato
r
::
template
Grid
<
facetGridId
>;
using
FacetGrid
=
typename
Grid
Manage
r
::
template
Grid
<
facetGridId
>;
using
FacetGridView
=
typename
FacetGrid
::
LeafGridView
;
using
FacetGridVertex
=
typename
FacetGridView
::
template
Codim
<
FacetGrid
::
dimension
>
::
Entity
;
using
FacetGridElement
=
typename
FacetGridView
::
template
Codim
<
0
>
::
Entity
;
using
FacetGridIndexType
=
typename
FacetGridView
::
IndexSet
::
IndexType
;
// Extract some types of the bulk grid
using
BulkGrid
=
typename
Grid
Creato
r
::
template
Grid
<
bulkGridId
>;
using
BulkGrid
=
typename
Grid
Manage
r
::
template
Grid
<
bulkGridId
>;
using
BulkGridView
=
typename
BulkGrid
::
LeafGridView
;
using
BulkMapper
=
Dune
::
MultipleCodimMultipleGeomTypeMapper
<
BulkGridView
>
;
using
BulkReferenceElements
=
typename
Dune
::
ReferenceElements
<
typename
BulkGridView
::
ctype
,
BulkGrid
::
dimension
>
;
...
...
@@ -65,7 +65,7 @@ class CodimOneGridAdapter
using
BulkIndexType
=
typename
BulkGridView
::
IndexSet
::
IndexType
;
// Find out if the given bulk grid is the one with highest dimensionality among the created grids
static
constexpr
bool
bulkHasHighestDimension
=
(
int
(
BulkGrid
::
dimension
)
==
Grid
Creato
r
::
bulkDim
);
static
constexpr
bool
bulkHasHighestDimension
=
(
int
(
BulkGrid
::
dimension
)
==
Grid
Manage
r
::
bulkDim
);
// check if provided id combination makes sense
static_assert
(
int
(
FacetGrid
::
dimension
)
==
int
(
BulkGrid
::
dimension
)
-
1
,
...
...
@@ -76,28 +76,28 @@ class CodimOneGridAdapter
public:
//! The constructor
CodimOneGridAdapter
(
const
Grid
Creato
r
&
grid
Creato
r
)
:
grid
Creato
rPtr_
(
&
grid
Creato
r
)
,
bulkVertexMapper_
(
grid
Creato
r
.
template
grid
<
bulkGridId
>().
leafGridView
(),
Dune
::
mcmgVertexLayout
())
CodimOneGridAdapter
(
const
Grid
Manage
r
&
grid
Manage
r
)
:
grid
Manage
rPtr_
(
&
grid
Manage
r
)
,
bulkVertexMapper_
(
grid
Manage
r
.
template
grid
<
bulkGridId
>().
leafGridView
(),
Dune
::
mcmgVertexLayout
())
{
// bulk insertion to grid index map
const
auto
&
bulkGridView
=
grid
Creato
r
.
template
grid
<
bulkGridId
>().
leafGridView
();
const
auto
&
bulkGridFactory
=
grid
Creato
rPtr_
->
template
gridFactory
<
bulkGridId
>();
const
auto
&
bulkGridView
=
grid
Manage
r
.
template
grid
<
bulkGridId
>().
leafGridView
();
const
auto
&
bulkGridFactory
=
grid
Manage
rPtr_
->
template
gridFactory
<
bulkGridId
>();
bulkInsertionToGridVIdx_
.
resize
(
bulkGridView
.
size
(
BulkGrid
::
dimension
));
for
(
const
auto
&
v
:
vertices
(
bulkGridView
))
bulkInsertionToGridVIdx_
[
bulkGridFactory
.
insertionIndex
(
v
)
]
=
bulkVertexMapper_
.
index
(
v
);
// maybe set up index map from hierachy insertion to bulk insertion indices
makeBulkIndexMap_
(
grid
Creato
r
);
makeBulkIndexMap_
(
grid
Manage
r
);
// determine which bulk vertices lie on facet elements
bulkVertexIsOnFacetGrid_
.
resize
(
bulkGridView
.
size
(
BulkGrid
::
dimension
),
false
);
const
auto
&
facetGridView
=
grid
Creato
r
.
template
grid
<
facetGridId
>().
leafGridView
();
const
auto
&
facetGridFactory
=
grid
CreatorPtr_
->
template
gridFactory
<
facetGridId
>();
const
auto
&
facetGridView
=
grid
Manage
r
.
template
grid
<
facetGridId
>().
leafGridView
();
const
auto
&
facetGridFactory
=
grid
Manager
.
template
gridFactory
<
facetGridId
>();
for
(
const
auto
&
v
:
vertices
(
facetGridView
))
{
const
auto
insIdx
=
facetGridFactory
.
insertionIndex
(
v
);
const
auto
highestLevelInsIdx
=
grid
CreatorPtr_
->
lowDimVertexIndices
(
facetGridId
)[
insIdx
];
const
auto
highestLevelInsIdx
=
grid
Manager
.
lowDimVertexIndices
(
facetGridId
)[
insIdx
];
const
auto
bulkGridIdx
=
getBulkGridVertexIndex_
(
highestLevelInsIdx
);
bulkVertexIsOnFacetGrid_
[
bulkGridIdx
]
=
true
;
}
...
...
@@ -138,8 +138,8 @@ public:
*/
BulkIndexType
bulkGridVertexIndex
(
const
FacetGridVertex
&
v
)
const
{
const
auto
insIdx
=
grid
Creato
rPtr_
->
template
gridFactory
<
facetGridId
>().
insertionIndex
(
v
);
const
auto
highestLevelInsIdx
=
grid
Creato
rPtr_
->
lowDimVertexIndices
(
facetGridId
)[
insIdx
];
const
auto
insIdx
=
grid
Manage
rPtr_
->
template
gridFactory
<
facetGridId
>().
insertionIndex
(
v
);
const
auto
highestLevelInsIdx
=
grid
Manage
rPtr_
->
lowDimVertexIndices
(
facetGridId
)[
insIdx
];
return
getBulkGridVertexIndex_
(
highestLevelInsIdx
);
}
...
...
@@ -149,7 +149,7 @@ public:
*/
bool
isOnFacetGrid
(
const
BulkGridVertex
&
v
)
const
{
const
auto
bulkInsIdx
=
grid
Creato
rPtr_
->
template
gridFactory
<
bulkGridId
>().
insertionIndex
(
v
);
const
auto
bulkInsIdx
=
grid
Manage
rPtr_
->
template
gridFactory
<
bulkGridId
>().
insertionIndex
(
v
);
const
auto
bulkVIdx
=
bulkInsertionToGridVIdx_
[
bulkInsIdx
];
return
bulkVertexIsOnFacetGrid_
[
bulkVIdx
];
}
...
...
@@ -230,29 +230,29 @@ public:
* given (d-1)-dimensional element is embedded in
*/
std
::
size_t
numEmbedments
(
const
FacetGridElement
&
e
)
const
{
return
grid
Creato
rPtr_
->
template
embedmentEntityIndices
<
facetGridId
>(
e
).
size
();
}
{
return
grid
Manage
rPtr_
->
template
embedmentEntityIndices
<
facetGridId
>(
e
).
size
();
}
private:
//! Determine map from the insertion idx of the highest-dimensional grid to bulk insertion idx
template
<
bool
isHighest
=
bulkHasHighestDimension
,
std
::
enable_if_t
<!
isHighest
,
int
>
=
0
>
void
makeBulkIndexMap_
(
const
Grid
Creato
r
&
grid
Creato
r
)
void
makeBulkIndexMap_
(
const
Grid
Manage
r
&
grid
Manage
r
)
{
// obtain highest-dimensional grid using the bulkId from grid creator
const
auto
&
highestLevelGridView
=
grid
Creato
r
.
template
grid
<
Grid
Creato
r
::
bulkGridId
>().
leafGridView
();
highestLevelInsertionToBulkInsertionIdx_
.
resize
(
highestLevelGridView
.
size
(
Grid
Creato
r
::
bulkDim
));
const
auto
&
highestLevelGridView
=
grid
Manage
r
.
template
grid
<
Grid
Manage
r
::
bulkGridId
>().
leafGridView
();
highestLevelInsertionToBulkInsertionIdx_
.
resize
(
highestLevelGridView
.
size
(
Grid
Manage
r
::
bulkDim
));
// indices in grid creator stem from the grid file, which has one set of vertices
// for the entire hierarchy. Thus, the vertex indices we obtain from the grid creator
// that make up this bulk grid (lower-dimensional within the hierarchy), correspond to
// the highest-dimensional grid's insertion indices.
const
auto
&
vertexInsIndices
=
grid
CreatorPtr_
->
lowDimVertexIndices
(
bulkGridId
);
const
auto
&
vertexInsIndices
=
grid
Manager
.
lowDimVertexIndices
(
bulkGridId
);
for
(
std
::
size_t
insIdx
=
0
;
insIdx
<
vertexInsIndices
.
size
();
++
insIdx
)
highestLevelInsertionToBulkInsertionIdx_
[
vertexInsIndices
[
insIdx
]
]
=
insIdx
;
}
//! If the given bulk grid is on the highest level of grid creation, we do not need the map
template
<
bool
isHighest
=
bulkHasHighestDimension
,
std
::
enable_if_t
<
isHighest
,
int
>
=
0
>
void
makeBulkIndexMap_
(
const
Grid
Creato
r
&
grid
Creato
r
)
void
makeBulkIndexMap_
(
const
Grid
Manage
r
&
grid
Manage
r
)
{}
//! Obtains the bulk grid vertex index from a given insertion index on the hierarchy
...
...
@@ -264,7 +264,7 @@ private:
}
// pointer to the grid creator
const
Grid
Creato
r
*
grid
Creato
rPtr_
;
const
Grid
Manage
r
*
grid
Manage
rPtr_
;
// vertex mapper of the bulk grid
BulkMapper
bulkVertexMapper_
;
...
...
dumux/multidomain/facet/couplingmapper.hh
View file @
121bba76
...
...
@@ -113,16 +113,16 @@ public:
* \param bulkFvGridGeometry The finite-volume grid geometry of the bulk grid
* \param facetFvGridGeometry The finite-volume grid geometry of the codimension-one grid
* \param edgeFvGridGeometry The finite-volume grid geometry of the codimension-two grid
* \param grid
Creato
r Class that contains the
grid factories and embedment
s
* \param grid
Manage
r Class that contains the
embedments and allows obtaining entity insertion indice
s
*/
template
<
class
Grid
Creato
r
>
template
<
class
Grid
Manage
r
>
void
update
(
const
BulkFVG
&
bulkFvGridGeometry
,
const
FacetFVG
&
facetFvGridGeometry
,
const
EdgeFVG
&
edgeFvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
)
const
Grid
Manage
r
&
grid
Manage
r
)
{
BulkFacetMapper
::
update
(
bulkFvGridGeometry
,
facetFvGridGeometry
,
grid
Creato
r
);
FacetEdgeMapper
::
update
(
facetFvGridGeometry
,
edgeFvGridGeometry
,
grid
Creato
r
);
BulkFacetMapper
::
update
(
bulkFvGridGeometry
,
facetFvGridGeometry
,
grid
Manage
r
);
FacetEdgeMapper
::
update
(
facetFvGridGeometry
,
edgeFvGridGeometry
,
grid
Manage
r
);
}
//! Pull up the parents' access operators to allow for individual updates
...
...
dumux/multidomain/facet/couplingmapperbase.hh
View file @
121bba76
...
...
@@ -64,11 +64,11 @@ class FacetCouplingMapperBase
static
constexpr
auto
bulkDiscMethod
=
BulkFVG
::
discMethod
;
// helper struct to check validity of the given domain id offset
template
<
class
Grid
Creato
r
>
class
IsValidGrid
Creato
r
template
<
class
Grid
Manage
r
>
class
IsValidGrid
Manage
r
{
using
GCBulkGridView
=
typename
Grid
Creato
r
::
template
Grid
<
bulkId
>
::
LeafGridView
;
using
GCLowDimGridView
=
typename
Grid
Creato
r
::
template
Grid
<
lowDimId
>
::
LeafGridView
;
using
GCBulkGridView
=
typename
Grid
Manage
r
::
template
Grid
<
bulkId
>
::
LeafGridView
;
using
GCLowDimGridView
=
typename
Grid
Manage
r
::
template
Grid
<
lowDimId
>
::
LeafGridView
;
static
constexpr
bool
bulkMatch
=
std
::
is_same
<
GCBulkGridView
,
BulkGridView
>::
value
;
static
constexpr
bool
lowDimMatch
=
std
::
is_same
<
GCLowDimGridView
,
LowDimGridView
>::
value
;
static_assert
(
bulkMatch
,
"The bulk domain id does not match the provided bulk grid geometry"
);
...
...
@@ -145,10 +145,10 @@ public:
* \brief Update coupling maps. This is the standard interface
* and has to be overloaded by the implementation.
*/
template
<
class
Grid
Creato
r
>
template
<
class
Grid
Manage
r
>
void
update
(
const
BulkFVG
&
bulkFvGridGeometry
,
const
LowDimFVG
&
lowDimFvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
)
const
Grid
Manage
r
&
grid
Manage
r
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Implementation does not provide an update() function."
);
}
//! returns coupling data for bulk -> lowDim
...
...
@@ -166,30 +166,30 @@ protected:
*
* \param bulkFvGridGeometry The finite-volume grid geometry of the bulk grid
* \param lowDimFvGridGeometry The finite-volume grid geometry of the lower-dimensional grid
* \param grid
Creato
r Class that contains the
grid factories and embedment
s
* \param grid
Manage
r Class that contains the
embedments and allows obtaining entity insertion indice
s
* \param EmbedmentExecutionPolicy Policy for adding coupling entries for embedments
*/
template
<
class
Grid
Creato
r
,
typename
EmbedmentExecutionPolicy
>
template
<
class
Grid
Manage
r
,
typename
EmbedmentExecutionPolicy
>
void
update_
(
const
BulkFVG
&
bulkFvGridGeometry
,
const
LowDimFVG
&
lowDimFvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
,
const
Grid
Manage
r
&
grid
Manage
r
,
EmbedmentExecutionPolicy
&&
embedmentPolicy
)
{
// some static assertions on the grid creator
static_assert
(
IsValidGrid
Creato
r
<
Grid
Creato
r
>::
value
,
"Grid type mismatch. Please review the provided domain id offset."
);
static_assert
(
IsValidGrid
Manage
r
<
Grid
Manage
r
>::
value
,
"Grid type mismatch. Please review the provided domain id offset."
);
// clear data
bulkCouplingData_
.
clear
();
lowDimCouplingData_
.
clear
();
// set up maps between element indices and insertion indices
const
auto
&
bulkGridFactory
=
grid
Creato
r
.
template
gridFactory
<
bulkId
>();
const
auto
&
bulkGridFactory
=
grid
Manage
r
.
template
gridFactory
<
bulkId
>();
const
auto
bulkInsertionToElemIdxMap
=
makeInsertionToGridIndexMap_
(
bulkGridFactory
,
bulkFvGridGeometry
);
// set up coupling maps coming from the low dim domain
for
(
const
auto
&
element
:
elements
(
lowDimFvGridGeometry
.
gridView
()))
{
auto
embedments
=
grid
Creato
r
.
template
embedmentEntityIndices
<
lowDimId
>(
element
);
auto
embedments
=
grid
Manage
r
.
template
embedmentEntityIndices
<
lowDimId
>(
element
);
// proceed only if embedments were found
if
(
embedments
.
size
()
==
0
)
...
...
dumux/multidomain/facet/gmshreader.hh
View file @
121bba76
...
...
@@ -52,25 +52,24 @@ namespace Dumux {
* then be interpreted as boundary segments. Use respective physical entity
* indexing in your grid file in that case.
*
* \tparam GCTraits The type traits of the grid creator class
* \tparam BulkGrid The type of the highest-dimensional grid in the hierachy
* \tparam IndexType The index type to be used
* \tparam numGrids The number of grids to be considered in the hierarchy
*/
template
<
typename
GCTrait
s
>
template
<
class
BulkGrid
,
class
IndexType
,
int
numGrid
s
>
class
FacetCouplingGmshReader
{
// extract some necessary info from bulk grid
using
BulkGrid
=
typename
GCTraits
::
BulkGrid
;
static
constexpr
int
bulkDim
=
BulkGrid
::
dimension
;
static
constexpr
int
bulkDimWorld
=
BulkGrid
::
dimensionworld
;
using
ctype
=
typename
BulkGrid
::
ctype
;
using
GlobalPosition
=
Dune
::
FieldVector
<
ctype
,
bulkDimWorld
>
;
// determine minimum dimension for which a grid is created
static
constexpr
int
numGrids
=
GCTraits
::
numGrids
;
static
constexpr
int
minGridDim
=
BulkGrid
::
dimension
-
numGrids
+
1
;
static_assert
(
minGridDim
>=
1
,
"Grids with dim < 1 cannot be read!"
);
// structure to store data on an element
using
IndexType
=
typename
GCTraits
::
IndexType
;
using
VertexIndexSet
=
std
::
vector
<
IndexType
>
;
struct
ElementData
{
...
...
@@ -302,28 +301,28 @@ public:
}
//! Returns the maps of element markers
typename
GCTraits
::
ElementToDomainMarkerMap
&
elementMarkerMap
(
std
::
size_t
id
)
std
::
vector
<
int
>
&
elementMarkerMap
(
std
::
size_t
id
)
{
assert
(
id
<
numGrids
&&
"Index exceeds number of grids provided"
);
return
elementMarkerMaps_
[
id
];
}
//! Returns the maps of domain markers
typename
GCTraits
::
BoundarySegmentToMarkerMap
&
boundaryMarkerMap
(
std
::
size_t
id
)
std
::
vector
<
int
>
&
boundaryMarkerMap
(
std
::
size_t
id
)
{
assert
(
id
<
numGrids
&&
"Index exceeds number of grids provided"
);
return
boundaryMarkerMaps_
[
id
];
}
//! Returns the maps of the embedded entities
typename
GCTraits
::
EmbeddedEntityMap
&
embeddedEntityMap
(
std
::
size_t
id
)
std
::
unordered_map
<
IndexType
,
std
::
vector
<
IndexType
>
>
&
embeddedEntityMap
(
std
::
size_t
id
)
{
assert
(
id
<
numGrids
&&
"Index exceeds number of grids provided"
);
return
embeddedEntityMaps_
[
id
];
}
//! Returns the maps of the embedments
typename
GCTraits
::
EmbedmentMap
&
embedmentMap
(
std
::
size_t
id
)
std
::
unordered_map
<
IndexType
,
std
::
vector
<
IndexType
>
>
&
embedmentMap
(
std
::
size_t
id
)
{
assert
(
id
<
numGrids
&&
"Index exceeds number of grids provided"
);
return
embedmentMaps_
[
id
];
...
...
@@ -415,12 +414,12 @@ private:
std
::
array
<
std
::
vector
<
VertexIndexSet
>
,
numGrids
>
boundarySegments_
;
//! data on connectivity between the grids
std
::
array
<
typename
GCTraits
::
EmbeddedEntityMap
,
numGrids
>
embeddedEntityMaps_
;
std
::
array
<
typename
GCTraits
::
EmbedmentMap
,
numGrids
>
embedmentMaps_
;
std
::
array
<
std
::
unordered_map
<
IndexType
,
std
::
vector
<
IndexType
>
>
,
numGrids
>
embeddedEntityMaps_
;
std
::
array
<
std
::
unordered_map
<
IndexType
,
std
::
vector
<
IndexType
>
>
,
numGrids
>
embedmentMaps_
;
//! data on domain and boundary markers
std
::
array
<
typename
GCTraits
::
ElementToDomainMarkerMap
,
numGrids
>
elementMarkerMaps_
;
std
::
array
<
typename
GCTraits
::
BoundarySegmentToMarkerMap
,
numGrids
>
boundaryMarkerMaps_
;
std
::
array
<
std
::
vector
<
int
>
,
numGrids
>
elementMarkerMaps_
;
std
::
array
<
std
::
vector
<
int
>
,
numGrids
>
boundaryMarkerMaps_
;
};
}
// end namespace Dumux
...
...
dumux/multidomain/facet/grid
creato
r.hh
→
dumux/multidomain/facet/grid
manage
r.hh
View file @
121bba76
This diff is collapsed.
Click to expand it.
test/multidomain/facet/1p_1p/analytical/test_facetcoupling_fv_1p1p.cc
View file @
121bba76
...
...
@@ -46,7 +46,7 @@
#include
<dumux/multidomain/fvassembler.hh>
#include
<dumux/multidomain/traits.hh>
#include
<dumux/multidomain/facet/grid
creato
r.hh>
#include
<dumux/multidomain/facet/grid
manage
r.hh>
#include
<dumux/multidomain/facet/couplingmapper.hh>
#include
<dumux/multidomain/facet/couplingmanager.hh>
#include
<dumux/multidomain/facet/codimonegridadapter.hh>
...
...
@@ -157,24 +157,24 @@ computeL2Norm(const GridView& gridView,
// the update. The reason is that we have to create additional faces on interior
// boundaries, which wouldn't be created in the standard scheme.
template
<
class
FVGridGeometry
,
class
Grid
Creato
r
,
class
Grid
Manage
r
,
class
LowDimGridView
,
std
::
enable_if_t
<
FVGridGeometry
::
discMethod
==
Dumux
::
DiscretizationMethod
::
box
,
int
>
=
0
>
void
updateBulkFVGridGeometry
(
FVGridGeometry
&
fvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
,
const
Grid
Manage
r
&
grid
Manage
r
,
const
LowDimGridView
&
lowDimGridView
)
{
Dumux
::
CodimOneGridAdapter
<
Grid
Creato
r
>
facetGridAdapter
(
grid
Creato
r
);
Dumux
::
CodimOneGridAdapter
<
Grid
Manage
r
>
facetGridAdapter
(
grid
Manage
r
);
fvGridGeometry
.
update
(
lowDimGridView
,
facetGridAdapter
);
}
// specialization for cell-centered schemes
template
<
class
FVGridGeometry
,
class
Grid
Creato
r
,
class
Grid
Manage
r
,
class
LowDimGridView
,
std
::
enable_if_t
<
FVGridGeometry
::
discMethod
!=
Dumux
::
DiscretizationMethod
::
box
,
int
>
=
0
>
void
updateBulkFVGridGeometry
(
FVGridGeometry
&
fvGridGeometry
,
const
Grid
Creato
r
&
grid
Creato
r
,
const
Grid
Manage
r
&
grid
Manage
r
,
const
LowDimGridView
&
lowDimGridView
)
{
fvGridGeometry
.
update
();
...
...
@@ -206,25 +206,25 @@ int main(int argc, char** argv) try
using
BulkGrid
=
typename
GET_PROP_TYPE
(
BulkProblemTypeTag
,
Grid
);
using
LowDimGrid
=
typename
GET_PROP_TYPE
(
LowDimProblemTypeTag
,
Grid
);
using
Grid
Creato
r
=
FacetCouplingGrid
Creato
r
<
BulkGrid
,
LowDimGrid
>
;
Grid
Creator
gridCreato
r
;
grid
Creator
.
makeGrids
(
getParam
<
std
::
string
>
(
"Grid.File"
)
);
grid
Creato
r
.
loadBalance
();
using
Grid
Manage
r
=
FacetCouplingGrid
Manage
r
<
BulkGrid
,
LowDimGrid
>
;
Grid
Manager
gridManage
r
;
grid
Manager
.
init
(
);
grid
Manage
r
.
loadBalance
();
////////////////////////////////////////////////////////////
// run stationary, non-linear problem on this grid
////////////////////////////////////////////////////////////
// we compute on the leaf grid views
const
auto
&
bulkGridView
=
grid
Creato
r
.
template
grid
<
0
>().
leafGridView
();
const
auto
&
lowDimGridView
=
grid
Creato
r
.
template
grid
<
1
>().
leafGridView
();
const
auto
&
bulkGridView
=
grid
Manage
r
.
template
grid
<
0
>().
leafGridView
();
const
auto
&
lowDimGridView
=
grid
Manage
r
.
template
grid
<
1
>().
leafGridView
();
// create the finite volume grid geometries
using
BulkFVGridGeometry
=
typename
GET_PROP_TYPE
(
BulkProblemTypeTag
,
FVGridGeometry
);
using
LowDimFVGridGeometry
=
typename
GET_PROP_TYPE
(
LowDimProblemTypeTag
,
FVGridGeometry
);
auto
bulkFvGridGeometry
=
std
::
make_shared
<
BulkFVGridGeometry
>
(
bulkGridView
);
auto
lowDimFvGridGeometry
=
std
::
make_shared
<
LowDimFVGridGeometry
>
(
lowDimGridView
);
updateBulkFVGridGeometry
(
*
bulkFvGridGeometry
,
grid
Creato
r
,
lowDimGridView
);
updateBulkFVGridGeometry
(
*
bulkFvGridGeometry
,
grid
Manage
r
,
lowDimGridView
);
lowDimFvGridGeometry
->
update
();
// the problems (boundary conditions)
...
...
@@ -250,7 +250,7 @@ int main(int argc, char** argv) try
// the coupling mapper
auto
couplingMapper
=
std
::
make_shared
<
typename
TestTraits
::
CouplingMapper
>
();
couplingMapper
->
update
(
*
bulkFvGridGeometry
,
*
lowDimFvGridGeometry
,
grid
Creato
r
);
couplingMapper
->
update
(
*
bulkFvGridGeometry
,
*
lowDimFvGridGeometry
,
grid
Manage
r
);
// the coupling manager
using
CouplingManager
=
typename
TestTraits
::
CouplingManager
;
...
...
test/multidomain/facet/1p_1p/threedomain/test_facetcoupling_tpfa_1p1p_threedomain.cc
View file @
121bba76
...
...
@@ -43,7 +43,7 @@
#include
<dumux/multidomain/fvassembler.hh>
#include
<dumux/multidomain/traits.hh>
#include
<dumux/multidomain/facet/grid
creato
r.hh>
#include
<dumux/multidomain/facet/grid
manage
r.hh>
#include
<dumux/multidomain/facet/couplingmapper.hh>
#include
<dumux/multidomain/facet/couplingmanager.hh>
...
...
@@ -100,19 +100,19 @@ int main(int argc, char** argv) try
using
FacetGrid
=
typename
GET_PROP_TYPE
(
FacetProblemTypeTag
,
Grid
);
using
EdgeGrid
=
typename
GET_PROP_TYPE
(
EdgeProblemTypeTag
,
Grid
);
using
Grid
Creato
r
=
FacetCouplingGrid
Creato
r
<
BulkGrid
,
FacetGrid
,
EdgeGrid
>
;
Grid
Creator
gridCreato
r
;
grid
Creator
.
makeGrids
(
getParam
<
std
::
string
>
(
"Grid.File"
)
);
grid
Creato
r
.
loadBalance
();
using
Grid
Manage
r
=
FacetCouplingGrid
Manage
r
<
BulkGrid
,
FacetGrid
,
EdgeGrid
>
;
Grid
Manager
gridManage
r
;
grid
Manager
.
init
(
);
grid
Manage
r
.
loadBalance
();
////////////////////////////////////////////////////////////
// run stationary non-linear problem on this grid
////////////////////////////////////////////////////////////
// we compute on the leaf grid views
const
auto
&
bulkGridView
=
grid
Creato
r
.
template
grid
<
0
>().
leafGridView
();
const
auto
&
facetGridView
=
grid
Creato
r
.
template
grid
<
1
>().
leafGridView
();
const
auto
&
edgeGridView
=
grid
Creato
r
.
template
grid
<
2
>().
leafGridView
();
const
auto
&
bulkGridView
=
grid
Manage
r
.
template
grid
<
0
>().
leafGridView
();
const
auto
&
facetGridView
=
grid
Manage
r
.
template
grid
<
1
>().
leafGridView
();
const
auto
&
edgeGridView
=
grid
Manage
r
.
template
grid
<
2
>().
leafGridView
();
// create the finite volume grid geometries
using
BulkFVGridGeometry
=
typename
GET_PROP_TYPE
(
BulkProblemTypeTag
,
FVGridGeometry
);
...
...
@@ -154,7 +154,7 @@ int main(int argc, char** argv) try
// the coupling mapper
using
CouplingMapper
=
typename
TestTraits
::
CouplingMapper
;
auto
couplingMapper
=
std
::
make_shared
<
CouplingMapper
>
();
couplingMapper
->
update
(
*
bulkFvGridGeometry
,
*
facetFvGridGeometry
,
*
edgeFvGridGeometry
,
grid
Creato
r
);
couplingMapper
->
update
(
*
bulkFvGridGeometry
,
*
facetFvGridGeometry
,
*
edgeFvGridGeometry
,
grid
Manage
r
);
// the coupling manager
using
CouplingManager
=
typename
TestTraits
::
CouplingManager
;
...
...
test/multidomain/facet/CMakeLists.txt
View file @
121bba76
add_subdirectory
(
1p_1p
)
dune_symlink_to_source_files
(
FILES
"grid.msh"
"grid2.msh"
"test_gridcreator.input"
"2d_grid.msh"
"3d_grid.msh"
)
dune_add_test
(
NAME test_facetgridcreator_alu
dune_symlink_to_source_files
(
FILES
"grid.msh"
"grid2.msh"
"test_gridmanager.input"
"test_vertexmapper.input"
"test_couplingmapper_boundary.input"
"2d_grid.msh"
"3d_grid.msh"
)
dune_add_test
(
NAME test_facetgridmanager_alu
CMAKE_GUARD
"( dune-foamgrid_FOUND AND dune-alugrid_FOUND )"
COMPILE_DEFINITIONS BULKGRIDTYPE=Dune::ALUGrid<3,3,Dune::simplex,Dune::conforming>
SOURCES test_grid
creato
r.cc
COMMAND ./test_facetgrid
creato
r_alu
CMD_ARGS test_grid
creato
r.input
)
SOURCES test_grid
manage
r.cc
COMMAND ./test_facetgrid
manage
r_alu
CMD_ARGS test_grid
manage
r.input
)
dune_add_test
(
NAME test_facetgrid
creato
r_ug
dune_add_test
(
NAME test_facetgrid
manage
r_ug
CMAKE_GUARD
"( dune-foamgrid_FOUND AND dune-uggrid_FOUND )"
COMPILE_DEFINITIONS BULKGRIDTYPE=Dune::UGGrid<3>
SOURCES test_grid
creato
r.cc
COMMAND ./test_facetgrid
creato
r_ug
CMD_ARGS test_grid
creato
r.input
)
SOURCES test_grid
manage
r.cc
COMMAND ./test_facetgrid
manage
r_ug
CMD_ARGS test_grid
manage
r.input
)
dune_add_test
(
NAME test_facetcouplingmapper_tpfa_alu
CMAKE_GUARD
"( dune-foamgrid_FOUND AND dune-alugrid_FOUND )"
COMPILE_DEFINITIONS BULKGRIDTYPE=Dune::ALUGrid<3,3,Dune::simplex,Dune::conforming>
SOURCES test_facetcouplingmapper.cc
COMMAND ./test_facetcouplingmapper_tpfa_alu
CMD_ARGS test_grid
creato
r.input
)
CMD_ARGS test_grid
manage
r.input
)
dune_add_test
(
NAME test_facetcouplingmapper_tpfa_ug
CMAKE_GUARD
"( dune-foamgrid_FOUND AND dune-uggrid_FOUND )"
COMPILE_DEFINITIONS BULKGRIDTYPE=Dune::UGGrid<3>
SOURCES test_facetcouplingmapper.cc
COMMAND ./test_facetcouplingmapper_tpfa_ug
CMD_ARGS test_grid
creato
r.input
)
CMD_ARGS test_grid
manage
r.input
)
dune_add_test
(
NAME test_facetcouplingmapper_box_alu
CMAKE_GUARD
"( dune-foamgrid_FOUND AND dune-alugrid_FOUND )"
...
...
@@ -35,7 +36,7 @@ dune_add_test(NAME test_facetcouplingmapper_box_alu
COMPILE_DEFINITIONS USEBOXINBULK=true
SOURCES test_facetcouplingmapper.cc
COMMAND ./test_facetcouplingmapper_box_alu
CMD_ARGS test_grid
creato
r.input
)
CMD_ARGS test_grid
manage
r.input
)
dune_add_test
(
NAME test_facetcouplingmapper_box_ug
CMAKE_GUARD
"( dune-foamgrid_FOUND AND dune-uggrid_FOUND )"
...
...
@@ -43,19 +44,21 @@ dune_add_test(NAME test_facetcouplingmapper_box_ug
COMPILE_DEFINITIONS USEBOXINBULK=true
SOURCES test_facetcouplingmapper.cc
COMMAND ./test_facetcouplingmapper_box_ug
CMD_ARGS test_grid
creato
r.input
)
CMD_ARGS test_grid
manage
r.input
)
dune_add_test
(
NAME test_facetcouplingmapper_tpfa_boundary_alu
CMAKE_GUARD
"( dune-foamgrid_FOUND AND dune-alugrid_FOUND )"
COMPILE_DEFINITIONS BULKGRIDTYPE=Dune::ALUGrid<2,2,Dune::simplex,Dune::conforming