Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-vtk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
iwr
dune-vtk
Commits
8a18a5d6
Commit
8a18a5d6
authored
4 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
make lagrange grid-creator a grid-function by implementing entitySet and operator()
parent
1fc42aa7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/vtk/gridcreators/lagrangegridcreator.hh
+56
-36
56 additions, 36 deletions
dune/vtk/gridcreators/lagrangegridcreator.hh
with
56 additions
and
36 deletions
dune/vtk/gridcreators/lagrangegridcreator.hh
+
56
−
36
View file @
8a18a5d6
...
@@ -21,14 +21,14 @@ namespace Dune
...
@@ -21,14 +21,14 @@ namespace Dune
{
{
// \brief Create a grid from data that represents higher (lagrange) cells.
// \brief Create a grid from data that represents higher (lagrange) cells.
/**
/**
* The grid is created from the first nodes of a cell parametrization, representing
* The grid is created from the first nodes of a cell parametrization, representing
* the corner vertices. Thus a piecewise "flat" grid is constructed. The parametrization
* the corner vertices. Thus a piecewise "flat" grid is constructed. The parametrization
* is 1. passed as a local element parametrization to the `insertElement()` function of a
* is 1. passed as a local element parametrization to the `insertElement()` function of a
* gridFactory to allow the grid itself to handle the parametrization and 2. is stored
* gridFactory to allow the grid itself to handle the parametrization and 2. is stored
* internally that can be accessed by using this GridCreator object as a grid function,
* internally that can be accessed by using this GridCreator object as a grid function,
* or by extracting locally the parametrization on each existing grid element after
* or by extracting locally the parametrization on each existing grid element after
* creation of the grid.
* creation of the grid.
*
*
* So, the LagrangeGridCreator models both, a `GridCreator` and a `GridFunction`.
* So, the LagrangeGridCreator models both, a `GridCreator` and a `GridFunction`.
**/
**/
template
<
class
Grid
>
template
<
class
Grid
>
...
@@ -43,7 +43,7 @@ namespace Dune
...
@@ -43,7 +43,7 @@ namespace Dune
struct
ElementParametrization
struct
ElementParametrization
{
{
GeometryType
type
;
//< Geometry type of the element
GeometryType
type
;
//< Geometry type of the element
std
::
vector
<
std
::
int64_t
>
nodes
;
//< Indices of the w.r.t. `nodes_` vector
std
::
vector
<
std
::
int64_t
>
nodes
;
//< Indices of the w.r.t. `nodes_` vector
std
::
vector
<
unsigned
int
>
corners
;
//< Insertion-indices of the element corner nodes
std
::
vector
<
unsigned
int
>
corners
;
//< Insertion-indices of the element corner nodes
};
};
...
@@ -71,7 +71,7 @@ namespace Dune
...
@@ -71,7 +71,7 @@ namespace Dune
}
}
template
<
class
F
>
template
<
class
F
>
using
HasParametrizedElements
=
decltype
(
std
::
declval
<
F
>
().
insertElement
(
std
::
declval
<
GeometryType
>
(),
using
HasParametrizedElements
=
decltype
(
std
::
declval
<
F
>
().
insertElement
(
std
::
declval
<
GeometryType
>
(),
std
::
declval
<
std
::
vector
<
unsigned
int
>
const
&>
(),
std
::
declval
<
std
::
function
<
GlobalCoordinate
(
LocalCoordinate
)
>>
()));
std
::
declval
<
std
::
vector
<
unsigned
int
>
const
&>
(),
std
::
declval
<
std
::
function
<
GlobalCoordinate
(
LocalCoordinate
)
>>
()));
/// Implementation of the interface function `insertElements()`
/// Implementation of the interface function `insertElements()`
...
@@ -144,11 +144,11 @@ namespace Dune
...
@@ -144,11 +144,11 @@ namespace Dune
/// \brief Construct an element parametrization
/// \brief Construct an element parametrization
/**
/**
* The returned LocalParametrization is a mapping `GlobalCoordinate(LocalCoordinate)`
* The returned LocalParametrization is a mapping `GlobalCoordinate(LocalCoordinate)`
* where `LocalCoordinate is w.r.t. the local coordinate system in an element with
* where `LocalCoordinate is w.r.t. the local coordinate system in an element with
* given `insertionIndex` (defined by the inserted corner vertices) and
* given `insertionIndex` (defined by the inserted corner vertices) and
* `GlobalCoordinate` a world coordinate in the parametrized grid.
* `GlobalCoordinate` a world coordinate in the parametrized grid.
**/
**/
LocalParametrization
localParametrization
(
unsigned
int
insertionIndex
)
const
LocalParametrization
localParametrization
(
unsigned
int
insertionIndex
)
const
{
{
assert
(
!
nodes_
.
empty
()
&&
!
parametrization_
.
empty
());
assert
(
!
nodes_
.
empty
()
&&
!
parametrization_
.
empty
());
auto
const
&
localParam
=
parametrization_
.
at
(
insertionIndex
);
auto
const
&
localParam
=
parametrization_
.
at
(
insertionIndex
);
...
@@ -158,13 +158,13 @@ namespace Dune
...
@@ -158,13 +158,13 @@ namespace Dune
/// \brief Construct an element parametrization
/// \brief Construct an element parametrization
/**
/**
* The returned LocalParametrization is a mapping `GlobalCoordinate(LocalCoordinate)`
* The returned LocalParametrization is a mapping `GlobalCoordinate(LocalCoordinate)`
* where `LocalCoordinate is w.r.t. the local coordinate system in the passed element
* where `LocalCoordinate is w.r.t. the local coordinate system in the passed element
* and `GlobalCoordinate` a world coordinate in the parametrized grid.
* and `GlobalCoordinate` a world coordinate in the parametrized grid.
*
*
* Note, when an element is passed, it might have a different local coordinate system
* Note, when an element is passed, it might have a different local coordinate system
* than the coordinate system used to defined the element parametrization. Thus coordinate
* than the coordinate system used to defined the element parametrization. Thus coordinate
* transform is internally chained to the evaluation of the local parametrization. This
* transform is internally chained to the evaluation of the local parametrization. This
* local geometry transform is obtained by figuring out the permutation of corners in the
* local geometry transform is obtained by figuring out the permutation of corners in the
* element corresponding to the inserted corner vertices.
* element corresponding to the inserted corner vertices.
**/
**/
LocalParametrization
localParametrization
(
Element
const
&
element
)
const
LocalParametrization
localParametrization
(
Element
const
&
element
)
const
...
@@ -191,25 +191,6 @@ namespace Dune
...
@@ -191,25 +191,6 @@ namespace Dune
return
LocalParametrization
{
nodes_
,
localParam
,
order
(
localParam
),
permutation
};
return
LocalParametrization
{
nodes_
,
localParam
,
order
(
localParam
),
permutation
};
}
}
/// \brief Local function representing the parametrization of the grid.
/**
* The returned LocalFunction object models a Functions::Concept::LocalFunction
* and can thus be bound to an element of the created grid and evaluated in the
* local coordinates of the bound element.
*
* It is implemented in terms of the \ref LocalParametrization function returned by
* the method \ref localParametrization(element). See comments there for furhter
* details.
*
* Note, this methods requires the GridCreator to be bassed by lvalue-reference. This
* is necessary, since we want to guarantee that all internal storage is preserved while
* evaluating the local function.
**/
friend
LocalFunction
localFunction
(
LagrangeGridCreator
&
gridCreator
)
{
return
LocalFunction
{
gridCreator
};
}
/// Determine lagrange order from number of points
/// Determine lagrange order from number of points
template
<
class
LocalParam
>
template
<
class
LocalParam
>
unsigned
int
order
(
LocalParam
const
&
localParam
)
const
unsigned
int
order
(
LocalParam
const
&
localParam
)
const
...
@@ -224,12 +205,51 @@ namespace Dune
...
@@ -224,12 +205,51 @@ namespace Dune
}
}
/// Determine lagrange order from number of points from the first element parametrization
/// Determine lagrange order from number of points from the first element parametrization
unsigned
int
order
()
const
unsigned
int
order
()
const
{
{
assert
(
!
parametrization_
.
empty
());
assert
(
!
parametrization_
.
empty
());
return
order
(
parametrization_
.
front
());
return
order
(
parametrization_
.
front
());
}
}
public
:
/// \brief Local function representing the parametrization of the grid.
/**
* The returned object models Functions::Concept::LocalFunction
* and can thus be bound to an element of the created grid and evaluated in
* the local coordinates of the bound element.
*
* It is implemented in terms of the \ref LocalParametrization function
* returned by the method \ref localParametrization(element). See comments
* there for further details.
*
* Note, this methods requires the GridCreator to be based by
* lvalue-reference. This is necessary, since we want to guarantee that all
* internal storage is preserved while evaluating the local function.
**/
friend
LocalFunction
localFunction
(
LagrangeGridCreator
&
gridCreator
)
{
return
LocalFunction
{
gridCreator
};
}
struct
EntitySet
{
using
Grid
=
typename
Self
::
Grid
;
};
/// Dummy function returning a placeholder entityset
EntitySet
entitySet
()
const
{
assert
(
false
&&
"Should not be used!"
);
return
EntitySet
{};
}
/// Dummy function returning a placeholder entityset
GlobalCoordinate
operator
()
(
GlobalCoordinate
const
&
)
const
{
assert
(
false
&&
"Should not be used!"
);
return
GlobalCoordinate
{};
}
private
:
private
:
/// All point coordinates inclusing the higher-order lagrange points
/// All point coordinates inclusing the higher-order lagrange points
Nodes
nodes_
;
Nodes
nodes_
;
...
@@ -243,7 +263,7 @@ namespace Dune
...
@@ -243,7 +263,7 @@ namespace Dune
class
LagrangeGridCreator
<
Grid
>::
LocalParametrization
class
LagrangeGridCreator
<
Grid
>::
LocalParametrization
{
{
using
ctype
=
typename
Grid
::
ctype
;
using
ctype
=
typename
Grid
::
ctype
;
using
GlobalCoordinate
=
typename
Grid
::
template
Codim
<
0
>
::
Entity
::
Geometry
::
GlobalCoordinate
;
using
GlobalCoordinate
=
typename
Grid
::
template
Codim
<
0
>
::
Entity
::
Geometry
::
GlobalCoordinate
;
using
LocalCoordinate
=
typename
Grid
::
template
Codim
<
0
>
::
Entity
::
Geometry
::
LocalCoordinate
;
using
LocalCoordinate
=
typename
Grid
::
template
Codim
<
0
>
::
Entity
::
Geometry
::
LocalCoordinate
;
using
LocalGeometry
=
MultiLinearGeometry
<
ctype
,
Grid
::
dimension
,
Grid
::
dimension
>
;
using
LocalGeometry
=
MultiLinearGeometry
<
ctype
,
Grid
::
dimension
,
Grid
::
dimension
>
;
...
...
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