Skip to content

Instantly share code, notes, and snippets.

@grim-yawn
Last active March 26, 2017 15:51
Show Gist options
  • Save grim-yawn/1c8f0a6760dab5da0d3df030d0929ef4 to your computer and use it in GitHub Desktop.
Save grim-yawn/1c8f0a6760dab5da0d3df030d0929ef4 to your computer and use it in GitHub Desktop.
std::shared_ptr<MeshBase> MeshFactory::create_mesh(const json &mesh_properties)
{
const std::string mesh_type = mesh_properties["type"].get<std::string>();
const json geometry = mesh_properties["geometry"];
if (mesh_type == "cube") {
return create_cube_mesh(geometry);
}
// Некторое колличество else if (...)
else if (mesh_type == "cylinder") {
return create_cylinder_mesh(geometry);
}
else {
throw dealii::StandardExceptions::ExcNotImplemented(
std::string("Mesh type " + mesh_type + " doesn\'t exist.")
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment