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
94a31508
Commit
94a31508
authored
Sep 17, 2020
by
Praetorius, Simon
Browse files
allow construction of curvedsurfcaegrid with runtime lagrange order
parent
e6c5f490
Pipeline
#4783
passed with stage
in 9 minutes and 20 seconds
Changes
17
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dune/curvedsurfacegrid/backuprestore.hh
View file @
94a31508
...
...
@@ -46,10 +46,10 @@ namespace Curved {
// BackupRestoreFacility for CurvedSurfaceGrid
// -------------------------------------------
template
<
class
GridFunction
,
int
order
>
struct
BackupRestoreFacility
<
CurvedSurfaceGrid
<
GridFunction
,
order
>>
template
<
class
GridFunction
,
bool
useInterpolation
>
struct
BackupRestoreFacility
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>>
{
using
Grid
=
CurvedSurfaceGrid
<
GridFunction
,
order
>
;
using
Grid
=
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>
;
using
HostGrid
=
typename
Grid
::
HostGrid
;
using
HostBackupRestoreFacility
=
BackupRestoreFacility
<
HostGrid
>
;
...
...
dune/curvedsurfacegrid/capabilities.hh
View file @
94a31508
...
...
@@ -19,37 +19,37 @@ namespace Capabilities {
// Capabilities from dune-grid
// ---------------------------
template
<
class
GridFunction
,
int
order
>
struct
hasSingleGeometryType
<
CurvedSurfaceGrid
<
GridFunction
,
order
>>
template
<
class
GridFunction
,
bool
useInterpolation
>
struct
hasSingleGeometryType
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>>
{
using
HostGrid
=
GridOf_t
<
GridFunction
>
;
static
const
bool
v
=
hasSingleGeometryType
<
HostGrid
>::
v
;
static
const
unsigned
int
topologyId
=
hasSingleGeometryType
<
HostGrid
>::
topologyId
;
};
template
<
class
GridFunction
,
int
order
,
int
codim
>
struct
hasEntity
<
CurvedSurfaceGrid
<
GridFunction
,
order
>
,
codim
>
template
<
class
GridFunction
,
bool
useInterpolation
,
int
codim
>
struct
hasEntity
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>
,
codim
>
{
using
HostGrid
=
GridOf_t
<
GridFunction
>
;
static
const
bool
v
=
hasEntity
<
HostGrid
,
codim
>::
v
;
};
template
<
class
GridFunction
,
int
order
,
int
codim
>
struct
hasEntityIterator
<
CurvedSurfaceGrid
<
GridFunction
,
order
>
,
codim
>
template
<
class
GridFunction
,
bool
useInterpolation
,
int
codim
>
struct
hasEntityIterator
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>
,
codim
>
{
using
HostGrid
=
GridOf_t
<
GridFunction
>
;
static
const
bool
v
=
hasEntityIterator
<
HostGrid
,
codim
>::
v
;
};
/// \brief Implements geometry only for codim=0 entity
template
<
class
GridFunction
,
int
order
,
int
codim
>
struct
hasGeometry
<
CurvedSurfaceGrid
<
GridFunction
,
order
>
,
codim
>
template
<
class
GridFunction
,
bool
useInterpolation
,
int
codim
>
struct
hasGeometry
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>
,
codim
>
{
static
const
bool
v
=
(
codim
==
0
);
};
template
<
class
GridFunction
,
int
order
,
int
codim
>
struct
canCommunicate
<
CurvedSurfaceGrid
<
GridFunction
,
order
>
,
codim
>
template
<
class
GridFunction
,
bool
useInterpolation
,
int
codim
>
struct
canCommunicate
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>
,
codim
>
{
using
HostGrid
=
GridOf_t
<
GridFunction
>
;
static
const
bool
v
=
canCommunicate
<
HostGrid
,
codim
>::
v
&&
hasEntity
<
HostGrid
,
codim
>::
v
;
...
...
@@ -57,24 +57,24 @@ struct canCommunicate<CurvedSurfaceGrid<GridFunction,order>, codim>
/// \brief Conformity of the grid is not guaranteed since it depends on the GridFunction that
/// \brief must be continuous in that case.
template
<
class
GridFunction
,
int
order
>
struct
isLevelwiseConforming
<
CurvedSurfaceGrid
<
GridFunction
,
order
>>
template
<
class
GridFunction
,
bool
useInterpolation
>
struct
isLevelwiseConforming
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>>
{
static
const
bool
v
=
false
;
};
/// \brief Conformity of the grid is not guaranteed since it depends on the GridFunction that
/// \brief must be continuous in that case.
template
<
class
GridFunction
,
int
order
>
struct
isLeafwiseConforming
<
CurvedSurfaceGrid
<
GridFunction
,
order
>>
template
<
class
GridFunction
,
bool
useInterpolation
>
struct
isLeafwiseConforming
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>>
{
static
const
bool
v
=
false
;
};
/// \brief Implements only partial backup-restore facilities, since the gridfunction is not
/// \brief backuped automatically.
template
<
class
GridFunction
,
int
order
>
struct
hasBackupRestoreFacilities
<
CurvedSurfaceGrid
<
GridFunction
,
order
>>
template
<
class
GridFunction
,
bool
useInterpolation
>
struct
hasBackupRestoreFacilities
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>>
{
using
HostGrid
=
GridOf_t
<
GridFunction
>
;
static
const
bool
v
=
hasBackupRestoreFacilities
<
HostGrid
>::
v
;
...
...
@@ -84,8 +84,8 @@ struct hasBackupRestoreFacilities<CurvedSurfaceGrid<GridFunction,order>>
// hasHostEntity
// -------------
template
<
class
GridFunction
,
int
order
,
int
codim
>
struct
hasHostEntity
<
CurvedSurfaceGrid
<
GridFunction
,
order
>
,
codim
>
template
<
class
GridFunction
,
bool
useInterpolation
,
int
codim
>
struct
hasHostEntity
<
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>
,
codim
>
{
using
HostGrid
=
GridOf_t
<
GridFunction
>
;
static
const
bool
v
=
hasEntity
<
HostGrid
,
codim
>::
v
;
...
...
dune/curvedsurfacegrid/datahandle.hh
View file @
94a31508
...
...
@@ -42,7 +42,7 @@ public:
{
using
Entity
=
typename
Grid
::
Traits
::
template
Codim
<
HostEntity
::
codimension
>
::
Entity
;
using
EntityImpl
=
typename
Grid
::
Traits
::
template
Codim
<
HostEntity
::
codimension
>
::
EntityImpl
;
Entity
entity
(
EntityImpl
(
grid_
.
gridFunction
(),
hostEntity
));
Entity
entity
(
EntityImpl
(
grid_
.
gridFunction
(),
hostEntity
,
grid_
.
order
()
));
return
wrappedHandle_
.
size
(
entity
);
}
...
...
@@ -51,7 +51,7 @@ public:
{
using
Entity
=
typename
Grid
::
Traits
::
template
Codim
<
HostEntity
::
codimension
>
::
Entity
;
using
EntityImpl
=
typename
Grid
::
Traits
::
template
Codim
<
HostEntity
::
codimension
>
::
EntityImpl
;
Entity
entity
(
EntityImpl
(
grid_
.
gridFunction
(),
hostEntity
));
Entity
entity
(
EntityImpl
(
grid_
.
gridFunction
(),
hostEntity
,
grid_
.
order
()
));
wrappedHandle_
.
gather
(
buffer
,
entity
);
}
...
...
@@ -60,7 +60,7 @@ public:
{
using
Entity
=
typename
Grid
::
Traits
::
template
Codim
<
HostEntity
::
codimension
>
::
Entity
;
using
EntityImpl
=
typename
Grid
::
Traits
::
template
Codim
<
HostEntity
::
codimension
>
::
EntityImpl
;
Entity
entity
(
EntityImpl
(
grid_
.
gridFunction
(),
hostEntity
));
Entity
entity
(
EntityImpl
(
grid_
.
gridFunction
(),
hostEntity
,
grid_
.
order
()
));
wrappedHandle_
.
scatter
(
buffer
,
entity
,
size
);
}
...
...
dune/curvedsurfacegrid/declaration.hh
View file @
94a31508
...
...
@@ -3,7 +3,7 @@
namespace
Dune
{
template
<
class
GridFunction
,
int
order
>
template
<
class
GridFunction
,
bool
useInterpolation
>
class
CurvedSurfaceGrid
;
}
// end namespace Dune
...
...
dune/curvedsurfacegrid/entity.hh
View file @
94a31508
...
...
@@ -107,24 +107,28 @@ public:
EntityBase
(
const
Grid
&
grid
,
const
EntitySeed
&
seed
)
:
hostEntity_
(
grid
.
hostGrid
().
entity
(
seed
.
impl
().
hostEntitySeed
()))
,
gridFunction_
(
&
grid
.
gridFunction
())
,
order_
(
grid
.
order
())
{}
/// \brief construct the entity from a subentity of a host-entity
EntityBase
(
const
GridFunction
&
gridFunction
,
const
HostElement
&
hostElement
,
int
i
)
EntityBase
(
const
GridFunction
&
gridFunction
,
const
HostElement
&
hostElement
,
int
i
,
int
order
)
:
hostEntity_
(
hostElement
.
template
subEntity
<
codim
>(
i
))
,
gridFunction_
(
&
gridFunction
)
,
order_
(
order
)
{}
/// \brief construct the entity from a host-entity
EntityBase
(
const
GridFunction
&
gridFunction
,
const
HostEntity
&
hostEntity
)
EntityBase
(
const
GridFunction
&
gridFunction
,
const
HostEntity
&
hostEntity
,
int
order
)
:
hostEntity_
(
hostEntity
)
,
gridFunction_
(
&
gridFunction
)
,
order_
(
order
)
{}
/// \brief construct the entity from a host-entity
EntityBase
(
const
GridFunction
&
gridFunction
,
HostEntity
&&
hostEntity
)
EntityBase
(
const
GridFunction
&
gridFunction
,
HostEntity
&&
hostEntity
,
int
order
)
:
hostEntity_
(
std
::
move
(
hostEntity
))
,
gridFunction_
(
&
gridFunction
)
,
order_
(
order
)
{}
/// \brief compare two entities
...
...
@@ -185,11 +189,17 @@ public:
return
hostEntity_
;
}
int
order
()
const
{
return
order_
;
}
/** \} */
private:
HostEntity
hostEntity_
;
const
GridFunction
*
gridFunction_
=
nullptr
;
int
order_
=
-
1
;
};
...
...
@@ -238,7 +248,7 @@ public:
auto
refElem
=
referenceElement
<
ctype
,
Super
::
dimension
>
(
hostElement_
->
type
());
auto
localGeometry
=
refElem
.
template
geometry
<
codim
>(
subEntity_
);
geo_
=
std
::
make_shared
<
GeometryImpl
>
(
Super
::
type
(),
std
::
move
(
localFct
),
localGeometry
);
geo_
=
std
::
make_shared
<
GeometryImpl
>
(
Super
::
type
(),
Super
::
order
(),
std
::
move
(
localFct
),
localGeometry
);
}
else
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Geometry of entities of codim!=0 not implemented"
);
...
...
@@ -293,7 +303,7 @@ public:
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
(),
std
::
move
(
localFct
),
fakeDefaultGeometry
);
geo_
=
std
::
make_shared
<
GeometryImpl
>
(
Super
::
type
(),
Super
::
order
(),
std
::
move
(
localFct
),
fakeDefaultGeometry
);
}
return
Geometry
(
*
geo_
);
...
...
dune/curvedsurfacegrid/geometry.hh
View file @
94a31508
...
...
@@ -20,6 +20,7 @@
#include <dune/geometry/quadraturerules.hh>
#include <dune/geometry/referenceelements.hh>
#include <dune/geometry/type.hh>
#include <dune/localfunctions/lagrange/lfecache.hh>
#include "localgeometrywrapper.hh"
...
...
@@ -36,15 +37,17 @@ namespace Curved {
* \tparam LF localFunction parametrizing the geometry
* \tparam LG localGeometry for coordinate transform from subEntity to element,
* see \ref Impl::DefaultLocalGeometry and \ref Impl::LocalGeometryInterface
* \tparam ORDER Polynomial order of lagrange parametrization. If order == -1 use
* a localFunction parametrization. Otherwise interpolate the localfunction
* in the constructor to a local Lagrange basis.
* \tparam useInterpolation If set to true, use a Lagrange interpolation of the geometry
*/
template
<
class
ct
,
int
mydim
,
int
cdim
,
class
LF
,
class
LG
,
int
ORDER
=
-
1
>
class
Geometry
:
public
LagrangeCurvedGeometry
<
ct
,
mydim
,
cdim
,
(
ORDER
>
0
?
ORDER
:
1
)
>
template
<
class
ct
,
int
mydim
,
int
cdim
,
class
LF
,
class
LG
,
bool
useInterpolation
>
class
Geometry
;
template
<
class
ct
,
int
mydim
,
int
cdim
,
class
LF
,
class
LG
>
class
Geometry
<
ct
,
mydim
,
cdim
,
LF
,
LG
,
true
>
:
public
CurvedGeometry
<
ct
,
mydim
,
cdim
,
CurvedGeometryTraits
<
ct
,
LagrangeLFECache
<
ct
,
ct
,
mydim
>>>
{
using
Super
=
Lagrange
CurvedGeometry
<
ct
,
mydim
,
cdim
,
(
ORDER
>
0
?
ORDER
:
1
)
>
;
using
Super
=
CurvedGeometry
<
ct
,
mydim
,
cdim
,
CurvedGeometryTraits
<
ct
,
LagrangeLFECache
<
ct
,
ct
,
mydim
>>
>
;
/// \brief type of the localFunction representation the geometry parametrization
using
LocalFunction
=
LF
;
...
...
@@ -66,11 +69,11 @@ public:
*
*/
template
<
class
...
Args
>
Geometry
(
const
ReferenceElement
&
refElement
,
const
LocalFunction
&
localFunction
,
Args
&&
...
args
)
Geometry
(
const
ReferenceElement
&
refElement
,
int
order
,
const
LocalFunction
&
localFunction
,
Args
&&
...
args
)
:
Super
(
refElement
,
[
localFunction
,
localGeometry
=
LocalGeometry
{
std
::
forward
<
Args
>
(
args
)...}](
const
auto
&
local
)
{
return
localFunction
(
localGeometry
.
global
(
local
));
})
}
,
order
)
{}
/// \brief constructor, forwarding to the other constructor that take a reference-element
...
...
@@ -81,15 +84,15 @@ public:
* \param[in] args... argument to construct the local geometry
*/
template
<
class
...
Args
>
Geometry
(
Dune
::
GeometryType
gt
,
const
LocalFunction
&
localFunction
,
Args
&&
...
args
)
:
Geometry
(
ReferenceElements
::
general
(
gt
),
localFunction
,
std
::
forward
<
Args
>
(
args
)...)
Geometry
(
Dune
::
GeometryType
gt
,
int
order
,
const
LocalFunction
&
localFunction
,
Args
&&
...
args
)
:
Geometry
(
ReferenceElements
::
general
(
gt
),
order
,
localFunction
,
std
::
forward
<
Args
>
(
args
)...)
{}
};
// Specialization for the case that
ORDER < 0
: Use LocalFunction `LF` directly as parametrization
// Specialization for the case that
no interpolation should be used
: Use LocalFunction `LF` directly as parametrization
template
<
class
ct
,
int
mydim
,
int
cdim
,
class
LF
,
class
LG
>
class
Geometry
<
ct
,
mydim
,
cdim
,
LF
,
LG
,
-
1
>
class
Geometry
<
ct
,
mydim
,
cdim
,
LF
,
LG
,
false
>
:
public
LocalFunctionGeometry
<
LF
,
LG
>
{
using
Super
=
LocalFunctionGeometry
<
LF
,
LG
>
;
...
...
@@ -114,7 +117,7 @@ public:
*
*/
template
<
class
LF_
,
class
...
Args
>
Geometry
(
const
ReferenceElement
&
refElement
,
LF_
&&
localFunction
,
Args
&&
...
args
)
Geometry
(
const
ReferenceElement
&
refElement
,
int
,
LF_
&&
localFunction
,
Args
&&
...
args
)
:
Super
(
refElement
,
std
::
forward
<
LF_
>
(
localFunction
),
LocalGeometry
{
std
::
forward
<
Args
>
(
args
)...})
{}
...
...
@@ -126,7 +129,7 @@ public:
* \param[in] args... argument to construct the local geometry
*/
template
<
class
LF_
,
class
...
Args
>
Geometry
(
Dune
::
GeometryType
gt
,
LF_
&&
localFunction
,
Args
&&
...
args
)
Geometry
(
Dune
::
GeometryType
gt
,
int
,
LF_
&&
localFunction
,
Args
&&
...
args
)
:
Super
(
gt
,
std
::
forward
<
LF_
>
(
localFunction
),
LocalGeometry
{
std
::
forward
<
Args
>
(
args
)...})
{}
};
...
...
@@ -200,17 +203,8 @@ private:
// Specialization for vertex geometries
template
<
class
ct
,
int
cdim
,
class
LF
,
class
LG
,
int
order
>
class
Geometry
<
ct
,
0
,
cdim
,
LF
,
LG
,
order
>
:
public
VertexGeometry
<
ct
,
cdim
,
LF
,
LG
>
{
using
Super
=
VertexGeometry
<
ct
,
cdim
,
LF
,
LG
>
;
public:
using
Super
::
Super
;
};
template
<
class
ct
,
int
cdim
,
class
LF
,
class
LG
>
class
Geometry
<
ct
,
0
,
cdim
,
LF
,
LG
,
-
1
>
template
<
class
ct
,
int
cdim
,
class
LF
,
class
LG
,
bool
useInterpolation
>
class
Geometry
<
ct
,
0
,
cdim
,
LF
,
LG
,
useInterpolation
>
:
public
VertexGeometry
<
ct
,
cdim
,
LF
,
LG
>
{
using
Super
=
VertexGeometry
<
ct
,
cdim
,
LF
,
LG
>
;
...
...
dune/curvedsurfacegrid/grid.hh
View file @
94a31508
...
...
@@ -17,21 +17,21 @@
namespace
Dune
{
namespace
Impl
{
template
<
class
GridFunction
,
int
order
>
template
<
class
GridFunction
,
bool
useInterpolation
>
struct
CurvedSurfaceGridBase
{
using
HG
=
GridOf_t
<
GridFunction
>
;
using
type
=
GridDefaultImplementation
<
HG
::
dimension
,
Curved
::
DimRange
<
GridFunction
>::
value
,
typename
HG
::
ctype
,
Curved
::
GridFamily
<
GridFunction
,
order
>
Curved
::
GridFamily
<
GridFunction
,
useInterpolation
>
>
;
};
}
// end namespace Impl
template
<
class
GridFunction
,
int
order
>
using
CurvedSurfaceGridBase
=
typename
Impl
::
CurvedSurfaceGridBase
<
GridFunction
,
order
>::
type
;
template
<
class
GridFunction
,
bool
useInterpolation
>
using
CurvedSurfaceGridBase
=
typename
Impl
::
CurvedSurfaceGridBase
<
GridFunction
,
useInterpolation
>::
type
;
// CurvedSurfaceGrid
...
...
@@ -45,42 +45,41 @@ using CurvedSurfaceGridBase = typename Impl::CurvedSurfaceGridBase<GridFunction,
* of a CurvedGeometry.
*
* \tparam GF GridViewFunction defined on a (flat) hostgrid
* \tparam ORDER Polynomial order of local lagrange basis functions to use when approximating
* the curved geometry. [optional]
* \tparam useInterpolation If true, use Lagrange interpolation of geometries [false]
*
* \nosubgrouping
*/
template
<
class
GF
,
int
ORDER
=
-
1
>
template
<
class
GF
,
bool
useInterpolation
=
false
>
class
CurvedSurfaceGrid
;
/// \brief Generator for CurvedSurfaceGrid from a grid-functions
template
<
class
HostGrid
,
class
GF
,
int
ORDER
=
-
1
,
template
<
class
HostGrid
,
class
GF
,
bool
useInterpolation
=
false
,
std
::
enable_if_t
<
Concept
::
isGridFunction
<
GF
,
HostGrid
>(),
int
>
=
0
>
auto
curvedSurfaceGrid
(
HostGrid
&
hostGrid
,
GF
&&
gridFunction
)
auto
curvedSurfaceGrid
(
HostGrid
&
hostGrid
,
GF
&&
gridFunction
,
int
order
=
-
1
)
{
static_assert
(
std
::
is_same
<
HostGrid
,
GridOf_t
<
std
::
decay_t
<
GF
>>>::
value
,
"GridFunction must be defined on the HostGrid"
);
return
CurvedSurfaceGrid
<
std
::
decay_t
<
GF
>
,
ORDER
>
{
hostGrid
,
std
::
forward
<
GF
>
(
gridFunction
)};
return
CurvedSurfaceGrid
<
std
::
decay_t
<
GF
>
,
useInterpolation
>
{
hostGrid
,
std
::
forward
<
GF
>
(
gridFunction
)
,
order
};
}
/// \brief Generator for CurvedSurfaceGrid from a callable
template
<
class
HostGrid
,
class
F
,
int
ORDER
=
-
1
,
template
<
class
HostGrid
,
class
F
,
bool
useInterpolation
=
false
,
std
::
enable_if_t
<
not
Concept
::
isGridFunction
<
F
,
HostGrid
>(),
int
>
=
0
>
auto
curvedSurfaceGrid
(
HostGrid
&
hostGrid
,
F
&&
callable
)
auto
curvedSurfaceGrid
(
HostGrid
&
hostGrid
,
F
&&
callable
,
int
order
=
-
1
)
{
using
GlobalCoordinate
=
typename
GridEntitySet
<
HostGrid
,
0
>::
GlobalCoordinate
;
static_assert
(
Concept
::
isCallable
<
F
,
GlobalCoordinate
>
(),
"Function must be callable"
);
auto
gridFct
=
analyticGridFunction
<
HostGrid
>
(
std
::
forward
<
F
>
(
callable
));
return
CurvedSurfaceGrid
<
decltype
(
gridFct
),
ORDER
>
{
hostGrid
,
std
::
move
(
gridFct
)};
return
CurvedSurfaceGrid
<
decltype
(
gridFct
),
useInterpolation
>
{
hostGrid
,
std
::
move
(
gridFct
)
,
order
};
}
template
<
class
GF
,
int
ORDER
>
template
<
class
GF
,
bool
useInterpolation
>
class
CurvedSurfaceGrid
:
public
CurvedSurfaceGridBase
<
GF
,
ORDER
>
,
public
Curved
::
BackupRestoreFacilities
<
CurvedSurfaceGrid
<
GF
,
ORDER
>>
:
public
CurvedSurfaceGridBase
<
GF
,
useInterpolation
>
,
public
Curved
::
BackupRestoreFacilities
<
CurvedSurfaceGrid
<
GF
,
useInterpolation
>>
{
using
Self
=
CurvedSurfaceGrid
;
using
Super
=
CurvedSurfaceGridBase
<
GF
,
ORDER
>
;
using
Super
=
CurvedSurfaceGridBase
<
GF
,
useInterpolation
>
;
// friend declarations
template
<
class
,
class
>
friend
class
Curved
::
IdSet
;
...
...
@@ -88,7 +87,7 @@ class CurvedSurfaceGrid
public:
using
GridFunction
=
GF
;
using
GridFamily
=
Curved
::
GridFamily
<
GF
,
ORDER
>
;
using
GridFamily
=
Curved
::
GridFamily
<
GF
,
useInterpolation
>
;
/** \name Traits
* \{ */
...
...
@@ -212,22 +211,27 @@ public:
* \param[in] hostGrid reference to the grid to wrap
* \param[in] gridFunction mapping from global coordinates in the host geometry
* to global coordinates in the curved geometry
* \param[in] order polynomial order of Lagrange functions used to interpolate
* the geometry, if useInterpolation is true. (optional)
*
* If the gridFunction is passed by (non-const) reference it is stored as a non-destroying shared_ptr.
* Otherwise it is copied or moved into a new object (stored as shared_ptr as well).
*/
template
<
class
GF_
,
std
::
enable_if_t
<
std
::
is_same
<
GF
,
std
::
decay_t
<
GF_
>
>::
value
,
int
>
=
0
>
CurvedSurfaceGrid
(
HostGrid
&
hostGrid
,
GF_
&&
gridFunction
,
std
::
integral_constant
<
int
,
ORDER
>
=
{}
)
CurvedSurfaceGrid
(
HostGrid
&
hostGrid
,
GF_
&&
gridFunction
,
int
order
=
-
1
)
:
hostGrid_
(
hostGrid
)
,
gridFunction_
(
wrap_or_move
(
std
::
forward
<
GF_
>
(
gridFunction
)))
,
levelIndexSets_
(
hostGrid_
.
maxLevel
()
+
1
,
nullptr
)
{}
,
order_
(
order
)
{
assert
(
!
useInterpolation
!=
(
order
>
0
));
}
template
<
class
F_
,
std
::
enable_if_t
<
std
::
is_same
<
GF
,
AnalyticGridFunction
<
HostGrid
,
std
::
decay_t
<
F_
>
>>::
value
,
int
>
=
0
>
CurvedSurfaceGrid
(
HostGrid
&
hostGrid
,
F_
&&
callable
,
std
::
integral_constant
<
int
,
ORDER
>
=
{}
)
:
CurvedSurfaceGrid
(
hostGrid
,
analyticGridFunction
<
HostGrid
>
(
std
::
forward
<
F_
>
(
callable
)))
CurvedSurfaceGrid
(
HostGrid
&
hostGrid
,
F_
&&
callable
,
int
order
=
-
1
)
:
CurvedSurfaceGrid
(
hostGrid
,
analyticGridFunction
<
HostGrid
>
(
std
::
forward
<
F_
>
(
callable
))
,
order
)
{}
/// \brief destructor
...
...
@@ -257,7 +261,7 @@ public:
return
hostGrid
().
maxLevel
();
}
/// \brief obtain number of entites on a level
/// \brief obtain number of entit
i
es on a level
/**
* \param[in] level level to consider
* \param[in] codim codimension to consider
...
...
@@ -280,7 +284,7 @@ public:
return
leafGridView
().
size
(
codim
);
}
/// \brief obtain number of entites on a level
/// \brief obtain number of entit
i
es on a level
/**
* \param[in] level level to consider
* \param[in] type geometry type to consider
...
...
@@ -403,7 +407,7 @@ public:
/// \brief rebalance the load each process has to handle
/**
* A parallel grid is redistributed such that each process has about
* the same load (e.g., the same number of leaf entites).
* the same load (e.g., the same number of leaf entit
i
es).
*
* \note DUNE does not specify, how the load is measured.
*
...
...
@@ -420,7 +424,7 @@ public:
/// \brief rebalance the load each process has to handle
/**
* A parallel grid is redistributed such that each process has about
* the same load (e.g., the same number of leaf entites).
* the same load (e.g., the same number of leaf entit
i
es).
*
* The data handle is used to communicate the data associated with
* entities that move from one process to another.
...
...
@@ -529,6 +533,12 @@ public:
return
*
gridFunction_
;
}
/// \brief return the interpolation order for the geometries
int
order
()
const
{
return
order_
;
}
/** \} */
protected:
...
...
@@ -547,20 +557,29 @@ private:
mutable
LeafIndexSet
leafIndexSet_
;
mutable
GlobalIdSet
globalIdSet_
;
mutable
LocalIdSet
localIdSet_
;
int
order_
;
// polynomial order of local geometry interpolation
};
/// \brief Deduction guide for CurvedSurfaceGrid from a grid-functions or callables
template
<
class
HostGrid
,
class
GF
,
int
ORDER
=
-
1
>
CurvedSurfaceGrid
(
HostGrid
&
hostGrid
,
GF
&&
gridFunction
,
std
::
integral_constant
<
int
,
ORDER
>
=
{})
->
CurvedSurfaceGrid
<
GridFunctionOf_t
<
HostGrid
,
std
::
decay_t
<
GF
>>
,
ORDER
>
;
/// \brief Deduction guide for CurvedSurfaceGrid from a grid-functions or callables if
/// the local-function of the grid-function should be used directly as geometry parametrization
template
<
class
HostGrid
,
class
GF
>
CurvedSurfaceGrid
(
HostGrid
&
hostGrid
,
GF
&&
gridFunction
)
->
CurvedSurfaceGrid
<
GridFunctionOf_t
<
HostGrid
,
std
::
decay_t
<
GF
>>
,
false
>
;
/// \brief Deduction guide for CurvedSurfaceGrid from a grid-functions or callables if
/// interpolation should be used
template
<
class
HostGrid
,
class
GF
>
CurvedSurfaceGrid
(
HostGrid
&
hostGrid
,
GF
&&
gridFunction
,
int
order
)
->
CurvedSurfaceGrid
<
GridFunctionOf_t
<
HostGrid
,
std
::
decay_t
<
GF
>>
,
true
>
;
// CurvedSurfaceGrid::Codim
// ------------------------
template
<
class
GridFunction
,
int
ORDER
>
template
<
class
GridFunction
,
bool
useInterpolation
>
template
<
int
codim
>
struct
CurvedSurfaceGrid
<
GridFunction
,
ORDER
>::
Codim
struct
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>::
Codim
:
public
Super
::
template
Codim
<
codim
>
{
/** \name Entity types
...
...
dune/curvedsurfacegrid/gridfamily.hh
View file @
94a31508
...
...
@@ -36,12 +36,12 @@ struct DimRange
// GridFamily
// ----------
template
<
class
GF
,
int
order
>
template
<
class
GF
,
bool
useInterpolation
>
struct
GridFamily
{
struct
Traits
{
using
Grid
=
CurvedSurfaceGrid
<
GF
,
order
>
;
using
Grid
=
CurvedSurfaceGrid
<
GF
,
useInterpolation
>
;
using
HostGrid
=
GridOf_t
<
GF
>
;
using
GridFunction
=
GF
;
...
...
@@ -80,7 +80,7 @@ struct GridFamily
template
<
int
mydim
,
int
cdim
,
class
GridImpl
>
using
GeometryImplTemplate
=
Curved
::
Geometry
<
ctype
,
mydim
,
cdim
,
LocalFunction
,
LocalTransformation
,
order
>
;
=
Curved
::
Geometry
<
ctype
,
mydim
,
cdim
,
LocalFunction
,
LocalTransformation
,
useInterpolation
>
;
// geometry types
using
GeometryImpl
=
GeometryImplTemplate
<
dimension
-
codim
,
dimensionworld
,
const
Grid
>
;
...
...
@@ -120,9 +120,9 @@ struct GridFamily
// grid views
using
LeafGridView
=
Dune
::
GridView
<
Curved
::
GridViewTraits
<
typename
HostGrid
::
LeafGridView
,
GF
,
order
>>
;
=
Dune
::
GridView
<
Curved
::
GridViewTraits
<
typename
HostGrid
::
LeafGridView
,
GF
,
useInterpolation
>>
;
using
LevelGridView
=
Dune
::
GridView
<
Curved
::
GridViewTraits
<
typename
HostGrid
::
LevelGridView
,
GF
,
order
>>
;
=
Dune
::
GridView
<
Curved
::
GridViewTraits
<
typename
HostGrid
::
LevelGridView
,
GF
,
useInterpolation
>>
;
};
};
...
...
dune/curvedsurfacegrid/gridview.hh
View file @
94a31508
...
...
@@ -18,17 +18,17 @@ namespace Curved {
// Internal Forward Declarations
// -----------------------------
template
<
class
HGV
,
class
GF
,
int
order
>
template
<
class
HGV
,
class
GF
,
bool
useInterpolation
>
class
GridView
;
// GridViewTraits
// --------------
template
<
class
HGV
,
class
GF
,
int
order
>
template
<
class
HGV
,
class
GF
,
bool
useInterpolation
>
class
GridViewTraits
{
friend
class
GridView
<
HGV
,
GF
,
order
>
;
friend
class
GridView
<
HGV
,
GF
,
useInterpolation
>
;
using
HostGridView
=
HGV
;
using
GridFunction
=
GF
;
...
...
@@ -38,8 +38,8 @@ class GridViewTraits
using
HostIntersectionIterator
=
typename
HostGridView
::
IntersectionIterator
;
public:
using
GridViewImp
=
GridView
<
HostGridView
,
GridFunction
,
order
>
;
using
Grid
=
Dune
::
CurvedSurfaceGrid
<
GridFunction
,
order
>
;
using
GridViewImp
=
GridView
<
HostGridView
,
GridFunction
,
useInterpolation
>
;
using
Grid
=
Dune
::
CurvedSurfaceGrid
<
GridFunction
,
useInterpolation
>
;
using
IndexSet
=
Curved
::
IndexSet
<
const
Grid
,
typename
HostGridView
::
IndexSet
>
;
using
Intersection
=
Dune
::
Intersection
<
const
Grid
,
Curved
::
Intersection
<
const
Grid
,
HostIntersection
>>
;
...
...
@@ -78,13 +78,13 @@ public:
// GridView
// --------
template
<
class
HGV
,
class
GF
,
int
order
>
template
<
class
HGV
,
class
GF
,
bool
useInterpolation
>