1 #include "MEDMEM_Coordinate.hxx"
4 /*! This class contains coordinates of the nodes */
5 //----------------------------------------------------------//
6 COORDINATE::COORDINATE():_coordinate((MEDARRAY<double>*)NULL),
7 _coordinateName((string*)NULL),
8 _coordinateUnit((string*)NULL),
9 _nodeNumber((int*)NULL)
10 //----------------------------------------------------------//
12 BEGIN_OF("Default Constructor COORDINATE");
15 //------------------------------------------------------------------------------//
16 COORDINATE::COORDINATE(medModeSwitch Mode,int SpaceDimension, int NumberOfNodes):
17 _nodeNumber((int*)NULL)
18 //------------------------------------------------------------------------------//
20 BEGIN_OF("Constructor COORDINATE");
21 _coordinateName = new string[SpaceDimension] ;
22 _coordinateUnit = new string[SpaceDimension] ;
23 _coordinate = new MEDARRAY<double>(SpaceDimension,NumberOfNodes,Mode);
25 //----------------------//
26 COORDINATE::~COORDINATE()
27 //----------------------//
29 MESSAGE("Debut Destructeur COORDINATE");
30 if (_coordinate!=NULL)
32 if (_coordinateName!=NULL)
33 delete[] _coordinateName ;
34 if (_coordinateUnit!=NULL)
35 delete[] _coordinateUnit ;
36 if (_nodeNumber!=NULL)
37 delete[] _nodeNumber ;
40 /*! set the attribute _coordinate with Coordinate */
41 //----------------------------------------------------------//
42 void COORDINATE::setCoordinates(MEDARRAY<double> *Coordinate)
43 //----------------------------------------------------------//
45 _coordinate=Coordinate ;
48 /*! set the attribute _coordinateName with CoordinateName */
49 //----------------------------------------------------------//
50 void COORDINATE::setCoordinatesNames(string * CoordinateName)
51 //----------------------------------------------------------//
53 _coordinateName=CoordinateName ;
56 /*! set the attribute _coordinateUnit with CoordinateUnit */
57 //----------------------------------------------------------//
58 void COORDINATE::setCoordinatesUnits(string * CoordinateUnit)
59 //----------------------------------------------------------//
61 _coordinateUnit=CoordinateUnit ;
64 /*! set the attribute _nodeNumber with NodeNumber */
65 //------------------------------------------------//
66 void COORDINATE::setNodesNumbers(int * NodeNumber)
67 //------------------------------------------------//
69 _nodeNumber=NodeNumber ;
72 /*! returns the number of nodes defined in the mesh*/
73 //-------------------------------------------------//
74 int * COORDINATE::getNodesNumbers() const
75 //-------------------------------------------------//
80 /*! returns the mode of coordinates (FULL_INTERLACE or NO_INTERLACE) */
81 //-------------------------------------------------------------------//
82 const double * COORDINATE::getCoordinates (medModeSwitch Mode)
83 //-------------------------------------------------------------------//
85 return _coordinate->get(Mode) ;
88 /* returns the coordinate of node Number on axis Axis */
89 //----------------------------------------------------//
90 double COORDINATE::getCoordinate(int Number,int Axis)
91 //----------------------------------------------------//
93 return _coordinate->getIJ(Number,Axis) ;
96 /* returns all nodes coordinates from axis Axis */
97 //----------------------------------------------------//
98 const double * COORDINATE::getCoordinateAxis(int Axis)
99 //----------------------------------------------------//
100 { //< return all nodes coordinates from axis Axis
101 return _coordinate->getI(MED_NO_INTERLACE,Axis) ;
104 /*! Returns an array with names of coordinates.
109 //--------------------------------------//
110 string * COORDINATE::getCoordinatesNames()
112 return _coordinateName ;
115 /* returns the name of axis Axis */
116 //-------------------------------------------//
117 string COORDINATE::getCoordinateName(int Axis)
118 //-------------------------------------------//
120 return _coordinateName[Axis-1];
123 /*! Returns an array with units of coordinates (cm, m, mm, ...)
124 It could be empty. We suppose we are IS (meter). */
125 //-----------------------------------------------------//
126 string * COORDINATE::getCoordinatesUnits()
127 //-----------------------------------------------------//
129 return _coordinateUnit ;
132 /*! Returns the unit of axis Axis */
133 //------------------------------------------//
134 string COORDINATE::getCoordinateUnit(int Axis)
135 //------------------------------------------//
137 return _coordinateUnit[Axis-1] ;
139 /*! Returns "CARTESIAN", "CYLINDRICAL" or "SPHERICAL"*/
140 //---------------------------------------------------//
141 string COORDINATE::getCoordinatesSystem() const
142 //---------------------------------------------------//
144 return _coordinateSystem ;