feat(probe): vector overload for glVisView

glVisView can now also be called with a vector and finite element space as opposed to just a grid function and mesh
This commit is contained in:
2025-02-28 09:47:15 -05:00
parent 974842c633
commit 83ee05272c
3 changed files with 23 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ libprobe = static_library('probe',
include_directories: include_directories('public'),
cpp_args: ['-fvisibility=default'],
install : true,
dependencies: [config_dep, mfem_dep, quill_dep]
dependencies: [config_dep, mfem_dep, quill_dep, warning_control_dep]
)
probe_dep = declare_dependency(

View File

@@ -15,6 +15,8 @@
#include "config.h"
#include "probe.h"
#include "warning_control.h"
namespace Probe {
@@ -43,6 +45,15 @@ void glVisView(mfem::GridFunction& u, mfem::Mesh& mesh,
}
}
void glVisView(mfem::Vector &vec, mfem::FiniteElementSpace &fes, const std::string &windowTitle) {
mfem::GridFunction gf(&fes);
DEPRECATION_WARNING_OFF
gf.SetData(vec);
DEPRECATION_WARNING_ON
glVisView(gf, *fes.GetMesh(), windowTitle);
}
double getMeshRadius(mfem::Mesh& mesh) {
int numVertices = mesh.GetNV(); // Number of vertices
double maxRadius = 0.0;

View File

@@ -32,13 +32,21 @@ namespace Probe {
* @param windowTitle The title of the visualization window.
*/
void glVisView(mfem::GridFunction& u, mfem::Mesh& mesh,
const std::string& windowTitle = "solution");
const std::string& windowTitle = "grid function");
/**
* @brief Visualize a vector using GLVis.
* @param vec The vector to visualize.
* @param mesh The mesh associated with the vector.
* @param windowTitle The title of the visualization window.
*/
void glVisView(mfem::Vector &vec, mfem::FiniteElementSpace &fes,
const std::string &windowTitle = "vector");
double getMeshRadius(mfem::Mesh& mesh);
std::vector<double> getRaySolution(mfem::GridFunction& u, mfem::Mesh& mesh,
const std::vector<double>& rayDirection,
int numSamples);
const std::vector<double>& rayDirection, int numSamples);
/**
* @brief Class to manage logging operations.