FEM: implement interface of ComplexGeoData

This commit is contained in:
wmayer
2023-03-03 12:05:54 +01:00
committed by wwmayer
parent 6e7e94e342
commit afd59cbe82
4 changed files with 27 additions and 3 deletions

View File

@@ -2596,6 +2596,23 @@ Data::Segment* FemMesh::getSubElement(const char* /*Type*/, unsigned long /*n*/)
return nullptr;
}
void FemMesh::getPoints(std::vector<Base::Vector3d> &Points,
std::vector<Base::Vector3d> & /*Normals*/,
double /*Accuracy*/, uint16_t /*flags*/) const
{
const SMESHDS_Mesh* data = getSMesh()->GetMeshDS();
std::vector<Base::Vector3d> nodes;
nodes.reserve(data->NbNodes());
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
for (;aNodeIter->more();) {
const SMDS_MeshNode* aNode = aNodeIter->next();
nodes.emplace_back(aNode->X(), aNode->Y(), aNode->Z());
}
Points = transformPointsToOutside(nodes);
}
struct Fem::FemMesh::FemMeshInfo FemMesh::getInfo() const{
struct FemMeshInfo rtrn;

View File

@@ -85,6 +85,10 @@ public:
unsigned long countSubElements(const char* Type) const override;
/// get the subelement by type and number
Data::Segment* getSubElement(const char* Type, unsigned long) const override;
/** Get points from object with given accuracy */
void getPoints(std::vector<Base::Vector3d> &Points,
std::vector<Base::Vector3d> &Normals,
double Accuracy, uint16_t flags=0) const override;
//@}
/** @name search and retrieval */

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#include <App/DocumentObjectPy.h>
#include <App/GeoFeaturePy.h>
#include <App/FeaturePythonPyImp.h>
#include <Base/Placement.h>
@@ -56,7 +56,7 @@ PyObject *FemMeshObject::getPyObject()
{
if (PythonObject.is(Py::_None())){
// ref counter is set to 1
PythonObject = Py::Object(new DocumentObjectPy(this), true);
PythonObject = Py::asObject(new GeoFeaturePy(this));
}
return Py::new_reference_to(PythonObject);
}
@@ -84,7 +84,7 @@ template<> const char* Fem::FemMeshObjectPython::getViewProviderName() const {
template<> PyObject* Fem::FemMeshObjectPython::getPyObject() {
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new App::FeaturePythonPyT<App::DocumentObjectPy>(this), true);
PythonObject = Py::asObject(new App::FeaturePythonPyT<App::GeoFeaturePy>(this));
}
return Py::new_reference_to(PythonObject);
}

View File

@@ -51,6 +51,9 @@ public:
}
short mustExecute() const override;
PyObject *getPyObject() override;
const App::PropertyComplexGeoData* getPropertyOfGeometry() const override {
return &FemMesh;
}
PropertyFemMesh FemMesh;