X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingNatureOfField.cxx;h=d3702d0bff1dc8e7970777bea7a08495e3422ead;hb=90b7c9c73054965b8085ab0ecd2646a3d59f475a;hp=7a1161848418b64fa3b2eb69e3aadf3eec04ec05;hpb=afaa18a980c8c9bd0e48b95c6aa7acf7a6161e1a;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.cxx b/src/MEDCoupling/MEDCouplingNatureOfField.cxx index 7a1161848..d3702d0bf 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfField.cxx +++ b/src/MEDCoupling/MEDCouplingNatureOfField.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 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. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,25 +21,50 @@ #include "MEDCouplingNatureOfField.hxx" #include +#include -namespace ParaMEDMEM +namespace MEDCoupling { const char *MEDCouplingNatureOfField::REPR_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES]= - { "NoNature", - "ConservativeVolumic", - "Integral", - "IntegralGlobConstraint", - "RevIntegral"}; - + { "NoNature", + "IntensiveMaximum", + "ExtensiveMaximum", + "ExtensiveConservation", + "IntensiveConservation"}; + 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 char *MEDCouplingNatureOfField::GetRepr(NatureOfField nat) { 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 !"); + { + std::ostringstream oss; oss << "MEDCouplingNatureOfField::getRepr : Unrecognized nature of field ! "; + oss << GetAllPossibilitiesStr() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } std::size_t pos2=std::distance(POS_OF_NATUREOFFIELD,pos); return REPR_OF_NATUREOFFIELD[pos2]; } + + std::string MEDCouplingNatureOfField::GetReprNoThrow(NatureOfField nat) + { + const int *pos=std::find(POS_OF_NATUREOFFIELD,POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES,(int)nat); + if(pos==POS_OF_NATUREOFFIELD+NB_OF_POSSIBILITIES) + return std::string("Unrecognized nature of field !"); + std::size_t pos2=std::distance(POS_OF_NATUREOFFIELD,pos); + return std::string(REPR_OF_NATUREOFFIELD[pos2]); + } + + std::string MEDCouplingNatureOfField::GetAllPossibilitiesStr() + { + std::ostringstream oss; oss << "Possibilities are : "; + for(int i=0;i