From: eap Date: Tue, 26 Nov 2013 13:30:21 +0000 (+0000) Subject: 22362: EDF SMESH: Quadrangle (mapping) algorithm: enforced vertices X-Git-Tag: V7_3_0a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=06236fdb5a448ef7546f484b59fffcf22878d7df;p=modules%2Fsmesh.git 22362: EDF SMESH: Quadrangle (mapping) algorithm: enforced vertices + * \brief Create a side from an UVPtStructVec + */ + StdMeshers_FaceSide(UVPtStructVec& theSideNodes); --- diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 3e1780299..4e5e0478a 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -51,6 +51,7 @@ #include #include +#include #include "utilities.h" @@ -245,9 +246,49 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const StdMeshers_FaceSide* theSide, } //================================================================================ -/*! - * \brief Return info on nodes on the side - * \retval UVPtStruct* - array of data structures +/* + * Create a side from an UVPtStructVec + */ +//================================================================================ + +StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes) +{ + myEdge.resize( 1 ); + myEdgeID.resize( 1, -1 ); + myC2d.resize( 1 ); + myC3dAdaptor.resize( 1 ); + myFirst.resize( 1, 0. ); + myLast.resize( 1, 1. ); + myNormPar.resize( 1, 1. ); + myIsUniform.resize( 1, 1 ); + myMissingVertexNodes = myIgnoreMediumNodes = false; + myDefaultPnt2d.SetCoord( 1e100, 1e100 ); + + myPoints = theSideNodes; + myNbPonits = myPoints.size(); + myNbSegments = myNbPonits + 1; + + myLength = 0; + if ( !myPoints.empty() ) + { + myPoints[0].normParam = 0; + gp_Pnt pPrev = SMESH_TNodeXYZ( myPoints[0].node ); + for ( size_t i = 1; i < myPoints.size(); ++i ) + { + gp_Pnt p = SMESH_TNodeXYZ( myPoints[i].node ); + myLength += ( myPoints[i].normParam = p.Distance( pPrev )); + pPrev = p; + } + if ( myLength > std::numeric_limits::min() ) + for ( size_t i = 1; i < myPoints.size(); ++i ) + myPoints[i].normParam /= myLength; + } + myEdgeLength.resize( 1, myLength ); +} + +//================================================================================ +/* + * Return info on nodes on the side */ //================================================================================ @@ -604,7 +645,8 @@ void StdMeshers_FaceSide::Reverse() int nbEdges = myEdge.size(); for ( int i = nbEdges-1; i >= 0; --i ) { std::swap( myFirst[i], myLast[i] ); - myEdge[i].Reverse(); + if ( !myEdge[i].IsNull() ) + myEdge[i].Reverse(); if ( i > 0 ) // at the first loop 1. is overwritten myNormPar[i] = 1 - myNormPar[i-1]; } @@ -622,10 +664,33 @@ void StdMeshers_FaceSide::Reverse() if ( nbEdges > 0 ) { myNormPar[nbEdges-1]=1.; - myPoints.clear(); - myFalsePoints.clear(); - for ( size_t i = 0; i < myEdge.size(); ++i ) - reverseProxySubmesh( myEdge[i] ); + if ( !myEdge[0].IsNull() ) + { + for ( size_t i = 0; i < myEdge.size(); ++i ) + reverseProxySubmesh( myEdge[i] ); + myPoints.clear(); + myFalsePoints.clear(); + } + else + { + for ( size_t i = 0; i < myPoints.size(); ++i ) + { + UVPtStruct & uvPt = myPoints[i]; + uvPt.normParam = 1 - uvPt.normParam; + uvPt.x = 1 - uvPt.x; + uvPt.y = 1 - uvPt.y; + } + reverse( myPoints ); + + for ( size_t i = 0; i < myFalsePoints.size(); ++i ) + { + UVPtStruct & uvPt = myFalsePoints[i]; + uvPt.normParam = 1 - uvPt.normParam; + uvPt.x = 1 - uvPt.x; + uvPt.y = 1 - uvPt.y; + } + reverse( myFalsePoints ); + } } for ( size_t i = 0; i < myEdge.size(); ++i ) { diff --git a/src/StdMeshers/StdMeshers_FaceSide.hxx b/src/StdMeshers/StdMeshers_FaceSide.hxx index 2a4e1786f..4f714d4bf 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.hxx +++ b/src/StdMeshers/StdMeshers_FaceSide.hxx @@ -93,6 +93,11 @@ public: const Handle(Geom2d_Curve)& theC2d=NULL, const double theUFirst=0., const double theULast=1.); + /*! + * \brief Create a side from an UVPtStructVec + */ + StdMeshers_FaceSide(UVPtStructVec& theSideNodes); + /*! * \brief Return wires of a face as StdMeshers_FaceSide's */