feat(meshIO): added basic mesh reading implimentation

also added basic unit sphere mesh file which can be rescaled
This commit is contained in:
2025-02-16 15:08:33 -05:00
parent 1713f6cb08
commit ea037cf996
6 changed files with 100 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
#include "mfem.hpp"
#include <string>
#include <iostream>
#include <fstream>
#include "meshIO.h"
MeshIO::MeshIO(const std::string &mesh_file)
{
mesh_file_ = mesh_file;
std::ifstream mesh_stream(mesh_file);
if (!mesh_stream)
{
throw std::runtime_error("Mesh file not found: " + mesh_file);
loaded_ = false;
}
else
{
mesh_ = mfem::Mesh(mesh_stream, 1, 2);
loaded_ = true;
}
}
MeshIO::~MeshIO()
{
}
bool MeshIO::IsLoaded() const
{
return loaded_;
}
mfem::Mesh& MeshIO::GetMesh()
{
return mesh_;
}