1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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
20 // File : MEDMEM_Extractor.hxx
21 // Created : Thu Dec 18 10:52:01 2008
22 // Author : Edward AGAPOV (eap)
24 #ifndef __MEDMEM_EXTRACTOR_HXX__
25 #define __MEDMEM_EXTRACTOR_HXX__
27 #include "MEDMEM_Exception.hxx"
28 #include "MEDMEM_Mesh.hxx"
29 #include "MEDMEM_Field.hxx"
38 * \brief Tool taking an input field and making a field of lower dimension
39 * by cutting the given field by a plane or a line.
41 * The following extractions are possible: <ul>
42 *<li> 3D -> 2D (3D mesh cut by plane)</li>
43 *<li> 3D -> 1D (3D mesh cut by line)</li>
44 *<li> 2D -> 1D (2D mesh cut by line in 2D space or by plane in 3D space)</li></ul>
46 class MEDMEM_EXPORT Extractor
49 * \brief Creates a tool
50 * \param inputField - input field
52 * The input field is supposed to comply with following conditions <ul>
53 *<li> it is constant by element (i.e. has 1 gauss point),</li>
54 *<li> it's support mesh does not contain poly elements,</li>
55 *<li> volumic elements have planar faces,</li>
56 *<li> surfasic elements have linear edges.</li></ul>
59 Extractor(const FIELD<double>& inputField) throw (MEDEXCEPTION);
62 * \brief Creates a field by cutting inputField by a plane
63 * \param coords - give a point to pass through by the plane
64 * \param normal - gives the plane normal
65 * \retval FIELD<double>* - resulting field holding ownership of its support,
66 * which in its turn holds ownership of its mesh
68 FIELD<double>* extractPlane(const double* coords, const double* normal) throw (MEDEXCEPTION);
71 * \brief Creates a field by cutting inputField by a line
72 * \param coords - give a point to pass through by the line
73 * \param direction - gives a vector collinear to the line
74 * \retval FIELD<double>* - resulting field holding ownership of its support,
75 * which in its turn holds ownership of its mesh
77 FIELD<double>* extractLine(const double* coords, const double* direction) throw (MEDEXCEPTION);
81 MESH* divideEdges(const double* coords,
83 std::map<int,std::set<int> >& new2oldCells);
85 MESH* transfixFaces( const double* coords,
86 const double* direction,
87 std::map<int,std::set<int> >& new2oldCells);
89 FIELD<double>* makeField( const std::map<int,std::set<int> >& new2oldCells,
92 void computeDistanceOfNodes(const double* point, const double* normal);
94 void sortNodes( std::map< int, std::vector< int > >& connByNbNodes,
95 const double* nodeCoords,
98 const std::list<int> & nbNodesPerPolygon);
101 const FIELD<double>* _myInputField; //!< input field
102 const MESH* _myInputMesh; //!< unstructured field support mesh
103 std::vector<double> _myNodeDistance; //!< distance of input nodes to cutting tool