Dune Core Modules (2.5.0)

uggridfactory.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#ifndef DUNE_UGGRID_FACTORY_HH
5#define DUNE_UGGRID_FACTORY_HH
6
12#include <array>
13#include <memory>
14#include <vector>
15
17
20#include <dune/grid/uggrid.hh>
21
22namespace Dune {
23
24
160 template <int dimworld>
161 class GridFactory<UGGrid<dimworld> > : public GridFactoryInterface<UGGrid<dimworld> > {
162
164 typedef typename UGGrid<dimworld>::ctype ctype;
165
166 // UGGrid only in 2d and 3d
167 static_assert(dimworld==2 || dimworld == 3, "UGGrid only in 2d and 3d");
168
169 public:
170
173
185
188
191
196 virtual void insertElement(const GeometryType& type,
197 const std::vector<unsigned int>& vertices);
198
205 void insertBoundarySegment(const std::vector<unsigned int>& vertices);
206
211 void insertBoundarySegment(const std::vector<unsigned int>& vertices,
212 const std::shared_ptr<BoundarySegment<dimworld> > &boundarySegment);
213
214
220
221 static const int dimension = UGGrid<dimworld>::dimension;
222
223 template< int codim >
224 struct Codim
225 {
226 typedef typename UGGrid<dimworld>::template Codim< codim >::Entity Entity;
227 };
228
233 virtual unsigned int
234 insertionIndex ( const typename Codim< 0 >::Entity &entity ) const
235 {
236 return UG_NS<dimension>::levelIndex(grid_->getRealImplementation(entity).target_);
237 }
238
243 virtual unsigned int
244 insertionIndex ( const typename Codim< dimension >::Entity &entity ) const
245 {
246 return UG_NS<dimension>::levelIndex(grid_->getRealImplementation(entity).target_);
247 }
248
253 virtual unsigned int
254 insertionIndex ( const typename UGGrid<dimworld>::LeafIntersection &intersection ) const
255 {
256 return intersection.boundarySegmentIndex();
257 }
258
260 virtual bool
261 wasInserted ( const typename UGGrid<dimworld>::LeafIntersection &intersection ) const
262 {
263 return (insertionIndex( intersection ) < boundarySegmentVertices_.size());
264 }
265
266 private:
267
268 // Initialize the grid structure in UG
269 void createBegin();
270
271 // Pointer to the grid being built
272 UGGrid<dimworld>* grid_;
273
274 // True if the factory allocated the grid itself, false if the
275 // grid was handed over from the outside
276 bool factoryOwnsGrid_;
277
279 std::vector<std::array<int, dimworld*2-2> > boundarySegmentVertices_;
280
283 std::vector<unsigned char> elementTypes_;
284
287 std::vector<unsigned int> elementVertices_;
288
290 std::vector<FieldVector<double, dimworld> > vertexPositions_;
291
292 };
293
294}
295
296#endif
Base class for grid boundary segments of arbitrary geometry.
Wrapper class for entities.
Definition: entity.hh:65
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:268
Provide a generic factory class for unstructured grids.
Definition: gridfactory.hh:74
virtual unsigned int insertionIndex(const typename Codim< 0 >::Entity &entity) const
obtain an element's insertion index
Definition: gridfactory.hh:179
static const int dimension
dimension of the grid
Definition: gridfactory.hh:78
void insertBoundarySegment(const std::vector< unsigned int > &vertices, const std::shared_ptr< BoundarySegment< dimworld > > &boundarySegment)
Method to insert an arbitrarily shaped boundary segment into a coarse grid.
virtual void insertVertex(const FieldVector< ctype, dimworld > &pos)
Insert a vertex into the coarse grid.
virtual unsigned int insertionIndex(const typename Codim< 0 >::Entity &entity) const
Return the number of the element in the order of insertion into the factory.
Definition: uggridfactory.hh:234
virtual void insertElement(const GeometryType &type, const std::vector< unsigned int > &vertices)
Insert an element into the coarse grid.
virtual unsigned int insertionIndex(const typename Codim< dimension >::Entity &entity) const
Return the number of the vertex in the order of insertion into the factory.
Definition: uggridfactory.hh:244
virtual UGGrid< dimworld > * createGrid()
Finalize grid creation and hand over the grid.
virtual bool wasInserted(const typename UGGrid< dimworld >::LeafIntersection &intersection) const
Return true if the intersection has been explictily insterted into the factory.
Definition: uggridfactory.hh:261
GridFactory(UGGrid< dimworld > *grid)
Constructor for a given grid object.
virtual unsigned int insertionIndex(const typename UGGrid< dimworld >::LeafIntersection &intersection) const
Return the number of the intersection in the order of insertion into the factory.
Definition: uggridfactory.hh:254
void insertBoundarySegment(const std::vector< unsigned int > &vertices)
Method to insert a boundary segment into a coarse grid.
Provide a generic factory class for unstructured grids.
Definition: gridfactory.hh:263
Front-end for the grid manager of the finite element toolbox UG.
Definition: uggrid.hh:231
Provide a generic factory class for unstructured grids.
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignment.hh:11
Base class for classes implementing geometries of boundary segments.
Definition: boundarysegment.hh:30
Static tag representing a codimension.
Definition: dimension.hh:22
The UGGrid class.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)