Dune Core Modules (2.4.1)

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 <vector>
13
15
18#include <dune/grid/uggrid.hh>
19
20namespace Dune {
21
22
158 template <int dimworld>
159 class GridFactory<UGGrid<dimworld> > : public GridFactoryInterface<UGGrid<dimworld> > {
160
162 typedef typename UGGrid<dimworld>::ctype ctype;
163
164 // UGGrid only in 2d and 3d
165 static_assert(dimworld==2 || dimworld || 3, "UGGrid only in 2d and 3d");
166
167 public:
168
171
183
186
189
194 virtual void insertElement(const GeometryType& type,
195 const std::vector<unsigned int>& vertices);
196
203 void insertBoundarySegment(const std::vector<unsigned int>& vertices);
204
209 void insertBoundarySegment(const std::vector<unsigned int>& vertices,
210 const shared_ptr<BoundarySegment<dimworld> > &boundarySegment);
211
212
218
219 static const int dimension = UGGrid<dimworld>::dimension;
220
221 template< int codim >
222 struct Codim
223 {
224 typedef typename UGGrid<dimworld>::template Codim< codim >::Entity Entity;
225 };
226
231 virtual unsigned int
232 insertionIndex ( const typename Codim< 0 >::Entity &entity ) const
233 {
234 return UG_NS<dimension>::levelIndex(grid_->getRealImplementation(entity).target_);
235 }
236
241 virtual unsigned int
242 insertionIndex ( const typename Codim< dimension >::Entity &entity ) const
243 {
244 return UG_NS<dimension>::levelIndex(grid_->getRealImplementation(entity).target_);
245 }
246
251 virtual unsigned int
252 insertionIndex ( const typename UGGrid<dimworld>::LeafIntersection &intersection ) const
253 {
254 return intersection.boundarySegmentIndex();
255 }
256
258 virtual bool
259 wasInserted ( const typename UGGrid<dimworld>::LeafIntersection &intersection ) const
260 {
261 return (insertionIndex( intersection ) < boundarySegmentVertices_.size());
262 }
263
264 private:
265
266 // Initialize the grid structure in UG
267 void createBegin();
268
269 // Pointer to the grid being built
270 UGGrid<dimworld>* grid_;
271
272 // True if the factory allocated the grid itself, false if the
273 // grid was handed over from the outside
274 bool factoryOwnsGrid_;
275
277 std::vector<array<int, dimworld*2-2> > boundarySegmentVertices_;
278
281 std::vector<unsigned char> elementTypes_;
282
285 std::vector<unsigned int> elementVertices_;
286
288 std::vector<FieldVector<double, dimworld> > vertexPositions_;
289
290 };
291
292}
293
294#endif
Base class for grid boundary segments of arbitrary geometry.
Wrapper class for entities.
Definition: entity.hh:62
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:25
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
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:232
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:242
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:259
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:252
void insertBoundarySegment(const std::vector< unsigned int > &vertices)
Method to insert a boundary segment into a coarse grid.
void insertBoundarySegment(const std::vector< unsigned int > &vertices, const shared_ptr< BoundarySegment< dimworld > > &boundarySegment)
Method to insert an arbitrarily shaped 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:208
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:10
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 (Dec 22, 23:30, 2024)