+ std::ostringstream oss;
+ oss << "In file \"" << fileName << "\" field \"" << fieldName << "\" exists but with more than one time steps !" << std::endl;
+ oss << "You are invited to use ReadField(fileName, fieldName, iteration, order) instead to avoid misleading concerning time steps." << std::endl;
+ oss << "For information, time steps available for field \"" << fieldName << "\" are :" << std::endl;
+ for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator it=iterations.begin();it!=iterations.end();it++)
+ oss << " - " << (*it).first.first << ", " << (*it).first.second << " (" << (*it).second << ")" << std::endl;
+ throw INTERP_KERNEL::Exception(oss.str());
+ }
+ return ReadField(fileName,fieldName,iterations[0].first.first,iterations[0].first.second);
+}
+
+MCAuto<MEDCoupling::MEDCouplingField> MEDCoupling::ReadField(const std::string& fileName, const std::string& fieldName, int iteration, int order)
+{
+ MCAuto<MEDFileAnyTypeField1TS> f(MEDFileAnyTypeField1TS::New(fileName,fieldName,iteration,order));
+ MCAuto<MEDFileMesh> mesh(MEDFileMesh::New(fileName,f->getMeshName()));
+ {
+ MCAuto<MEDFileField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileField1TS>(f));
+ if(f1.isNotNull())
+ {
+ MCAuto<MEDCoupling::MEDCouplingFieldDouble> ret(f1->field(mesh));
+ return MEDCoupling::DynamicCast<MEDCouplingFieldDouble,MEDCouplingField>(ret);
+ }
+ }
+ {
+ MCAuto<MEDFileInt32Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt32Field1TS>(f));
+ if(f1.isNotNull())
+ {
+ MCAuto<MEDCoupling::MEDCouplingFieldInt32> ret(f1->field(mesh));
+ return MEDCoupling::DynamicCast<MEDCouplingFieldInt32,MEDCouplingField>(ret);
+ }
+ }
+ {
+ MCAuto<MEDFileFloatField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileFloatField1TS>(f));
+ if(f1.isNotNull())
+ {
+ MCAuto<MEDCoupling::MEDCouplingFieldFloat> ret(f1->field(mesh));
+ return MEDCoupling::DynamicCast<MEDCouplingFieldFloat,MEDCouplingField>(ret);
+ }
+ }
+ throw INTERP_KERNEL::Exception("MEDCoupling::ReadField : only FLOAT32, FLOAT64 and INT32 supported for the moment !");
+}
+
+MCAuto<MEDCoupling::MEDCouplingField> MEDCoupling::ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
+{
+ MEDCoupling::CheckFileForRead(fileName);
+ switch(type)
+ {