#include "MEDCouplingNatureOfField.hxx"
#include <algorithm>
+#include <sstream>
namespace ParaMEDMEM
{
{
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::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<NB_OF_POSSIBILITIES;i++)
+ {
+ oss << REPR_OF_NATUREOFFIELD[i] << "(value=" << POS_OF_NATUREOFFIELD[i] << ")";
+ if(i!=NB_OF_POSSIBILITIES-1)
+ oss << ", ";
+ }
+ return oss.str();
+ }
}
-
public:
MEDCOUPLING_EXPORT static const char *GetRepr(NatureOfField nat) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static std::string GetReprNoThrow(NatureOfField nat);
+ MEDCOUPLING_EXPORT static std::string GetAllPossibilitiesStr();
private:
static const int NB_OF_POSSIBILITIES=5;
static const char *REPR_OF_NATUREOFFIELD[NB_OF_POSSIBILITIES];