Salome HOME
Update copyrights
[modules/homard.git] / src / FrontTrack / FrontTrack_NodeGroups.hxx
1 // Copyright (C) 2017-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // File      : FrontTrack_NodeGroups.hxx
20 // Created   : Tue Apr 25 19:02:49 2017
21 // Author    : Edward AGAPOV (eap)
22
23 #ifndef __FrontTrack_NodeGroups_HXX__
24 #define __FrontTrack_NodeGroups_HXX__
25
26 #include "FrontTrack_NodesOnGeom.hxx"
27 #include "FrontTrack_Projector.hxx"
28
29 #include <vector>
30 #include <string>
31
32 namespace MEDCoupling {
33   class DataArrayDouble;
34 }
35 namespace XAO {
36   class Xao;
37 }
38
39 /*!
40  * \brief Container of node groups.
41  */
42 class FT_NodeGroups
43 {
44 public:
45
46   // Load node groups from files
47   void read( const std::vector< std::string >& nodeFiles,
48              const XAO::Xao*                   xaoGeom,
49              MEDCoupling::DataArrayDouble*     nodeCoords );
50
51   // return number of groups of nodes to move
52   int nbOfGroups() const { return _nodesOnGeom.size(); }
53
54   // Move nodes of a group in parallel mode
55   void operator() ( const int groupIndex ) const
56   {
57     const_cast< FT_NodeGroups* >( this )->projectAndMove( groupIndex );
58   }
59
60   // Project and move nodes of a given group of nodes
61   void projectAndMove( const int groupIndex );
62
63   // return true if all nodes were successfully relocated
64   bool isOK() const;
65
66   // print some statistics on node groups
67   void dumpStat() const;
68
69 private:
70
71   std::vector< FT_NodesOnGeom > _nodesOnGeom;
72   std::vector< FT_Projector >   _projectors[2]; // curves and surfaces separately
73
74 };
75
76 #endif