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