diff --git a/src/Mod/Fem/App/FemMesh.cpp b/src/Mod/Fem/App/FemMesh.cpp index f4c693b50..1f9a2eb93 100755 --- a/src/Mod/Fem/App/FemMesh.cpp +++ b/src/Mod/Fem/App/FemMesh.cpp @@ -391,7 +391,7 @@ void FemMesh::compute() myGen->Compute(*myMesh, myMesh->GetShapeToMesh()); } -std::set FemMesh::getSurfaceNodes(long ElemId,short FaceId, float Angle) const +std::set FemMesh::getSurfaceNodes(long ElemId, short FaceId, float Angle) const { std::set result; //const SMESHDS_Mesh* data = myMesh->GetMeshDS(); @@ -403,9 +403,8 @@ std::set FemMesh::getSurfaceNodes(long ElemId,short FaceId, float Angle) c return result; } -std::set FemMesh::getSurfaceNodes(const TopoDS_Face &face)const +std::set FemMesh::getNodesByFace(const TopoDS_Face &face) const { - std::set result; Bnd_Box box; @@ -414,18 +413,18 @@ std::set FemMesh::getSurfaceNodes(const TopoDS_Face &face)const double limit = box.SquareExtent()/10000.0; box.Enlarge(limit); - // get the actuall transform of the FemMesh + // get the current transform of the FemMesh const Base::Matrix4D Mtrx(getTransform()); SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator(); while (aNodeIter->more()) { const SMDS_MeshNode* aNode = aNodeIter->next(); Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z()); - // Apply the matrix to hold the BoundBox in absolute space. + // Apply the matrix to hold the BoundBox in absolute space. vec = Mtrx * vec; - if(!box.IsOut(gp_Pnt(vec.x,vec.y,vec.z))){ - // create a Vertex + if (!box.IsOut(gp_Pnt(vec.x,vec.y,vec.z))) { + // create a vertex BRepBuilderAPI_MakeVertex aBuilder(gp_Pnt(vec.x,vec.y,vec.z)); TopoDS_Shape s = aBuilder.Vertex(); // measure distance @@ -433,19 +432,17 @@ std::set FemMesh::getSurfaceNodes(const TopoDS_Face &face)const measure.Perform(); if (!measure.IsDone() || measure.NbSolution() < 1) continue; - - if(measure.Value() < limit) - result.insert(aNode->GetID()); + if (measure.Value() < limit) + result.insert(aNode->GetID()); } } return result; } -std::set FemMesh::getSurfaceNodes(const TopoDS_Edge &edge)const +std::set FemMesh::getNodesByEdge(const TopoDS_Edge &edge) const { - std::set result; Bnd_Box box; @@ -454,18 +451,18 @@ std::set FemMesh::getSurfaceNodes(const TopoDS_Edge &edge)const double limit = box.SquareExtent()/10000.0; box.Enlarge(limit); - // get the actuall transform of the FemMesh + // get the current transform of the FemMesh const Base::Matrix4D Mtrx(getTransform()); SMDS_NodeIteratorPtr aNodeIter = myMesh->GetMeshDS()->nodesIterator(); while (aNodeIter->more()) { const SMDS_MeshNode* aNode = aNodeIter->next(); Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z()); - // Apply the matrix to hold the BoundBox in absolute space. + // Apply the matrix to hold the BoundBox in absolute space. vec = Mtrx * vec; - if(!box.IsOut(gp_Pnt(vec.x,vec.y,vec.z))){ - // create a Vertex + if (!box.IsOut(gp_Pnt(vec.x,vec.y,vec.z))) { + // create a vertex BRepBuilderAPI_MakeVertex aBuilder(gp_Pnt(vec.x,vec.y,vec.z)); TopoDS_Shape s = aBuilder.Vertex(); // measure distance @@ -473,18 +470,15 @@ std::set FemMesh::getSurfaceNodes(const TopoDS_Edge &edge)const measure.Perform(); if (!measure.IsDone() || measure.NbSolution() < 1) continue; - - if(measure.Value() < limit) - result.insert(aNode->GetID()); + if (measure.Value() < limit) + result.insert(aNode->GetID()); } } return result; } - - void FemMesh::readNastran(const std::string &Filename) { Base::TimeInfo Start; diff --git a/src/Mod/Fem/App/FemMesh.h b/src/Mod/Fem/App/FemMesh.h index 2942aa84d..b8421b1f0 100755 --- a/src/Mod/Fem/App/FemMesh.h +++ b/src/Mod/Fem/App/FemMesh.h @@ -82,14 +82,14 @@ public: virtual Data::Segment* getSubElement(const char* Type, unsigned long) const; //@} - /** @name search and retraivel */ + /** @name search and retrieval */ //@{ - /// retriving by region growing - std::set getSurfaceNodes(long ElemId,short FaceId, float Angle=360)const; - /// retrivinb by face - std::set getSurfaceNodes(const TopoDS_Face &face)const; - /// retrivinb by edge - std::set getSurfaceNodes(const TopoDS_Edge &edge)const; + /// retrieving by region growing + std::set getSurfaceNodes(long ElemId, short FaceId, float Angle=360)const; + /// retrieving by face + std::set getNodesByFace(const TopoDS_Face &face)const; + /// retrieving by edge + std::set getNodesByEdge(const TopoDS_Edge &edge)const; //@} /** @name Placement control */ @@ -111,7 +111,7 @@ public: //@} struct FemMeshInfo { - int numFaces; + int numFaces; int numNode; int numTria; int numQuad; diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp index b6a5c5d95..698d9f79d 100755 --- a/src/Mod/Fem/App/FemMeshPyImp.cpp +++ b/src/Mod/Fem/App/FemMeshPyImp.cpp @@ -546,8 +546,8 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args) return 0; } Py::List ret; - std::set resultSet = getFemMeshPtr()->getSurfaceNodes(fc); - for( std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) + std::set resultSet = getFemMeshPtr()->getNodesByFace(fc); + for (std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) ret.append(Py::Int(*it)); return Py::new_reference_to(ret); @@ -575,8 +575,8 @@ PyObject* FemMeshPy::getNodesByEdge(PyObject *args) return 0; } Py::List ret; - std::set resultSet = getFemMeshPtr()->getSurfaceNodes(fc); - for( std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) + std::set resultSet = getFemMeshPtr()->getNodesByEdge(fc); + for (std::set::const_iterator it = resultSet.begin();it!=resultSet.end();++it) ret.append(Py::Int(*it)); return Py::new_reference_to(ret); @@ -603,15 +603,15 @@ Py::Dict FemMeshPy::getNodes(void) const Base::Matrix4D Mtrx = getFemMeshPtr()->getTransform(); SMDS_NodeIteratorPtr aNodeIter = getFemMeshPtr()->getSMesh()->GetMeshDS()->nodesIterator(); - for (int i=0;aNodeIter->more();i++) { - const SMDS_MeshNode* aNode = aNodeIter->next(); + for (int i=0;aNodeIter->more();i++) { + const SMDS_MeshNode* aNode = aNodeIter->next(); Base::Vector3d vec(aNode->X(),aNode->Y(),aNode->Z()); // Apply the matrix to hold the BoundBox in absolute space. vec = Mtrx * vec; int id = aNode->GetID(); dict[Py::Int(id)] = Py::asObject(new Base::VectorPy( vec )); - } + } return dict; }