X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFrontTrack%2FFrontTrack_NodesOnGeom.cxx;h=ff164dc1f6b54ad6c9d28708935b1019dfae02b7;hb=refs%2Ftags%2FV9_13_0b1;hp=911358d5519401aa16178d1ae7570ced04dd95fa;hpb=df48f2f8906e43a3b04e5cfb4076647890a50b95;p=modules%2Fhomard.git diff --git a/src/FrontTrack/FrontTrack_NodesOnGeom.cxx b/src/FrontTrack/FrontTrack_NodesOnGeom.cxx old mode 100755 new mode 100644 index 911358d5..ff164dc1 --- a/src/FrontTrack/FrontTrack_NodesOnGeom.cxx +++ b/src/FrontTrack/FrontTrack_NodesOnGeom.cxx @@ -1,3 +1,21 @@ +// Copyright (C) 2017-2024 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) @@ -55,7 +73,7 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, // 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; @@ -63,6 +81,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, _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 @@ -77,7 +98,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, 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 ); @@ -149,6 +172,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, 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 ) @@ -219,7 +245,9 @@ void FT_NodesOnGeom::read( const std::string& theNodeFile, 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 ) @@ -240,6 +268,10 @@ void FT_NodesOnGeom::projectAndMove() 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; @@ -284,6 +316,9 @@ void FT_NodesOnGeom::projectAndMove() } } } +// +// 2.2. Avec une seule shape +// else // one shape { for ( size_t i = 0; i < _nodesOrder.size(); ++i ) @@ -293,8 +328,11 @@ void FT_NodesOnGeom::projectAndMove() 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 noued à bouger +// 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 ); @@ -302,8 +340,9 @@ void FT_NodesOnGeom::projectAndMove() notProjectedNodes.push_back( &nn ); } } - - +// +// 3. Bilan +// if ( !notProjectedNodes.empty() ) { // project nodes that are not projected by any of _projectors;