2025-02-16 15:08:33 -05:00
|
|
|
#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
|
|
|
|
|
{
|
2025-02-24 12:39:21 -05:00
|
|
|
mesh_ = mfem::Mesh(mesh_stream, 1, 10);
|
2025-02-16 15:08:33 -05:00
|
|
|
loaded_ = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MeshIO::~MeshIO()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool MeshIO::IsLoaded() const
|
|
|
|
|
{
|
|
|
|
|
return loaded_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mfem::Mesh& MeshIO::GetMesh()
|
|
|
|
|
{
|
|
|
|
|
return mesh_;
|
|
|
|
|
}
|