MeshLib::Mesh* readMeshFromFile(const std::string &file_name) { if (BaseLib::hasFileExtension("msh", file_name)) { Legacy::MeshIO meshIO; return meshIO.loadMeshFromFile(file_name); } if (BaseLib::hasFileExtension("vtu", file_name)) return BoostVtuInterface::readVTUFile(file_name); ERR("readMeshFromFile(): Unknown mesh file format in file %s.", file_name.c_str()); return nullptr; }
MeshLib::Mesh* readMeshFromFile(const std::string &file_name) { #ifdef USE_PETSC NodePartitionedMeshReader read_pmesh(PETSC_COMM_WORLD); std::string const file_name_base = boost::erase_last_copy(file_name, ".vtk"); return read_pmesh.read(file_name_base); #else if (BaseLib::hasFileExtension("msh", file_name)) { Legacy::MeshIO meshIO; return meshIO.loadMeshFromFile(file_name); } if (BaseLib::hasFileExtension("vtu", file_name)) return VtuInterface::readVTUFile(file_name); ERR("readMeshFromFile(): Unknown mesh file format in file %s.", file_name.c_str()); return nullptr; #endif }