]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESH/SMESH_Homard.hxx
Salome HOME
416fe39371d591592719e726c456684b777f71c4
[modules/smesh.git] / src / SMESH / SMESH_Homard.hxx
1 //  HOMARD HOMARD : implementation of HOMARD idl descriptions
2 //
3 // Copyright (C) 2011-2021  CEA/DEN, EDF R&D
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 //  File   : HOMARD.hxx
22 //  Author : Gerald NICOLAS, EDF
23 //  Module : HOMARD
24
25 #ifndef _SMESH_HOMARD_ADAPT_HXX_
26 #define _SMESH_HOMARD_ADAPT_HXX_
27
28 // C'est le ASSERT de SALOMELocalTrace/utilities.h dans KERNEL
29 #ifndef VERIFICATION
30 #define VERIFICATION(condition) \
31         if (!(condition)){INTERRUPTION("CONDITION "<<#condition<<" NOT VERIFIED")}
32 #endif /* VERIFICATION */
33
34 #ifdef WIN32
35   #if defined HOMARDIMPL_EXPORTS || defined HOMARDImpl_EXPORTS
36     #define HOMARDIMPL_EXPORT __declspec( dllexport )
37   #else
38     #define HOMARDIMPL_EXPORT __declspec( dllimport )
39   #endif
40 #else
41    #define HOMARDIMPL_EXPORT
42 #endif
43
44 // La gestion des repertoires
45 #ifndef CHDIR
46   #ifdef WIN32
47     #define CHDIR _chdir
48   #else
49     #define CHDIR chdir
50   #endif
51 #endif
52
53 #include <vector>
54 #include <string>
55 #include <list>
56 #include <map>
57
58 #include <iostream>
59 #include <fstream>
60
61 #include <TopoDS_Shape.hxx>
62 #include <Bnd_Box.hxx>
63 #include <NCollection_DataMap.hxx>
64 #include <TColStd_DataMapOfIntegerInteger.hxx>
65
66 #if defined WIN32
67 #pragma warning ( disable: 4251 )
68 #endif
69
70 namespace MEDCoupling {
71   class DataArrayDouble;
72 }
73 namespace XAO {
74   class Xao;
75   class Group;
76   class BrepGeometry;
77 }
78
79 namespace SMESHHOMARDImpl
80 {
81
82 class HOMARDIMPL_EXPORT HOMARD_Boundary
83 {
84 public:
85   HOMARD_Boundary();
86   ~HOMARD_Boundary();
87
88   // Generalites
89   void                          SetName( const char* Name );
90   std::string                   GetName() const;
91
92   std::string                   GetDumpPython() const;
93
94   // Caracteristiques
95   void                          SetType( int Type );
96   int                           GetType() const;
97
98   void                          SetMeshName( const char* MeshName );
99   std::string                   GetMeshName() const;
100
101   void                          SetDataFile( const char* DataFile );
102   std::string                   GetDataFile() const;
103
104   void                          SetCylinder( double X0, double X1, double X2, double X3,
105                                              double X4, double X5, double X6 );
106   void                          SetSphere( double X0, double X1, double X2, double X3 );
107   void                          SetConeR( double Xcentre1, double Ycentre1, double Zcentre1, double Rayon1,
108                                           double Xcentre2, double Ycentre2, double Zcentre2, double Rayon2);
109   void                          SetConeA( double Xaxe, double Yaxe, double Zaxe, double Angle,
110                                           double Xcentre, double Ycentre, double ZCentre);
111   void                          SetTorus( double X0, double X1, double X2, double X3,
112                                              double X4, double X5, double X6, double X7 );
113
114   std::vector<double>           GetCoords() const;
115
116   void                          SetLimit( double X0, double X1, double X2 );
117   std::vector<double>           GetLimit() const;
118
119   void                          AddGroup( const char* LeGroupe);
120   void                          SetGroups(const std::list<std::string>& ListGroup );
121   const std::list<std::string>& GetGroups() const;
122
123 // Liens avec les autres structures
124   std::string                   GetCaseCreation() const;
125   void                          SetCaseCreation( const char* NomCasCreation );
126
127 private:
128   std::string                   _Name;
129   std::string                   _NomCasCreation;
130   std::string                   _DataFile;
131   std::string                   _MeshName;
132   int                           _Type;
133   double                        _Xmin, _Xmax, _Ymin, _Ymax, _Zmin, _Zmax;
134   double                        _Xaxe, _Yaxe, _Zaxe;
135   double                        _Xcentre, _Ycentre, _Zcentre, _rayon;
136   double                        _Xincr, _Yincr, _Zincr;
137   double                        _Xcentre1, _Ycentre1, _Zcentre1, _Rayon1;
138   double                        _Xcentre2, _Ycentre2, _Zcentre2, _Rayon2;
139   double                        _Angle;
140
141   std::list<std::string>        _ListGroupSelected;
142
143 };
144
145 class HOMARDIMPL_EXPORT HOMARD_Cas
146 {
147 public:
148   HOMARD_Cas();
149   ~HOMARD_Cas();
150
151   // Generalites
152   void                          SetName( const char* Name );
153   std::string                   GetName() const;
154
155   std::string                   GetDumpPython() const;
156
157   // Caracteristiques
158   int                           SetDirName( const char* NomDir );
159   std::string                   GetDirName() const;
160
161   int                           GetNumberofIter();
162
163   void                          SetConfType( int ConfType );
164   const int                     GetConfType() const;
165
166   void                          SetBoundingBox( const std::vector<double>& extremas );
167   const std::vector<double>&    GetBoundingBox() const;
168
169   void                          AddGroup( const char* Group);
170   void                          SetGroups( const std::list<std::string>& ListGroup );
171   const std::list<std::string>& GetGroups() const;
172   void                          SupprGroups();
173
174   void                          AddBoundary( const char* Boundary );
175   void                          AddBoundaryGroup( const char* Boundary, const char* Group );
176   const std::list<std::string>& GetBoundaryGroup() const;
177   void                          SupprBoundaryGroup();
178
179 // Liens avec les autres structures
180   std::string                   GetIter0Name() const;
181
182   void                          AddIteration( const char* NomIteration );
183   const std::list<std::string>& GetIterations() const;
184   void                          SupprIterations();
185
186 private:
187   std::string                   _Name;
188   std::string                   _NomDir;
189   int                           _ConfType;
190   int                           _Etat;
191
192   std::vector<double>           _Boite;         // cf HomardQTCommun pour structure du vecteur
193   std::list<std::string>        _ListGroup;
194   std::list<std::string>        _ListBoundaryGroup;
195
196   typedef std::string           IterName;
197   typedef std::list<IterName>   IterNames;
198   IterNames                     _ListIter;
199 };
200
201 class HOMARDIMPL_EXPORT HomardDriver
202 {
203 public:
204   HomardDriver(const std::string siter, const std::string siterp1);
205   ~HomardDriver();
206   //
207   void        TexteInit( const std::string DirCompute, const std::string LogFile, const std::string Langue );
208   void        TexteInfo( int TypeBila, int NumeIter );
209   void        TexteMajCoords( int NumeIter );
210   void        CreeFichierDonn();
211   void        TexteAdap();
212   void        CreeFichier();
213   void        TexteMaillage( const std::string NomMesh, const std::string MeshFile, int apres );
214   void        TexteMaillageHOMARD( const std::string Dir, const std::string liter, int apres );
215   void        TexteConfRaffDera( int ConfType, int TypeAdap, int TypeRaff, int TypeDera );
216   void        TexteZone( int NumeZone, int ZoneType, int TypeUse, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8 );
217   void        TexteGroup( const std::string GroupName );
218   void        TexteField( const std::string FieldName, const std::string FieldFile,
219                           int TimeStep, int Rank,
220                           int TypeThR, double ThreshR, int TypeThC, double ThreshC,
221                           int UsField, int UsCmpI );
222   void        TexteCompo( int NumeComp, const std::string NomCompo);
223
224   void        TexteBoundaryOption( int BoundaryOption );
225   void        TexteBoundaryCAOGr( const std::string GroupName );
226   void        TexteBoundaryDi( const std::string MeshName, const std::string MeshFile );
227   void        TexteBoundaryDiGr( const std::string GroupName );
228   void        TexteBoundaryAn( const std::string NameBoundary, int NumeBoundary, int BoundaryType, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7 );
229   void        TexteBoundaryAnGr( const std::string NameBoundary, int NumeBoundary, const std::string GroupName );
230
231   void        TexteFieldInterp( const std::string FieldFile, const std::string MeshFile );
232   void        TexteFieldInterpAll();
233   void        TexteFieldInterpNameType( int NumeChamp, const std::string FieldName, const std::string TypeInterp, int TimeStep, int Rank );
234   void        TexteAdvanced( int NivMax, double DiamMin, int AdapInit, int LevelOutput );
235   void        TexteInfoCompute( int MessInfo );
236   //
237   int         ExecuteHomard();
238
239 public:
240   int         _modeHOMARD;
241   std::string _HOMARD_Exec;
242   std::string _NomDir;
243   std::string _NomFichierConfBase;
244   std::string _NomFichierConf;
245   std::string _NomFichierDonn;
246   std::string _siter;
247   std::string _siterp1;
248   std::string _Texte;
249   int         _TimeStep;
250   int         _Rank;
251   bool _bLu;
252 };
253
254 class HOMARD_Iteration;
255 class HOMARD_Hypothesis;
256
257   //! persistence entity type
258   typedef enum { Case, Zone, Hypothesis, Iteration, Boundary } SignatureType;
259
260   //! get persistence signature
261   HOMARDIMPL_EXPORT std::string GetSignature( SignatureType type );
262
263   //! get data separator
264   HOMARDIMPL_EXPORT std::string separator();
265
266   //! dump boundary to the string
267   HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Boundary& boundary );
268   //! dump case to the string
269   HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Cas& cas );
270   //! dump iteration to the string
271   HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Iteration& iteration );
272   //! dump hypothesis to the string
273   HOMARDIMPL_EXPORT std::string Dump( const SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis );
274
275   //! restore boundary from the string
276   HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Boundary& boundary, const std::string& stream );
277   //! restore case from the string
278   HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Cas& cas, const std::string& stream );
279   //! restore hypothesis from the string
280   HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Hypothesis& hypothesis, const std::string& stream );
281   //! restore iteration from the string
282   HOMARDIMPL_EXPORT bool Restore( SMESHHOMARDImpl::HOMARD_Iteration& iteration, const std::string& stream );
283
284 class HOMARDIMPL_EXPORT HOMARD_Gen
285 {
286 public :
287   HOMARD_Gen();
288   ~HOMARD_Gen();
289 };
290
291 class HOMARDIMPL_EXPORT HOMARD_Hypothesis
292 {
293 public:
294   HOMARD_Hypothesis();
295   ~HOMARD_Hypothesis();
296
297 // Generalites
298   void                          SetName( const char* Name );
299   std::string                   GetName() const;
300
301 // Caracteristiques
302   void                          SetAdapType( int TypeAdap );
303   int                           GetAdapType() const;
304   void                          SetRefinTypeDera( int TypeRaff, int TypeDera );
305   int                           GetRefinType() const;
306   int                           GetUnRefType() const;
307
308   void                          SetField( const char* FieldName );
309   std::string                   GetFieldName() const;
310   void                          SetUseField( int UsField );
311   int                           GetUseField()    const;
312
313   void                          SetUseComp( int UsCmpI );
314   int                           GetUseComp()    const;
315   void                          AddComp( const char* NomComp );
316   void                          SupprComp( const char* NomComp );
317   void                          SupprComps();
318   const std::list<std::string>& GetComps() const;
319
320   void                          SetRefinThr( int TypeThR, double ThreshR );
321   int                           GetRefinThrType()   const;
322   double                        GetThreshR()   const;
323   void                          SetUnRefThr( int TypeThC, double ThreshC );
324   int                           GetUnRefThrType()   const;
325   double                        GetThreshC()   const;
326
327   void                          SetNivMax( int NivMax );
328   const int                     GetNivMax() const;
329
330   void                          SetDiamMin( double DiamMin );
331   const double                  GetDiamMin() const;
332
333   void                          SetAdapInit( int AdapInit );
334   const int                     GetAdapInit() const;
335
336   void                          SetExtraOutput( int ExtraOutput );
337   const int                     GetExtraOutput() const;
338
339   void                          AddGroup( const char* Group);
340   void                          SupprGroup( const char* Group );
341   void                          SupprGroups();
342   void                          SetGroups(const std::list<std::string>& ListGroup );
343   const std::list<std::string>& GetGroups() const;
344
345   void                          SetTypeFieldInterp( int TypeFieldInterp );
346   int                           GetTypeFieldInterp() const;
347   void                          AddFieldInterpType( const char* FieldInterp, int TypeInterp );
348   void                          SupprFieldInterp( const char* FieldInterp );
349   void                          SupprFieldInterps();
350   const std::list<std::string>& GetFieldInterps() const;
351
352 // Liens avec les autres structures
353   void                          SetCaseCreation( const char* NomCasCreation );
354   std::string                   GetCaseCreation() const;
355
356   void                          LinkIteration( const char* NomIter );
357   void                          UnLinkIteration( const char* NomIter );
358   void                          UnLinkIterations();
359   const std::list<std::string>& GetIterations() const;
360
361   void                          AddZone( const char* NomZone, int TypeUse );
362   void                          SupprZone( const char* NomZone );
363   void                          SupprZones();
364   const std::list<std::string>& GetZones() const;
365
366 private:
367   std::string                   _Name;
368   std::string                   _NomCasCreation;
369
370   int                           _TypeAdap; // -1 pour une adapation Uniforme,
371                                            //  0 si l adaptation depend des zones,
372                                            //  1 pour des champs
373
374   int                           _TypeRaff;
375   int                           _TypeDera;
376
377   std::string                   _Field;
378   int                           _TypeThR;
379   int                           _TypeThC;
380   double                        _ThreshR;
381   double                        _ThreshC;
382   int                           _UsField;
383   int                           _UsCmpI;
384   int                           _TypeFieldInterp; // 0 pour aucune interpolation,
385                                                   // 1 pour interpolation de tous les champs,
386                                                   // 2 pour une liste
387   int                           _NivMax;
388   double                        _DiamMin;
389   int                           _AdapInit;
390   int                           _ExtraOutput;
391
392   std::list<std::string>        _ListIter;
393   std::list<std::string>        _ListZone;
394   std::list<std::string>        _ListComp;
395   std::list<std::string>        _ListGroupSelected;
396   std::list<std::string>        _ListFieldInterp;
397 };
398
399 class HOMARDIMPL_EXPORT HOMARD_Iteration
400 {
401 public:
402   HOMARD_Iteration();
403   ~HOMARD_Iteration();
404
405   // Generalites
406   void                          SetName( const char* Name );
407   std::string                   GetName() const;
408
409   // Caracteristiques
410   void                          SetDirNameLoc( const char* NomDir );
411   std::string                   GetDirNameLoc() const;
412
413   void                          SetNumber( int NumIter );
414   int                           GetNumber() const;
415
416   void                          SetState( int etat );
417   int                           GetState() const;
418
419   void                          SetMeshName( const char* NomMesh );
420   std::string                   GetMeshName() const;
421
422   void                          SetMeshFile( const char* MeshFile );
423   std::string                   GetMeshFile() const;
424
425   void                          SetFieldFile( const char* FieldFile );
426   std::string                   GetFieldFile() const;
427 // Instants pour le champ de pilotage
428   void                          SetTimeStep( int TimeStep );
429   void                          SetTimeStepRank( int TimeStep, int Rank );
430   void                          SetTimeStepRankLast();
431   int                           GetTimeStep() const;
432   int                           GetRank() const;
433 // Instants pour un champ a interpoler
434   void                          SetFieldInterpTimeStep( const char* FieldInterp, int TimeStep );
435   void                          SetFieldInterpTimeStepRank( const char* FieldInterp, int TimeStep, int Rank );
436   const std::list<std::string>& GetFieldInterpsTimeStepRank() const;
437   void                          SetFieldInterp( const char* FieldInterp );
438   const std::list<std::string>& GetFieldInterps() const;
439   void                          SupprFieldInterps();
440
441   void                          SetLogFile( const char* LogFile );
442   std::string                   GetLogFile() const;
443
444   void                          SetFileInfo( const char* FileInfo );
445   std::string                   GetFileInfo() const;
446
447 // Liens avec les autres iterations
448   void                          LinkNextIteration( const char* NomIteration );
449   void                          UnLinkNextIteration( const char* NomIteration );
450   void                          UnLinkNextIterations();
451   const std::list<std::string>& GetIterations() const;
452
453   void                          SetIterParentName( const char* iterParent );
454   std::string                   GetIterParentName() const;
455
456 // Liens avec les autres structures
457   void                          SetCaseName( const char* NomCas );
458   std::string                   GetCaseName() const;
459
460   void                          SetHypoName( const char* NomHypo );
461   std::string                   GetHypoName() const;
462
463 // Divers
464   void                          SetInfoCompute( int MessInfo );
465   int                           GetInfoCompute() const;
466
467 private:
468   std::string                   _Name;
469   int                           _Etat;
470   int                           _NumIter;
471   std::string                   _NomMesh;
472   std::string                   _MeshFile;
473   std::string                   _FieldFile;
474   int                           _TimeStep;
475   int                           _Rank;
476   std::string                   _LogFile;
477   std::string                   _IterParent;
478   std::string                   _NomHypo;
479   std::string                   _NomCas;
480   std::string                   _NomDir;
481   std::list<std::string>        _mesIterFilles;
482   std::string                   _FileInfo;
483   int                           _MessInfo;
484   // La liste des champs retenus par l'hypothese
485   std::list<std::string>        _ListFieldInterp;
486   // La liste des triplets (champs, pas de temps, numero d'ordre) retenus par l'iteration
487   std::list<std::string>        _ListFieldInterpTSR;
488 };
489
490 // HOMARD/FrontTrack
491
492 class FrontTrack
493 {
494 public:
495
496   /*!
497    * \brief Relocate nodes to lie on geometry
498    *  \param [in] theInputMedFile - a MED file holding a mesh including nodes that will be
499    *         moved onto the geometry
500    *  \param [in] theOutputMedFile - a MED file to create, that will hold a modified mesh
501    *  \param [in] theInputNodeFiles - an array of names of files describing groups of nodes that
502    *         will be moved onto the geometry
503    *  \param [in] theXaoFileName - a path to a file in XAO format  holding the geometry and
504    *         the geometrical groups.
505    *  \param [in] theIsParallel - if \c true, all processors are used to treat boundary shapes
506    *          in parallel.
507    */
508   void track( const std::string&                 theInputMedFile,
509               const std::string&                 theOutputMedFile,
510               const std::vector< std::string > & theInputNodeFiles,
511               const std::string&                 theXaoFileName,
512               bool                               theIsParallel=true);
513
514 };
515
516
517 struct FT_RealProjector;
518
519 /*!
520  * \brief Projector of a point to a boundary shape. Wrapper of a real projection algo
521  */
522 class FT_Projector
523 {
524 public:
525
526   FT_Projector(const TopoDS_Shape& shape = TopoDS_Shape());
527   FT_Projector(const FT_Projector& other);
528   ~FT_Projector();
529
530   // initialize with a boundary shape, compute the bounding box
531   void setBoundaryShape(const TopoDS_Shape& shape);
532
533   // return the boundary shape
534   const TopoDS_Shape& getShape() const { return _shape; }
535
536   // return the bounding box
537   const Bnd_Box getBoundingBox() const { return _bndBox; }
538
539
540   // create a real projector
541   void prepareForProjection();
542
543   // return true if a previously found solution can be used to speed up the projection
544   bool canUsePrevSolution() const;
545
546   // return true if projection is not needed
547   bool isPlanarBoundary() const;
548
549
550   // switch a mode of usage of prevSolution.
551   // If projection fails, to try to project without usage of prevSolution.
552   // By default this mode is off
553   void tryWithoutPrevSolution( bool toTry ) { _tryWOPrevSolution = toTry; }
554
555   // project a point to the boundary shape
556   bool project( const gp_Pnt& point,
557                 const double  maxDist2,
558                 gp_Pnt&       projection,
559                 double*       newSolution,
560                 const double* prevSolution = 0);
561
562   // project a point to the boundary shape and check if the projection is within the shape boundary
563   bool projectAndClassify( const gp_Pnt& point,
564                            const double  maxDist2,
565                            gp_Pnt&       projection,
566                            double*       newSolution,
567                            const double* prevSolution = 0);
568
569   // check if a point lies on the boundary shape
570   bool isOnShape( const gp_Pnt& point,
571                   const double  tol2,
572                   double*       newSolution,
573                   const double* prevSolution = 0);
574
575 private:
576
577   FT_RealProjector* _realProjector;
578   Bnd_Box           _bndBox;
579   TopoDS_Shape      _shape;
580   bool              _tryWOPrevSolution;
581 };
582
583 namespace FT_Utils
584 {
585   // Check if a file exists
586   bool fileExists( const std::string& path );
587
588   // Check if a file can be created/overwritten
589   bool canWrite( const std::string& path );
590
591   // Transform anything printable to a string
592   template< typename T> std::string toStr( const T& t )
593   {
594     std::ostringstream s;
595     s << t;
596     return s.str();
597   }
598
599   //--------------------------------------------------------------------------------------------
600   /*!
601    * \brief Return projectors by group name
602    */
603   struct XaoGroups
604   {
605     XaoGroups( const XAO::Xao* xao );
606
607     int getProjectors( const std::string&                   groupName,
608                        const int                            dim,
609                        const std::vector< FT_Projector > &  allProjectors,
610                        std::vector< const FT_Projector* > & groupProjectors ) const;
611   private:
612
613     typedef std::multimap< std::string, XAO::Group* > TGroupByNameMap;
614     TGroupByNameMap _xaoGroups[ 2 ]; // by dim
615   };
616 } // namespace FT_Utils
617
618 /*!
619  * \brief Node group and geometry to project onto
620  */
621 class FT_NodesOnGeom
622 {
623 public:
624
625   // read node IDs form a file and try to find a boundary sub-shape by name
626   void read( const std::string&            nodesFile,
627              const FT_Utils::XaoGroups&    xaoGroups,
628              MEDCoupling::DataArrayDouble* nodeCoords,
629              std::vector< FT_Projector > * allProjectorsByDim);
630
631   // chose boundary shapes by evaluating distance between nodes and shapes
632   //void choseShape( const std::vector< FT_Utils::ShapeAndBndBox >& shapeAndBoxList );
633
634   // project nodes to the shapes and move them to new positions
635   void projectAndMove();
636
637   // return true if all nodes were successfully relocated
638   bool isOK() const { return _OK; }
639
640   // return dimension of boundary shapes
641   int getShapeDim() const { return _shapeDim; }
642
643   // return nb of nodes to move
644   int nbNodes() const { return _nodes.size(); }
645
646
647 private:
648
649   // put nodes in the order for optimal projection
650   void putNodesInOrder();
651
652   // get node coordinates
653   gp_Pnt getPoint( const int nodeID );
654
655   // change node coordinates
656   void moveNode( const int nodeID, const gp_Pnt& xyz );
657
658
659   // Ids of a node to move and its 2 or 4 neighbors
660   struct FT_NodeToMove
661   {
662     int                _nodeToMove;
663     std::vector< int > _neighborNodes;
664
665     double             _params[2];   // parameters on shape (U or UV) found by projection
666     double            *_nearParams; // _params of a neighbor already projected node
667
668     FT_NodeToMove(): _nearParams(0) {}
669   };
670
671   std::vector< std::string >    _groupNames;
672   int                           _shapeDim;   // dimension of boundary shapes
673   std::vector< FT_NodeToMove >  _nodes;      // ids of nodes to move and their neighbors
674   std::vector< FT_Projector >   _projectors; // FT_Projector's initialized with boundary shapes
675   std::vector< FT_Projector > * _allProjectors; // FT_Projector's for all shapes of _shapeDim
676   MEDCoupling::DataArrayDouble* _nodeCoords;
677   bool                          _OK;          // projecting is successful 
678
679   // map of { FT_NodeToMove::_neighborNodes[i] } to { FT_NodeToMove* }
680   // this map is used to find neighbor nodes
681   typedef NCollection_DataMap< int, std::vector< FT_NodeToMove* > > TNodeIDToLinksMap;
682   TNodeIDToLinksMap             _neigborsMap;
683   std::vector<int>              _nodesOrder;
684
685 };
686
687 /*!
688  * \brief Container of node groups.
689  */
690 class FT_NodeGroups
691 {
692 public:
693
694   // Load node groups from files
695   void read( const std::vector< std::string >& nodeFiles,
696              const XAO::Xao*                   xaoGeom,
697              MEDCoupling::DataArrayDouble*     nodeCoords );
698
699   // return number of groups of nodes to move
700   int nbOfGroups() const { return _nodesOnGeom.size(); }
701
702   // Move nodes of a group in parallel mode
703   void operator() ( const int groupIndex ) const
704   {
705     const_cast< FT_NodeGroups* >( this )->projectAndMove( groupIndex );
706   }
707
708   // Project and move nodes of a given group of nodes
709   void projectAndMove( const int groupIndex );
710
711   // return true if all nodes were successfully relocated
712   bool isOK() const;
713
714   // print some statistics on node groups
715   void dumpStat() const;
716
717 private:
718
719   std::vector< FT_NodesOnGeom > _nodesOnGeom;
720   std::vector< FT_Projector >   _projectors[2]; // curves and surfaces separately
721
722 };
723
724 }; // namespace SMESHHOMARDImpl
725
726 #endif