1 // File : FrontTrack_NodesOnGeom.hxx
2 // Created : Tue Apr 25 19:12:25 2017
3 // Author : Edward AGAPOV (eap)
6 #ifndef __FrontTrack_NodesOnGeom_HXX__
7 #define __FrontTrack_NodesOnGeom_HXX__
9 #include "FrontTrack_Projector.hxx"
11 #include <Bnd_Box.hxx>
12 #include <NCollection_DataMap.hxx>
13 #include <TopoDS_Shape.hxx>
14 #include <TColStd_DataMapOfIntegerInteger.hxx>
22 namespace MEDCoupling {
23 class DataArrayDouble;
29 //--------------------------------------------------------------------------------------------
31 * \brief Node group and geometry to project onto
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);
43 // chose boundary shapes by evaluating distance between nodes and shapes
44 //void choseShape( const std::vector< FT_Utils::ShapeAndBndBox >& shapeAndBoxList );
46 // project nodes to the shapes and move them to new positions
47 void projectAndMove();
49 // return true if all nodes were successfully relocated
50 bool isOK() const { return _OK; }
52 // return dimension of boundary shapes
53 int getShapeDim() const { return _shapeDim; }
55 // return nb of nodes to move
56 int nbNodes() const { return _nodes.size(); }
61 // put nodes in the order for optimal projection
62 void putNodesInOrder();
64 // get node coordinates
65 gp_Pnt getPoint( const int nodeID );
67 // change node coordinates
68 void moveNode( const int nodeID, const gp_Pnt& xyz );
71 // Ids of a node to move and its 2 or 4 neighbors
75 std::vector< int > _neighborNodes;
77 double _params[2]; // parameters on shape (U or UV) found by projection
78 double *_nearParams; // _params of a neighbor already projected node
80 FT_NodeToMove(): _nearParams(0) {}
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
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;