Salome HOME
Merge from V6_main 01/04/2013
[modules/med.git] / src / MEDMEM / MEDMEM_Coordinate.hxx
1 // Copyright (C) 2007-2013  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 /*
24  File Coordinate.hxx
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
85   friend class MED_MESH_RDONLY_DRIVER;
86   friend class MED_MESH_WRONLY_DRIVER;
87
88
89   COORDINATE();
90   COORDINATE(int SpaceDimension, int NumberOfNodes, MED_EN::medModeSwitch Mode);
91   COORDINATE(int SpaceDimension,const string * CoordinateName, const string * CoordinateUnit);
92   COORDINATE(const COORDINATE & m);
93   virtual ~COORDINATE();
94
95   void setCoordinates(MEDARRAY<double> *Coordinate,bool shallowCopy=false);
96   void setCoordinates(const MED_EN::medModeSwitch Mode, const double *Coordinate);
97   void setCoordinatesNames(const string * CoordinateName);
98   void setCoordinateName(const string CoordinateName, const int i);
99   void setCoordinatesUnits(const string * CoordinateUnit);
100   void setCoordinateUnit(const string CoordinateUnit, const int i);
101   void setCoordinatesSystem(const string CoordinateSystem);
102   void setNodesNumbers(const int * NodeNumber);
103
104   int             getSpaceDimension() const;
105   int             getNumberOfNodes() const;
106
107   virtual const int*      getNodesNumbers() const;
108   //const int*            getNodesNumbers() ;
109   string          getCoordinatesSystem() const;
110
111   virtual const double *  getCoordinates(MED_EN::medModeSwitch Mode);
112   virtual double          getCoordinate(int Number,int Axis);
113   virtual const double *  getCoordinateAxis(int Axis);
114
115   const string * getCoordinatesNames() const;
116   string   getCoordinateName(int Axis) const;
117   const string * getCoordinatesUnits() const;
118   string   getCoordinateUnit(int Axis) const;
119 };
120 }
121
122 #endif /* COORDINATE_HXX */