#include "SMDS_MeshNode.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
-#include "SMESH_Algo.hxx"
+//#include "SMESH_Algo.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshEditor.hxx"
+#include "SMESH_ComputeError.hxx"
+#include "SMESH_Block.hxx"
#include <Adaptor2d_Curve2d.hxx>
#include <BRepAdaptor_CompCurve.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#ifdef _DEBUG_
if ( normPar > 1 || normPar < 0) {
dump("DEBUG");
- cout << "WRONG normPar: "<<normPar<< " prevNormPar="<<prevNormPar
- << " u="<<u << " myFirst[i]="<<myFirst[i]<< " myLast[i]="<<myLast[i]
- << " paramSize="<<paramSize<<endl;
+ MESSAGE ( "WRONG normPar: "<<normPar<< " prevNormPar="<<prevNormPar
+ << " u="<<u << " myFirst[i]="<<myFirst[i]<< " myLast[i]="<<myLast[i]
+ << " paramSize="<<paramSize );
}
#endif
u2node.insert( make_pair( normPar, node ));
#ifdef _DEBUG_
if ( EdgeIndex >= myEdge.size() ) {
dump("DEBUG");
- cout << "WRONg EdgeIndex " << 1+EdgeIndex
- << " myNormPar.size()="<<myNormPar.size()
- << " myNormPar["<< EdgeIndex<<"]="<< myNormPar[ EdgeIndex ]
- << " uvPt.normParam="<<uvPt.normParam <<endl;
+ MESSAGE ( "WRONg EdgeIndex " << 1+EdgeIndex
+ << " myNormPar.size()="<<myNormPar.size()
+ << " myNormPar["<< EdgeIndex<<"]="<< myNormPar[ EdgeIndex ]
+ << " uvPt.normParam="<<uvPt.normParam );
}
#endif
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
void StdMeshers_FaceSide::dump(const char* msg) const
{
#ifdef _DEBUG_
- cout << endl;
- if (msg) cout << msg <<endl;
- cout<<"NB EDGES: "<< myEdge.size() <<endl;
- cout << "nbPoints: "<<myNbPonits<<" vecSize: " << myPoints.size()<<" "<<myFalsePoints.size() <<endl;
+ if (msg) MESSAGE ( std::endl << msg );
+ MESSAGE_BEGIN ("NB EDGES: "<< myEdge.size() );
+ MESSAGE_ADD ( "nbPoints: "<<myNbPonits<<" vecSize: " << myPoints.size()<<" "<<myFalsePoints.size() );
for ( int i=0; i<myEdge.size(); ++i)
{
- cout << "\t"<<i+1<<endl;
- cout << "\tEDGE: ";
- if (myEdge[i].IsNull())
- cout<<"NULL"<<endl;
+ MESSAGE_ADD ( "\t"<<i+1 );
+ MESSAGE_ADD ( "\tEDGE: " );
+ if (myEdge[i].IsNull()) {
+ MESSAGE_ADD ( "NULL" );
+ }
else {
TopAbs::Print(myEdge[i].Orientation(),cout)<<" "<<myEdge[i].TShape().operator->()<<endl;
- cout << "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
- << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() << endl;
+ MESSAGE_ADD ( "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
+ << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() );
+ }
+ MESSAGE_ADD ( "\tC2d: ");
+
+ if (myC2d[i].IsNull()) {
+ MESSAGE_ADD ( "NULL" );
}
- cout << "\tC2d: ";
- if (myC2d[i].IsNull()) cout<<"NULL"<<endl;
- else cout << myC2d[i].operator->()<<endl;
- cout << "\tF: "<<myFirst[i]<< " L: "<< myLast[i]<<endl;
- cout << "\tnormPar: "<<myNormPar[i]<<endl;
+ else {
+ MESSAGE_ADD ( myC2d[i].operator->() );
+ }
+
+ MESSAGE_ADD ( "\tF: "<<myFirst[i]<< " L: "<< myLast[i] );
+ MESSAGE_END ( "\tnormPar: "<<myNormPar[i]<<endl );
}
#endif
}
}
return gp_Pnt2d( 1e+100, 1e+100 );
}
+
+//================================================================================
+/*!
+ * \brief Return wires of a face as StdMeshers_FaceSide's
+ */
+//================================================================================
+
+TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace,
+ SMESH_Mesh & theMesh,
+ const bool theIgnoreMediumNodes,
+ TError & theError)
+{
+ TopoDS_Vertex V1;
+ list< TopoDS_Edge > edges;
+ list< int > nbEdgesInWires;
+ int nbWires = SMESH_Block::GetOrderedEdges (theFace, V1, edges, nbEdgesInWires);
+
+ // split list of all edges into separate wires
+ TSideVector wires( nbWires );
+ list< int >::iterator nbE = nbEdgesInWires.begin();
+ list< TopoDS_Edge >::iterator from, to;
+ from = to = edges.begin();
+ for ( int iW = 0; iW < nbWires; ++iW )
+ {
+ std::advance( to, *nbE++ );
+ list< TopoDS_Edge > wireEdges( from, to );
+ // assure that there is a node on the first vertex
+ // as StdMeshers_FaceSide::GetUVPtStruct() requires
+ while ( !SMESH_Algo::VertexNode( TopExp::FirstVertex( wireEdges.front(), true),
+ theMesh.GetMeshDS()))
+ {
+ wireEdges.splice(wireEdges.end(), wireEdges,
+ wireEdges.begin(), ++wireEdges.begin());
+ if ( from->IsSame( wireEdges.front() )) {
+ theError = TError
+ ( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"No nodes on vertices"));
+ return TSideVector(0);
+ }
+ }
+ // find out side orientation, which is important if there are several wires (PAL19080)
+ bool isForward = true;
+ if ( nbWires > 1 ) {
+ TopExp_Explorer e( theFace, TopAbs_EDGE );
+ while ( ! e.Current().IsSame( wireEdges.back() ))
+ e.Next();
+ isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() );
+ }
+
+ StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
+ isForward, theIgnoreMediumNodes);
+ wires[ iW ] = StdMeshers_FaceSidePtr( wire );
+ from = to;
+ }
+ return wires;
+}
+