Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/med.git] / src / ParaMEDMEM / ParaMESH.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __PARAMESH_HXX__
21 #define __PARAMESH_HXX__
22
23 #include "MEDCouplingPointSet.hxx"
24 #include "ProcessorGroup.hxx"
25 #include "MEDCouplingMemArray.hxx"
26
27 #include <string>
28 #include <vector>
29
30 namespace ParaMEDMEM
31 {
32   class Topology;
33   class BlockTopology;
34   class DataArrayInt;
35
36   class ParaMESH
37   {
38   public:
39     ParaMESH( MEDCouplingPointSet *subdomain_mesh,
40               MEDCouplingPointSet *subdomain_face,
41               DataArrayInt *CorrespElt_local2global,
42               DataArrayInt *CorrespFace_local2global,
43               DataArrayInt *CorrespNod_local2global,
44               const ProcessorGroup& proc_group ) ;
45     ParaMESH( MEDCouplingPointSet *mesh,
46               const ProcessorGroup& proc_group, const std::string& name);
47
48     virtual ~ParaMESH();
49     void setNodeGlobal(DataArrayInt *nodeGlobal);
50     void setCellGlobal(DataArrayInt *cellGlobal);
51     Topology* getTopology() const { return _explicit_topology; }
52     bool isStructured() const { return _cell_mesh->isStructured(); }
53     MEDCouplingPointSet *getCellMesh() const { return _cell_mesh; }
54     MEDCouplingPointSet *getFaceMesh() const { return _face_mesh; }
55     BlockTopology* getBlockTopology() const { return _block_topology; }
56
57     DataArrayInt* getGlobalNumberingNodeDA() const { if(_node_global) _node_global->incrRef(); return _node_global; }
58     DataArrayInt* getGlobalNumberingFaceDA() const { if(_face_global) _face_global->incrRef(); return _face_global; }
59     DataArrayInt* getGlobalNumberingCellDA() const { if(_cell_global) _cell_global->incrRef(); return _cell_global; }
60     const int* getGlobalNumberingNode() const { if(_node_global) return _node_global->getConstPointer(); return 0; }
61     const int* getGlobalNumberingFace() const { if(_face_global) return _face_global->getConstPointer(); return 0; }
62     const int* getGlobalNumberingCell() const { if(_cell_global) return _cell_global->getConstPointer(); return 0; }
63
64   private:
65     //mesh object underlying the ParaMESH object
66     MEDCouplingPointSet *_cell_mesh ;
67     MEDCouplingPointSet *_face_mesh ;
68
69     //id of the local grid
70     int _my_domain_id;
71
72     //global topology of the cells
73     ParaMEDMEM::BlockTopology* _block_topology;
74     Topology*  _explicit_topology;
75     // pointers to global numberings
76     DataArrayInt* _node_global;
77     DataArrayInt* _face_global;
78     DataArrayInt* _cell_global;
79   };
80 }
81
82 #endif