FEM: Draft architecture of post data extraction with histogram example

This commit is contained in:
Stefan Tröger
2025-03-31 20:11:09 +02:00
parent f92d33944b
commit 6e4fab1f50
51 changed files with 4228 additions and 14 deletions

View File

@@ -29,6 +29,10 @@
#include "FemPostObjectPy.h"
#include "FemPostObjectPy.cpp"
#ifdef BUILD_FEM_VTK_WRAPPER
#include <vtkDataSet.h>
#include <vtkPythonUtil.h>
#endif //BUILD_FEM_VTK
using namespace Fem;
@@ -55,6 +59,27 @@ PyObject* FemPostObjectPy::writeVTK(PyObject* args)
Py_Return;
}
PyObject* FemPostObjectPy::getDataSet(PyObject* args)
{
#ifdef BUILD_FEM_VTK_WRAPPER
// we take no arguments
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
// return python object for the dataset
auto dataset = getFemPostObjectPtr()->getDataSet();
if (dataset) {
PyObject* py_algorithm = vtkPythonUtil::GetObjectFromPointer(dataset);
return Py::new_reference_to(py_algorithm);
}
return Py_None;
#else
PyErr_SetString(PyExc_NotImplementedError, "VTK python wrapper not available");
Py_Return;
#endif
}
PyObject* FemPostObjectPy::getCustomAttributes(const char* /*attr*/) const
{
return nullptr;