0022362: EDF SMESH: Quadrangle (mapping) algorithm: enforced vertices

1)
+  StdMeshers_FaceSide(UVPtStructVec&     theSideNodes,
+                      const TopoDS_Face& theFace = TopoDS_Face());
2) + static creator methods New()
This commit is contained in:
eap 2013-12-17 08:19:07 +00:00
parent a623b301fb
commit 8b7bc04906
2 changed files with 87 additions and 8 deletions

View File

@ -251,7 +251,8 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const StdMeshers_FaceSide* theSide,
*/
//================================================================================
StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes)
StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes,
const TopoDS_Face& theFace)
{
myEdge.resize( 1 );
myEdgeID.resize( 1, -1 );
@ -272,12 +273,42 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes)
if ( !myPoints.empty() )
{
myPoints[0].normParam = 0;
gp_Pnt pPrev = SMESH_TNodeXYZ( myPoints[0].node );
for ( size_t i = 1; i < myPoints.size(); ++i )
if ( myPoints[0].node &&
myPoints.back().node &&
myPoints[ myNbPonits/2 ].node )
{
gp_Pnt p = SMESH_TNodeXYZ( myPoints[i].node );
myLength += ( myPoints[i].normParam = p.Distance( pPrev ));
pPrev = p;
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 += p.Distance( pPrev );
myPoints[i].normParam = myLength;
pPrev = p;
}
}
else if ( !theFace.IsNull() )
{
TopLoc_Location loc;
Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc );
gp_Pnt pPrev = surf->Value( myPoints[0].u, myPoints[0].v );
for ( size_t i = 1; i < myPoints.size(); ++i )
{
gp_Pnt p = surf->Value( myPoints[i].u, myPoints[i].v );
myLength += p.Distance( pPrev );
myPoints[i].normParam = myLength;
pPrev = p;
}
}
else
{
gp_Pnt2d pPrev = myPoints[0].UV();
for ( size_t i = 1; i < myPoints.size(); ++i )
{
gp_Pnt2d p = myPoints[i].UV();
myLength += p.Distance( pPrev );
myPoints[i].normParam = myLength;
pPrev = p;
}
}
if ( myLength > std::numeric_limits<double>::min() )
for ( size_t i = 1; i < myPoints.size(); ++i )
@ -926,6 +957,18 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const
return myC2d[ i ]->Value(par);
}
else if ( !myPoints.empty() )
{
int i = U * double( myPoints.size()-1 );
while ( i > 0 && myPoints[ i ].normParam > U )
--i;
while ( i+1 < myPoints.size() && myPoints[ i+1 ].normParam < U )
++i;
double r = (( U - myPoints[ i ].normParam ) /
( myPoints[ i+1 ].normParam - myPoints[ i ].normParam ));
return ( myPoints[ i ].UV() * ( 1 - r ) +
myPoints[ i+1 ].UV() * r );
}
return myDefaultPnt2d;
}

View File

@ -35,6 +35,7 @@
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <gp_Pnt2d.hxx>
@ -47,7 +48,6 @@ class SMESH_Mesh;
class Adaptor2d_Curve2d;
class Adaptor3d_Curve;
class BRepAdaptor_CompCurve;
class TopoDS_Face;
struct SMESH_ComputeError;
class StdMeshers_FaceSide;
@ -96,7 +96,43 @@ public:
/*!
* \brief Create a side from an UVPtStructVec
*/
StdMeshers_FaceSide(UVPtStructVec& theSideNodes);
StdMeshers_FaceSide(UVPtStructVec& theSideNodes,
const TopoDS_Face& theFace = TopoDS_Face());
// static "consrtuctors"
static StdMeshers_FaceSidePtr New(const TopoDS_Face& Face,
const TopoDS_Edge& Edge,
SMESH_Mesh* Mesh,
const bool IsForward,
const bool IgnoreMediumNodes,
SMESH_ProxyMesh::Ptr ProxyMesh = SMESH_ProxyMesh::Ptr())
{ return StdMeshers_FaceSidePtr
( new StdMeshers_FaceSide( Face,Edge,Mesh,IsForward,IgnoreMediumNodes,ProxyMesh ));
}
static StdMeshers_FaceSidePtr New (const TopoDS_Face& Face,
std::list<TopoDS_Edge>& Edges,
SMESH_Mesh* Mesh,
const bool IsForward,
const bool IgnoreMediumNodes,
SMESH_ProxyMesh::Ptr ProxyMesh = SMESH_ProxyMesh::Ptr())
{ return StdMeshers_FaceSidePtr
( new StdMeshers_FaceSide( Face,Edges,Mesh,IsForward,IgnoreMediumNodes,ProxyMesh ));
}
static StdMeshers_FaceSidePtr New (const StdMeshers_FaceSide* Side,
const SMDS_MeshNode* Node,
const gp_Pnt2d* Pnt2d1,
const gp_Pnt2d* Pnt2d2=NULL,
const Handle(Geom2d_Curve)& C2d=NULL,
const double UFirst=0.,
const double ULast=1.)
{ return StdMeshers_FaceSidePtr
( new StdMeshers_FaceSide( Side,Node,Pnt2d1,Pnt2d2,C2d,UFirst,ULast ));
}
static StdMeshers_FaceSidePtr New (UVPtStructVec& theSideNodes,
const TopoDS_Face& theFace = TopoDS_Face())
{
return StdMeshers_FaceSidePtr( new StdMeshers_FaceSide( theSideNodes, theFace ));
}
/*!
* \brief Return wires of a face as StdMeshers_FaceSide's