27 "material_id_fieldname",
29 "The name of the field storing cell block/material ids. Only really used "
30 "for .vtu, .pvtu and .e files.");
32 "boundary_id_fieldname",
"",
"The name of the field storing boundary-ids");
39 filename_(params.GetParamValue<std::string>(
"filename")),
40 material_id_fieldname_(
41 params.GetParamValue<std::string>(
"material_id_fieldname")),
42 boundary_id_fieldname_(
43 params.GetParamValue<std::string>(
"boundary_id_fieldname"))
45 const std::filesystem::path filepath(
filename_);
46 const std::string extension = filepath.extension();
49std::unique_ptr<UnpartitionedMesh>
51 std::unique_ptr<UnpartitionedMesh> input_umesh)
54 input_umesh !=
nullptr,
55 "FromFileMeshGenerator can not be preceded by another"
56 " mesh generator because it cannot process an input mesh");
64 const std::filesystem::path filepath(
filename_);
65 const std::string extension = filepath.extension();
67 auto umesh = std::make_unique<UnpartitionedMesh>();
69 Chi::log.
Log() <<
"FromFileMeshGenerator: Generating UnpartitionedMesh";
71 if (extension ==
".obj") umesh->ReadFromWavefrontOBJ(options);
72 else if (extension ==
".msh")
73 umesh->ReadFromMsh(options);
74 else if (extension ==
".e")
75 umesh->ReadFromExodus(options);
76 else if (extension ==
".vtu")
77 umesh->ReadFromVTU(options);
78 else if (extension ==
".pvtu")
79 umesh->ReadFromPVTU(options);
80 else if (extension ==
".case")
81 umesh->ReadFromEnsightGold(options);
84 "\". Supported types limited to"
85 ".obj, .msh, .e, .vtu, .pvtu, .case.");
87 Chi::log.
Log() <<
"FromFileMeshGenerator: Done generating UnpartitionedMesh";
#define ChiInvalidArgumentIf(condition, message)
#define ChiInvalidArgument(message)
LogStream Log(LOG_LVL level=LOG_0)
std::unique_ptr< UnpartitionedMesh > GenerateUnpartitionedMesh(std::unique_ptr< UnpartitionedMesh > input_umesh) override
static chi::InputParameters GetInputParameters()
const std::string filename_
const std::string material_id_fieldname_
const std::string boundary_id_fieldname_
FromFileMeshGenerator(const chi::InputParameters ¶ms)
static chi::InputParameters GetInputParameters()
RegisterChiObject(chi_mesh, BooleanLogicalVolume)
std::string boundary_id_fieldname
std::string material_id_fieldname