Example #1
0
MeshLib::Mesh* readMeshFromFile(const std::string &file_name)
{
#ifdef USE_PETSC
    MeshLib::IO::NodePartitionedMeshReader read_pmesh(PETSC_COMM_WORLD);
    const std::string file_name_base = BaseLib::dropFileExtension(file_name);
    return read_pmesh.read(file_name_base);
#else
    if (BaseLib::hasFileExtension("msh", file_name))
    {
        MeshLib::IO::Legacy::MeshIO meshIO;
        return meshIO.loadMeshFromFile(file_name);
    }

    if (BaseLib::hasFileExtension("vtu", file_name))
        return MeshLib::IO::VtuInterface::readVTUFile(file_name);

    ERR("readMeshFromFile(): Unknown mesh file format in file %s.", file_name.c_str());
    return nullptr;
#endif
}
Example #2
0
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
}