feat(meshIO): added basic mesh reading implimentation
also added basic unit sphere mesh file which can be rescaled
This commit is contained in:
37
src/meshIO/private/meshIO.cpp
Normal file
37
src/meshIO/private/meshIO.cpp
Normal 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_;
|
||||
}
|
||||
Reference in New Issue
Block a user