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

[!363] GridPtr: Only instantiate GmshReader if dimworld <= 3.

Merge branch 'bugfix/gridptr-gmshreader' into 'master'

ref:core/dune-grid This fixes a compile error for tests in the dune-spgrid
module.

See merge request [!363]

  [!363]: gitlab.dune-project.org/core/dune-grid/merge_requests/363
parents 9d2bf027 ae887213
Branches
Tags
1 merge request!363GridPtr: Only instantiate GmshReader if dimworld <= 3.
Pipeline #22821 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