Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/med.git] / src / MEDMEM / MEDMEM_Coordinate.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 /*
23  File Coordinate.hxx
24  $Header$
25 */
26
27 #ifndef COORDINATE_HXX
28 #define COORDINATE_HXX
29
30 #include <MEDMEM.hxx>
31
32 #include <string>
33 #include <vector>
34
35 #include "MEDMEM_PointerOf.hxx"
36 #include "MEDMEM_Exception.hxx"
37 #include "MEDMEM_define.hxx"
38
39
40 #include "MEDMEM_Array.hxx"
41
42 /*!
43     This class contains coordinates of the nodes .\n
44     It could also store useful optional information about nodes
45     as  node numbers and about axes as names or units. \n
46     spaceDimension and  numberOfNodes can be found in _coordinate object.
47 */
48
49 namespace MEDMEM {
50 class MEDMEM_EXPORT COORDINATE
51 {
52
53 protected:
54                                     /*! contains "CARTESIAN",
55                                         "CYLINDRICAL" or "SPHERICAL"*/
56   string                       _coordinateSystem;
57
58
59                                      /*! _coordinate is a MEDARRAY<double> object : \n
60                                          - spaceDimension \n
61                                          - numberOfNodes \n
62                                          - default storage mode \n
63                                          - Up to 4 "PointerOf" to an array of size spaceDimension*NumberOfNodes\n
64
65                                          Storing the object (not a pointer to this object) is more convenient for memory
66                                          management.
67                                          */
68   mutable MEDARRAY<double>            _coordinate;
69
70                                      /*! PointerOf to an array of size spaceDimension storing axes names*/
71   //PointerOf<string>          _coordinateName;
72   vector<string>          _coordinateName;
73
74                                      /*! PointerOf to an array of size spaceDimension storing units */
75   //PointerOf<string>          _coordinateUnit;
76   vector<string>          _coordinateUnit;
77
78                                      /*! PointerOf to an array of size NumberOfNodes : optional nodes numbers */
79   PointerOf<int>             _nodeNumber;
80
81
82 public :
83
84   friend class IMED_MESH_RDONLY_DRIVER;
85   friend class MED_MESH_RDONLY_DRIVER21;
86   friend class IMED_MESH_WRONLY_DRIVER;
87   friend class MED_MESH_WRONLY_DRIVER21;
88   friend class MED_MESH_RDONLY_DRIVER22;
89   friend class MED_MESH_WRONLY_DRIVER22;
90
91
92   COORDINATE();
93   COORDINATE(int SpaceDimension, int NumberOfNodes, MED_EN::medModeSwitch Mode);
94   COORDINATE(int SpaceDimension,const string * CoordinateName, const string * CoordinateUnit);
95   COORDINATE(const COORDINATE & m);
96   virtual ~COORDINATE();
97
98   void setCoordinates(MEDARRAY<double> *Coordinate,bool shallowCopy=false);
99   void setCoordinates(const MED_EN::medModeSwitch Mode, const double *Coordinate);
100   void setCoordinatesNames(const string * CoordinateName);
101   void setCoordinateName(const string CoordinateName, const int i);
102   void setCoordinatesUnits(const string * CoordinateUnit);
103   void setCoordinateUnit(const string CoordinateUnit, const int i);
104   void setCoordinatesSystem(const string CoordinateSystem);
105   void setNodesNumbers(const int * NodeNumber);
106
107   int             getSpaceDimension() const;
108   int             getNumberOfNodes() const;
109
110   virtual const int*      getNodesNumbers() const;
111   //const int*            getNodesNumbers() ;
112   string          getCoordinatesSystem() const;
113
114   virtual const double *  getCoordinates(MED_EN::medModeSwitch Mode);
115   virtual double          getCoordinate(int Number,int Axis);
116   virtual const double *  getCoordinateAxis(int Axis);
117
118   const string * getCoordinatesNames() const;
119   string   getCoordinateName(int Axis) const;
120   const string * getCoordinatesUnits() const;
121   string   getCoordinateUnit(int Axis) const;
122 };
123 }
124
125 #endif /* COORDINATE_HXX */