Dune Core Modules (2.8.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
184
187
190
195 virtual void insertElement(const GeometryType& type,
196 const std::vector<unsigned int>& vertices);
197
204 void insertBoundarySegment(const std::vector<unsigned int>& vertices);
205
210 void insertBoundarySegment(const std::vector<unsigned int>& vertices,
211 const std::shared_ptr<BoundarySegment<dimworld> > &boundarySegment);
212
213
218 virtual std::unique_ptr<UGGrid<dimworld>> createGrid();
219
220 static const int dimension = UGGrid<dimworld>::dimension;
221
222 template< int codim >
223 struct Codim
224 {
225 typedef typename UGGrid<dimworld>::template Codim< codim >::Entity Entity;
226 };
227
232 virtual unsigned int
233 insertionIndex ( const typename Codim< 0 >::Entity &entity ) const
234 {
235 return UG_NS<dimension>::levelIndex(entity.impl().target_);
236 }
237
242 virtual unsigned int
243 insertionIndex ( const typename Codim< dimension >::Entity &entity ) const
244 {
245 return UG_NS<dimension>::levelIndex(entity.impl().target_);
246 }
247
252 virtual unsigned int
253 insertionIndex ( const typename UGGrid<dimworld>::LeafIntersection &intersection ) const
254 {
255 return intersection.boundarySegmentIndex();
256 }
257
259 virtual bool
260 wasInserted ( const typename UGGrid<dimworld>::LeafIntersection &intersection ) const
261 {
262 return (insertionIndex( intersection ) < boundarySegmentVertices_.size());
263 }
264
266
271 Communication comm() const
272 {
273 return grid_->comm();
274 }
275
276 private:
277
278 // Initialize the grid structure in UG
279 void createBegin();
280
281 // Pointer to the grid being built
282 UGGrid<dimworld>* grid_;
283
284 // True if the factory allocated the grid itself, false if the
285 // grid was handed over from the outside
286 bool factoryOwnsGrid_;
287
289 std::vector<std::array<int, dimworld*2-2> > boundarySegmentVertices_;
290
293 std::vector<unsigned char> elementTypes_;
294
297 std::vector<unsigned int> elementVertices_;
298
300 std::vector<FieldVector<double, dimworld> > vertexPositions_;
301
302 };
303
304}
305
306#endif
Base class for grid boundary segments of arbitrary geometry.
Collective communication interface and sequential default implementation.
Definition: communication.hh:98
Wrapper class for entities.
Definition: entity.hh:64
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:123
Provide a generic factory class for unstructured grids.
Definition: gridfactory.hh:71
virtual unsigned int insertionIndex(const typename Codim< 0 >::Entity &entity) const
obtain an element's insertion index
Definition: gridfactory.hh:218
static const int dimension
dimension of the grid
Definition: gridfactory.hh:75
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:233
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:243
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:260
Communication comm() const
Return the Communication used by the grid factory.
Definition: uggridfactory.hh:271
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:253
virtual std::unique_ptr< UGGrid< dimworld > > createGrid()
Finalize grid creation and hand over the grid.
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:312
Front-end for the grid manager of the finite element toolbox UG3.
Definition: uggrid.hh:205
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: alignedallocator.hh:11
Base class for classes implementing geometries of boundary segments.
Definition: boundarysegment.hh:92
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 (Nov 13, 23:29, 2024)