throw INTERP_KERNEL::Exception("Representation does not match with any field discretization !");
}
+std::string MEDCouplingFieldDiscretization::GetTypeOfFieldRepr(TypeOfField type)
+{
+ if(type==MEDCouplingFieldDiscretizationP0::TYPE)
+ return MEDCouplingFieldDiscretizationP0::REPR;
+ if(type==MEDCouplingFieldDiscretizationP1::TYPE)
+ return MEDCouplingFieldDiscretizationP1::REPR;
+ if(type==MEDCouplingFieldDiscretizationGauss::TYPE)
+ return MEDCouplingFieldDiscretizationGauss::REPR;
+ if(type==MEDCouplingFieldDiscretizationGaussNE::TYPE)
+ return MEDCouplingFieldDiscretizationGaussNE::REPR;
+ if(type==MEDCouplingFieldDiscretizationKriging::TYPE)
+ return MEDCouplingFieldDiscretizationKriging::REPR;
+ throw INTERP_KERNEL::Exception("GetTypeOfFieldRepr : Representation does not match with any field discretization !");
+}
+
bool MEDCouplingFieldDiscretization::isEqual(const MEDCouplingFieldDiscretization *other, double eps) const
{
std::string reason;
MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr);
+ MEDCOUPLING_EXPORT static std::string GetTypeOfFieldRepr(TypeOfField type);
MEDCOUPLING_EXPORT virtual TypeOfField getEnum() const = 0;
MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const;
MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const = 0;
#include "MEDFileField.hxx"
#include "MEDFileMesh.hxx"
+#include "MEDCouplingFieldDiscretization.hxx"
#include "CellModel.hxx"
using namespace ParaMEDMEM;
if(_pfl->getName().empty())
{
if(nbOfEntity!=(_start_end.second-_start_end.first)/nip)
- throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Mismatch between number of entities and size of node field !");
+ throw INTERP_KERNEL::Exception("MEDFileField1TSStructItem2::checkInRange : Mismatch between number of entities and size of field !");
return ;
}
else
}
}
MEDFileField1TSStructItem ret(atype,anItems);
- ret.checkWithMeshStruct(meshSt,ref);
+ try
+ {
+ ret.checkWithMeshStruct(meshSt,ref);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ std::ostringstream oss; oss << e.what() << " (" << MEDCouplingFieldDiscretization::GetTypeOfFieldRepr(ret.getType()) << ")";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
return ret;
}
for(int i=0;i<nbPts;i++)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> elt=ref->getTimeStepAtPos(i);
- _f1ts_cmps[i]=MEDFileField1TSStruct::New(elt,_mesh_comp);
- _f1ts_cmps[i]->checkWithMeshStruct(_mesh_comp,elt);
+ try
+ {
+ _f1ts_cmps[i]=MEDFileField1TSStruct::New(elt,_mesh_comp);
+ _f1ts_cmps[i]->checkWithMeshStruct(_mesh_comp,elt);
+ }
+ catch(INTERP_KERNEL::Exception& e)
+ {
+ std::ostringstream oss; oss << "Problem in field with name \"" << ref->getName() << "\"" << std::endl;
+ oss << "More Details : " << e.what();
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
}
}