dune-alugrid  2.8-git
gridfactory.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALU3DGRID_FACTORY_HH
2 #define DUNE_ALU3DGRID_FACTORY_HH
3 
4 #include <algorithm>
5 #include <array>
6 #include <map>
7 #include <memory>
8 #include <vector>
9 
10 // #include <dune/common/shared_ptr.hh>
11 #include <dune/common/parallel/mpihelper.hh>
12 #include <dune/common/version.hh>
13 
14 #include <dune/geometry/referenceelements.hh>
15 
16 #include <dune/grid/common/gridfactory.hh>
17 #include <dune/grid/common/boundaryprojection.hh>
18 
21 
23 
24 namespace Dune
25 {
27  template< class ALUGrid >
29  : public GridFactoryInterface< ALUGrid >
30  {
32  typedef GridFactoryInterface< ALUGrid > BaseType;
33 
34  public:
35  typedef ALUGrid Grid;
36 
37  typedef typename Grid::ctype ctype;
38 
39  static const ALU3dGridElementType elementType = Grid::elementType;
40 
41  static const unsigned int dimension = Grid::dimension;
42  static const unsigned int dimensionworld = Grid::dimensionworld;
43 
45 
46  template< int codim >
47  struct Codim
48  {
49  typedef typename Grid::template Codim< codim >::Entity Entity;
50  };
51 
52  typedef unsigned int VertexId;
53  typedef unsigned int GlobalIdType;
54 
56 
61 
62  typedef typename Grid::CollectiveCommunication Communication;
63 
64  // typedef grid pointer type based on what the grid factory interface defines
65  typedef decltype(std::declval< Dune::GridFactoryInterface< Grid >* >()->createGrid()) GridPtrType;
66 
67  private:
68  static_assert ( (elementType == tetra || elementType == hexa),
69  "ALU3dGridFactory supports only grids containing "
70  "tetrahedrons or hexahedrons exclusively." );
71 
73  typedef DuneBoundaryProjection< dimensionworld > DuneBoundaryProjectionType;
74 
75  typedef Dune::BoundarySegmentWrapper< dimension, dimensionworld > BoundarySegmentWrapperType;
77 
78  static const unsigned int numCorners = EntityCount< elementType >::numVertices;
79  static const unsigned int numFaces = EntityCount< elementType >::numFaces;
80  static const unsigned int numFaceCorners = EntityCount< elementType >::numVerticesPerFace;
81 
84 
85  // type of vertex coordinates put into the factory
86  typedef FieldVector< ctype, dimensionworld > VertexInputType;
88 
89  // type of vertex coordinates stored inside the factory
90  typedef FieldVector< ctype, 3 > VertexType;
91 
92  typedef std::vector< unsigned int > ElementType;
93  typedef std::array< unsigned int, numFaceCorners > FaceType;
94 
95  struct FaceLess;
96 
97  typedef std::vector< std::pair< VertexType, GlobalIdType > > VertexVector;
98  typedef std::vector< ElementType > ElementVector;
99  typedef std::pair< FaceType, int > BndPair ;
100  typedef std::map < FaceType, int > BoundaryIdMap;
101  typedef std::vector< std::pair< BndPair, BndPair > > PeriodicBoundaryVector;
102  typedef std::pair< unsigned int, int > SubEntity;
103  typedef std::map< FaceType, SubEntity, FaceLess > FaceMap;
104 
105  typedef std::map< FaceType, const DuneBoundaryProjectionType* > BoundaryProjectionMap;
106  typedef std::vector< const DuneBoundaryProjectionType* > BoundaryProjectionVector;
107 
108  typedef std::vector< Transformation > FaceTransformationVector;
109 
110  static void copy ( const std::initializer_list< unsigned int > &vertices, FaceType &faceId )
111  {
112  std::copy_n( vertices.begin(), faceId.size(), faceId.begin() );
113  }
114 
115  static FaceType makeFace ( const std::vector< unsigned int > &vertices )
116  {
117  if( vertices.size() != (dimension == 2 ? 2 : numFaceCorners) )
118  DUNE_THROW( GridError, "Wrong number of face vertices passed: " << vertices.size() << "." );
119 
120  FaceType faceId;
121  if( dimension == 2 )
122  {
123  if( elementType == tetra )
124  copy( { 0, vertices[ 1 ]+1, vertices[ 0 ]+1 }, faceId );
125  else if( elementType == hexa )
126  copy( { 2*vertices[ 0 ], 2*vertices[ 1 ], 2*vertices[ 0 ]+1, 2*vertices[ 1 ]+1 }, faceId );
127  }
128  else if( dimension == 3 )
129  std::copy_n( vertices.begin(), numFaceCorners, faceId.begin() );
130  return faceId;
131  }
132 
133  static BndPair makeBndPair ( const FaceType &face, const int id )
134  {
135  BndPair bndPair;
136  for( unsigned int i = 0; i < numFaceCorners; ++i )
137  {
138  const unsigned int j = FaceTopologyMappingType::dune2aluVertex( i );
139  bndPair.first[ j ] = face[ i ];
140  }
141  bndPair.second = id;
142  return bndPair;
143  }
144 
145  void markLongestEdge( std::vector< bool >& elementOrientation, const bool resortElements = true ) ;
146  void markLongestEdge();
147 
148  private:
149  // return grid object
150  virtual Grid* createGridObj( const std::string& name ) const
151  {
152  ALU3DSPACE ProjectVertexPtrPair pv = std::make_pair( globalProjection_, surfaceProjection_ );
153  return new Grid( communicator_, pv, name, realGrid_ );
154  }
155 
156  protected:
158  explicit ALU3dGridFactory ( const bool verbose, const MPICommunicatorType &communicator );
159 
160  public:
162  explicit ALU3dGridFactory ( const MPICommunicatorType &communicator = Grid::defaultCommunicator(),
163  bool removeGeneratedFile = true );
164 
166  explicit ALU3dGridFactory ( const std::string &filename,
167  const MPICommunicatorType &communicator = Grid::defaultCommunicator() );
168 
170  virtual ~ALU3dGridFactory ();
171 
176  virtual void insertVertex ( const VertexInputType &pos );
177 
183  void insertVertex ( const VertexInputType &pos, const VertexId globalId );
184 
193  virtual void
194  insertElement ( const GeometryType &geometry,
195  const std::vector< VertexId > &vertices );
196 
208  virtual void
209  insertBoundary ( const GeometryType &geometry, const std::vector< VertexId > &faceVertices, int boundaryId = 1 );
210 
211 
219  virtual void insertBoundary ( int element, int face, int boundaryId = 1 );
220 
221  // for testing parallel GridFactory
222  void insertProcessBorder ( int element, int face )
223  {
225  }
226 
235  virtual void
236  insertBoundaryProjection ( const GeometryType &type,
237  const std::vector< VertexId > &vertices,
238  const DuneBoundaryProjectionType *projection );
239 
244  virtual void
245  insertBoundarySegment ( const std::vector< VertexId >& vertices ) ;
246 
247  virtual void
248  insertProcessBorder ( const std::vector< VertexId >& vertices );
249 
255  virtual void
256  insertBoundarySegment ( const std::vector< VertexId >& vertices,
257  const std::shared_ptr<BoundarySegment<dimension,dimensionworld> >& boundarySegment ) ;
258 
263  virtual void insertBoundaryProjection ( const DuneBoundaryProjectionType& bndProjection, const bool isSurfaceProjection = (dimension != dimensionworld) );
264 
274  void insertFaceTransformation ( const WorldMatrix &matrix, const WorldVector &shift );
275 
281 
282  GridPtrType createGrid ( const bool addMissingBoundaries, const std::string dgfName = "" );
283 
284  GridPtrType createGrid ( const bool addMissingBoundaries, bool temporary, const std::string dgfName = "" );
285 
286  virtual unsigned int
287  insertionIndex ( const typename Codim< 0 >::Entity &entity ) const
288  {
289  alugrid_assert( entity.impl().getIndex() < int(ordering_.size()) );
290  return ordering_[ entity.impl().getIndex() ];
291  }
292 
293  virtual unsigned int
294  insertionIndex ( const typename Codim< dimension >::Entity &entity ) const
295  {
296  if(dimension == 2 && elementType == hexa )
297  // for quadrilaterals we simply half the number, see gridfactory.cc doInsertVertex
298  return entity.impl().getIndex()/2;
299  else if ( dimension == 2 && elementType == tetra )
300  // for triangles we have to substract 1, see gridfactory.cc doInsertVertex
301  return entity.impl().getIndex() - 1;
302  else // dimension 3
303  return entity.impl().getIndex();
304  }
305 
306  virtual unsigned int insertionIndex ( const typename Grid::LevelIntersection &intersection ) const
307  {
308  return boundaryInsertionIndex( intersection.inside(), intersection.indexInInside() );
309  }
310 
311  virtual unsigned int insertionIndex ( const typename Grid::LeafIntersection &intersection ) const
312  {
313  return boundaryInsertionIndex( intersection.inside(), intersection.indexInInside() );
314  }
315 
316  virtual bool wasInserted ( const typename Grid::LevelIntersection &intersection ) const
317  {
318  return intersection.boundary() && (insertionIndex(intersection) < std::numeric_limits<unsigned int>::max());
319  }
320 
321  virtual bool wasInserted ( const typename Grid::LeafIntersection &intersection ) const
322  {
323  return intersection.boundary() && (insertionIndex(intersection) < std::numeric_limits<unsigned int>::max());
324  }
325 
326  const std::vector<unsigned int>& ordering () const { return ordering_; }
327 
328 
330  void setLongestEdgeFlag (bool flag = true) { markLongestEdge_ = flag ; }
331 
337  {
338  return Communication(communicator_);
339  }
340 
341  private:
342  unsigned int boundaryInsertionIndex ( const typename Codim< 0 >::Entity &entity, int face ) const
343  {
344  const auto& refElem = Dune::ReferenceElements< double, dimension >::general( entity.type() );
345  const int vxSize = refElem.size( face, 1, dimension );
346  std::vector< unsigned int > vertices( vxSize );
347  for( int i = 0; i < vxSize; ++i )
348  vertices[ i ] = insertionIndex( entity.template subEntity< dimension >( refElem.subEntity( face, 1, i, dimension ) ) );
349 
350  FaceType faceId = makeFace( vertices );
351  std::sort( faceId.begin(), faceId.end() );
352 
353  const auto pos = insertionOrder_.find( faceId );
354  return (pos != insertionOrder_.end() ? pos->second : std::numeric_limits< unsigned int >::max());
355  }
356 
357  void doInsertVertex ( const VertexInputType &pos, const GlobalIdType globalId );
358  void doInsertBoundary ( int element, int face, int boundaryId );
359 
360  GlobalIdType globalId ( const VertexId &id ) const
361  {
362  alugrid_assert ( id < vertices_.size() );
363  return vertices_[ id ].second;
364  }
365 
366  const VertexType &position ( const VertexId &id ) const
367  {
368  alugrid_assert ( id < vertices_.size() );
369  return vertices_[ id ].first;
370  }
371 
372  const VertexInputType inputPosition ( const VertexId &id ) const
373  {
374  alugrid_assert ( id < vertices_.size() );
375  VertexType vertex = vertices_[ id ].first;
376  VertexInputType iVtx(0.);
377  for(unsigned i = 0 ; i < dimensionworld ; ++i)
378  iVtx[i] = vertex[i];
379  return iVtx;
380  }
381 
382  void assertGeometryType( const GeometryType &geometry );
383  static void generateFace ( const ElementType &element, const int f, FaceType &face );
384  void generateFace ( const SubEntity &subEntity, FaceType &face ) const;
385  void correctElementOrientation ();
386  bool identifyFaces ( const Transformation &transformation, const FaceType &key1, const FaceType &key2, const int defaultId );
387  void searchPeriodicNeighbor ( FaceMap &faceMap, typename FaceMap::iterator &pos, const int defaultId );
388  void reinsertBoundary ( const FaceMap &faceMap, const typename FaceMap::const_iterator &pos, const int id );
389  void recreateBoundaryIds ( const int defaultId = 1 );
390 
391  // sort elements according to hilbert space filling curve (if Zoltan is available)
392  void sortElements( const VertexVector& vertices, const ElementVector& elements, std::vector< unsigned int >& ordering );
393 
394  int rank_;
395 
396  VertexVector vertices_;
397  ElementVector elements_;
398  BoundaryIdMap boundaryIds_,insertionOrder_;
399  PeriodicBoundaryVector periodicBoundaries_;
400  ALU3DSPACE ProjectVertexPtr globalProjection_ ;
401  ALU3DSPACE ProjectVertexPtr surfaceProjection_ ;
402  BoundaryProjectionMap boundaryProjections_;
403  FaceTransformationVector faceTransformations_;
404  unsigned int numFacesInserted_;
405  bool realGrid_;
406  const bool allowGridGeneration_;
407  bool foundGlobalIndex_ ;
408 
409  MPICommunicatorType communicator_;
410 
411  typename SpaceFillingCurveOrderingType :: CurveType curveType_;
412  std::vector< unsigned int > ordering_;
413 
414  bool markLongestEdge_;
415  };
416 
417 
418 
419  template< class ALUGrid >
421  : public std::binary_function< FaceType, FaceType, bool >
422  {
423  bool operator() ( const FaceType &a, const FaceType &b ) const
424  {
425  for( unsigned int i = 0; i < numFaceCorners; ++i )
426  {
427  if( a[ i ] != b[ i ] )
428  return (a[ i ] < b[ i ]);
429  }
430  return false;
431  }
432  };
433 
434 
435  template< class ALUGrid >
436  inline void ALU3dGridFactory< ALUGrid >
437  ::assertGeometryType( const GeometryType &geometry )
438  {
439  if( elementType == tetra )
440  {
441  if( !geometry.isSimplex() )
442  DUNE_THROW( GridError, "Only simplex geometries can be inserted into "
443  "ALUGrid< 3, 3, simplex, refrule >." << geometry );
444  }
445  else
446  {
447  if( !geometry.isCube() )
448  DUNE_THROW( GridError, "Only cube geometries can be inserted into "
449  "ALUGrid< 3, 3, cube, refrule >." );
450  }
451  }
452 
456  template<int dim, int dimw, ALUGridElementType eltype, ALUGridRefinementType refinementtype , class Comm >
457  class GridFactory< ALUGrid< dim, dimw, eltype, refinementtype, Comm > >
458  : public ALU3dGridFactory< ALUGrid< dim, dimw, eltype, refinementtype, Comm > >
459  {
460  typedef GridFactory< ALUGrid< dim, dimw, eltype, refinementtype, Comm > > ThisType;
462 
463  public:
464  typedef typename BaseType::Grid Grid;
465 
467 
469  explicit GridFactory ( const MPICommunicatorType &communicator = Grid::defaultCommunicator() )
470  : BaseType( communicator )
471  {}
472 
474  template <class MPIComm>
475  explicit GridFactory ( const MPIComm & )
476  : BaseType( Grid::defaultCommunicator() )
477  {}
478 
480  explicit GridFactory ( const std::string &filename,
481  const MPICommunicatorType &communicator = Grid::defaultCommunicator() )
482  : BaseType( filename, communicator )
483  {}
484 
486  template <class MPIComm>
487  explicit GridFactory ( const std::string &filename,
488  const MPIComm & )
489  : BaseType( filename, Grid::defaultCommunicator() )
490  {}
491  };
492 
493  template< class Grid >
495 
496  // Specialization of the ReferenceGridFactory for ALUGrid
497  template<int dim, int dimw, ALUGridElementType eltype, ALUGridRefinementType refinementtype , class Comm >
498  class ReferenceGridFactory< ALUGrid< dim, dimw, eltype, refinementtype, Comm > >
499  : public ALU3dGridFactory< ALUGrid< dim, dimw, eltype, refinementtype, Comm > >
500  {
503 
504  public:
505  typedef typename BaseType::Grid Grid;
506 
508 
511  : BaseType(false, Grid::defaultCommunicator() )
512  {}
513  };
514 
515 
516 
517  // Implementation of ALU3dGridFactory
518  // ----------------------------------
519 
520  template< class ALUGrid >
521  inline
524  bool removeGeneratedFile )
525  : rank_( ALU3dGridCommunications< ALUGrid::dimension, ALUGrid::dimensionworld, elementType, MPICommunicatorType >::getRank( communicator ) ),
526  globalProjection_ ( 0 ),
527  surfaceProjection_ ( 0 ),
528  numFacesInserted_ ( 0 ),
529  realGrid_( true ),
530  allowGridGeneration_( rank_ == 0 ),
531  foundGlobalIndex_( false ),
532  communicator_( communicator ),
533  curveType_( SpaceFillingCurveOrderingType :: DefaultCurve ),
534  markLongestEdge_( ALUGrid::dimension == 2 )
535  {
536  BoundarySegmentWrapperType::registerFactory();
537  ALUProjectionType::registerFactory();
538  }
539 
540  template< class ALUGrid >
541  inline
543  :: ALU3dGridFactory ( const std::string &filename,
544  const MPICommunicatorType &communicator )
545  : rank_( ALU3dGridCommunications< ALUGrid::dimension, ALUGrid::dimensionworld, elementType, MPICommunicatorType >::getRank( communicator ) ),
546  globalProjection_ ( 0 ),
547  surfaceProjection_ ( 0 ),
548  numFacesInserted_ ( 0 ),
549  realGrid_( true ),
550  allowGridGeneration_( rank_ == 0 ),
551  foundGlobalIndex_( false ),
552  communicator_( communicator ),
553  curveType_( SpaceFillingCurveOrderingType :: DefaultCurve ),
554  markLongestEdge_( ALUGrid::dimension == 2 )
555  {
556  BoundarySegmentWrapperType::registerFactory();
557  ALUProjectionType::registerFactory();
558  }
559 
560  template< class ALUGrid >
561  inline
563  :: ALU3dGridFactory ( const bool realGrid,
564  const MPICommunicatorType &communicator )
565  : rank_( ALU3dGridCommunications< ALUGrid::dimension, ALUGrid::dimensionworld, elementType, MPICommunicatorType >::getRank( communicator ) ),
566  globalProjection_ ( 0 ),
567  surfaceProjection_ ( 0 ),
568  numFacesInserted_ ( 0 ),
569  realGrid_( realGrid ),
570  allowGridGeneration_( true ),
571  foundGlobalIndex_( false ),
572  communicator_( communicator ),
573  curveType_( SpaceFillingCurveOrderingType :: DefaultCurve ),
574  markLongestEdge_( ALUGrid::dimension == 2 )
575  {
576  BoundarySegmentWrapperType::registerFactory();
577  ALUProjectionType::registerFactory();
578  }
579 
580  template< class ALUGrid >
582  insertBoundarySegment ( const std::vector< unsigned int >& vertices )
583  {
584  FaceType faceId = makeFace( vertices );
585 
586  boundaryIds_.insert( makeBndPair( faceId, 1 ) );
587 
588  std::sort( faceId.begin(), faceId.end() );
589  if( boundaryProjections_.find( faceId ) != boundaryProjections_.end() )
590  DUNE_THROW( GridError, "Only one boundary projection can be attached to a face." );
591 
592  boundaryProjections_[ faceId ] = nullptr;
593 
594  insertionOrder_.insert( std::make_pair( faceId, insertionOrder_.size() ) );
595  }
596 
597  template< class ALUGrid >
599  insertProcessBorder ( const std::vector< unsigned int >& vertices )
600  {
601  FaceType faceId = makeFace( vertices );
602 
603  boundaryIds_.insert( makeBndPair( faceId, ALU3DSPACE ProcessorBoundary_t ) );
604 
605  std::sort( faceId.begin(), faceId.end() );
606  boundaryProjections_[ faceId ] = nullptr;
607  }
608 
609  template< class ALUGrid >
611  insertBoundarySegment ( const std::vector< unsigned int >& vertices,
612  const std::shared_ptr<BoundarySegment<dimension,dimensionworld> >& boundarySegment )
613  {
614  const std::size_t numVx = vertices.size();
615 
616  GeometryType type = (elementType == tetra) ?
617  GeometryTypes::simplex(dimension-1) :
618  GeometryTypes::cube(dimension-1);
619 
620  // we need double here because of the structure of BoundarySegment
621  // and BoundarySegmentWrapper which have double as coordinate type
622  typedef FieldVector< double, dimensionworld > CoordType;
623  std::vector< CoordType > coords( numVx );
624  for( std::size_t i = 0; i < numVx; ++i )
625  {
626  // adapt vertex index for 2d grids
627  const std::size_t vtx = (dimension == 2 ? (elementType == tetra ? vertices[ i ] + 1 : 2 * vertices[ i ]) : vertices[ i ]);
628 
629  // if this assertions is thrown vertices were not inserted at first
630  alugrid_assert ( vertices_.size() > vtx );
631 
632  // get global coordinate and copy it
633  std::copy_n( position( vtx ).begin(), dimensionworld, coords[ i ].begin() );
634  }
635 
636  std::unique_ptr< BoundarySegmentWrapperType > prj( new BoundarySegmentWrapperType( type, coords, boundarySegment ) );
637 
638  // consistency check
639  for( std::size_t i = 0; i < numVx; ++i )
640  {
641  CoordType global = (*prj)( coords [ i ] );
642  if( (global - coords[ i ]).two_norm() > 1e-6 )
643  DUNE_THROW( GridError, "BoundarySegment does not map face vertices to face vertices." );
644  }
645 
646  FaceType faceId = makeFace( vertices );
647 
648  boundaryIds_.insert( makeBndPair( faceId, 1 ) );
649 
650  std::sort( faceId.begin(), faceId.end() );
651  if( boundaryProjections_.find( faceId ) != boundaryProjections_.end() )
652  DUNE_THROW( GridError, "Only one boundary projection can be attached to a face." );
653 
654  boundaryProjections_[ faceId ] = prj.release();
655 
656  insertionOrder_.insert( std::make_pair( faceId, insertionOrder_.size() ) );
657  }
658 
659 
660  template< class ALUGrid >
661  inline void ALU3dGridFactory< ALUGrid >
662  ::generateFace ( const SubEntity &subEntity, FaceType &face ) const
663  {
664  generateFace( elements_[ subEntity.first ], subEntity.second, face );
665  }
666 
667 } // end namespace Dune
668 
669 #if COMPILE_ALUGRID_INLINE
670  #include "gridfactory.cc"
671 #endif
672 #endif
#define ALU3DSPACE
Definition: alu3dinclude.hh:7
Provides base classes for ALUGrid.
#define alugrid_assert(EX)
Definition: alugrid_assert.hh:20
Definition: alu3dinclude.hh:33
static const int ProcessorBoundary_t
Definition: alu3dinclude.hh:37
Definition: alu3dinclude.hh:63
ALU3dGridElementType
Definition: topology.hh:12
@ hexa
Definition: topology.hh:12
@ tetra
Definition: topology.hh:12
@ simplex
use only simplex elements (i.e., triangles or tetrahedra)
Definition: declaration.hh:18
@ cube
use only cube elements (i.e., quadrilaterals or hexahedra)
Definition: declaration.hh:19
unstructured parallel implementation of the DUNE grid interface
Definition: alugrid.hh:31
BaseType::ctype ctype
Definition: alugrid.hh:46
@ dimension
Definition: alugrid.hh:44
@ dimensionworld
Definition: alugrid.hh:44
BaseType::MPICommunicatorType MPICommunicatorType
Definition: alugrid.hh:39
Factory class for ALUGrids.
Definition: gridfactory.hh:30
Communication comm() const
Return the Communication used by the grid factory.
Definition: gridfactory.hh:336
unsigned int VertexId
Definition: gridfactory.hh:52
GridPtrType createGrid()
finalize the grid creation and hand over the grid
Definition: gridfactory.cc:476
static const unsigned int dimensionworld
Definition: gridfactory.hh:42
virtual void insertVertex(const VertexInputType &pos)
insert a vertex into the coarse grid
Definition: gridfactory.cc:34
Grid::MPICommunicatorType MPICommunicatorType
Definition: gridfactory.hh:44
virtual unsigned int insertionIndex(const typename Codim< 0 >::Entity &entity) const
Definition: gridfactory.hh:287
virtual bool wasInserted(const typename Grid::LeafIntersection &intersection) const
Definition: gridfactory.hh:321
void insertFaceTransformation(const WorldMatrix &matrix, const WorldVector &shift)
add a face transformation (for periodic identification)
Definition: gridfactory.cc:242
virtual unsigned int insertionIndex(const typename Codim< dimension >::Entity &entity) const
Definition: gridfactory.hh:294
ALU3dGridFactory(const MPICommunicatorType &communicator=Grid::defaultCommunicator(), bool removeGeneratedFile=true)
default constructor
Definition: gridfactory.hh:523
decltype(std::declval< Dune::GridFactoryInterface< Grid > * >() ->createGrid()) typede GridPtrType)
Definition: gridfactory.hh:65
ALUGrid Grid
Definition: gridfactory.hh:35
Grid::CollectiveCommunication Communication
Definition: gridfactory.hh:62
const std::vector< unsigned int > & ordering() const
Definition: gridfactory.hh:326
Transformation::WorldMatrix WorldMatrix
type of matrix from world coordinates to world coordinates
Definition: gridfactory.hh:60
virtual void insertBoundarySegment(const std::vector< VertexId > &vertices)
insert a boundary segment into the macro grid
Definition: gridfactory.hh:582
ALUGridTransformation< ctype, dimensionworld > Transformation
Definition: gridfactory.hh:55
virtual void insertBoundary(const GeometryType &geometry, const std::vector< VertexId > &faceVertices, int boundaryId=1)
insert a boundary element into the coarse grid
Definition: gridfactory.cc:148
void insertProcessBorder(int element, int face)
Definition: gridfactory.hh:222
Transformation::WorldVector WorldVector
type of vector for world coordinates
Definition: gridfactory.hh:58
virtual void insertProcessBorder(const std::vector< VertexId > &vertices)
Definition: gridfactory.hh:599
ALU3dGridFactory(const std::string &filename, const MPICommunicatorType &communicator=Grid::defaultCommunicator())
constructor taking filename for temporary outfile
Definition: gridfactory.hh:543
static const unsigned int dimension
Definition: gridfactory.hh:41
virtual void insertElement(const GeometryType &geometry, const std::vector< VertexId > &vertices)
insert an element into the coarse grid
Definition: gridfactory.cc:98
virtual void insertBoundaryProjection(const GeometryType &type, const std::vector< VertexId > &vertices, const DuneBoundaryProjectionType *projection)
insert a boundary projection into the macro grid
Definition: gridfactory.cc:221
virtual unsigned int insertionIndex(const typename Grid::LevelIntersection &intersection) const
Definition: gridfactory.hh:306
unsigned int GlobalIdType
Definition: gridfactory.hh:53
virtual ~ALU3dGridFactory()
Destructor.
Definition: gridfactory.cc:28
virtual bool wasInserted(const typename Grid::LevelIntersection &intersection) const
Definition: gridfactory.hh:316
Grid::ctype ctype
Definition: gridfactory.hh:37
void setLongestEdgeFlag(bool flag=true)
set longest edge marking for biscetion grids (default is off)
Definition: gridfactory.hh:330
ALU3dGridFactory(const bool verbose, const MPICommunicatorType &communicator)
constructor taking verbose flag
Definition: gridfactory.hh:563
static const ALU3dGridElementType elementType
Definition: gridfactory.hh:39
virtual void insertBoundarySegment(const std::vector< VertexId > &vertices, const std::shared_ptr< BoundarySegment< dimension, dimensionworld > > &boundarySegment)
insert a shaped boundary segment into the macro grid
Definition: gridfactory.hh:611
virtual unsigned int insertionIndex(const typename Grid::LeafIntersection &intersection) const
Definition: gridfactory.hh:311
Definition: 3d/grid.hh:117
Definition: gridfactory.hh:48
Grid::template Codim< codim >::Entity Entity
Definition: gridfactory.hh:49
Definition: gridfactory.hh:422
Specialization of the generic GridFactory for ALUGrid.
Definition: gridfactory.hh:459
GridFactory(const MPICommunicatorType &communicator=Grid::defaultCommunicator())
Default constructor.
Definition: gridfactory.hh:469
GridFactory(const std::string &filename, const MPIComm &)
constructor taking filename and ignoring MPIComm
Definition: gridfactory.hh:487
GridFactory(const MPIComm &)
Default constructor ignoring MPIComm.
Definition: gridfactory.hh:475
GridFactory(const std::string &filename, const MPICommunicatorType &communicator=Grid::defaultCommunicator())
constructor taking filename
Definition: gridfactory.hh:480
BaseType::MPICommunicatorType MPICommunicatorType
Definition: gridfactory.hh:466
Definition: gridfactory.hh:494
BaseType::MPICommunicatorType MPICommunicatorType
Definition: gridfactory.hh:507
ReferenceGridFactory()
Default constructor.
Definition: gridfactory.hh:510
Definition: topology.hh:15
Definition: topology.hh:40
Definition: topology.hh:151
static int dune2aluVertex(int index)
Maps vertex index from Dune onto ALU3dGrid reference face.
Definition: topology.cc:497
ALUGrid boundary projection implementation DuneBndProjection has to fulfil the DuneBoundaryProjection...
Definition: bndprojection.hh:14
Definition: hsfc.hh:167
CurveType
Definition: hsfc.hh:175
Definition: transformation.hh:12
FieldMatrix< ctype, dimension, dimension > WorldMatrix
Definition: transformation.hh:16
FieldVector< ctype, dimension > WorldVector
Definition: transformation.hh:15