#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"
#include "SMESH_Gen.hxx"
+#include "SMESH_Comment.hxx"
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Tool.hxx>
TAssocTool::InitVertexAssociation( _sourceHypo, shape2ShapeMap );
if ( !TAssocTool::FindSubShapeAssociation( tgtEdge, tgtMesh, srcEdge, srcMesh,
shape2ShapeMap) )
- RETURN_BAD_RESULT("FindSubShapeAssociation failed");
+ return error(dfltErr(),SMESH_Comment("Vertices association failed" ));
// ----------------------------------------------
// Assure that mesh on a source edge is computed
if ( tgtMesh == srcMesh ) {
if ( !TAssocTool::MakeComputed( srcSubMesh ))
- RETURN_BAD_RESULT("Impossible to compute the source mesh");
+ return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
}
else {
if ( !srcSubMesh->IsMeshComputed() )
- RETURN_BAD_RESULT("Source mesh is not computed");
+ return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed");
}
// -----------------------------------------------
// Find out nodes distribution on the source edge
vector< double > params; // sorted parameters of nodes on the source edge
if ( !SMESH_Algo::GetNodeParamOnEdge( srcMesh->GetMeshDS(), srcEdge, params ))
- RETURN_BAD_RESULT("Bad node params on the source edge");
+ return error(COMPERR_BAD_INPUT_MESH,"Bad node parameters on the source edge");
int i, nbNodes = params.size();
vector< const SMDS_MeshNode* > nodes ( nbNodes );
// Get the first and last nodes
- // -----------------------------
-
- SMESHDS_SubMesh* smV0 = meshDS->MeshElements( tgtV[0] );
- SMESHDS_SubMesh* smV1 = meshDS->MeshElements( tgtV[1] );
- if ( !smV0 || !smV1 )
- RETURN_BAD_RESULT("No submeshes on vertices");
-
- SMDS_NodeIteratorPtr nItV0 = smV0->GetNodes();
- SMDS_NodeIteratorPtr nItV1 = smV1->GetNodes();
- if ( !nItV0->more() || !nItV1->more() )
- RETURN_BAD_RESULT("No nodes on vertices");
-
- nodes.front() = nItV0->next();
- nodes.back() = nItV1->next();
+ nodes.front() = VertexNode( tgtV[0], meshDS );
+ nodes.back() = VertexNode( tgtV[1], meshDS );
+ if ( !nodes.front() || !nodes.back() )
+ return error(COMPERR_BAD_INPUT_MESH,"No node on vertex");
// Compute parameters on the target edge and make internal nodes
// --------------------------------------------------------------
// from the point at given parameter.
GCPnts_AbscissaPoint Discret( curveAdaptor, dl * lengths[ i-1 ], tgtParams[ i-1 ] );
if ( !Discret.IsDone() )
- RETURN_BAD_RESULT(" GCPnts_AbscissaPoint failed");
+ return error(dfltErr(),"GCPnts_AbscissaPoint failed");
tgtParams[ i ] = Discret.Parameter();
}
// make internal nodes
}
// enough nodes to make all edges quadratic?
if ( quadratic && ( nbNodes < 3 || ( nbNodes % 2 != 1 )))
- RETURN_BAD_RESULT("Wrong nb nodes to make quadratic mesh");
+ return error(COMPERR_BAD_INPUT_MESH,
+ SMESH_Comment("Wrong number of nodes to make quadratic mesh: ")<<nbNodes);
// Create edges
// -------------