Skip to content
Snippets Groups Projects
Commit 178a7777 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

fix the fix

parent 8a18a5d6
Branches
Tags
No related merge requests found
......@@ -22,21 +22,21 @@ namespace Dune
// \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 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
* 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,
* or by extracting locally the parametrization on each existing grid element after
* creation of the grid.
* 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 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, or by extracting locally the parametrization
* on each existing grid element after creation of the grid.
*
* So, the LagrangeGridCreator models both, a `GridCreator` and a `GridFunction`.
**/
template <class Grid>
template <class GridType>
struct LagrangeGridCreator
: public GridCreatorInterface<Grid, LagrangeGridCreator<Grid>>
: public GridCreatorInterface<GridType, LagrangeGridCreator<GridType>>
{
using Self = LagrangeGridCreator;
using Super = GridCreatorInterface<Grid, Self>;
using Super = GridCreatorInterface<GridType, Self>;
using GlobalCoordinate = typename Super::GlobalCoordinate;
using Nodes = std::vector<GlobalCoordinate>;
......@@ -49,7 +49,7 @@ namespace Dune
};
using Parametrization = std::vector<ElementParametrization>;
using Element = typename Grid::template Codim<0>::Entity;
using Element = typename GridType::template Codim<0>::Entity;
using LocalCoordinate = typename Element::Geometry::LocalCoordinate;
class LocalParametrization;
......@@ -58,7 +58,7 @@ namespace Dune
public:
using Super::factory;
LagrangeGridCreator (GridFactory<Grid>& factory)
LagrangeGridCreator (GridFactory<GridType>& factory)
: Super(factory)
{}
......@@ -88,15 +88,15 @@ namespace Dune
std::int64_t vertexIndex = 0;
for (std::size_t i = 0; i < types.size(); ++i) {
auto type = Vtk::to_geometry(types[i]);
if (type.dim() != Grid::dimension)
if (type.dim() != GridType::dimension)
continue;
Vtk::CellType cellType{type};
auto refElem = referenceElement<double,Grid::dimension>(type);
auto refElem = referenceElement<double,GridType::dimension>(type);
std::int64_t shift = (i == 0 ? 0 : offsets[i-1]);
int nNodes = offsets[i] - shift;
int nVertices = refElem.size(Grid::dimension);
int nVertices = refElem.size(GridType::dimension);
// insert vertices into grid and construct element vertices
std::vector<unsigned int> element(nVertices);
......@@ -129,7 +129,7 @@ namespace Dune
param.corners = element;
// try to create element with parametrization
if constexpr (Std::is_detected_v<HasParametrizedElements, GridFactory<Grid>>) {
if constexpr (Std::is_detected_v<HasParametrizedElements, GridFactory<GridType>>) {
try {
factory().insertElement(type, element, localParametrization(parametrization_.size()-1));
} catch (Dune::GridError const& /* notImplemented */) {
......@@ -162,10 +162,11 @@ namespace Dune
* and `GlobalCoordinate` a world coordinate in the parametrized grid.
*
* 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
* 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
* element corresponding to the inserted corner vertices.
* than the coordinate system used to defined the element parametrization. Thus
* coordinate 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 element corresponding to the inserted corner
* vertices.
**/
LocalParametrization localParametrization (Element const& element) const
{
......@@ -176,9 +177,9 @@ namespace Dune
assert(element.type() == localParam.type);
// collect indices of vertices
std::vector<unsigned int> indices(element.subEntities(Grid::dimension));
for (unsigned int i = 0; i < element.subEntities(Grid::dimension); ++i)
indices[i] = factory().insertionIndex(element.template subEntity<Grid::dimension>(i));
std::vector<unsigned int> indices(element.subEntities(GridType::dimension));
for (unsigned int i = 0; i < element.subEntities(GridType::dimension); ++i)
indices[i] = factory().insertionIndex(element.template subEntity<GridType::dimension>(i));
// calculate permutation vector
std::vector<unsigned int> permutation(indices.size());
......@@ -233,7 +234,7 @@ namespace Dune
struct EntitySet
{
using Grid = typename Self::Grid;
using Grid = GridType;
};
/// Dummy function returning a placeholder entityset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment