Salome HOME
2fe1f85c16fe1902dc0e6acd9313820bbfefd275
[modules/med.git] / src / MEDCoupling / MEDCouplingNormalizedCartesianMesh.txx
1 // Copyright (C) 2007-2015  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, or (at your option) any later version.
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 // File      : MEDCouplingNormalizedCartesianMesh.txx
20 // Created   : Mon Aug 17 12:00:38 2009
21 // Author    : Edward AGAPOV (eap)
22 //
23
24 #include "MEDCouplingNormalizedCartesianMesh.hxx"
25 #include "MEDCouplingCMesh.hxx"
26
27 template<int SPACEDIM>
28 MEDCouplingNormalizedCartesianMesh<SPACEDIM>::MEDCouplingNormalizedCartesianMesh(const ParaMEDMEM::MEDCouplingCMesh *mesh):_mesh(mesh)
29 {
30   if(_mesh)
31     _mesh->incrRef();
32 }
33
34 template<int SPACEDIM>
35 MEDCouplingNormalizedCartesianMesh<SPACEDIM>::~MEDCouplingNormalizedCartesianMesh()
36 {
37   if(_mesh)
38     _mesh->decrRef();
39 }
40
41 template<int SPACEDIM>
42 unsigned long MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getNumberOfElements() const
43 {
44   return _mesh->getNumberOfCells();
45 }
46
47 template<int SPACEDIM>
48 unsigned long MEDCouplingNormalizedCartesianMesh<SPACEDIM>::nbCellsAlongAxis(int axis) const
49 {
50   return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1;
51 }
52
53 template<int SPACEDIM>
54 const double * MEDCouplingNormalizedCartesianMesh<SPACEDIM>::getCoordsAlongAxis(int axis) const
55 {
56   return _mesh->getCoordsAt(axis)->getConstPointer();
57 }