#include "SMESH_Pattern.hxx"#include <BRepAdaptor_Curve.hxx>#include <BRepTools.hxx>#include <BRepTools_WireExplorer.hxx>#include <BRep_Tool.hxx>#include <Bnd_Box.hxx>#include <Bnd_Box2d.hxx>#include <ElSLib.hxx>#include <Extrema_ExtPC.hxx>#include <Extrema_GenExtPS.hxx>#include <Extrema_POnSurf.hxx>#include <Geom2d_Curve.hxx>#include <GeomAdaptor_Surface.hxx>#include <Geom_Curve.hxx>#include <Geom_Surface.hxx>#include <Precision.hxx>#include <TopAbs_ShapeEnum.hxx>#include <TopExp.hxx>#include <TopExp_Explorer.hxx>#include <TopLoc_Location.hxx>#include <TopTools_ListIteratorOfListOfShape.hxx>#include <TopoDS.hxx>#include <TopoDS_Edge.hxx>#include <TopoDS_Face.hxx>#include <TopoDS_Iterator.hxx>#include <TopoDS_Shell.hxx>#include <TopoDS_Vertex.hxx>#include <TopoDS_Wire.hxx>#include <gp_Ax2.hxx>#include <gp_Lin2d.hxx>#include <gp_Pnt2d.hxx>#include <gp_Trsf.hxx>#include <gp_XY.hxx>#include <gp_XYZ.hxx>#include "SMDS_EdgePosition.hxx"#include "SMDS_FacePosition.hxx"#include "SMDS_MeshElement.hxx"#include "SMDS_MeshFace.hxx"#include "SMDS_MeshNode.hxx"#include "SMDS_VolumeTool.hxx"#include "SMESHDS_Group.hxx"#include "SMESHDS_Mesh.hxx"#include "SMESHDS_SubMesh.hxx"#include "SMESH_Block.hxx"#include "SMESH_Mesh.hxx"#include "SMESH_MesherHelper.hxx"#include "SMESH_subMesh.hxx"#include <Basics_Utils.hxx>#include "utilities.h"
Go to the source code of this file.
Data Structures | |
| struct | TSizeCmp< T > |
| struct | TIsoNode |
Defines | |
| #define | smdsNode(elem) static_cast<const SMDS_MeshNode*>( elem ) |
Typedefs | |
| typedef map< const SMDS_MeshElement *, int > | TNodePointIDMap |
Enumerations | |
| enum | { CHECK_NEW_IN, CHECK_NEW_OK, FIX_OLD } |
Functions | |
| static int | getInt (const char *theSring) |
| static double | getDouble (const char *theSring) |
| static int | readLine (list< const char * > &theFields, const char *&theLineBeg, const bool theClearFields) |
| template<typename T > | |
| void | sortBySize (list< list< T > > &theListOfList) |
| static gp_XY | project (const SMDS_MeshNode *theNode, Extrema_GenExtPS &theProjectorPS) |
| template<class TFaceIterator > | |
| bool | areNodesBound (TFaceIterator &faceItr) |
| static bool | isMeshBoundToShape (SMESHDS_Mesh *aMeshDS, SMESHDS_SubMesh *aFaceSubmesh, const bool isMainShape) |
| static bool | intersectIsolines (const gp_XY &uv11, const gp_XY &uv12, const double r1, const gp_XY &uv21, const gp_XY &uv22, const double r2, gp_XY &resUV, bool &isDeformed) |
| static TIsoNode * | getNextNode (const TIsoNode *node, int dir) |
| static bool | checkQuads (const TIsoNode *node, gp_XY &newUV, const bool reversed, const int crit=FIX_OLD, double fixSize=0.) |
| static const gp_XYZ & | undefinedXYZ () |
| static bool | isDefined (const gp_XYZ &theXYZ) |
| static bool | clearSubMesh (SMESH_Mesh *theMesh, const TopoDS_Shape &theShape) |
| ostream & | operator<< (ostream &OS, const SMESH_Pattern::TPoint &p) |
| #define smdsNode | ( | elem | ) | static_cast<const SMDS_MeshNode*>( elem ) |
Definition at line 84 of file SMESH_Pattern.cxx.
Referenced by SMESH_Pattern.Apply(), areNodesBound(), clearSubMesh(), SMESH_Pattern.createElements(), SMESH_Pattern.Load(), and SMESH_Pattern.makePolyElements().
| typedef map< const SMDS_MeshElement*, int > TNodePointIDMap |
Definition at line 82 of file SMESH_Pattern.cxx.
| anonymous enum |
Definition at line 1205 of file SMESH_Pattern.cxx.
{ CHECK_NEW_IN, CHECK_NEW_OK, FIX_OLD };
| bool areNodesBound | ( | TFaceIterator & | faceItr | ) |
Definition at line 459 of file SMESH_Pattern.cxx.
References SMDS_MeshElement.getshapeId(), ex29_refine.node(), and smdsNode.
Referenced by isMeshBoundToShape().
{
while ( faceItr->more() )
{
SMDS_ElemIteratorPtr nIt = faceItr->next()->nodesIterator();
while ( nIt->more() )
{
const SMDS_MeshNode* node = smdsNode( nIt->next() );
if (node->getshapeId() <1) {
return false;
}
}
}
return true;
}
| static bool checkQuads | ( | const TIsoNode * | node, |
| gp_XY & | newUV, | ||
| const bool | reversed, | ||
| const int | crit = FIX_OLD, |
||
| double | fixSize = 0. |
||
| ) | [static] |
Definition at line 1207 of file SMESH_Pattern.cxx.
References CHECK_NEW_IN, CHECK_NEW_OK, SMESH_AdvancedEditor.dir1, SMESH_AdvancedEditor.dir2, FIX_OLD, getNextNode(), Max(), TIsoNode.myUV, PI, and XY().
Referenced by SMESH_Pattern.compUVByElasticIsolines().
{
gp_XY oldUV = node->myUV, oldUVFixed[4], oldUVImpr[4];
int nbOldFix = 0, nbOldImpr = 0;
double newBadRate = 0, oldBadRate = 0;
bool newIsOk = true, newIsIn = true, oldIsIn = true, oldIsOk = true;
int i, dir1 = 0, dir2 = 3;
for ( ; dir1 < 4; dir1++, dir2++ ) // loop on 4 quadrangles around <node>
{
if ( dir2 > 3 ) dir2 = 0;
TIsoNode* n[3];
// walking counterclockwise around a quad,
// nodes are in the order: node, n[0], n[1], n[2]
n[0] = getNextNode( node, dir1 );
n[2] = getNextNode( node, dir2 );
if ( !n[0] || !n[2] ) continue;
n[1] = getNextNode( n[0], dir2 );
if ( !n[1] ) n[1] = getNextNode( n[2], dir1 );
bool isTriangle = ( !n[1] );
if ( reversed ) {
TIsoNode* tmp = n[0]; n[0] = n[2]; n[2] = tmp;
}
// if ( fixSize != 0 ) {
// cout<<"NODE: "<<node->myInitUV.X()<<" "<<node->myInitUV.Y()<<" UV: "<<node->myUV.X()<<" "<<node->myUV.Y()<<endl;
// cout<<"\t0: "<<n[0]->myInitUV.X()<<" "<<n[0]->myInitUV.Y()<<" UV: "<<n[0]->myUV.X()<<" "<<n[0]->myUV.Y()<<endl;
// cout<<"\t1: "<<n[1]->myInitUV.X()<<" "<<n[1]->myInitUV.Y()<<" UV: "<<n[1]->myUV.X()<<" "<<n[1]->myUV.Y()<<endl;
// cout<<"\t2: "<<n[2]->myInitUV.X()<<" "<<n[2]->myInitUV.Y()<<" UV: "<<n[2]->myUV.X()<<" "<<n[2]->myUV.Y()<<endl;
// }
// check if a quadrangle is degenerated
if ( !isTriangle &&
((( n[0]->myUV - n[1]->myUV ).SquareModulus() <= DBL_MIN ) ||
(( n[2]->myUV - n[1]->myUV ).SquareModulus() <= DBL_MIN )))
isTriangle = true;
if ( isTriangle &&
( n[0]->myUV - n[2]->myUV ).SquareModulus() <= DBL_MIN )
continue;
// find min size of the diagonal node-n[1]
double minDiag = fixSize;
if ( minDiag == 0. ) {
double maxLen2 = ( node->myUV - n[0]->myUV ).SquareModulus();
if ( !isTriangle ) {
maxLen2 = Max( maxLen2, ( n[0]->myUV - n[1]->myUV ).SquareModulus() );
maxLen2 = Max( maxLen2, ( n[1]->myUV - n[2]->myUV ).SquareModulus() );
}
maxLen2 = Max( maxLen2, ( n[2]->myUV - node->myUV ).SquareModulus() );
minDiag = sqrt( maxLen2 ) * PI / 60.; // ~ maxLen * Sin( 3 deg )
}
// check if newUV is behind 3 dirs: n[0]-n[1], n[1]-n[2] and n[0]-n[2]
// ( behind means "to the right of")
// it is OK if
// 1. newUV is not behind 01 and 12 dirs
// 2. or newUV is not behind 02 dir and n[2] is convex
bool newIn[3] = { true, true, true }, newOk[3] = { true, true, true };
bool wasIn[3] = { true, true, true }, wasOk[3] = { true, true, true };
gp_Vec2d moveVec[3], outVec[3];
for ( i = isTriangle ? 2 : 0; i < 3; i++ )
{
bool isDiag = ( i == 2 );
if ( isDiag && newOk[0] && newOk[1] && !isTriangle )
break;
gp_Vec2d sideDir;
if ( isDiag )
sideDir = gp_Vec2d( n[0]->myUV, n[2]->myUV );
else
sideDir = gp_Vec2d( n[i]->myUV, n[i+1]->myUV );
gp_Vec2d outDir( sideDir.Y(), -sideDir.X() ); // to the right
outDir.Normalize();
gp_Vec2d newDir( n[i]->myUV, newUV );
gp_Vec2d oldDir( n[i]->myUV, oldUV );
outVec[i] = outDir;
if ( newIsOk ) newOk[i] = ( outDir * newDir < -minDiag );
if ( newIsIn ) newIn[i] = ( outDir * newDir < 0 );
if ( crit == FIX_OLD ) {
wasIn[i] = ( outDir * oldDir < 0 );
wasOk[i] = ( outDir * oldDir < -minDiag );
if ( !newOk[i] )
newBadRate += outDir * newDir;
if ( !wasOk[i] )
oldBadRate += outDir * oldDir;
// push node inside
if ( !wasOk[i] ) {
double oldDist = - outDir * oldDir;//, l2 = outDir * newDir;
// double r = ( l1 - minDiag ) / ( l1 + l2 );
// moveVec[i] = r * gp_Vec2d( node->myUV, newUV );
moveVec[i] = ( oldDist - minDiag ) * outDir;
}
}
}
// check if n[2] is convex
bool convex = true;
if ( !isTriangle )
convex = ( outVec[0] * gp_Vec2d( n[1]->myUV, n[2]->myUV ) < 0 );
bool isNewOk = ( newOk[0] && newOk[1] ) || ( newOk[2] && convex );
bool isNewIn = ( newIn[0] && newIn[1] ) || ( newIn[2] && convex );
newIsOk = ( newIsOk && isNewOk );
newIsIn = ( newIsIn && isNewIn );
if ( crit != FIX_OLD ) {
if ( crit == CHECK_NEW_OK && !newIsOk ) break;
if ( crit == CHECK_NEW_IN && !newIsIn ) break;
continue;
}
bool isOldIn = ( wasIn[0] && wasIn[1] ) || ( wasIn[2] && convex );
bool isOldOk = ( wasOk[0] && wasOk[1] ) || ( wasOk[2] && convex );
oldIsIn = ( oldIsIn && isOldIn );
oldIsOk = ( oldIsOk && isOldIn );
if ( !isOldIn ) { // node is outside a quadrangle
// move newUV inside a quadrangle
//MESSAGE("Quad "<< dir1 << " WAS IN " << wasIn[0]<<" "<<wasIn[1]<<" "<<wasIn[2]);
// node and newUV are outside: push newUV inside
gp_XY uv;
if ( convex || isTriangle ) {
uv = 0.5 * ( n[0]->myUV + n[2]->myUV ) - minDiag * outVec[2].XY();
}
else {
gp_Vec2d out = outVec[0].Normalized() + outVec[1].Normalized();
double outSize = out.Magnitude();
if ( outSize > DBL_MIN )
out /= outSize;
else
out.SetCoord( -outVec[1].Y(), outVec[1].X() );
uv = n[1]->myUV - minDiag * out.XY();
}
oldUVFixed[ nbOldFix++ ] = uv;
//node->myUV = newUV;
}
else if ( !isOldOk ) {
// try to fix old UV: move node inside as less as possible
//MESSAGE("Quad "<< dir1 << " old is BAD, try to fix old, minDiag: "<< minDiag);
gp_XY uv1, uv2 = node->myUV;
for ( i = isTriangle ? 2 : 0; i < 3; i++ ) // mark not computed vectors
if ( wasOk[i] )
moveVec[ i ].SetCoord( 1, 2e100); // not use this vector
while ( !isOldOk ) {
// find the least moveVec
int i, iMin = 4;
double minMove2 = 1e100;
for ( i = isTriangle ? 2 : 0; i < 3; i++ )
{
if ( moveVec[i].Coord(1) < 1e100 ) {
double move2 = moveVec[i].SquareMagnitude();
if ( move2 < minMove2 ) {
minMove2 = move2;
iMin = i;
}
}
}
if ( iMin == 4 ) {
break;
}
// move node to newUV
uv1 = node->myUV + moveVec[ iMin ].XY();
uv2 += moveVec[ iMin ].XY();
moveVec[ iMin ].SetCoord( 1, 2e100); // not use this vector more
// check if uv1 is ok
for ( i = isTriangle ? 2 : 0; i < 3; i++ )
wasOk[i] = ( outVec[i] * gp_Vec2d( n[i]->myUV, uv1 ) < -minDiag );
isOldOk = ( wasOk[0] && wasOk[1] ) || ( wasOk[2] && convex );
if ( isOldOk )
oldUVImpr[ nbOldImpr++ ] = uv1;
else {
// check if uv2 is ok
for ( i = isTriangle ? 2 : 0; i < 3; i++ )
wasOk[i] = ( outVec[i] * gp_Vec2d( n[i]->myUV, uv2 ) < -minDiag );
isOldOk = ( wasOk[0] && wasOk[1] ) || ( wasOk[2] && convex );
if ( isOldOk )
oldUVImpr[ nbOldImpr++ ] = uv2;
}
}
}
} // loop on 4 quadrangles around <node>
if ( crit == CHECK_NEW_OK )
return newIsOk;
if ( crit == CHECK_NEW_IN )
return newIsIn;
if ( newIsOk )
return true;
if ( oldIsOk )
newUV = oldUV;
else {
if ( oldIsIn && nbOldImpr ) {
// MESSAGE(" Try to improve UV, init: "<<node->myInitUV.X()<<" "<<node->myInitUV.Y()<<
// " uv: "<<oldUV.X()<<" "<<oldUV.Y() );
gp_XY uv = oldUVImpr[ 0 ];
for ( int i = 1; i < nbOldImpr; i++ )
uv += oldUVImpr[ i ];
uv /= nbOldImpr;
if ( checkQuads( node, uv, reversed, CHECK_NEW_OK )) {
newUV = uv;
return false;
}
else {
//MESSAGE(" Cant improve UV, uv: "<<uv.X()<<" "<<uv.Y());
}
}
if ( !oldIsIn && nbOldFix ) {
// MESSAGE(" Try to fix UV, init: "<<node->myInitUV.X()<<" "<<node->myInitUV.Y()<<
// " uv: "<<oldUV.X()<<" "<<oldUV.Y() );
gp_XY uv = oldUVFixed[ 0 ];
for ( int i = 1; i < nbOldFix; i++ )
uv += oldUVFixed[ i ];
uv /= nbOldFix;
if ( checkQuads( node, uv, reversed, CHECK_NEW_IN )) {
newUV = uv;
return false;
}
else {
//MESSAGE(" Cant fix UV, uv: "<<uv.X()<<" "<<uv.Y());
}
}
if ( newIsIn && oldIsIn )
newUV = ( newBadRate < oldBadRate ) ? newUV : oldUV;
else if ( !newIsIn )
newUV = oldUV;
}
return false;
}
| static bool clearSubMesh | ( | SMESH_Mesh * | theMesh, |
| const TopoDS_Shape & | theShape | ||
| ) | [static] |
Definition at line 3834 of file SMESH_Pattern.cxx.
References SMESH_subMesh.CLEAN, SMESHDS_Mesh.MeshElements(), SMESHDS_Mesh.RemoveElement(), SMESHDS_Mesh.RemoveNode(), and smdsNode.
Referenced by SMESH_Pattern.clearMesh().
{
bool removed = false;
if ( SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( theShape ))
{
removed = !aSubMesh->IsEmpty();
if ( removed )
aSubMesh->ComputeStateEngine( SMESH_subMesh::CLEAN );
}
else {
SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
if ( SMESHDS_SubMesh* aSubMeshDS = aMeshDS->MeshElements( theShape ))
{
SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
removed = eIt->more();
while ( eIt->more() )
aMeshDS->RemoveElement( eIt->next() );
SMDS_NodeIteratorPtr nIt = aSubMeshDS->GetNodes();
removed = removed || nIt->more();
while ( nIt->more() )
aMeshDS->RemoveNode( smdsNode( nIt->next() ));
}
}
return removed;
}
| static double getDouble | ( | const char * | theSring | ) | [static] |
Definition at line 119 of file SMESH_Pattern.cxx.
Referenced by SMESH_Pattern.Load().
{
char *ptr;
return strtod( theSring, &ptr );
}
| static int getInt | ( | const char * | theSring | ) | [static] |
Definition at line 99 of file SMESH_Pattern.cxx.
Referenced by SMESH_Pattern.Load().
{
if ( *theSring < '0' || *theSring > '9' )
return -1;
char *ptr;
int val = strtol( theSring, &ptr, 10 );
if ( ptr == theSring ||
// there must not be neither '.' nor ',' nor 'E' ...
(*ptr != ' ' && *ptr != '\n' && *ptr != '\0'))
return -1;
return val;
}
Definition at line 1189 of file SMESH_Pattern.cxx.
References ex10_grid4geometry.dir, TIsoNode.IsUVComputed(), and TIsoNode.myNext.
Referenced by checkQuads().
{
TIsoNode* n = node->myNext[ dir ];
if ( n && !n->IsUVComputed()/* && node->IsMovable()*/ ) {
n = 0;//node->myBndNodes[ dir ];
// MESSAGE("getNextNode: use bnd for node "<<
// node->myInitUV.X()<<" "<<node->myInitUV.Y());
}
return n;
}
| static bool intersectIsolines | ( | const gp_XY & | uv11, |
| const gp_XY & | uv12, | ||
| const double | r1, | ||
| const gp_XY & | uv21, | ||
| const gp_XY & | uv22, | ||
| const double | r2, | ||
| gp_XY & | resUV, | ||
| bool & | isDeformed | ||
| ) | [static] |
Definition at line 1011 of file SMESH_Pattern.cxx.
References MESSAGE, SMESH_test.r1, and SMESH_test.r2.
Referenced by SMESH_Pattern.compUVByIsoIntersection().
{
gp_XY loc1 = uv11 * ( 1 - r1 ) + uv12 * r1;
gp_XY loc2 = uv21 * ( 1 - r2 ) + uv22 * r2;
resUV = 0.5 * ( loc1 + loc2 );
//isDeformed = ( loc1 - loc2 ).SquareModulus() > 1e-8;
// SKL 26.07.2007 for NPAL16567
double d1 = (uv11-uv12).Modulus();
double d2 = (uv21-uv22).Modulus();
// double delta = d1*d2*1e-6; PAL17233
double delta = min( d1, d2 ) / 10.;
isDeformed = ( loc1 - loc2 ).SquareModulus() > delta * delta;
// double len1 = ( uv11 - uv12 ).Modulus();
// double len2 = ( uv21 - uv22 ).Modulus();
// resUV = loc1 * len2 / ( len1 + len2 ) + loc2 * len1 / ( len1 + len2 );
// return true;
// gp_Lin2d line1( uv11, uv12 - uv11 );
// gp_Lin2d line2( uv21, uv22 - uv21 );
// double angle = Abs( line1.Angle( line2 ) );
// IntAna2d_AnaIntersection inter;
// inter.Perform( line1.Normal( loc1 ), line2.Normal( loc2 ) );
// if ( inter.IsDone() && inter.NbPoints() == 1 )
// {
// gp_Pnt2d interUV = inter.Point(1).Value();
// resUV += interUV.XY();
// inter.Perform( line1, line2 );
// interUV = inter.Point(1).Value();
// resUV += interUV.XY();
// resUV /= 2.;
// }
if ( isDeformed ) {
MESSAGE("intersectIsolines(), d1 = " << d1 << ", d2 = " << d2 << ", delta = " << delta <<
", " << (loc1 - loc2).SquareModulus() << " > " << delta * delta);
}
return true;
}
| static bool isDefined | ( | const gp_XYZ & | theXYZ | ) | [static] |
Definition at line 2914 of file SMESH_Pattern.cxx.
Referenced by SMESH_Pattern.GetMappedPoints(), and SMESH_Pattern.mergePoints().
{
return theXYZ.X() < 1.e100;
}
| static bool isMeshBoundToShape | ( | SMESHDS_Mesh * | aMeshDS, |
| SMESHDS_SubMesh * | aFaceSubmesh, | ||
| const bool | isMainShape | ||
| ) | [static] |
Definition at line 482 of file SMESH_Pattern.cxx.
References areNodesBound(), SMDS_Mesh.facesIterator(), SMESHDS_SubMesh.GetElements(), SMESHDS_SubMesh.NbElements(), and SMDS_Mesh.NbFaces().
{
if ( isMainShape ) {
// check that all faces are bound to aFaceSubmesh
if ( aMeshDS->NbFaces() != aFaceSubmesh->NbElements() )
return false;
}
// check face nodes binding
if ( aFaceSubmesh ) {
SMDS_ElemIteratorPtr fIt = aFaceSubmesh->GetElements();
return areNodesBound( fIt );
}
SMDS_FaceIteratorPtr fIt = aMeshDS->facesIterator();
return areNodesBound( fIt );
}
| ostream& operator<< | ( | std::ostream & | OS, |
| const SMESH_Pattern::TPoint & | p | ||
| ) |
Definition at line 4765 of file SMESH_Pattern.cxx.
References SMESH_Pattern.TPoint.myInitU, SMESH_Pattern.TPoint.myInitUV, SMESH_Pattern.TPoint.myInitXYZ, SMESH_Pattern.TPoint.myU, SMESH_Pattern.TPoint.myUV, SMESH_Pattern.TPoint.myXYZ, and SMESH_AdvancedEditor.xyz.
{
gp_XYZ xyz = p.myInitXYZ;
OS << "\tinit( xyz( " << xyz.X() << " " << xyz.Y() << " " << xyz.Z() << " )";
gp_XY xy = p.myInitUV;
OS << " uv( " << xy.X() << " " << xy.Y() << " )";
double u = p.myInitU;
OS << " u( " << u << " )) " << &p << endl;
xyz = p.myXYZ.XYZ();
OS << "\t ( xyz( " << xyz.X() << " " << xyz.Y() << " " << xyz.Z() << " )";
xy = p.myUV;
OS << " uv( " << xy.X() << " " << xy.Y() << " )";
u = p.myU;
OS << " u( " << u << " ))" << endl;
return OS;
}
| static gp_XY project | ( | const SMDS_MeshNode * | theNode, |
| Extrema_GenExtPS & | theProjectorPS | ||
| ) | [static] |
Definition at line 436 of file SMESH_Pattern.cxx.
References MESSAGE, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
{
gp_Pnt P( theNode->X(), theNode->Y(), theNode->Z() );
theProjectorPS.Perform( P );
if ( !theProjectorPS.IsDone() ) {
MESSAGE( "SMESH_Pattern: point projection FAILED");
return gp_XY(0.,0.);
}
double u, v, minVal = DBL_MAX;
for ( int i = theProjectorPS.NbExt(); i > 0; i-- )
if ( theProjectorPS.Value( i ) < minVal ) {
minVal = theProjectorPS.Value( i );
theProjectorPS.Point( i ).Parameter( u, v );
}
return gp_XY( u, v );
}
| static int readLine | ( | list< const char * > & | theFields, |
| const char *& | theLineBeg, | ||
| const bool | theClearFields | ||
| ) | [static] |
Definition at line 131 of file SMESH_Pattern.cxx.
Referenced by SMESH_Pattern.Load().
{
if ( theClearFields )
theFields.clear();
// algo:
/* loop */
/* switch ( symbol ) { */
/* case white-space: */
/* look for a non-space symbol; */
/* case string-end: */
/* case line-end: */
/* exit; */
/* case comment beginning: */
/* skip all till a line-end; */
/* case a number */
/* put its position in theFields, skip till a white-space;*/
/* default: */
/* abort; */
/* till line-end */
int nbRead = 0;
bool stopReading = false;
do {
bool goOn = true;
bool isNumber = false;
switch ( *theLineBeg )
{
case ' ': // white space
case '\t': // tab
case 13: // ^M
break;
case '\n': // a line ends
stopReading = ( nbRead > 0 );
break;
case '!': // comment
do theLineBeg++;
while ( *theLineBeg != '\n' && *theLineBeg != '\0' );
goOn = false;
break;
case '\0': // file ends
return nbRead;
case '-': // real number
case '+':
case '.':
isNumber = true;
default: // data
isNumber = isNumber || ( *theLineBeg >= '0' && *theLineBeg <= '9' );
if ( isNumber ) {
theFields.push_back( theLineBeg );
nbRead++;
do theLineBeg++;
while (*theLineBeg != ' ' &&
*theLineBeg != '\n' &&
*theLineBeg != '\0');
goOn = false;
}
else
return 0; // incorrect file format
}
if ( goOn )
theLineBeg++;
} while ( !stopReading );
return nbRead;
}
| void sortBySize | ( | list< list< T > > & | theListOfList | ) |
Definition at line 423 of file SMESH_Pattern.cxx.
{
if ( theListOfList.size() > 2 ) {
TSizeCmp< T > SizeCmp;
theListOfList.sort( SizeCmp );
}
}
| static const gp_XYZ& undefinedXYZ | ( | ) | [static] |
Definition at line 2903 of file SMESH_Pattern.cxx.
References SMESH_AdvancedEditor.xyz.
Referenced by SMESH_Pattern.Apply(), and SMESH_Pattern.mergePoints().