Skip to content
Snippets Groups Projects
Commit ae887213 authored by Robert K's avatar Robert K
Browse files

[bugfix][GridPtr] Only instantiate GmshReader if dimworld <= 3.

parent 9d2bf027
No related branches found
No related tags found
1 merge request!363GridPtr: Only instantiate GmshReader if dimworld <= 3.
Pipeline #22820 passed
......@@ -131,6 +131,22 @@ namespace Dune
return ext;
}
// read gmsh file if dimension world <= 3
void readGmsh( const std::string& filename, std::integral_constant< bool, true > )
{
GridFactory<GridType> gridFactory;
std::vector<int> boundaryIDs;
std::vector<int> elementsIDs;
GmshReader<GridType>::read(gridFactory,filename,boundaryIDs,elementsIDs);
initialize( gridFactory, boundaryIDs,elementsIDs);
}
// if dimension world > 3 throw GridError
void readGmsh( const std::string& filename, std::integral_constant< bool, false > )
{
DUNE_THROW(GridError, "GmshReader requires dimWorld <= 3." );
}
public:
typedef MPIHelper::MPICommunicator MPICommunicatorType;
......@@ -158,11 +174,8 @@ namespace Dune
}
else if( fileExt == "msh" )
{
GridFactory<GridType> gridFactory;
std::vector<int> boundaryIDs;
std::vector<int> elementsIDs;
GmshReader<GridType>::read(gridFactory,filename,boundaryIDs,elementsIDs);
initialize( gridFactory, boundaryIDs,elementsIDs);
// Gmsh reader only compiles for dimworld <= 3
readGmsh( filename, std::integral_constant< bool, GridType::dimensionworld <= 3 > () );
}
else if( fileExt == "amc" || fileExt == "2d" || fileExt == "3d" )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment