Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iwr
dune-curvedgrid
Commits
6fe3808b
Commit
6fe3808b
authored
Apr 27, 2020
by
Praetorius, Simon
Browse files
using std::optional
parent
ea95a2d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
dune/curvedsurfacegrid/entity.hh
View file @
6fe3808b
...
...
@@ -3,7 +3,8 @@
#ifndef DUNE_CURVED_SURFACE_GRID_ENTITY_HH
#define DUNE_CURVED_SURFACE_GRID_ENTITY_HH
#include <dune/common/std/optional.hh>
#include <optional>
#include <dune/geometry/referenceelements.hh>
#include <dune/grid/common/grid.hh>
...
...
@@ -228,13 +229,13 @@ namespace Dune
Geometry
geometry
()
const
{
if
(
!
geo_
)
{
auto
localFct
=
localFunction
(
Super
::
gridFunction
());
if
(
hostElement_
)
{
auto
localFct
=
localFunction
(
Super
::
gridFunction
());
localFct
.
bind
(
*
hostElement_
);
auto
refElem
=
referenceElement
<
ctype
,
Super
::
dimension
>
(
hostElement_
->
type
());
auto
localGeometry
=
refElem
.
template
geometry
<
codim
>(
subEntity_
);
geo_
=
std
::
make_shared
<
GeometryImpl
>
(
Super
::
type
(),
localFct
,
localGeometry
);
geo_
=
std
::
make_shared
<
GeometryImpl
>
(
Super
::
type
(),
std
::
move
(
localFct
)
,
localGeometry
);
}
else
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Geometry of entities of codim!=0 not implemented"
);
...
...
@@ -245,7 +246,7 @@ namespace Dune
}
private:
S
td
::
optional
<
HostElement
>
hostElement_
;
s
td
::
optional
<
HostElement
>
hostElement_
;
int
subEntity_
=
-
1
;
using
GeometryImpl
=
typename
Traits
::
template
Codim
<
codim
>
::
GeometryImpl
;
...
...
@@ -287,7 +288,7 @@ namespace Dune
auto
localFct
=
localFunction
(
Super
::
gridFunction
());
localFct
.
bind
(
Super
::
hostEntity
());
auto
fakeDefaultGeometry
=
Dune
::
DefaultLocalGeometry
<
typename
Super
::
ctype
,
Super
::
mydimension
,
Super
::
mydimension
>
{};
geo_
=
std
::
make_shared
<
GeometryImpl
>
(
Super
::
type
(),
localFct
,
fakeDefaultGeometry
);
geo_
=
std
::
make_shared
<
GeometryImpl
>
(
Super
::
type
(),
std
::
move
(
localFct
)
,
fakeDefaultGeometry
);
}
return
Geometry
(
*
geo_
);
...
...
dune/curvedsurfacegrid/geometry.hh
View file @
6fe3808b
...
...
@@ -7,13 +7,13 @@
#include <functional>
#include <iterator>
#include <limits>
#include <optional>
#include <vector>
#include <dune/common/diagonalmatrix.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/common/typetraits.hh>
#include <dune/common/std/optional.hh>
#include <dune/common/std/type_traits.hh>
#include <dune/curvedgeometry/curvedgeometry.hh>
...
...
@@ -113,9 +113,9 @@ namespace Dune
* \param[in] args... argument to construct the local geometry
*
*/
template
<
class
...
Args
>
Geometry
(
const
ReferenceElement
&
refElement
,
const
LocalFunction
&
localFunction
,
Args
&&
...
args
)
:
Super
(
refElement
,
localFunction
,
LocalGeometry
{
std
::
forward
<
Args
>
(
args
)...})
template
<
class
LF_
,
class
...
Args
>
Geometry
(
const
ReferenceElement
&
refElement
,
LF_
&
&
localFunction
,
Args
&&
...
args
)
:
Super
(
refElement
,
std
::
forward
<
LF_
>
(
localFunction
)
,
LocalGeometry
{
std
::
forward
<
Args
>
(
args
)...})
{}
/// \brief constructor, forwarding to the other constructor that take a reference-element
...
...
@@ -125,9 +125,9 @@ namespace Dune
* (stored by value)
* \param[in] args... argument to construct the local geometry
*/
template
<
class
...
Args
>
Geometry
(
Dune
::
GeometryType
gt
,
const
LocalFunction
&
localFunction
,
Args
&&
...
args
)
:
Super
(
gt
,
localFunction
,
LocalGeometry
{
std
::
forward
<
Args
>
(
args
)...})
template
<
class
LF_
,
class
...
Args
>
Geometry
(
Dune
::
GeometryType
gt
,
LF_
&
&
localFunction
,
Args
&&
...
args
)
:
Super
(
gt
,
std
::
forward
<
LF_
>
(
localFunction
)
,
LocalGeometry
{
std
::
forward
<
Args
>
(
args
)...})
{}
};
...
...
@@ -178,7 +178,7 @@ namespace Dune
LocalGeometry
(
std
::
forward
<
Args
>
(
args
)...))
{}
S
td
::
optional
<
LocalCoordinate
>
checkedLocal
(
const
GlobalCoordinate
&
globalCoord
)
const
s
td
::
optional
<
LocalCoordinate
>
checkedLocal
(
const
GlobalCoordinate
&
globalCoord
)
const
{
auto
localCoord
=
Super
::
local
(
globalCoord
);
if
((
globalCoord
-
Super
::
global
(
localCoord
)).
two_norm2
()
>
tolerance
())
...
...
dune/curvedsurfacegrid/gridfunctions/discretegridviewfunction.hh
View file @
6fe3808b
...
...
@@ -4,6 +4,7 @@
#define DUNE_CURVED_SURFACE_GRID_DISCRETE_GRIDVIEWFUNCTION_HH
#include <array>
#include <optional>
#include <vector>
#if !HAVE_DUNE_FUNCTIONS
...
...
@@ -223,7 +224,7 @@ namespace Dune
const
VectorType
&
coords_
;
std
::
vector
<
RangeType
>
localCoords_
;
S
td
::
optional
<
Geometry
>
geometry_
;
s
td
::
optional
<
Geometry
>
geometry_
;
mutable
std
::
vector
<
typename
LocalBasis
::
Traits
::
RangeType
>
shapeValues_
;
mutable
std
::
vector
<
typename
LocalBasis
::
Traits
::
JacobianType
>
shapeGradients_
;
mutable
std
::
vector
<
DerivativeRange
<
0
>>
gradients_
;
...
...
dune/curvedsurfacegrid/intersection.hh
View file @
6fe3808b
...
...
@@ -3,11 +3,11 @@
#ifndef DUNE_CURVED_SURFACE_GRID_INTERSECTION_HH
#define DUNE_CURVED_SURFACE_GRID_INTERSECTION_HH
#include <optional>
#include <type_traits>
#include <utility>
#include <dune/common/fvector.hh>
#include <dune/common/std/optional.hh>
#include <dune/geometry/referenceelements.hh>
namespace
Dune
...
...
@@ -178,8 +178,8 @@ namespace Dune
const
GridFunction
*
gridFunction_
=
nullptr
;
// geometry caches
mutable
S
td
::
optional
<
ElementGeometry
>
insideGeo_
;
mutable
S
td
::
optional
<
GeometryImpl
>
geo_
;
mutable
s
td
::
optional
<
ElementGeometry
>
insideGeo_
;
mutable
s
td
::
optional
<
GeometryImpl
>
geo_
;
};
}
// namespace Curved
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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