| 250 | } // namespace |
| 251 | |
| 252 | void seissol::initializer::initprocedure::initMesh(seissol::SeisSol& seissolInstance) { |
| 253 | SCOREP_USER_REGION("init_mesh", SCOREP_USER_REGION_TYPE_FUNCTION); |
| 254 | |
| 255 | const auto& seissolParams = seissolInstance.getSeisSolParameters(); |
| 256 | const auto commRank = seissol::MPI::mpi.rank(); |
| 257 | const auto commSize = seissol::MPI::mpi.size(); |
| 258 | |
| 259 | logInfo(commRank) << "Begin init mesh."; |
| 260 | |
| 261 | // Call the pre mesh initialization hook |
| 262 | seissol::Modules::callHook<ModuleHook::PreMesh>(); |
| 263 | |
| 264 | const auto meshFormat = seissolParams.mesh.meshFormat; |
| 265 | |
| 266 | logInfo(commRank) << "Mesh file:" << seissolParams.mesh.meshFileName; |
| 267 | |
| 268 | seissol::Stopwatch watch; |
| 269 | watch.start(); |
| 270 | |
| 271 | const std::string realMeshFileName = seissolParams.mesh.meshFileName; |
| 272 | [[maybe_unused]] bool addNC = true; |
| 273 | if (realMeshFileName.size() >= 3) { |
| 274 | const auto lastCharacters = realMeshFileName.substr(realMeshFileName.size() - 3); |
| 275 | addNC = lastCharacters != ".nc"; |
| 276 | } |
| 277 | |
| 278 | switch (meshFormat) { |
| 279 | case seissol::initializer::parameters::MeshFormat::Netcdf: { |
| 280 | #if USE_NETCDF |
| 281 | const auto realMeshFileNameNetcdf = [&]() { |
| 282 | if (addNC) { |
| 283 | const auto newRealMeshFileName = realMeshFileName + ".nc"; |
| 284 | logInfo(commRank) |
| 285 | << "The Netcdf file extension \".nc\" has been appended. Updated mesh file name:" |
| 286 | << newRealMeshFileName; |
| 287 | return newRealMeshFileName; |
| 288 | } else { |
| 289 | // (suppress preference for return move) |
| 290 | // NOLINTNEXTLINE |
| 291 | return realMeshFileName; |
| 292 | } |
| 293 | }(); |
| 294 | seissolInstance.setMeshReader( |
| 295 | new seissol::geometry::NetcdfReader(commRank, commSize, realMeshFileNameNetcdf.c_str())); |
| 296 | #else |
| 297 | logError() |
| 298 | << "Tried to load a Netcdf mesh, however this build of SeisSol is not linked to Netcdf."; |
| 299 | #endif |
| 300 | break; |
| 301 | } |
| 302 | case seissol::initializer::parameters::MeshFormat::PUML: { |
| 303 | readMeshPUML(seissolParams, seissolInstance); |
| 304 | break; |
| 305 | } |
| 306 | case seissol::initializer::parameters::MeshFormat::CubeGenerator: { |
| 307 | readCubeGenerator(seissolParams, seissolInstance); |
| 308 | break; |
| 309 | } |
nothing calls this directly
no test coverage detected