added public mesh_ptr() accessor. moved m->prepare_for_use() to filename constructor since it only happens there. for consistency, added theh length_multiplier scale modification to constructors

This commit is contained in:
lewisgross1296 2022-07-26 12:40:13 -05:00
parent 6a9be64d71
commit fd8a820708
2 changed files with 14 additions and 6 deletions

View file

@ -704,6 +704,8 @@ public:
double volume(int bin) const override;
libMesh::MeshBase * mesh_ptr() const;
private:
void initialize() override;
void set_mesh_pointer_from_filename(const std::string& filename);

View file

@ -2332,6 +2332,9 @@ LibMesh::LibMesh(libMesh::MeshBase & input_mesh, double length_multiplier)
{
m_ = &input_mesh;
set_length_multiplier(length_multiplier);
if (specified_length_multiplier_) {
libMesh::MeshTools::Modification::scale(*m_, length_multiplier_);
}
initialize();
}
@ -2340,6 +2343,10 @@ LibMesh::LibMesh(const std::string& filename, double length_multiplier)
{
set_mesh_pointer_from_filename(filename);
set_length_multiplier(length_multiplier);
if (specified_length_multiplier_) {
libMesh::MeshTools::Modification::scale(*m_, length_multiplier_);
}
m_->prepare_for_use();
initialize();
}
@ -2362,12 +2369,6 @@ void LibMesh::initialize()
// assuming that unstructured meshes used in OpenMC are 3D
n_dimension_ = 3;
if (specified_length_multiplier_) {
libMesh::MeshTools::Modification::scale(*m_, length_multiplier_);
}
m_->prepare_for_use();
// ensure that the loaded mesh is 3 dimensional
if (m_->mesh_dimension() != n_dimension_) {
fatal_error(fmt::format("Mesh file {} specified for use in an unstructured "
@ -2565,6 +2566,11 @@ double LibMesh::volume(int bin) const
return m_->elem_ref(bin).volume();
}
libMesh::MeshBase * mesh_ptr() const
{
return m_;
}
#endif // LIBMESH
//==============================================================================