Skip to content

Commit

Permalink
[MOD] clean SMESH (FreeCAD#12754)
Browse files Browse the repository at this point in the history
removed old smesh CODE <7
  • Loading branch information
mosfet80 authored Mar 11, 2024
1 parent f6eead2 commit ab89eb0
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 136 deletions.
4 changes: 0 additions & 4 deletions src/Mod/Fem/App/AppFem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ PyMOD_INIT_FUNC(Fem)
// load dependent module
try {
Base::Interpreter().loadModule("Part");
// Base::Interpreter().loadModule("Mesh");
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_ImportError, e.what());
Expand Down Expand Up @@ -120,9 +119,6 @@ PyMOD_INIT_FUNC(Fem)
Fem::StdMeshers_SegmentAroundVertex_0DPy ::init_type(femModule);
Fem::StdMeshers_SegmentLengthAroundVertexPy ::init_type(femModule);
Fem::StdMeshers_StartEndLengthPy ::init_type(femModule);
#if SMESH_VERSION_MAJOR < 7
Fem::StdMeshers_TrianglePreferencePy ::init_type(femModule);
#endif
Fem::StdMeshers_Hexa_3DPy ::init_type(femModule);

// Add Types to module
Expand Down
52 changes: 0 additions & 52 deletions src/Mod/Fem/App/FemMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,6 @@ void FemMesh::setStandardHypotheses()
SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, getGenerator()));
hypoth.push_back(reg);

// SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, getGenerator()));
// static_cast<StdMeshers_StartEndLength*>(sel.get())->SetLength(1.0, true);
// hypoth.push_back(sel);

SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++, getGenerator()));
hypoth.push_back(qdp);

Expand Down Expand Up @@ -599,10 +595,6 @@ void FemMesh::setStandardHypotheses()
SMESH_HypothesisPtr reg(new StdMeshers_Regular_1D(hyp++, 1, getGenerator()));
hypoth.push_back(reg);

// SMESH_HypothesisPtr sel(new StdMeshers_StartEndLength(hyp++, 1, getGenerator()));
// static_cast<StdMeshers_StartEndLength*>(sel.get())->SetLength(1.0, true);
// hypoth.push_back(sel);

SMESH_HypothesisPtr qdp(new StdMeshers_QuadranglePreference(hyp++, 1, getGenerator()));
hypoth.push_back(qdp);

Expand All @@ -624,12 +616,6 @@ void FemMesh::compute()
std::set<long> FemMesh::getSurfaceNodes(long /*ElemId*/, short /*FaceId*/, float /*Angle*/) const
{
std::set<long> result;
// const SMESHDS_Mesh* data = myMesh->GetMeshDS();

// const SMDS_MeshElement * element = data->FindElement(ElemId);
// int fNbr = element->NbFaces();
// element->

return result;
}

Expand All @@ -640,7 +626,6 @@ std::list<std::pair<int, int>> FemMesh::getVolumesByFace(const TopoDS_Face& face
std::list<std::pair<int, int>> result;
std::set<int> nodes_on_face = getNodesByFace(face);

#if SMESH_VERSION_MAJOR >= 7
// SMDS_MeshVolume::facesIterator() is broken with SMESH7 as it is impossible
// to iterate volume faces
// In SMESH9 this function has been removed
Expand Down Expand Up @@ -697,36 +682,6 @@ std::list<std::pair<int, int>> FemMesh::getVolumesByFace(const TopoDS_Face& face
}
}
}
#else
SMDS_VolumeIteratorPtr vol_iter = myMesh->GetMeshDS()->volumesIterator();
while (vol_iter->more()) {
const SMDS_MeshVolume* vol = vol_iter->next();
SMDS_ElemIteratorPtr face_iter = vol->facesIterator();

while (face_iter && face_iter->more()) {
const SMDS_MeshFace* face = static_cast<const SMDS_MeshFace*>(face_iter->next());
int numNodes = face->NbNodes();

std::set<int> face_nodes;
for (int i = 0; i < numNodes; i++) {
face_nodes.insert(face->GetNode(i)->GetID());
}

std::vector<int> element_face_nodes;
std::set_intersection(nodes_on_face.begin(),
nodes_on_face.end(),
face_nodes.begin(),
face_nodes.end(),
std::back_insert_iterator<std::vector<int>>(element_face_nodes));

// For curved faces it is possible that a volume contributes more than one face
if (element_face_nodes.size() == static_cast<std::size_t>(numNodes)) {
result.emplace_back(vol->GetID(), face->GetID());
}
}
}
#endif

result.sort();
return result;
}
Expand Down Expand Up @@ -1955,13 +1910,6 @@ void FemMesh::read(const char* FileName)
// read brep-file
myMesh->STLToMesh(File.filePath().c_str());
}
#if SMESH_VERSION_MAJOR < 7
else if (File.hasExtension("dat")) {
// read brep-file
// vejmarie disable
myMesh->DATToMesh(File.filePath().c_str());
}
#endif
else if (File.hasExtension("bdf")) {
// read Nastran-file
readNastran(File.filePath());
Expand Down
70 changes: 0 additions & 70 deletions src/Mod/Fem/App/HypothesisPy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@
#include <StdMeshers_StartEndLength.hxx>
#include <StdMeshers_UseExisting_1D2D.hxx>
#include <sstream>
#if SMESH_VERSION_MAJOR < 7
#include <StdMeshers_TrianglePreference.hxx>
#endif
#endif

#include <Base/Interpreter.h>
Expand Down Expand Up @@ -170,55 +167,6 @@ Py::Object SMESH_HypothesisPy<T>::getLibName(const Py::Tuple& args)
}


#if SMESH_VERSION_MAJOR < 7 // -----------------------------------------------
template<class T>
Py::Object SMESH_HypothesisPy<T>::setParameters(const Py::Tuple& args)
{
std::string paramName = static_cast<std::string>(Py::String(args[0]));
hypothesis<SMESH_Hypothesis>()->SetParameters(paramName.c_str());
return Py::None();
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::getParameters(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), "")) {
throw Py::Exception();
}
return Py::String(hypothesis<SMESH_Hypothesis>()->GetParameters());
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::setLastParameters(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), "")) {
throw Py::Exception();
}
std::string paramName = static_cast<std::string>(Py::String(args[0]));
hypothesis<SMESH_Hypothesis>()->SetLastParameters(paramName.c_str());
return Py::None();
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::getLastParameters(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), "")) {
throw Py::Exception();
}
return Py::String(hypothesis<SMESH_Hypothesis>()->GetLastParameters());
}

template<class T>
Py::Object SMESH_HypothesisPy<T>::clearParameters(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), "")) {
throw Py::Exception();
}
hypothesis<SMESH_Hypothesis>()->ClearParameters();
return Py::None();
}
#endif // --------------------------------------------------------------------

template<class T>
Py::Object SMESH_HypothesisPy<T>::setParametersByMesh(const Py::Tuple& args)
{
Expand Down Expand Up @@ -764,24 +712,6 @@ StdMeshers_Hexa_3DPy::StdMeshers_Hexa_3DPy(int hypId, int studyId, SMESH_Gen* ge

StdMeshers_Hexa_3DPy::~StdMeshers_Hexa_3DPy() = default;

// ---------------------------------------------------------------------------

#if SMESH_VERSION_MAJOR < 7 // -----------------------------------------------
void StdMeshers_TrianglePreferencePy::init_type(PyObject* module)
{
behaviors().name("StdMeshers_TrianglePreference");
behaviors().doc("StdMeshers_TrianglePreference");
SMESH_HypothesisPyBase::init_type(module);
}

StdMeshers_TrianglePreferencePy::StdMeshers_TrianglePreferencePy(int hypId,
int studyId,
SMESH_Gen* gen)
: SMESH_HypothesisPyBase(new StdMeshers_TrianglePreference(hypId, studyId, gen))
{}

StdMeshers_TrianglePreferencePy::~StdMeshers_TrianglePreferencePy() = default;
#endif // --------------------------------------------------------------------

// ---------------------------------------------------------------------------

Expand Down
7 changes: 0 additions & 7 deletions src/Mod/Fem/App/HypothesisPy.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ class SMESH_HypothesisPy: public Py::PythonExtension<T>
Py::Object repr() override;
Py::Object getLibName(const Py::Tuple& args);
Py::Object setLibName(const Py::Tuple& args);
#if SMESH_VERSION_MAJOR < 7
Py::Object setParameters(const Py::Tuple& args);
Py::Object getParameters(const Py::Tuple& args);
Py::Object setLastParameters(const Py::Tuple& args);
Py::Object getLastParameters(const Py::Tuple& args);
Py::Object clearParameters(const Py::Tuple& args);
#endif
Py::Object isAuxiliary(const Py::Tuple& args);
Py::Object setParametersByMesh(const Py::Tuple& args);

Expand Down
3 changes: 0 additions & 3 deletions src/Mod/Fem/App/PreCompiled.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@
#include <StdMeshers_SegmentAroundVertex_0D.hxx>
#include <StdMeshers_SegmentLengthAroundVertex.hxx>
#include <StdMeshers_StartEndLength.hxx>
#if SMESH_VERSION_MAJOR < 7
#include <StdMeshers_TrianglePreference.hxx>
#endif
#include <StdMeshers_UseExisting_1D2D.hxx>

// Opencascade
Expand Down

0 comments on commit ab89eb0

Please sign in to comment.