Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDCoupling / MEDCouplingUMesh.hxx
1 //  Copyright (C) 2007-2008  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 #ifndef __PARAMEDMEM_MEDCOUPLINGUMESH_HXX__
20 #define __PARAMEDMEM_MEDCOUPLINGUMESH_HXX__
21
22 #include "MEDCouplingMesh.hxx"
23 #include "MemArray.hxx"
24
25 #include <set>
26
27 namespace ParaMEDMEM
28 {
29   class MEDCouplingUMesh : public MEDCouplingMesh
30   {
31   public:
32     static MEDCouplingUMesh *New();
33     void updateTime();
34     void checkCoherency() const throw(INTERP_KERNEL::Exception);
35     void setMeshDimension(unsigned meshDim);
36     void allocateCells(int nbOfCells);
37     void setCoords(DataArrayDouble *coords);
38     DataArrayDouble *getCoords() const { return _coords; }
39     void insertNextCell(INTERP_KERNEL::NormalizedCellType type, int size, const int *nodalConnOfCell);
40     void finishInsertingCells();
41     const std::set<INTERP_KERNEL::NormalizedCellType> getAllTypes() const { return _types; }
42     void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
43     DataArrayInt *getNodalConnectivity() const { return _nodal_connec; }
44     DataArrayInt *getNodalConnectivityIndex() const { return _nodal_connec_index; }
45     INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
46     int getNumberOfNodesInCell(int cellId) const;
47     bool isStructured() const;
48     int getNumberOfCells() const;
49     int getNumberOfNodes() const;
50     int getSpaceDimension() const;
51     int getMeshDimension() const { return _mesh_dim; }
52     int getMeshLength() const;
53   private:
54     MEDCouplingUMesh();
55     ~MEDCouplingUMesh();
56     void computeTypes();
57   private:
58     //! this iterator stores current position in _nodal_connec array.
59     mutable int _iterator;
60     unsigned _mesh_dim;
61     DataArrayInt *_nodal_connec;
62     DataArrayInt *_nodal_connec_index;
63     DataArrayDouble *_coords;
64     std::set<INTERP_KERNEL::NormalizedCellType> _types;
65   };
66 }
67
68 #endif