+// Copyright (C) 2017-2023 CEA, EDF
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
// File : FrontTrack_NodesOnGeom.cxx
// Created : Tue Apr 25 20:48:23 2017
// Author : Edward AGAPOV (eap)
// get shape dimension by the file name
// -------------------------------------
- // hope the file name is something like "fr2D.**"
+ // hope the file name is something like "frnD.**" with n in (1,2)
int dimPos = theNodeFile.size() - 5;
if ( theNodeFile[ dimPos ] == '2' )
_shapeDim = 2;
_shapeDim = 1;
else
throw std::invalid_argument( "Can't define dimension by node file name " + theNodeFile );
+#ifdef _DEBUG_
+ std::cout << ". Dimension of the file " << theNodeFile << ": " << _shapeDim << std::endl;
+#endif
// -------------------------------------
// read geom group names; several lines
while ( ::fgets( line, maxLineLen, file )) // read a line
{
if ( ::feof( file ))
+ {
return; // no nodes in the file
+ }
// check if the line describes node ids in format 3I10 (e.g. " 120 1 43\n")
size_t lineLen = strlen( line );
for ( size_t i = 0; i < geomNames.size(); ++i )
{
std::string & groupName = geomNames[i];
+#ifdef _DEBUG_
+ std::cout << ". Group name: " << groupName << std::endl;
+#endif
// remove trailing white spaces
for ( int iC = groupName.size() - 1; iC >= 0; --iC )
void FT_NodesOnGeom::projectAndMove()
{
_OK = true;
-
+//
+// 1. Préalables
+//
// check if all the shapes are planar
bool isAllPlanar = true;
for ( size_t i = 0; i < _projectors.size() && isAllPlanar; ++i )
size_t iP, iProjector;
gp_Pnt newXyz;
+#ifdef _DEBUG_
+ std::cout << ".. _projectors.size() = " << _projectors.size() << std::endl;
+ std::cout << ".. _nodesOrder.size() = " << _nodesOrder.size() << std::endl;
+#endif
+//
+// 2. Calculs
+// 2.1. Avec plusieurs shapes
+//
if ( _projectors.size() > 1 )
{
// the nodes are to be projected onto several boundary shapes;
}
}
}
+//
+// 2.2. Avec une seule shape
+//
else // one shape
{
for ( size_t i = 0; i < _nodesOrder.size(); ++i )
gp_Pnt xyz = getPoint( nn._nodeToMove );
gp_Pnt xyz1 = getPoint( nn._neighborNodes[0] );
gp_Pnt xyz2 = getPoint( nn._neighborNodes[1] );
+
+// maxDist2 : le quart du carré de la distance entre les deux voisins du noeud à bouger
double maxDist2 = xyz1.SquareDistance( xyz2 ) / 4.;
+#ifdef _DEBUG_
+ std::cout << "\n.. maxDist2 = " << maxDist2 << " entre " << nn._neighborNodes[0] << " et " << nn._neighborNodes[1] << " - milieu " << nn._nodeToMove << " - d/2 = " << sqrt(maxDist2) << " - d = " << sqrt(xyz1.SquareDistance( xyz2 )) << std::endl;
+#endif
if ( _projectors[ 0 ].project( xyz, maxDist2, newXyz,
nn._params, nn._nearParams ))
moveNode( nn._nodeToMove, newXyz );
notProjectedNodes.push_back( &nn );
}
}
-
-
+//
+// 3. Bilan
+//
if ( !notProjectedNodes.empty() )
{
// project nodes that are not projected by any of _projectors;
for ( iP = 0; iP < projectors.size(); ++iP )
{
projectors[ iProjector ].prepareForProjection();
+ projectors[ iProjector ].tryWithoutPrevSolution( true );
if (( ok = projectors[ iProjector ].isOnShape( xyz1, tol2, nn._params, nn._nearParams )) &&
( ok = projectors[ iProjector ].isOnShape( xyz2, tol2, nn._params, nn._params )))