6#ifndef DUNE_GMSHREADER_HH
7#define DUNE_GMSHREADER_HH
51 template<
int dimension,
int dimWorld = dimension >
52 class GmshReaderQuadraticBoundarySegment
56 static void registerFactory() {}
71 template<
int dimWorld >
72 struct GmshReaderQuadraticBoundarySegment< 2, dimWorld >
75 typedef GmshReaderQuadraticBoundarySegment< 2, dimWorld > ThisType;
79 GmshReaderQuadraticBoundarySegment (
const GlobalVector &p0_,
const GlobalVector &p1_,
const GlobalVector &p2_)
80 : p0(p0_), p1(p1_), p2(p2_)
85 GmshReaderQuadraticBoundarySegment( ObjectStreamType& in )
88 const int bytes =
sizeof(double)*dimWorld;
89 in.read( (
char *) &p0[ 0 ], bytes );
90 in.read( (
char *) &p1[ 0 ], bytes );
91 in.read( (
char *) &p2[ 0 ], bytes );
95 static void registerFactory()
107 y.axpy((local[0]-alpha)*(local[0]-1.0)/alpha,p0);
108 y.axpy(local[0]*(local[0]-1.0)/(alpha*(alpha-1.0)),p1);
109 y.axpy(local[0]*(local[0]-alpha)/(1.0-alpha),p2);
113 void backup( ObjectStreamType& out )
const
116 out.write( (
const char *) &key(),
sizeof(
int ) );
118 const int bytes =
sizeof(double)*dimWorld;
119 out.write( (
const char*) &p0[ 0 ], bytes );
120 out.write( (
const char*) &p1[ 0 ], bytes );
121 out.write( (
const char*) &p2[ 0 ], bytes );
127 GlobalVector d1 = p1;
129 GlobalVector d2 = p2;
132 alpha=d1.two_norm()/(d1.two_norm()+d2.two_norm());
133 if (alpha<1E-6 || alpha>1-1E-6)
143 GlobalVector p0,p1,p2;
172 class GmshReaderQuadraticBoundarySegment< 3, 3 >
175 typedef GmshReaderQuadraticBoundarySegment< 3, 3 > ThisType;
181 : p0(p0_), p1(p1_), p2(p2_), p3(p3_), p4(p4_), p5(p5_)
186 GmshReaderQuadraticBoundarySegment( ObjectStreamType& in )
188 const int bytes =
sizeof(double)*3;
189 in.read( (
char *) &p0[ 0 ], bytes );
190 in.read( (
char *) &p1[ 0 ], bytes );
191 in.read( (
char *) &p2[ 0 ], bytes );
192 in.read( (
char *) &p3[ 0 ], bytes );
193 in.read( (
char *) &p4[ 0 ], bytes );
194 in.read( (
char *) &p5[ 0 ], bytes );
198 static void registerFactory()
210 y.
axpy(phi0(local),p0);
211 y.
axpy(phi1(local),p1);
212 y.
axpy(phi2(local),p2);
213 y.
axpy(phi3(local),p3);
214 y.
axpy(phi4(local),p4);
215 y.
axpy(phi5(local),p5);
219 void backup( ObjectStreamType& out )
const
222 out.write( (
const char*) &key(),
sizeof(
int ) );
224 const int bytes =
sizeof(double)*3;
225 out.write( (
const char*) &p0[ 0 ], bytes );
226 out.write( (
const char*) &p1[ 0 ], bytes );
227 out.write( (
const char*) &p2[ 0 ], bytes );
228 out.write( (
const char*) &p3[ 0 ], bytes );
229 out.write( (
const char*) &p4[ 0 ], bytes );
230 out.write( (
const char*) &p5[ 0 ], bytes );
243 if (alpha<1E-6 || alpha>1-1E-6)
249 if (beta<1E-6 || beta>1-1E-6)
255 if (gamma<1E-6 || gamma>1-1E-6)
270 return (alpha*beta-beta*local[0]-alpha*local[1])*(1-local[0]-local[1])/(alpha*beta);
274 return local[0]*(1-local[0]-local[1])/(alpha*(1-alpha));
278 return local[0]*(gamma*local[0]-(sqrt2-gamma-sqrt2*alpha)*local[1]-alpha*gamma)/(gamma*(1-alpha));
282 return local[1]*(1-local[0]-local[1])/(beta*(1-beta));
286 return local[0]*local[1]/((1-gamma/sqrt2)*gamma/sqrt2);
290 return local[1]*(beta*(1-gamma/sqrt2)-local[0]*(beta-gamma/sqrt2)-local[1]*(1-gamma/sqrt2))/((1-gamma/sqrt2)*(beta-1));
294 double alpha,beta,gamma,sqrt2;
300 template<
typename Gr
idType>
307 bool insert_boundary_segments;
308 unsigned int number_of_real_vertices;
309 int boundary_element_count;
313 std::string fileName;
315 std::vector<int> boundary_id_to_physical_entity;
316 std::vector<int> element_index_to_physical_entity;
317 std::vector<std::string> physical_entity_names;
320 static const int dim = GridType::dimension;
321 static const int dimWorld = GridType::dimensionworld;
322 static_assert( (dimWorld <= 3),
"GmshReader requires dimWorld <= 3." );
331 void readfile(FILE * file,
int cnt,
const char * format, ...)
333 __attribute__((format(scanf, 4, 5)))
337 va_start(ap, format);
338 auto pos = std::ftell(file);
339 int c = std::vfscanf(file, format, ap);
344 <<
": Expected '" << format <<
"', only read " << c <<
" entries instead of " << cnt <<
".");
348 void skipline(FILE * file)
352 c = std::fgetc(file);
353 }
while(c !=
'\n' && c != EOF);
359 factory(_factory), verbose(v), insert_boundary_segments(i) {}
361 std::vector<int> & boundaryIdMap()
363 return boundary_id_to_physical_entity;
369 return element_index_to_physical_entity;
375 return physical_entity_names;
378 void read (
const std::string& f)
380 if (verbose) std::cout <<
"Reading " << dim <<
"d Gmsh grid..." << std::endl;
384 FILE* file = fopen(fileName.c_str(),
"rb");
393 number_of_real_vertices = 0;
394 boundary_element_count = 0;
398 double version_number;
399 int file_type, data_size;
401 readfile(file,1,
"%s\n",buf);
402 if (strcmp(buf,
"$MeshFormat")!=0)
404 readfile(file,3,
"%lg %d %d\n",&version_number,&file_type,&data_size);
407 if( (version_number < 2.0) || (version_number >= 2.20001) )
409 if (verbose) std::cout <<
"version " << version_number <<
" Gmsh file detected" << std::endl;
410 readfile(file,1,
"%s\n",buf);
411 if (strcmp(buf,
"$EndMeshFormat")!=0)
415 physical_entity_names.clear();
416 readfile(file,1,
"%s\n",buf);
417 if (strcmp(buf,
"$PhysicalNames")==0) {
419 readfile(file,1,
"%d\n",&number_of_names);
420 if (verbose) std::cout <<
"file contains " << number_of_names <<
" physical entities" << std::endl;
421 physical_entity_names.resize(number_of_names);
422 std::string buf_name;
423 for(
int i = 0; i < number_of_names; ++i ) {
425 readfile(file,3,
"%d %d %s\n", &dim, &
id, buf);
426 buf_name.assign(buf);
427 auto begin = buf_name.find_first_of(
'\"') + 1;
428 auto end = buf_name.find_last_of(
'\"') - begin;
429 physical_entity_names[
id-1].assign(buf_name.substr(begin, end));
431 readfile(file,1,
"%s\n",buf);
432 if (strcmp(buf,
"$EndPhysicalNames")!=0)
434 readfile(file,1,
"%s\n",buf);
440 if (strcmp(buf,
"$Nodes")!=0)
442 readfile(file,1,
"%d\n",&number_of_nodes);
443 if (verbose) std::cout <<
"file contains " << number_of_nodes <<
" nodes" << std::endl;
447 std::vector< GlobalVector > nodes( number_of_nodes+1 );
451 for(
int i = 1; i <= number_of_nodes; ++i )
453 readfile(file,4,
"%d %lg %lg %lg\n", &
id, &x[ 0 ], &x[ 1 ], &x[ 2 ] );
455 if (
id > number_of_nodes) {
457 "Only dense sequences of node indices are currently supported (node index "
458 <<
id <<
" is invalid).");
462 for(
int j = 0; j < dimWorld; ++j )
463 nodes[
id ][ j ] = x[ j ];
465 readfile(file,1,
"%s\n",buf);
466 if (strcmp(buf,
"$EndNodes")!=0)
471 readfile(file,1,
"%s\n",buf);
472 if (strcmp(buf,
"$Elements")!=0)
474 int number_of_elements;
475 readfile(file,1,
"%d\n",&number_of_elements);
476 if (verbose) std::cout <<
"file contains " << number_of_elements <<
" elements" << std::endl;
483 auto section_element_offset = std::ftell(file);
484 std::map<int,unsigned int>
renumber;
485 for (
int i=1; i<=number_of_elements; i++)
487 int id, elm_type, number_of_tags;
488 readfile(file,3,
"%d %d %d ",&
id,&elm_type,&number_of_tags);
489 for (
int k=1; k<=number_of_tags; k++)
492 readfile(file,1,
"%d ",&blub);
503 if (verbose) std::cout <<
"number of real vertices = " << number_of_real_vertices << std::endl;
504 if (verbose) std::cout <<
"number of boundary elements = " << boundary_element_count << std::endl;
505 if (verbose) std::cout <<
"number of elements = " << element_count << std::endl;
506 readfile(file,1,
"%s\n",buf);
507 if (strcmp(buf,
"$EndElements")!=0)
509 boundary_id_to_physical_entity.resize(boundary_element_count);
510 element_index_to_physical_entity.resize(element_count);
516 std::fseek(file, section_element_offset, SEEK_SET);
517 boundary_element_count = 0;
519 for (
int i=1; i<=number_of_elements; i++)
521 int id, elm_type, number_of_tags;
522 readfile(file,3,
"%d %d %d ",&
id,&elm_type,&number_of_tags);
523 int physical_entity = -1;
525 for (
int k=1; k<=number_of_tags; k++)
528 readfile(file,1,
"%d ",&blub);
529 if (k==1) physical_entity = blub;
533 readfile(file,1,
"%s\n",buf);
534 if (strcmp(buf,
"$EndElements")!=0)
546 std::map<int,unsigned int> & renumber,
547 const std::vector< GlobalVector > & nodes)
550 const int nDofs[16] = {-1, 2, 3, 4, 4, 8, 6, 5, 3, 6, -1, 10, -1, -1, -1, 1};
551 const int nVertices[16] = {-1, 2, 3, 4, 4, 8, 6, 5, 2, 3, -1, 4, -1, -1, -1, 1};
552 const int elementDim[16] = {-1, 1, 2, 2, 3, 3, 3, 3, 1, 2, -1, 3, -1, -1, -1, 0};
555 if ( not (elm_type > 0 && elm_type <= 15
556 && (elementDim[elm_type] == dim || elementDim[elm_type] == (dim-1) ) ) )
564 for (
int i=1; i<nDofs[elm_type]; i++)
569 std::vector<int> elementDofs(10);
572 &(elementDofs[0]),&(elementDofs[1]),&(elementDofs[2]),
573 &(elementDofs[3]),&(elementDofs[4]),&(elementDofs[5]),
574 &(elementDofs[6]),&(elementDofs[7]),&(elementDofs[8]),
578 for (
int i=0; i<nVertices[elm_type]; i++)
579 if (renumber.find(elementDofs[i])==renumber.end())
581 renumber[elementDofs[i]] = number_of_real_vertices++;
586 if (elementDim[elm_type] == dim)
589 boundary_element_count++;
596 template <
class E,
class V,
class V2>
597 void boundarysegment_insert(
607 template <
class E,
class V>
608 void boundarysegment_insert(
609 const std::vector<FieldVector<double, 3> >& nodes,
610 const E& elementDofs,
614 std::array<FieldVector<double,dimWorld>, 6> v;
615 for (
int i=0; i<6; i++)
616 for (
int j=0; j<dimWorld; j++)
617 v[i][j] = nodes[elementDofs[i]][j];
619 BoundarySegment<dim,dimWorld>* newBoundarySegment
620 = (BoundarySegment<dim,dimWorld>*)
new GmshReaderQuadraticBoundarySegment< 3, 3 >( v[0], v[1], v[2],
624 std::shared_ptr<BoundarySegment<dim,dimWorld> >(newBoundarySegment) );
634 std::map<int,unsigned int> & renumber,
635 const std::vector< GlobalVector > & nodes,
636 const int physical_entity)
639 const int nDofs[16] = {-1, 2, 3, 4, 4, 8, 6, 5, 3, 6, -1, 10, -1, -1, -1, 1};
640 const int nVertices[16] = {-1, 2, 3, 4, 4, 8, 6, 5, 2, 3, -1, 4, -1, -1, -1, 1};
641 const int elementDim[16] = {-1, 1, 2, 2, 3, 3, 3, 3, 1, 2, -1, 3, -1, -1, -1, 0};
644 if ( not (elm_type > 0 && elm_type <= 15
645 && (elementDim[elm_type] == dim || elementDim[elm_type] == (dim-1) ) ) )
653 for (
int i=1; i<nDofs[elm_type]; i++)
658 std::vector<int> elementDofs(10);
661 &(elementDofs[0]),&(elementDofs[1]),&(elementDofs[2]),
662 &(elementDofs[3]),&(elementDofs[4]),&(elementDofs[5]),
663 &(elementDofs[6]),&(elementDofs[7]),&(elementDofs[8]),
670 std::swap(elementDofs[2],elementDofs[3]);
673 std::swap(elementDofs[2],elementDofs[3]);
674 std::swap(elementDofs[6],elementDofs[7]);
677 std::swap(elementDofs[2],elementDofs[3]);
683 std::vector<unsigned int> vertices(nVertices[elm_type]);
685 for (
int i=0; i<nVertices[elm_type]; i++)
686 vertices[i] = renumber[elementDofs[i]];
689 if (elementDim[elm_type] == dim) {
724 if (insert_boundary_segments) {
745 std::array<FieldVector<double,dimWorld>, 3> v;
746 for (
int i=0; i<dimWorld; i++) {
747 v[0][i] = nodes[elementDofs[0]][i];
748 v[1][i] = nodes[elementDofs[2]][i];
749 v[2][i] = nodes[elementDofs[1]][i];
758 boundarysegment_insert(nodes, elementDofs, vertices);
762 DUNE_THROW(
Dune::IOError,
"GmshReader does not support using element-type " << elm_type <<
" for boundary segments");
772 if (elementDim[elm_type] == dim) {
773 element_index_to_physical_entity[element_count] = physical_entity;
776 boundary_id_to_physical_entity[boundary_element_count] = physical_entity;
777 boundary_element_count++;
793 insertBoundarySegments = 2,
802 static_cast<int>(a) |
static_cast<int>(b)
809 return static_cast<int>(a) &
static_cast<int>(b);
838 template<
typename Gr
idType>
862 const std::string &fileName,
863 std::vector<int>& boundarySegmentToPhysicalEntity,
864 std::vector<int>& elementToPhysicalEntity,
865 bool verbose,
bool insertBoundarySegments)
869 GmshReaderQuadraticBoundarySegment< Grid::dimension, Grid::dimensionworld >::registerFactory();
880 parser.read(fileName);
882 boundarySegmentToPhysicalEntity = std::move(parser.boundaryIdMap());
887 boundarySegmentToPhysicalEntity = {};
888 elementToPhysicalEntity = {};
913 static T &discarded(T &&value) {
return static_cast<T&
>(value); }
916 std::vector<int> *data_ =
nullptr;
917 DataArg(std::vector<int> &data) : data_(&data) {}
918 DataArg(
const decltype(std::ignore)&) {}
922 struct DataFlagArg : DataArg {
924 using DataArg::DataArg;
925 DataFlagArg(
bool flag) : flag_(flag) {}
929 typedef GridType Grid;
937 static std::unique_ptr<Grid>
read (
const std::string& fileName,
bool verbose =
true,
bool insertBoundarySegments=
true)
942 read(factory, fileName, verbose, insertBoundarySegments);
966 static std::unique_ptr<Grid>
read (
const std::string& fileName,
967 std::vector<int>& boundarySegmentToPhysicalEntity,
968 std::vector<int>& elementToPhysicalEntity,
969 bool verbose =
true,
bool insertBoundarySegments=
true)
975 factory, fileName, boundarySegmentToPhysicalEntity,
976 elementToPhysicalEntity, verbose, insertBoundarySegments
984 bool verbose =
true,
bool insertBoundarySegments=
true)
987 factory, fileName, discarded(std::vector<int>{}),
988 discarded(std::vector<int>{}), verbose, insertBoundarySegments
1017 const std::string &fileName,
1018 DataFlagArg boundarySegmentData,
1024 boundarySegmentData.data_
1025 ? *boundarySegmentData.data_ : discarded(std::vector<int>{}),
1027 ? *
elementData.data_ : discarded(std::vector<int>{}),
1029 boundarySegmentData.flag_ || boundarySegmentData.data_
1054 const std::string& fileName,
1055 std::vector<int>& boundarySegmentToPhysicalEntity,
1056 std::vector<int>& elementToPhysicalEntity,
1057 bool verbose,
bool insertBoundarySegments)
1060 factory, fileName, boundarySegmentToPhysicalEntity,
1061 elementToPhysicalEntity, verbose, insertBoundarySegments
1070 static constexpr Opts defaultOpts =
1071 Opts::verbose | Opts::insertBoundarySegments | Opts::readElementData | Opts::readBoundaryData;
1100 gridFactory_ = std::make_unique<Dune::GridFactory<Grid>>();
1101 readGridFile(fileName, *gridFactory_, options);
1114 readGridFile(fileName, factory, options);
1121 return elementIndexToGmshPhysicalEntity_;
1127 checkBoundaryData();
1128 return boundarySegmentIndexToGmshPhysicalEntity_;
1136 {
return hasElementData_ && !extractedElementData_; }
1143 {
return hasBoundaryData_ && !extractedBoundaryData_; }
1149 extractedElementData_ =
true;
1150 return std::move(elementIndexToGmshPhysicalEntity_);
1156 checkBoundaryData();
1157 extractedBoundaryData_ =
true;
1158 return std::move(boundarySegmentIndexToGmshPhysicalEntity_);
1166 "This GmshReader has been constructed with a Dune::GridFactory. "
1167 <<
"This grid factory has been filled with all information to create a grid. "
1168 <<
"Please use this factory to create the grid by calling factory.createGrid(). "
1169 <<
"Alternatively use the constructor without passing the factory in combination with this member function."
1172 return gridFactory_->createGrid();
1178 void checkElementData ()
const
1180 if (!hasElementData_)
1182 "This GmshReader has been constructed without the option 'readElementData'. "
1183 <<
"Please enable reading element data by passing the option 'Gmsh::ReaderOpts::readElementData' "
1184 <<
"to the constructor of this class."
1187 if (extractedElementData_)
1189 "The element data has already been extracted from this GmshReader "
1190 <<
"via a function call to reader.extractElementData(). Use the extracted data or "
1191 <<
"read the grid data from file again by constructing a new reader."
1195 void checkBoundaryData ()
const
1197 if (!hasBoundaryData_)
1199 "This GmshReader has been constructed without the option 'readBoundaryData'. "
1200 <<
"Please enable reading boundary data by passing the option 'Gmsh::ReaderOpts::readBoundaryData' "
1201 <<
"to the constructor of this class."
1204 if (extractedBoundaryData_)
1206 "The boundary data has already been extracted from this GmshReader "
1207 <<
"via a function call to reader.extractBoundaryData(). Use the extracted data or "
1208 <<
"read the grid data from file again by constructing a new reader."
1212 void readGridFile (
const std::string& fileName, GridFactory<Grid>& factory,
Gmsh::ReaderOptions options)
1214 const bool verbose = options & Opts::verbose;
1215 const bool insertBoundarySegments = options & Opts::insertBoundarySegments;
1216 const bool readBoundaryData = options & Opts::readBoundaryData;
1217 const bool readElementData = options & Opts::readElementData;
1220 factory, fileName, boundarySegmentIndexToGmshPhysicalEntity_,
1221 elementIndexToGmshPhysicalEntity_, verbose,
1222 readBoundaryData || insertBoundarySegments
1226 if (!readBoundaryData)
1227 boundarySegmentIndexToGmshPhysicalEntity_ = std::vector<int>{};
1228 if (!readElementData)
1229 elementIndexToGmshPhysicalEntity_ = std::vector<int>{};
1231 hasElementData_ = readElementData;
1232 hasBoundaryData_ = readBoundaryData;
1235 std::unique_ptr<Dune::GridFactory<Grid>> gridFactory_;
1237 std::vector<int> elementIndexToGmshPhysicalEntity_;
1238 std::vector<int> boundarySegmentIndexToGmshPhysicalEntity_;
1240 bool hasElementData_;
1241 bool hasBoundaryData_;
1244 bool extractedElementData_ =
false;
1245 bool extractedBoundaryData_ =
false;
Base class for grid boundary segments of arbitrary geometry.
int rank() const
Return rank, is between 0 and size()-1.
Definition: communication.hh:114
int barrier() const
Wait until all processes have arrived at this point in the program.
Definition: communication.hh:267
FieldTraits< value_type >::real_type two_norm() const
two norm sqrt(sum over squared values of entries)
Definition: densevector.hh:641
derived_type & axpy(const field_type &a, const DenseVector< Other > &x)
vector space axpy operation ( *this += a x )
Definition: densevector.hh:575
vector space out of a tensor product of fields.
Definition: fvector.hh:91
dimension independent parts for GmshReaderParser
Definition: gmshreader.hh:302
std::vector< std::string > & physicalEntityNames()
Returns the names of the gmsh physical entities (0-based index)
Definition: gmshreader.hh:373
void pass1HandleElement(FILE *file, const int elm_type, std::map< int, unsigned int > &renumber, const std::vector< GlobalVector > &nodes)
Process one element during the first pass through the list of all elements.
Definition: gmshreader.hh:545
std::vector< int > & elementIndexMap()
Returns a map for the gmsh physical entity id (1-based index) for each entity of codim 0.
Definition: gmshreader.hh:367
virtual void pass2HandleElement(FILE *file, const int elm_type, std::map< int, unsigned int > &renumber, const std::vector< GlobalVector > &nodes, const int physical_entity)
Process one element during the second pass through the list of all elements.
Definition: gmshreader.hh:633
Read Gmsh mesh file.
Definition: gmshreader.hh:840
static std::unique_ptr< Grid > read(const std::string &fileName, std::vector< int > &boundarySegmentToPhysicalEntity, std::vector< int > &elementToPhysicalEntity, bool verbose=true, bool insertBoundarySegments=true)
Read Gmsh file, possibly with data.
Definition: gmshreader.hh:966
const std::vector< int > & elementData() const
Access element data (maps element index to Gmsh physical entity)
Definition: gmshreader.hh:1118
static void read(Dune::GridFactory< Grid > &factory, const std::string &fileName, DataFlagArg boundarySegmentData, DataArg elementData, bool verbose=true)
read Gmsh file, possibly with data
Definition: gmshreader.hh:1016
static std::unique_ptr< Grid > read(const std::string &fileName, bool verbose=true, bool insertBoundarySegments=true)
Definition: gmshreader.hh:937
static void read(Dune::GridFactory< Grid > &factory, const std::string &fileName, bool verbose=true, bool insertBoundarySegments=true)
Definition: gmshreader.hh:983
std::unique_ptr< Grid > createGrid()
Create the grid.
Definition: gmshreader.hh:1162
std::vector< int > extractBoundaryData()
Erase boundary data from reader and return the data.
Definition: gmshreader.hh:1154
static void read(Dune::GridFactory< Grid > &factory, const std::string &fileName, std::vector< int > &boundarySegmentToPhysicalEntity, std::vector< int > &elementToPhysicalEntity, bool verbose, bool insertBoundarySegments)
Read Gmsh file, possibly with data.
Definition: gmshreader.hh:1053
bool hasElementData() const
If element data is available.
Definition: gmshreader.hh:1135
bool hasBoundaryData() const
If boundary data is available.
Definition: gmshreader.hh:1142
GmshReader(const std::string &fileName, GridFactory< Grid > &factory, Gmsh::ReaderOptions options=defaultOpts)
Construct a Gmsh reader object from a file name and a grid factory.
Definition: gmshreader.hh:1111
GmshReader(const std::string &fileName, Gmsh::ReaderOptions options=defaultOpts)
Construct a Gmsh reader object (alternatively use one of the static member functions)
Definition: gmshreader.hh:1097
std::vector< int > extractElementData()
Erase element data from reader and return the data.
Definition: gmshreader.hh:1146
const std::vector< int > & boundaryData() const
Access boundary data (maps boundary segment index to Gmsh physical entity)
Definition: gmshreader.hh:1125
Communication comm() const
Return the Communication used by the grid factory.
Definition: gridfactory.hh:258
Provide a generic factory class for unstructured grids.
Definition: gridfactory.hh:275
virtual void insertElement(const GeometryType &type, const std::vector< unsigned int > &vertices)
Insert an element into the coarse grid.
Definition: gridfactory.hh:307
virtual void insertVertex(const FieldVector< ctype, dimworld > &pos)
Insert a vertex into the coarse grid.
Definition: gridfactory.hh:296
virtual void insertBoundarySegment(const std::vector< unsigned int > &vertices)
insert a boundary segment
Definition: gridfactory.hh:325
virtual std::unique_ptr< GridType > createGrid()
Finalize grid creation and hand over the grid.
Definition: gridfactory.hh:333
Default exception class for I/O errors.
Definition: exceptions.hh:231
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:281
Provide a generic factory class for unstructured grids.
A few common exception classes.
int renumber(const Dune::GeometryType &t, int i)
renumber VTK <-> Dune
Definition: common.hh:186
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr GeometryType line
GeometryType representing a line.
Definition: type.hh:498
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:528
constexpr GeometryType triangle
GeometryType representing a triangle.
Definition: type.hh:504
constexpr GeometryType quadrilateral
GeometryType representing a quadrilateral (a square).
Definition: type.hh:510
constexpr GeometryType hexahedron
GeometryType representing a hexahedron.
Definition: type.hh:534
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:522
constexpr GeometryType tetrahedron
GeometryType representing a tetrahedron.
Definition: type.hh:516
ReaderOptions
Option for the Gmsh mesh file reader.
Definition: gmshreader.hh:791
static std::string formatString(const std::string &s, const T &... args)
Format values according to printf format string.
Definition: stringutility.hh:73
Dune namespace.
Definition: alignedallocator.hh:13
Base class for classes implementing geometries of boundary segments.
Definition: boundarysegment.hh:94
Options for read operation.
Definition: gmshreader.hh:39
GeometryOrder
Definition: gmshreader.hh:40
@ firstOrder
edges are straight lines.
Definition: gmshreader.hh:42
@ secondOrder
quadratic boundary approximation.
Definition: gmshreader.hh:44
A unique label for each type of element that can occur in a grid.