5#ifndef DUNE_GRID_YASPGRID_STRUCTUREDYASPGRIDFACTORY_HH
6#define DUNE_GRID_YASPGRID_STRUCTUREDYASPGRIDFACTORY_HH
27 template<
class ctype,
int dim>
31 static const int dimworld = GridType::dimensionworld;
44 static std::unique_ptr<GridType>
46 const FieldVector<ctype,dimworld>& upperRight,
47 const std::array<unsigned int,dim>& elements)
50 for(
int d = 0; d < dimworld; ++d)
51 if(
abs(lowerLeft[d]) >
abs(upperRight[d])*1e-10)
52 DUNE_THROW(
GridError, className<StructuredGridFactory>()
53 <<
"::createCubeGrid(): You have to use Yaspgrid<dim"
54 ", EquidistantOffsetCoordinates<ctype,dim> > as your"
55 "grid type for non-trivial origin." );
58 std::array<int, dim> elem;
59 std::copy(elements.begin(), elements.end(), elem.begin());
61 return std::make_unique<GridType>(upperRight, elem,
62 std::bitset<dim>(), 1);
70 static std::unique_ptr<GridType>
72 const FieldVector<ctype,dimworld>& upperRight,
73 const std::array<unsigned int,dim>& elements)
75 DUNE_THROW(
GridError, className<StructuredGridFactory>()
76 <<
"::createSimplexGrid(): Simplices are not supported "
89 template<
class ctype,
int dim>
92 static const int dimworld = GridType::dimensionworld;
101 static std::unique_ptr<GridType>
103 const FieldVector<ctype,dimworld>& upperRight,
104 const std::array<unsigned int,dim>& elements)
107 std::array<int, dim> elem;
108 std::copy(elements.begin(), elements.end(), elem.begin());
110 return std::make_unique<GridType>(lowerLeft, upperRight, elem,
111 std::bitset<dim>(), 1);
119 static std::unique_ptr<GridType>
121 const FieldVector<ctype,dimworld>& upperRight,
122 const std::array<unsigned int,dim>& elements)
124 DUNE_THROW(
GridError, className<StructuredGridFactory>()
125 <<
"::createSimplexGrid(): Simplices are not supported "
Include standard header files.
Definition: agrid.hh:60
void abs(const DofVectorPointer< int > &dofVector)
Definition: dofvector.hh:328
Construct structured cube and simplex grids in unstructured grid managers.
Definition: utility/structuredgridfactory.hh:31
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:20
[ provides Dune::Grid ]
Definition: yaspgrid.hh:163
Container for equidistant coordinates in a YaspGrid.
Definition: coordinates.hh:29
Container for equidistant coordinates in a YaspGrid with non-trivial origin.
Definition: coordinates.hh:131
static std::unique_ptr< GridType > createCubeGrid(const FieldVector< ctype, dimworld > &lowerLeft, const FieldVector< ctype, dimworld > &upperRight, const std::array< unsigned int, dim > &elements)
Create a structured cube grid.
Definition: structuredyaspgridfactory.hh:45
static std::unique_ptr< GridType > createSimplexGrid(const FieldVector< ctype, dimworld > &lowerLeft, const FieldVector< ctype, dimworld > &upperRight, const std::array< unsigned int, dim > &elements)
Create a structured simplex grid.
Definition: structuredyaspgridfactory.hh:71
static std::unique_ptr< GridType > createCubeGrid(const FieldVector< ctype, dimworld > &lowerLeft, const FieldVector< ctype, dimworld > &upperRight, const std::array< unsigned int, dim > &elements)
Create a structured cube grid.
Definition: structuredyaspgridfactory.hh:102
static std::unique_ptr< GridType > createSimplexGrid(const FieldVector< ctype, dimworld > &lowerLeft, const FieldVector< ctype, dimworld > &upperRight, const std::array< unsigned int, dim > &elements)
Create a structured simplex grid.
Definition: structuredyaspgridfactory.hh:120
A class to construct structured cube and simplex grids using the grid factory.