+ choose consistent C++ and Python method names

+ fix typos
+fix whitespaces
This commit is contained in:
wmayer 2015-03-30 10:42:14 +02:00
parent a15ea4ca18
commit f84a150bfd
3 changed files with 30 additions and 36 deletions

View File

@ -391,7 +391,7 @@ void FemMesh::compute()
myGen->Compute(*myMesh, myMesh->GetShapeToMesh());
}
std::set<long> FemMesh::getSurfaceNodes(long ElemId,short FaceId, float Angle) const
std::set<long> FemMesh::getSurfaceNodes(long ElemId, short FaceId, float Angle) const
{
std::set<long> result;
//const SMESHDS_Mesh* data = myMesh->GetMeshDS();
@ -403,9 +403,8 @@ std::set<long> FemMesh::getSurfaceNodes(long ElemId,short FaceId, float Angle) c
return result;
}
std::set<long> FemMesh::getSurfaceNodes(const TopoDS_Face &face)const
std::set<long> FemMesh::getNodesByFace(const TopoDS_Face &face) const
{
std::set<long> result;
Bnd_Box box;
@ -414,18 +413,18 @@ std::set<long> 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<long> 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<long> FemMesh::getSurfaceNodes(const TopoDS_Edge &edge)const
std::set<long> FemMesh::getNodesByEdge(const TopoDS_Edge &edge) const
{
std::set<long> result;
Bnd_Box box;
@ -454,18 +451,18 @@ std::set<long> 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<long> 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;

View File

@ -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<long> getSurfaceNodes(long ElemId,short FaceId, float Angle=360)const;
/// retrivinb by face
std::set<long> getSurfaceNodes(const TopoDS_Face &face)const;
/// retrivinb by edge
std::set<long> getSurfaceNodes(const TopoDS_Edge &edge)const;
/// retrieving by region growing
std::set<long> getSurfaceNodes(long ElemId, short FaceId, float Angle=360)const;
/// retrieving by face
std::set<long> getNodesByFace(const TopoDS_Face &face)const;
/// retrieving by edge
std::set<long> 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;

View File

@ -546,8 +546,8 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
return 0;
}
Py::List ret;
std::set<long> resultSet = getFemMeshPtr()->getSurfaceNodes(fc);
for( std::set<long>::const_iterator it = resultSet.begin();it!=resultSet.end();++it)
std::set<long> resultSet = getFemMeshPtr()->getNodesByFace(fc);
for (std::set<long>::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<long> resultSet = getFemMeshPtr()->getSurfaceNodes(fc);
for( std::set<long>::const_iterator it = resultSet.begin();it!=resultSet.end();++it)
std::set<long> resultSet = getFemMeshPtr()->getNodesByEdge(fc);
for (std::set<long>::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;
}