]> SALOME platform Git repositories - modules/homard.git/blob - src/FrontTrack/FrontTrack_NodesOnGeom.hxx
Salome HOME
Impressions de DEBUG
[modules/homard.git] / src / FrontTrack / FrontTrack_NodesOnGeom.hxx
1 // File      : FrontTrack_NodesOnGeom.hxx
2 // Created   : Tue Apr 25 19:12:25 2017
3 // Author    : Edward AGAPOV (eap)
4
5
6 #ifndef __FrontTrack_NodesOnGeom_HXX__
7 #define __FrontTrack_NodesOnGeom_HXX__
8
9 #include "FrontTrack_Projector.hxx"
10
11 #include <Bnd_Box.hxx>
12 #include <NCollection_DataMap.hxx>
13 #include <TopoDS_Shape.hxx>
14 #include <TColStd_DataMapOfIntegerInteger.hxx>
15
16 #include <string>
17 #include <vector>
18
19 namespace FT_Utils {
20   struct XaoGroups;
21 }
22 namespace MEDCoupling {
23   class DataArrayDouble;
24 }
25 namespace XAO {
26   class BrepGeometry;
27 }
28
29   //--------------------------------------------------------------------------------------------
30 /*!
31  * \brief Node group and geometry to project onto
32  */
33 class FT_NodesOnGeom
34 {
35 public:
36
37   // read node IDs form a file and try to find a boundary sub-shape by name
38   void read( const std::string&            nodesFile,
39              const FT_Utils::XaoGroups&    xaoGroups,
40              MEDCoupling::DataArrayDouble* nodeCoords,
41              std::vector< FT_Projector > * allProjectorsByDim);
42
43   // chose boundary shapes by evaluating distance between nodes and shapes
44   //void choseShape( const std::vector< FT_Utils::ShapeAndBndBox >& shapeAndBoxList );
45
46   // project nodes to the shapes and move them to new positions
47   void projectAndMove();
48
49   // return true if all nodes were successfully relocated
50   bool isOK() const { return _OK; }
51
52   // return dimension of boundary shapes
53   int getShapeDim() const { return _shapeDim; }
54
55   // return nb of nodes to move
56   int nbNodes() const { return _nodes.size(); }
57
58
59 private:
60
61   // put nodes in the order for optimal projection
62   void putNodesInOrder();
63
64   // get node coordinates
65   gp_Pnt getPoint( const int nodeID );
66
67   // change node coordinates
68   void moveNode( const int nodeID, const gp_Pnt& xyz );
69
70
71   // Ids of a node to move and its 2 or 4 neighbors
72   struct FT_NodeToMove
73   {
74     int                _nodeToMove;
75     std::vector< int > _neighborNodes;
76
77     double             _params[2];   // parameters on shape (U or UV) found by projection
78     double            *_nearParams; // _params of a neighbor already projected node
79
80     FT_NodeToMove(): _nearParams(0) {}
81   };
82
83   std::vector< std::string >    _groupNames;
84   int                           _shapeDim;   // dimension of boundary shapes
85   std::vector< FT_NodeToMove >  _nodes;      // ids of nodes to move and their neighbors
86   std::vector< FT_Projector >   _projectors; // FT_Projector's initialized with boundary shapes
87   std::vector< FT_Projector > * _allProjectors; // FT_Projector's for all shapes of _shapeDim
88   MEDCoupling::DataArrayDouble* _nodeCoords;
89   bool                          _OK;          // projecting is successful 
90
91   // map of { FT_NodeToMove::_neighborNodes[i] } to { FT_NodeToMove* }
92   // this map is used to find neighbor nodes
93   typedef NCollection_DataMap< int, std::vector< FT_NodeToMove* > > TNodeIDToLinksMap;
94   TNodeIDToLinksMap             _neigborsMap;
95   std::vector<int>              _nodesOrder;
96
97 };
98
99 #endif