-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 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
const DataArray *arr=getOrCreateAndGetArray();
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : no array set !");
+ if(!arr->isAllocated())
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : the array to be written is not allocated !");
const DataArrayDouble *arrD=dynamic_cast<const DataArrayDouble *>(arr);
const DataArrayInt *arrI=dynamic_cast<const DataArrayInt *>(arr);
const unsigned char *locToWrite=0;
return arrC;
}
+MEDFileIntField1TS *MEDFileIntField1TS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+{
+ throw INTERP_KERNEL::Exception("MEDFileIntField1TS::extractPart : not implemented yet !");
+}
+
/*!
* Returns a new MEDCouplingFieldDouble of a given type lying on
* the top level cells of the first mesh in MED file. If \a this field
throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
if(!_time_steps.empty())
checkCoherencyOfTinyInfo(field,arr);
- MEDFileField1TSWithoutSDA *objC=new MEDFileField1TSWithoutSDA;
+ MEDFileAnyTypeField1TSWithoutSDA *objC=createNew1TSWithoutSDAEmptyInstance();
MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(objC);
objC->setFieldProfile(field,arr,mesh,meshDimRelToMax,profile,glob,*this);
copyTinyInfoFrom(field,arr);
return nts;
}
+/*!
+ * Return an extraction of \a this using \a extractDef map to specify the extraction.
+ * The keys of \a extractDef is level relative to max ext of \a mm mesh.
+ *
+ * \return A new object that the caller is responsible to deallocate.
+ */
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+{
+ if(!mm)
+ throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::extractPart : mesh is null !");
+ MCAuto<MEDFileAnyTypeFieldMultiTS> fmtsOut(buildNewEmpty());
+ int nbTS(getNumberOfTS());
+ for(int i=0;i<nbTS;i++)
+ {
+ MCAuto<MEDFileAnyTypeField1TS> f1ts(getTimeStepAtPos(i));
+ MCAuto<MEDFileAnyTypeField1TS> f1tsOut(f1ts->extractPart(extractDef,mm));
+ fmtsOut->pushBackTimeStep(f1tsOut);
+ }
+ return fmtsOut.retn();
+}
+
MEDFileAnyTypeFieldMultiTSIterator *MEDFileAnyTypeFieldMultiTS::iterator()
{
return new MEDFileAnyTypeFieldMultiTSIterator(this);
return static_cast<DataArrayDouble *>(contentNotNull()->getUndergroundDataArrayExt(iteration,order,entries));
}
-/*!
- * Return an extraction of \a this using \a extractDef map to specify the extraction.
- * The keys of \a extractDef is level relative to max ext of \a mm mesh.
- *
- * \return A new object that the caller is responsible to deallocate.
- */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::buildNewEmpty() const
{
- if(!mm)
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::extractPart : mesh is null !");
- MCAuto<MEDFileFieldMultiTS> fmtsOut(MEDFileFieldMultiTS::New());
- int nbTS(getNumberOfTS());
- for(int i=0;i<nbTS;i++)
- {
- MCAuto<MEDFileField1TS> f1ts(getTimeStepAtPos(i));
- MCAuto<MEDFileField1TS> f1tsOut(f1ts->extractPart(extractDef,mm));
- fmtsOut->pushBackTimeStep(f1tsOut);
- }
- return fmtsOut.retn();
+ return MEDFileFieldMultiTS::New();
}
//= MEDFileAnyTypeFieldMultiTSIterator
return static_cast<DataArrayInt *>(contentNotNull()->getUndergroundDataArray(iteration,order));
}
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::extractPart(const std::map<int, MCAuto<DataArrayInt> >& extractDef, MEDFileMesh *mm) const
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::buildNewEmpty() const
{
- throw INTERP_KERNEL::Exception("*MEDFileIntFieldMultiTS::extractPart : not implemented yet for int !");
+ return MEDFileIntFieldMultiTS::New();
}
//= MEDFileFields
int nbFields(getNumberOfFields());
for(int i=0;i<nbFields;i++)
{
- MEDFileAnyTypeFieldMultiTS *fmts(getFieldAtPos(i));
+ MCAuto<MEDFileAnyTypeFieldMultiTS> fmts(getFieldAtPos(i));
if(!fmts)
{
std::ostringstream oss; oss << "MEDFileFields::extractPart : at pos #" << i << " field is null !";