X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFrontTrack%2FFrontTrack.cxx;h=5970f91553d115ce96fa7a1cf31c9d9519782937;hb=refs%2Ftags%2FV9_13_0b1;hp=98974c1c909fbb48d1667403037236fccb1a30d0;hpb=99a6f0d673c78cab31f4db05cd5be737dba58e2b;p=modules%2Fhomard.git diff --git a/src/FrontTrack/FrontTrack.cxx b/src/FrontTrack/FrontTrack.cxx old mode 100755 new mode 100644 index 98974c1c..5970f915 --- a/src/FrontTrack/FrontTrack.cxx +++ b/src/FrontTrack/FrontTrack.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.cxx // Created : Tue Apr 25 17:20:28 2017 // Author : Edward AGAPOV (eap) @@ -22,7 +40,7 @@ * \param [in] theInputMedFile - a MED file holding a mesh including nodes that will be * moved onto the geometry * \param [in] theOutputMedFile - a MED file to create, that will hold a modified mesh - * \param [in] theNodeFiles - an array of names of files describing groups of nodes that + * \param [in] theInputNodeFiles - an array of names of files describing groups of nodes that * will be moved onto the geometry * \param [in] theXaoFileName - a path to a file in XAO format holding the geometry and * the geometrical groups. @@ -31,43 +49,58 @@ */ void FrontTrack::track( const std::string& theInputMedFile, const std::string& theOutputMedFile, - const std::vector< std::string > & theNodeFiles, + const std::vector< std::string > & theInputNodeFiles, const std::string& theXaoFileName, bool theIsParallel ) { // check arguments +#ifdef _DEBUG_ + std::cout << "FrontTrack::track" << std::endl; +#endif - if ( theNodeFiles.empty() ) + if ( theInputNodeFiles.empty() ) return; #ifdef _DEBUG_ - std::cout << "Input MED file:" << theInputMedFile << std::endl; + std::cout << "Input MED file: " << theInputMedFile << std::endl; #endif if ( !FT_Utils::fileExists( theInputMedFile )) throw std::invalid_argument( "Input MED file does not exist: " + theInputMedFile ); #ifdef _DEBUG_ - std::cout << "Output MED file:" << theOutputMedFile << std::endl; + std::cout << "Output MED file: " << theOutputMedFile << std::endl; #endif if ( !FT_Utils::canWrite( theOutputMedFile )) throw std::invalid_argument( "Can't create the output MED file: " + theOutputMedFile ); - for ( size_t i = 0; i < theNodeFiles.size(); ++i ) + std::vector< std::string > theNodeFiles ; + for ( size_t i = 0; i < theInputNodeFiles.size(); ++i ) { #ifdef _DEBUG_ - std::cout << "Fichier" << theNodeFiles[i] << std::endl; + std::cout << "Initial input node file #"<1 + // keep only files with more than 1 line: + std::ifstream fichier(theInputNodeFiles[i].c_str()); + std::string s; + unsigned int nb_lines = 0; + while(std::getline(fichier,s)) ++nb_lines; +// std::cout << ". nb_lines: " << nb_lines << std::endl; + if ( nb_lines >= 2 ) { theNodeFiles.push_back( theInputNodeFiles[i] ); } } +#ifdef _DEBUG_ + for ( size_t i = 0; i < theNodeFiles.size(); ++i ) + { std::cout << "Valid input node file #"<( xao.getGeometry() ); if ( !xaoGeom || xaoGeom->getTopoDS_Shape().IsNull() ) throw std::invalid_argument( "Failed to get a BREP shape from the XAO input file" ); @@ -104,17 +140,22 @@ void FrontTrack::track( const std::string& theInputMedFile, #endif FT_NodeGroups nodeGroups; nodeGroups.read( theNodeFiles, &xao, nodeCoords ); - +#ifdef _DEBUG_ + std::cout << "Nombre de groupes : " << nodeGroups.nbOfGroups() << std::endl; +#endif // project nodes to the boundary shapes and change their coordinates #ifdef _DEBUG_ - std::cout << "Projection des noeuds" << std::endl; + std::cout << "Projection des noeuds, theIsParallel=" << theIsParallel << std::endl; #endif OSD_Parallel::For( 0, nodeGroups.nbOfGroups(), nodeGroups, !theIsParallel ); // save the modified mesh +#ifdef _DEBUG_ + std::cout << "Ecriture du maillage" << std::endl; +#endif const int erase = 2; mfMesh->write( theOutputMedFile, /*mode=*/erase );