From 1e0b2e211b9db183a5d1504aa814333a5ed5762e Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 23 Sep 2010 13:09:01 +0000 Subject: [PATCH] *** empty log message *** --- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 2 + src/MEDCoupling/MEDCouplingNatureOfField.cxx | 44 ++++++++++++++++++++ src/MEDCoupling/MEDCouplingNatureOfField.hxx | 12 ++++++ src/MEDCoupling/Makefile.am | 3 +- 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/MEDCoupling/MEDCouplingNatureOfField.cxx diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index aeb69c038..80b38b919 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -22,6 +22,7 @@ #include "MEDCouplingTimeDiscretization.hxx" #include "MEDCouplingFieldDiscretization.hxx" #include "MEDCouplingAutoRefCountObjectPtr.hxx" +#include "MEDCouplingNatureOfField.hxx" #include #include @@ -81,6 +82,7 @@ std::string MEDCouplingFieldDouble::simpleRepr() const ret << "Description of field is : \"" << getDescription() << "\"\n"; ret << "FieldDouble space discretization is : " << _type->getStringRepr() << "\n"; ret << "FieldDouble time discretization is : " << _time_discr->getStringRepr() << "\n"; + ret << "FieldDouble nature of field is : " << MEDCouplingNatureOfField::getRepr(_nature) << "\n"; if(getArray()) ret << "FieldDouble default array has " << getArray()->getNumberOfComponents() << " components and " << getArray()->getNumberOfTuples() << " tuples.\n"; if(_mesh) diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.cxx b/src/MEDCoupling/MEDCouplingNatureOfField.cxx new file mode 100644 index 000000000..7969909f1 --- /dev/null +++ b/src/MEDCoupling/MEDCouplingNatureOfField.cxx @@ -0,0 +1,44 @@ +// Copyright (C) 2007-2010 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 +// + +#include "MEDCouplingNatureOfField.hxx" + +#include + +namespace ParaMEDMEM +{ + const char *MEDCouplingNatureOfField::REPR_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]= + { "NoNature", + "ConservativeVolumic", + "Integral", + "IntegralGlobConstraint", + "RevIntegral"}; + + const int MEDCouplingNatureOfField::POS_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]={17,26,32,35,37}; + + const char *MEDCouplingNatureOfField::getRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception) + { + const int *pos=std::find(POS_OF_NATUREOFFIELD,POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES,(int)nat); + if(pos==POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES) + throw INTERP_KERNEL::Exception("MEDCouplingNatureOfField::getRepr : Unrecognized nature of field !"); + int pos2=std::distance(POS_OF_NATUREOFFIELD,pos); + return REPR_OF_NATUREOFFIELD[pos2]; + } +} + diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.hxx b/src/MEDCoupling/MEDCouplingNatureOfField.hxx index 26bb01893..bdd28a6db 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfField.hxx +++ b/src/MEDCoupling/MEDCouplingNatureOfField.hxx @@ -20,6 +20,8 @@ #ifndef __PARAMEDMEM_MEDCOUPLINGNATUREOFFIELD_HXX__ #define __PARAMEDMEM_MEDCOUPLINGNATUREOFFIELD_HXX__ +#include "InterpKernelException.hxx" + namespace ParaMEDMEM { typedef enum @@ -30,6 +32,16 @@ namespace ParaMEDMEM IntegralGlobConstraint = 35, RevIntegral = 37 } NatureOfField; + + class MEDCouplingNatureOfField + { + public: + static const char *getRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception); + private: + static const int NB_OF_POSSIBILITIES=5; + static const char *REPR_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]; + static const int POS_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]; + }; } #endif diff --git a/src/MEDCoupling/Makefile.am b/src/MEDCoupling/Makefile.am index ca9dd5295..28553f288 100644 --- a/src/MEDCoupling/Makefile.am +++ b/src/MEDCoupling/Makefile.am @@ -47,7 +47,8 @@ dist_libmedcoupling_la_SOURCES = \ MEDCouplingCMesh.cxx MEDCouplingTimeDiscretization.cxx \ MEDCouplingFieldDiscretization.cxx MEDCouplingRefCountObject.cxx \ MEDCouplingPointSet.cxx MEDCouplingUMeshDesc.cxx \ - MEDCouplingExtrudedMesh.cxx MEDCouplingMesh.cxx MEDCouplingGaussLocalization.cxx + MEDCouplingExtrudedMesh.cxx MEDCouplingMesh.cxx MEDCouplingGaussLocalization.cxx \ + MEDCouplingNatureOfField.cxx libmedcoupling_la_LDFLAGS= -- 2.39.2