1 // Copyright (C) 2007-2012 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
19 // File : MEDMEM_MeshFuse.hxx
20 // Created : Tue Jul 7 17:04:38 2009
21 // Author : Edward AGAPOV (eap)
23 #ifndef __MEDMEM_MeshFuse_HXX__
24 #define __MEDMEM_MeshFuse_HXX__
26 #include "MEDMEM_Meshing.hxx"
35 * \brief Mesh able to concatenate other meshes
37 class MEDMEM_EXPORT MeshFuse : public MESHING
43 void concatenate( const MESH* mesh, const std::vector<int>& node_glob_numbers );
45 // unite glob_numbers and add_glob_numbers
46 void append( MED_EN::medEntityMesh entity,
47 std::vector<int>& glob_numbers,
48 const std::vector<int>& add_glob_numbers );
50 // if MeshFuse is filled via MESHING
51 void setNodeNumbers( const std::vector<int>& node_glob_numbers );
53 // return number collected during all concatenate()s
54 const std::vector<int> & getNodeNumbers() const { return _node_glob_numbers; }
58 int makeNewNodeIds(const std::vector<int>& node_glob_numbers);
60 void expandCoordinates(int final_nb_nodes);
62 void expandConnectivity(int final_nb_nodes);
64 void updateNodeIds( CONNECTIVITY* connectivity );
69 std::vector< int > _connectivity, _index;
71 TConnData(): _nb_elems(0) {}
74 int appendConnectivity( TConnData& data,
76 MED_EN::medEntityMesh entity,
77 MED_EN::medGeometryElement type);
79 template< class TSUPPORT >
80 TSUPPORT* updateOldSupport(TSUPPORT* support) const;
82 template< class TSUPPORT >
83 TSUPPORT* makeSupport(const TSUPPORT* add_support, TSUPPORT* same_name_support);
85 void expandSupports();
87 int getElemNbShift( const MED_EN::medEntityMesh& entity,
88 MED_EN::medGeometryElement type,
89 int which, bool prev ) const;
91 void uniteSupportElements(const SUPPORT* add_support,
93 MED_EN::medGeometryElement type,
94 std::vector<int> & elements);
96 void makeNewElemIds(MED_EN::medEntityMesh entity,
97 MED_EN::medGeometryElement type,
98 std::vector< int > & new_ids);
100 void findEqualOldElements(MED_EN::medEntityMesh entity,
101 MED_EN::medGeometryElement type,
102 std::vector< int > & old_ids);
106 const MESH* _mesh; // mesh to add
108 std::vector<int> _node_glob_numbers; // global numbers of nodes
110 // local ids of merged entities (whose all nodes are merged) of the added mesh
111 std::map< MED_EN::medGeometryElement, std::vector<int> > _merged_of_type;
112 // and corresponding ids of EQUAL elements (if any) of OLD mesh
113 std::map< MED_EN::medGeometryElement, std::vector<int> > _equalo_of_type;
115 // ids in final mesh of added elements of a geom type filled in case of double elements
116 std::map< MED_EN::medGeometryElement, std::vector<int> > _new_elem_ids_of_type;
118 // global numbering index by type:
119 // - of old mesh before addition
120 // - of added mesh before addition
121 // - of mesh added (taking merging into account)
122 enum { INIT_OLD=0, INIT_ADD, RSLT_ADD, NB_INDICES };
123 typedef std::map< MED_EN::medGeometryElement, int > TNbOfGeom;
124 vector< TNbOfGeom > _nb_index[NB_INDICES]; // for each entity