From af6847bb5879e1e2cacac94dba1cefb6b6b4e140 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 20 Jul 2007 11:21:20 +0000 Subject: [PATCH] PAL15881 New NETGEN capability: is it possible to do only a 2D mesh ? move some code to StdMeshers_FaceSide::GetFaceWires() --- src/StdMeshers/StdMeshers_MEFISTO_2D.cxx | 56 +++++++++--------------- 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx index c919f6a1e..ebf208060 100644 --- a/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx +++ b/src/StdMeshers/StdMeshers_MEFISTO_2D.cxx @@ -187,42 +187,29 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh const bool ignoreMediumNodes = _quadraticMesh; // get all edges of a face - TopoDS_Vertex V1; - list< TopoDS_Edge > edges; - list< int > nbEdgesInWires; - int nbWires = SMESH_Block::GetOrderedEdges (F, V1, edges, nbEdgesInWires); - - if (_hypLengthFromEdges) _edgeLength = 0; - - // split list of all edges into separate wires - TWireVector 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 ) + TError problem; + TWireVector wires = StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, problem ); + int nbWires = wires.size(); + if ( problem && !problem->IsOK() ) return error( problem ); + if ( nbWires == 0 ) return error( "Problem in StdMeshers_FaceSide::GetFaceWires()"); + if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments + return error(COMPERR_BAD_INPUT_MESH, + SMESH_Comment("Too few segments: ")<NbSegments()); + + // compute average edge length + if (_hypLengthFromEdges) { - 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 ( !VertexNode( TopExp::FirstVertex( wireEdges.front(), true), - aMesh.GetMeshDS())) + _edgeLength = 0; + int nbSegments = 0; + for ( int iW = 0; iW < nbWires; ++iW ) { - wireEdges.splice(wireEdges.end(), wireEdges, - wireEdges.begin(), ++wireEdges.begin()); - if ( from->IsSame( wireEdges.front() )) - return error(COMPERR_BAD_INPUT_MESH,"No nodes on vertices"); + StdMeshers_FaceSidePtr wire = wires[ iW ]; + _edgeLength += wire->Length(); + nbSegments += wire->NbSegments(); } - StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( F, wireEdges, &aMesh, - true, ignoreMediumNodes); - wires[ iW ] = StdMeshers_FaceSidePtr( wire ); - if (_hypLengthFromEdges && wire->NbSegments() ) - _edgeLength += wire->Length() / wire->NbSegments(); - from = to; + if ( nbSegments ) + _edgeLength /= nbSegments; } - if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments - return error(COMPERR_BAD_INPUT_MESH, - SMESH_Comment("Too few segments")<NbSegments()); if (_hypLengthFromEdges && _edgeLength < DBL_MIN ) _edgeLength = 100; @@ -502,15 +489,12 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector & wires, VWMap.Clear(); // wires have no common vertices } - const bool isXConst = false; // meaningles here - const double constValue = 0; // meaningles here - int m = 0; list< int > mOnVertex; for ( int iW = 0; iW < wires.size(); ++iW ) { - const vector& uvPtVec = wires[ iW ]->GetUVPtStruct(isXConst,constValue); + const vector& uvPtVec = wires[ iW ]->GetUVPtStruct(); if ( uvPtVec.size() != wires[ iW ]->NbPoints() ) { return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Unexpected nb of points on wire ") << iW << uvPtVec.size()<<" != "<NbPoints()); -- 2.39.2