1 // Copyright (C) 2017-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : FrontTrack_NodesOnGeom.hxx
20 // Created : Tue Apr 25 19:12:25 2017
21 // Author : Edward AGAPOV (eap)
24 #ifndef __FrontTrack_NodesOnGeom_HXX__
25 #define __FrontTrack_NodesOnGeom_HXX__
27 #include "FrontTrack_Projector.hxx"
29 #include <Bnd_Box.hxx>
30 #include <NCollection_DataMap.hxx>
31 #include <TopoDS_Shape.hxx>
32 #include <TColStd_DataMapOfIntegerInteger.hxx>
40 namespace MEDCoupling {
41 class DataArrayDouble;
47 //--------------------------------------------------------------------------------------------
49 * \brief Node group and geometry to project onto
55 // read node IDs form a file and try to find a boundary sub-shape by name
56 void read( const std::string& nodesFile,
57 const FT_Utils::XaoGroups& xaoGroups,
58 MEDCoupling::DataArrayDouble* nodeCoords,
59 std::vector< FT_Projector > * allProjectorsByDim);
61 // chose boundary shapes by evaluating distance between nodes and shapes
62 //void choseShape( const std::vector< FT_Utils::ShapeAndBndBox >& shapeAndBoxList );
64 // project nodes to the shapes and move them to new positions
65 void projectAndMove();
67 // return true if all nodes were successfully relocated
68 bool isOK() const { return _OK; }
70 // return dimension of boundary shapes
71 int getShapeDim() const { return _shapeDim; }
73 // return nb of nodes to move
74 int nbNodes() const { return _nodes.size(); }
79 // put nodes in the order for optimal projection
80 void putNodesInOrder();
82 // get node coordinates
83 gp_Pnt getPoint( const int nodeID );
85 // change node coordinates
86 void moveNode( const int nodeID, const gp_Pnt& xyz );
89 // Ids of a node to move and its 2 or 4 neighbors
93 std::vector< int > _neighborNodes;
95 double _params[2]; // parameters on shape (U or UV) found by projection
96 double *_nearParams; // _params of a neighbor already projected node
98 FT_NodeToMove(): _nearParams(0) {}
101 std::vector< std::string > _groupNames;
102 int _shapeDim; // dimension of boundary shapes
103 std::vector< FT_NodeToMove > _nodes; // ids of nodes to move and their neighbors
104 std::vector< FT_Projector > _projectors; // FT_Projector's initialized with boundary shapes
105 std::vector< FT_Projector > * _allProjectors; // FT_Projector's for all shapes of _shapeDim
106 MEDCoupling::DataArrayDouble* _nodeCoords;
107 bool _OK; // projecting is successful
109 // map of { FT_NodeToMove::_neighborNodes[i] } to { FT_NodeToMove* }
110 // this map is used to find neighbor nodes
111 typedef NCollection_DataMap< int, std::vector< FT_NodeToMove* > > TNodeIDToLinksMap;
112 TNodeIDToLinksMap _neigborsMap;
113 std::vector<int> _nodesOrder;