feat(meshView): simple mesh view utility added

This commit is contained in:
2025-03-03 09:51:16 -05:00
parent 3e69162ba0
commit ff2b850f90
4 changed files with 41 additions and 1 deletions

View File

@@ -12,3 +12,6 @@ subdir('src')
if get_option('build_tests') if get_option('build_tests')
subdir('tests') subdir('tests')
endif endif
# Build the utilities
subdir('utils')

View File

@@ -0,0 +1,28 @@
#include "mfem.hpp"
#include <string>
#include <iostream>
#include <cmath>
#include "probe.h"
#include "meshIO.h"
#include "config.h"
int main(int argv, char **argc) {
std::string CONFIG_FILENAME = std::string(getenv("MESON_SOURCE_ROOT")) + "/tests/testsConfig.yaml";
Config& config = Config::getInstance();
config.loadConfig(CONFIG_FILENAME);
// Read the mesh from the given mesh file
std::string meshFile = argc[1];
MeshIO meshIO(meshFile);
mfem::Mesh& mesh = meshIO.GetMesh();
mfem::H1_FECollection feCollection(1, mesh.SpaceDimension());
mfem::FiniteElementSpace feSpace(&mesh, &feCollection);
mfem::GridFunction u(&feSpace);
mfem::FunctionCoefficient initCoeff (
[&mesh](const mfem::Vector &x) {
return 1.0;
}
);
u.ProjectCoefficient(initCoeff);
Probe::glVisView(u, mesh, meshFile);
}

View File

@@ -0,0 +1,8 @@
sources = files('meshView.cpp')
meshView_exe = executable(
'meshView',
sources,
dependencies: [probe_dep, quill_dep, config_dep, mfem_dep, meshio_dep],
install_rpath: '@loader_path/../../src' # Ensure runtime library path resolves correctly
)

1
utils/meson.build Normal file
View File

@@ -0,0 +1 @@
subdir('meshView')