return ret.retn();
}
-void MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
+MCAuto<MEDCouplingFieldDouble> MEDFileField1TS::SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MCAuto<DataArray>& arr)
{
if(!f)
throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : input field is NULL !");
if(arr.isNull())
throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : no array !");
- DataArrayDouble *arrOutC(dynamic_cast<DataArrayDouble *>((DataArray*)arr));
- if(!arrOutC)
- throw INTERP_KERNEL::Exception("MEDFileField1TS::SetDataArrayDoubleInField : mismatch between dataArrays type and MEDFileField1TS ! Expected double !");
+ int t1,t2;
+ double t0(f->getTime(t1,t2));
+ std::string tu(f->getTimeUnit());
+ MCAuto<DataArrayDouble> arr2(DynamicCastSafe<DataArray,DataArrayDouble>(arr));
+ MCAuto<MEDCouplingFieldTemplate> ft(MEDCouplingFieldTemplate::New(*f));
+ MCAuto<MEDCouplingFieldDouble> ret(MEDCouplingFieldDouble::New(*ft));
+ ret->setTime(t0,t1,t2); ret->setArray(arr2); ret->setTimeUnit(tu);
+ return ret.retn();
+ /*DataArrayDouble *arrOutC(dynamic_cast<DataArrayDouble *>((DataArray*)arr));
f->setArray(arrOutC);
+ MCAuto<MEDCouplingFieldDouble> ret;
+ ret.takeRef(f);
+ return ret;*/
}
/*!
{
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->fieldOnMesh(this,mesh,arrOut,*contentNotNull()));
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull()));
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull()));
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
{
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNull()));
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
{
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNull()));
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()));
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
if(getFileName().empty())
throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
MCAuto<DataArray> arrOut;
- MCAuto<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull());
+ MCAuto<MEDCouplingFieldDouble> ret(contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNull()));
MCAuto<MEDCouplingFieldInt> ret2(SetDataArrayDoubleInIntField(ret,arrOut));
return ret2.retn();
}
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !");
MCAuto<DataArray> arrOut;
- MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase());
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase()));
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtTopLevel : mismatch of type of field !");
MCAuto<DataArray> arrOut;
- MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase());
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase()));
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
const MEDFileAnyTypeField1TSWithoutSDA& myF1TS(contentNotNullBase()->getTimeStepEntry(iteration,order));
MCAuto<DataArray> arrOut;
MCAuto<MEDCouplingFieldDouble> ret(myF1TS.fieldOnMesh(this,mesh,arrOut,*contentNotNullBase()));
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !");
MCAuto<DataArray> arrOut;
- MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase());
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,meshDimRelToMax,renumPol,this,mesh,arrOut,*contentNotNullBase()));
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldOnMeshAtLevel : mismatch of type of field !");
MCAuto<DataArray> arrOut;
- MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase());
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldOnMeshAtLevel(type,renumPol,this,mesh,0,0,arrOut,*contentNotNullBase()));
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!
if(!myF1TSC)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevelOld : mismatch of type of field !");
MCAuto<DataArray> arrOut;
- MCAuto<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase());
- MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
- return ret.retn();
+ MCAuto<MEDCouplingFieldDouble> ret(myF1TSC->getFieldAtLevel(type,meshDimRelToMax,mname,renumPol,this,arrOut,*contentNotNullBase()));
+ MCAuto<MEDCouplingFieldDouble> ret2(MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut));
+ return ret2.retn();
}
/*!