Skip to content
Snippets Groups Projects
Commit 5e48e0a3 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

automatically detect Gmsh API version + add support for version 4.9.0

parent 0d371042
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,13 @@ else() ...@@ -52,6 +52,13 @@ else()
link_directories(${GMSH_DIR}/lib) link_directories(${GMSH_DIR}/lib)
endif() endif()
endif() endif()
if(GMSH_INC)
file(STRINGS ${GMSH_INC}/gmsh.h GMSH_API_VERSION_STR REGEX "#define GMSH_API_VERSION .*")
string(REGEX MATCH "[\.0-9]+" GMSH_API_VERSION "${GMSH_API_VERSION_STR}")
if(GMSH_API_VERSION VERSION_LESS "4.9.0")
add_definitions(-DUSE_INITIAL_4_8_4_API)
endif()
endif()
find_package(SILO REQUIRED) find_package(SILO REQUIRED)
if (SILO_FOUND) if (SILO_FOUND)
...@@ -262,11 +269,6 @@ if (OPT_DEBUG_PRINT) ...@@ -262,11 +269,6 @@ if (OPT_DEBUG_PRINT)
endif() endif()
###################################################################### ######################################################################
## Handle 4.8.4 API breakage introduced in commit 91312e67
option(OPT_GMSH_484_BEFORE_SPLIT "Use old version of getKeysForElements() (see 91312e67)" OFF)
if (OPT_GMSH_484_BEFORE_SPLIT)
add_definitions(-DUSE_INITIAL_4_8_4_API)
endif()
option(OPT_DISABLE_TEXTURE_CACHE "On ROCm 4.1 texture stuff is broken, disable it" OFF) option(OPT_DISABLE_TEXTURE_CACHE "On ROCm 4.1 texture stuff is broken, disable it" OFF)
if (OPT_DISABLE_TEXTURE_CACHE) if (OPT_DISABLE_TEXTURE_CACHE)
......
...@@ -121,8 +121,13 @@ physical_elements_factory::physical_elements_factory(const entity_params& ep) ...@@ -121,8 +121,13 @@ physical_elements_factory::physical_elements_factory(const entity_params& ep)
gmm::getElementsByType(elemType, cellTags, cellNodesTags, tag); gmm::getElementsByType(elemType, cellTags, cellNodesTags, tag);
gmm::getIntegrationPoints(elemType, quadrature_name(2*approx_order), cellIps, cellIws); gmm::getIntegrationPoints(elemType, quadrature_name(2*approx_order), cellIps, cellIws);
gmm::getJacobians(elemType, cellIps, cellJacs, cellDets, cellPpts, tag); gmm::getJacobians(elemType, cellIps, cellJacs, cellDets, cellPpts, tag);
#ifdef USE_INITIAL_4_8_4_API
gmm::getBasisFunctionsOrientationForElements(elemType, basis_func_name(approx_order), gmm::getBasisFunctionsOrientationForElements(elemType, basis_func_name(approx_order),
cellOrientations, tag); cellOrientations, tag);
#else
gmm::getBasisFunctionsOrientation(elemType, basis_func_name(approx_order),
cellOrientations, tag);
#endif
assert(cellOrientations.size() == cellTags.size()); assert(cellOrientations.size() == cellTags.size());
gmm::getBarycenters(elemType, tag, false, false, barycenters); gmm::getBarycenters(elemType, tag, false, false, barycenters);
...@@ -132,12 +137,12 @@ physical_elements_factory::physical_elements_factory(const entity_params& ep) ...@@ -132,12 +137,12 @@ physical_elements_factory::physical_elements_factory(const entity_params& ep)
gmm::getKeysForElements(elemType, basis_func_name(approx_order), gmm::getKeysForElements(elemType, basis_func_name(approx_order),
keypairs, coord, tag, false); keypairs, coord, tag, false);
#else #else
gmm::getKeysForElements(elemType, basis_func_name(approx_order), gmm::getKeys(elemType, basis_func_name(approx_order),
tagKeys, entityKeys, coord, tag, false); tagKeys, entityKeys, coord, tag, false);
assert(tagKeys.size() == entityKeys.size()); assert(tagKeys.size() == entityKeys.size());
#endif #endif
keys_per_elem = gmm::getNumberOfKeysForElements(elemType, basis_func_name(approx_order)); keys_per_elem = gmm::getNumberOfKeys(elemType, basis_func_name(approx_order));
#ifdef USE_INITIAL_4_8_4_API #ifdef USE_INITIAL_4_8_4_API
assert(keys_per_elem*cellTags.size() == keypairs.size()); assert(keys_per_elem*cellTags.size() == keypairs.size());
#else #else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment