From 60b3ed49a968980823d953c7ee916448c43a61d6 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 18 Sep 2009 12:07:22 +0000 Subject: [PATCH] EHPOC: L1.1.1: Structrured/structrured interpolation Implementation of 1D-3D cartesian/cartesian interpolation +MEDCouplingNormalizedCartesianMesh.hxx MEDCouplingNormalizedCartesianMesh.txx --- .../MEDCouplingNormalizedCartesianMesh.hxx | 51 +++++++++++++++++ .../MEDCouplingNormalizedCartesianMesh.txx | 57 +++++++++++++++++++ src/MEDCoupling/Makefile.am | 3 +- 3 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx create mode 100644 src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx new file mode 100644 index 000000000..70dc2686d --- /dev/null +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.hxx @@ -0,0 +1,51 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef __MEDCouplingNormalizedCartesianMesh_HXX__ +#define __MEDCouplingNormalizedCartesianMesh_HXX__ + +#include "NormalizedUnstructuredMesh.hxx" + +namespace ParaMEDMEM +{ + class MEDCouplingCMesh; +} + +template +class MEDCouplingNormalizedCartesianMesh : public INTERP_KERNEL::GenericMesh +{ +public: + static const int MY_SPACEDIM=SPACEDIM; + static const int MY_MESHDIM=MESHDIM; + typedef int MyConnType; + static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE; +public: + MEDCouplingNormalizedCartesianMesh(ParaMEDMEM::MEDCouplingCMesh *mesh); + //void getBoundingBox(double *boundingBox) const; + //INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const; + //unsigned char getNumberOfNodesOfElement(int eltId) const; + //unsigned long getNumberOfNodes() const; + unsigned long getNumberOfElements() const; + unsigned long nbCellsAlongAxis(int axis) const; + const double * getCoordsAlongAxis(int axis) const; + ~MEDCouplingNormalizedCartesianMesh(); +private: + ParaMEDMEM::MEDCouplingCMesh *_mesh; +}; + +#endif diff --git a/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx new file mode 100644 index 000000000..ec8d2cac0 --- /dev/null +++ b/src/MEDCoupling/MEDCouplingNormalizedCartesianMesh.txx @@ -0,0 +1,57 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : MEDCouplingNormalizedCartesianMesh.txx +// Created : Mon Aug 17 12:00:38 2009 +// Author : Edward AGAPOV (eap) +// + +#include "MEDCouplingNormalizedCartesianMesh.hxx" +#include "MEDCouplingCMesh.hxx" + +template +MEDCouplingNormalizedCartesianMesh::MEDCouplingNormalizedCartesianMesh(ParaMEDMEM::MEDCouplingCMesh *mesh):_mesh(mesh) +{ + if(_mesh) + _mesh->incrRef(); +} + +template +MEDCouplingNormalizedCartesianMesh::~MEDCouplingNormalizedCartesianMesh() +{ + if(_mesh) + _mesh->decrRef(); +} + +template +unsigned long MEDCouplingNormalizedCartesianMesh::getNumberOfElements() const +{ + return _mesh->getNumberOfCells(); +} + +template +unsigned long MEDCouplingNormalizedCartesianMesh::nbCellsAlongAxis(int axis) const +{ + return _mesh->getCoordsAt(axis)->getNumberOfTuples() - 1; +} + +template +const double * MEDCouplingNormalizedCartesianMesh::getCoordsAlongAxis(int axis) const +{ + return _mesh->getCoordsAt(axis)->getPointer(); +} diff --git a/src/MEDCoupling/Makefile.am b/src/MEDCoupling/Makefile.am index 9524a1064..20c460b14 100644 --- a/src/MEDCoupling/Makefile.am +++ b/src/MEDCoupling/Makefile.am @@ -33,7 +33,8 @@ MEDCouplingField.hxx MEDCouplingNormalizedUnstructuredMesh.hxx MEDCouplingMemArr MEDCouplingNormalizedUnstructuredMesh.txx MEDCouplingMemArray.txx MEDCouplingRefCountObject.hxx \ MEDCouplingCMesh.hxx MEDCouplingTimeDiscretization.hxx \ MEDCouplingFieldDiscretization.hxx MEDCouplingPointSet.hxx \ -MEDCouplingUMeshDesc.hxx MEDCouplingNatureOfField.hxx +MEDCouplingUMeshDesc.hxx MEDCouplingNatureOfField.hxx \ +MEDCouplingNormalizedCartesianMesh.hxx MEDCouplingNormalizedCartesianMesh.txx # Libraries targets -- 2.39.2