1 // Copyright (C) 2007-2008 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.
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 : MEDMEM_Extractor.hxx
20 // Created : Thu Dec 18 10:52:01 2008
21 // Author : Edward AGAPOV (eap)
23 #ifndef __MEDMEM_EXTRACTOR_HXX__
24 #define __MEDMEM_EXTRACTOR_HXX__
26 #include "MEDMEM_Exception.hxx"
27 #include "MEDMEM_Mesh.hxx"
28 #include "MEDMEM_Field.hxx"
37 * \brief Tool taking an input field and making a field of lower dimension
38 * by cutting the given field by a plane or a line.
40 * The following extractions are possible: <ul>
41 *<li> 3D -> 2D (3D mesh cut by plane)</li>
42 *<li> 3D -> 1D (3D mesh cut by line)</li>
43 *<li> 2D -> 1D (2D mesh cut by line in 2D space or by plane in 3D space)</li></ul>
48 * \brief Creates a tool
49 * \param inputField - input field
51 * The input field is supposed to comply with following conditions <ul>
52 *<li> it is constant by element (i.e. has 1 gauss point),</li>
53 *<li> it's support mesh does not contain poly elements,</li>
54 *<li> volumic elements have planar faces,</li>
55 *<li> surfasic elements have linear edges.</li></ul>
58 Extractor(const FIELD<double>& inputField) throw (MEDEXCEPTION);
61 * \brief Creates a field by cutting inputField by a plane
62 * \param coords - give a point to pass through by the plane
63 * \param normal - gives the plane normal
64 * \retval FIELD<double>* - resulting field holding ownership of its support,
65 * which in its turn holds ownership of its mesh
67 FIELD<double>* extractPlane(const double* coords, const double* normal) throw (MEDEXCEPTION);
70 * \brief Creates a field by cutting inputField by a line
71 * \param coords - give a point to pass through by the line
72 * \param direction - gives a vector collinear to the line
73 * \retval FIELD<double>* - resulting field holding ownership of its support,
74 * which in its turn holds ownership of its mesh
76 FIELD<double>* extractLine(const double* coords, const double* direction) throw (MEDEXCEPTION);
80 MESH* divideEdges(const double* coords,
82 std::map<int,std::set<int> >& new2oldCells);
84 MESH* transfixFaces( const double* coords,
85 const double* direction,
86 std::map<int,std::set<int> >& new2oldCells);
88 FIELD<double>* makeField( const std::map<int,std::set<int> >& new2oldCells,
91 void computeDistanceOfNodes(const double* point, const double* normal);
93 void sortNodes( std::map< int, std::vector< int > >& connByNbNodes,
94 const double* nodeCoords,
97 const std::list<int> & nbNodesPerPolygon);
100 const FIELD<double>* _myInputField; //!< input field
101 std::vector<double> _myNodeDistance; //!< distance of input nodes to cutting tool