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
673ab052
Commit
673ab052
authored
5 years ago
by
Dennis Gläser
Browse files
Options
Downloads
Patches
Plain Diff
[md] deprecate mixeddimensionglue, forward to multidomainglue
parent
8f61fc1e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1616
Feature/free-function-make-glue
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/multidomain/embedded/mixeddimensionglue.hh
+27
-182
27 additions, 182 deletions
dumux/multidomain/embedded/mixeddimensionglue.hh
with
27 additions
and
182 deletions
dumux/multidomain/embedded/mixeddimensionglue.hh
+
27
−
182
View file @
673ab052
...
...
@@ -22,207 +22,52 @@
* \brief A class glueing two grids of different dimension geometrically
* Intersections are computed using axis-aligned bounding box trees
*/
#ifndef DUMUX_MULTIDOMAIN_MIXEDDIMENSION_GLUE_HH
#define DUMUX_MULTIDOMAIN_MIXEDDIMENSION_GLUE_HH
#include
<iostream>
#include
<fstream>
#include
<string>
#include
<utility>
#include
<dune/common/timer.hh>
#include
<dune/common/iteratorrange.hh>
#include
<dune/geometry/affinegeometry.hh>
#include
<dune/geometry/type.hh>
#include
<dumux/common/geometry/geometricentityset.hh>
#include
<dumux/common/geometry/boundingboxtree.hh>
#include
<dumux/common/geometry/intersectingentities.hh>
#include
<dumux/multidomain/glue.hh>
namespace
Dumux
{
// forward declaration
template
<
class
BulkGridView
,
class
LowDimGridView
,
class
BulkMapper
,
class
LowDimMapper
>
class
MixedDimensionGlue
;
/*!
* \ingroup MixedDimension
* \brief Range generator to iterate with range-based for loops over all intersections
* as follows: for (const auto& is : intersections(glue)) { ... }
*/
template
<
class
BulkGridView
,
class
LowDimGridView
,
class
BulkMapper
,
class
LowDimMapper
>
Dune
::
IteratorRange
<
typename
MixedDimensionGlue
<
BulkGridView
,
LowDimGridView
,
BulkMapper
,
LowDimMapper
>::
Intersections
::
const_iterator
>
intersections
(
const
MixedDimensionGlue
<
BulkGridView
,
LowDimGridView
,
BulkMapper
,
LowDimMapper
>&
glue
)
{
return
{
glue
.
ibegin
(),
glue
.
iend
()};
}
namespace
Glue
{
/*!
* \ingroup MixedDimension
* \brief An intersection object representing an intersection
* between two grid entites of different grids
*/
template
<
class
BulkGridView
,
class
LowDimGridView
,
class
BulkMapper
,
class
LowDimMapper
>
class
Intersection
{
using
BulkElement
=
typename
BulkGridView
::
template
Codim
<
0
>
::
Entity
;
using
LowDimElement
=
typename
LowDimGridView
::
template
Codim
<
0
>
::
Entity
;
using
BulkEntitySet
=
GridViewGeometricEntitySet
<
BulkGridView
,
0
,
BulkMapper
>
;
using
BulkTree
=
BoundingBoxTree
<
BulkEntitySet
>
;
using
LowDimEntitySet
=
GridViewGeometricEntitySet
<
LowDimGridView
,
0
,
LowDimMapper
>
;
using
LowDimTree
=
BoundingBoxTree
<
LowDimEntitySet
>
;
enum
{
dimWorld
=
BulkGridView
::
dimensionworld
,
dimIs
=
LowDimGridView
::
dimension
,
};
using
Scalar
=
typename
BulkGridView
::
ctype
;
using
Geometry
=
Dune
::
AffineGeometry
<
Scalar
,
dimIs
,
dimWorld
>
;
using
GlobalPosition
=
Dune
::
FieldVector
<
Scalar
,
dimWorld
>
;
public
:
Intersection
(
const
BulkTree
&
bulkTree
,
const
LowDimTree
&
lowDimTree
)
:
bulkTree_
(
bulkTree
)
,
lowDimTree_
(
lowDimTree
)
{}
//! set the intersection geometry corners
void
setCorners
(
const
std
::
vector
<
GlobalPosition
>&
corners
)
{
corners_
=
corners
;
assert
(
corners
.
size
()
==
dimIs
+
1
);
// Only simplex intersections are allowed
}
//! add a pair of neighbor elements
void
addNeighbors
(
std
::
size_t
bulk
,
std
::
size_t
lowDim
)
{
neighbors_
[
0
].
push_back
(
bulk
);
neighbors_
[
1
].
push_back
(
lowDim
);
}
//! get the intersection geometry
Geometry
geometry
()
const
{
return
Geometry
(
Dune
::
GeometryTypes
::
simplex
(
dimIs
),
corners_
);
}
//! get the number of neigbors
std
::
size_t
neighbor
(
unsigned
int
side
)
const
{
return
neighbors_
[
side
].
size
();
}
//! get the inside neighbor
LowDimElement
inside
(
unsigned
int
n
)
const
{
return
lowDimTree_
.
entitySet
().
entity
(
neighbors_
[
1
][
n
]);
}
//! get the outside neighbor
BulkElement
outside
(
unsigned
int
n
)
const
{
return
bulkTree_
.
entitySet
().
entity
(
neighbors_
[
0
][
n
]);
}
private
:
std
::
array
<
std
::
vector
<
std
::
size_t
>
,
2
>
neighbors_
;
std
::
vector
<
GlobalPosition
>
corners_
;
const
BulkTree
&
bulkTree_
;
const
LowDimTree
&
lowDimTree_
;
};
}
// end namespace Glue
/*!
* \ingroup MixedDimension
* \brief Manages the coupling between bulk elements and lower dimensional elements
* Point sources on each integration point are computed by an AABB tree.
* Both domain are assumed to be discretized using a cc finite volume scheme.
*/
template
<
class
BulkGridView
,
class
LowDimGridView
,
class
BulkMapper
=
Dune
::
MultipleCodimMultipleGeomTypeMapper
<
BulkGridView
>,
class
LowDimMapper
=
Dune
::
MultipleCodimMultipleGeomTypeMapper
<
LowDimGridView
>>
class
MixedDimensionGlue
class
DUNE_DEPRECATED_MSG
(
"Use MultiDomainGlue instead. Will be removed after 3.1!"
)
MixedDimensionGlue
:
public
MultiDomainGlue
<
LowDimGridView
,
BulkGridView
,
LowDimMapper
,
BulkMapper
>
{
using
BulkEntitySet
=
GridViewGeometricEntitySet
<
BulkGridView
,
0
,
BulkMapper
>
;
using
BulkTree
=
BoundingBoxTree
<
BulkEntitySet
>
;
using
LowDimEntitySet
=
GridViewGeometricEntitySet
<
LowDimGridView
,
0
,
LowDimMapper
>
;
using
LowDimTree
=
BoundingBoxTree
<
LowDimEntitySet
>
;
using
Scalar
=
typename
BulkGridView
::
ctype
;
enum
{
dimWorld
=
BulkGridView
::
dimensionworld
};
using
GlobalPosition
=
Dune
::
FieldVector
<
Scalar
,
dimWorld
>
;
using
ParentType
=
MultiDomainGlue
<
LowDimGridView
,
BulkGridView
,
LowDimMapper
,
BulkMapper
>
;
public:
// export intersection container type
using
Intersections
=
std
::
vector
<
Glue
::
Intersection
<
BulkGridView
,
LowDimGridView
,
BulkMapper
,
LowDimMapper
>>
;
/*!
* \brief Default constructor
*/
//! Default constructor
MixedDimensionGlue
()
=
default
;
/*!
* \brief Constructor
* \brief constructor from bounding box trees
* \note The definition of Glue::Intersection::inside() has changed!
* inside() used to return the lower-dimensional entities
* (i.e. from LowDimGridView). Now, inside() returns the entities
* of the template argument DomainGridView, i.e. the Dune::GridView
* given as the first template argument. In order to be backwards
* compatible, we flip the order here (and in the definition of ParentType).
*/
template
<
class
BulkTree
,
class
LowDimTree
>
MixedDimensionGlue
(
const
BulkTree
&
bulkTree
,
const
LowDimTree
&
lowDimTree
)
{
build
(
bulkTree
,
lowDimTree
);
}
:
ParentType
(
lowDimTree
,
bulkTree
)
{}
/*!
* \brief construction from bounding box trees
* \note The definition of Glue::Intersection::inside() has changed!
* inside() used to return the lower-dimensional entities
* (i.e. from LowDimGridView). Now, inside() returns the entities
* of the template argument DomainGridView, i.e. the Dune::GridView
* given as the first template argument. In order to be backwards
* compatible, we flip the order here (and in the definition of ParentType).
*/
template
<
class
BulkTree
,
class
LowDimTree
>
void
build
(
const
BulkTree
&
bulkTree
,
const
LowDimTree
&
lowDimTree
)
{
Dune
::
Timer
timer
;
// compute raw intersections
auto
rawIntersections
=
intersectingEntities
(
bulkTree
,
lowDimTree
);
// create a map to check whether intersection geometries were already inserted
std
::
vector
<
std
::
vector
<
std
::
vector
<
GlobalPosition
>>>
intersectionMap
;
std
::
vector
<
std
::
vector
<
std
::
size_t
>>
intersectionIndex
;
intersectionMap
.
resize
(
lowDimTree
.
entitySet
().
size
());
intersectionIndex
.
resize
(
lowDimTree
.
entitySet
().
size
());
for
(
const
auto
&
rawIntersection
:
rawIntersections
)
{
bool
add
=
true
;
for
(
int
i
=
0
;
i
<
intersectionMap
[
rawIntersection
.
second
()].
size
();
++
i
)
{
if
(
rawIntersection
.
cornersMatch
(
intersectionMap
[
rawIntersection
.
second
()][
i
]))
{
add
=
false
;
// only add the pair of neighbors using the insertionIndex
auto
idx
=
intersectionIndex
[
rawIntersection
.
second
()][
i
];
intersections_
[
idx
].
addNeighbors
(
rawIntersection
.
first
(),
rawIntersection
.
second
());
break
;
}
}
if
(
add
)
{
// add to the map
intersectionMap
[
rawIntersection
.
second
()].
push_back
(
rawIntersection
.
corners
());
intersectionIndex
[
rawIntersection
.
second
()].
push_back
(
intersections_
.
size
());
// add new intersection and add the neighbors
intersections_
.
emplace_back
(
bulkTree
,
lowDimTree
);
intersections_
.
back
().
setCorners
(
rawIntersection
.
corners
());
intersections_
.
back
().
addNeighbors
(
rawIntersection
.
first
(),
rawIntersection
.
second
());
}
}
std
::
cout
<<
"Computed tree intersections in "
<<
timer
.
elapsed
()
<<
std
::
endl
;
ParentType
::
build
(
lowDimTree
,
bulkTree
);
}
//! Return begin iterator to intersection container
typename
Intersections
::
const_iterator
ibegin
()
const
{
return
intersections_
.
begin
();
}
//! Return end iterator to intersection container
typename
Intersections
::
const_iterator
iend
()
const
{
return
intersections_
.
end
();
}
//! the number of intersections
std
::
size_t
size
()
const
{
return
intersections_
.
size
();
}
private
:
Intersections
intersections_
;
};
}
// end namespace Dumux
...
...
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