Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-subgrid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
agnumpde
dune-subgrid
Commits
7d3a637c
Commit
7d3a637c
authored
5 years ago
by
kilian.weishaupt_at_iws.uni-stuttgart.de
Browse files
Options
Downloads
Patches
Plain Diff
[subgridgeometry.hh] Use dune version check for std::variant
parent
f7f151d3
No related branches found
No related tags found
1 merge request
!16
Feature/fix deprecation warnings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/subgrid/subgrid/subgridgeometry.hh
+55
-1
55 additions, 1 deletion
dune/subgrid/subgrid/subgridgeometry.hh
with
55 additions
and
1 deletion
dune/subgrid/subgrid/subgridgeometry.hh
+
55
−
1
View file @
7d3a637c
...
@@ -5,7 +5,13 @@
...
@@ -5,7 +5,13 @@
* \brief The SubGridGeometry class and its specializations
* \brief The SubGridGeometry class and its specializations
*/
*/
#include
<type_traits>
#include
<type_traits>
#include
<dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
#include
<dune/common/std/variant.hh>
#include
<dune/common/std/variant.hh>
#else
#include
<variant>
#endif
#include
<dune/common/fmatrix.hh>
#include
<dune/common/fmatrix.hh>
#include
<dune/common/typetraits.hh>
#include
<dune/common/typetraits.hh>
...
@@ -147,7 +153,11 @@ class SubGridLocalGeometry
...
@@ -147,7 +153,11 @@ class SubGridLocalGeometry
using
MultiLinGeometry
=
MultiLinearGeometry
<
ctype
,
mydim
,
coorddim
>
;
using
MultiLinGeometry
=
MultiLinearGeometry
<
ctype
,
mydim
,
coorddim
>
;
// use a variant to store either a HostGridLocalGeometry or a MultiLinearGeometry
// use a variant to store either a HostGridLocalGeometry or a MultiLinearGeometry
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
using
GeometryContainer
=
Std
::
variant
<
HostGridLocalGeometry
,
MultiLinGeometry
>
;
using
GeometryContainer
=
Std
::
variant
<
HostGridLocalGeometry
,
MultiLinGeometry
>
;
#else
using
GeometryContainer
=
std
::
variant
<
HostGridLocalGeometry
,
MultiLinGeometry
>
;
#endif
public:
public:
...
@@ -177,45 +187,77 @@ class SubGridLocalGeometry
...
@@ -177,45 +187,77 @@ class SubGridLocalGeometry
/** \brief Return the element type identifier
/** \brief Return the element type identifier
*/
*/
GeometryType
type
()
const
{
GeometryType
type
()
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
type
();},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
type
();},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
type
();},
localGeometry_
);
#endif
}
}
/** \brief Return true if the geometry mapping is affine and false otherwise */
/** \brief Return true if the geometry mapping is affine and false otherwise */
bool
affine
()
const
{
bool
affine
()
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
affine
();},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
affine
();},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
affine
();},
localGeometry_
);
#endif
}
}
//! return the number of corners of this element. Corners are numbered 0...n-1
//! return the number of corners of this element. Corners are numbered 0...n-1
int
corners
()
const
{
int
corners
()
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
corners
();},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
corners
();},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
corners
();},
localGeometry_
);
#endif
}
}
//! access to coordinates of corners. Index is the number of the corner
//! access to coordinates of corners. Index is the number of the corner
FieldVector
<
ctype
,
coorddim
>
corner
(
int
i
)
const
{
FieldVector
<
ctype
,
coorddim
>
corner
(
int
i
)
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
corner
(
i
);},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
corner
(
i
);},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
corner
(
i
);},
localGeometry_
);
#endif
}
}
/** \brief Maps a local coordinate within reference element to
/** \brief Maps a local coordinate within reference element to
* global coordinate in element */
* global coordinate in element */
FieldVector
<
ctype
,
coorddim
>
global
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
FieldVector
<
ctype
,
coorddim
>
global
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
global
(
local
);},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
global
(
local
);},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
global
(
local
);},
localGeometry_
);
#endif
}
}
/** \brief Maps a global coordinate within the element to a
/** \brief Maps a global coordinate within the element to a
* local coordinate in its reference element */
* local coordinate in its reference element */
FieldVector
<
ctype
,
mydim
>
local
(
const
FieldVector
<
ctype
,
coorddim
>&
global
)
const
{
FieldVector
<
ctype
,
mydim
>
local
(
const
FieldVector
<
ctype
,
coorddim
>&
global
)
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
local
(
global
);},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
local
(
global
);},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
local
(
global
);},
localGeometry_
);
#endif
}
}
/**
/**
*/
*/
ctype
integrationElement
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
ctype
integrationElement
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
integrationElement
(
local
);},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
integrationElement
(
local
);},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
integrationElement
(
local
);},
localGeometry_
);
#endif
}
}
/** \brief return volume of geometry */
/** \brief return volume of geometry */
ctype
volume
()
const
{
ctype
volume
()
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
volume
();},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
volume
();},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
volume
();},
localGeometry_
);
#endif
}
}
/** \brief return center of geometry
/** \brief return center of geometry
...
@@ -228,17 +270,29 @@ class SubGridLocalGeometry
...
@@ -228,17 +270,29 @@ class SubGridLocalGeometry
* find reasonably efficient ways to implement it properly.
* find reasonably efficient ways to implement it properly.
*/
*/
FieldVector
<
ctype
,
coorddim
>
center
()
const
{
FieldVector
<
ctype
,
coorddim
>
center
()
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
center
();},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
center
();},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
geom
.
center
();},
localGeometry_
);
#endif
}
}
//! The Jacobian matrix of the mapping from the reference element to this element
//! The Jacobian matrix of the mapping from the reference element to this element
const
JacobianTransposed
jacobianTransposed
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
const
JacobianTransposed
jacobianTransposed
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
static_cast
<
JacobianTransposed
>
(
geom
.
jacobianTransposed
(
local
));},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
static_cast
<
JacobianTransposed
>
(
geom
.
jacobianTransposed
(
local
));},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
static_cast
<
JacobianTransposed
>
(
geom
.
jacobianTransposed
(
local
));},
localGeometry_
);
#endif
}
}
//! The inverse of the Jacobian matrix of the mapping from the reference element to this element
//! The inverse of the Jacobian matrix of the mapping from the reference element to this element
const
JacobianInverseTransposed
jacobianInverseTransposed
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
const
JacobianInverseTransposed
jacobianInverseTransposed
(
const
FieldVector
<
ctype
,
mydim
>&
local
)
const
{
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
static_cast
<
JacobianInverseTransposed
>
(
geom
.
jacobianInverseTransposed
(
local
));},
localGeometry_
);
return
Std
::
visit
([
&
](
auto
&&
geom
)
{
return
static_cast
<
JacobianInverseTransposed
>
(
geom
.
jacobianInverseTransposed
(
local
));},
localGeometry_
);
#else
return
std
::
visit
([
&
](
auto
&&
geom
)
{
return
static_cast
<
JacobianInverseTransposed
>
(
geom
.
jacobianInverseTransposed
(
local
));},
localGeometry_
);
#endif
}
}
private
:
private
:
...
...
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