X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingNatureOfField.cxx;h=96cf475a8159fe7d22cf7c3746f086e50ab24790;hb=0c9d48870957c4a9f6f82fc8e2c569780a5f886b;hp=8344d7588bb6c3f81311695901d3b6eb20db35f8;hpb=94d102d362379da8b0dc676e72a7af0a0a0af49a;p=modules%2Fmed.git diff --git a/src/MEDCoupling/MEDCouplingNatureOfField.cxx b/src/MEDCoupling/MEDCouplingNatureOfField.cxx index 8344d7588..96cf475a8 100644 --- a/src/MEDCoupling/MEDCouplingNatureOfField.cxx +++ b/src/MEDCoupling/MEDCouplingNatureOfField.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2013 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 @@ -16,10 +16,12 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// Author : Anthony Geay (CEA/DEN) #include "MEDCouplingNatureOfField.hxx" #include +#include namespace ParaMEDMEM { @@ -32,13 +34,37 @@ namespace ParaMEDMEM 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