{
case ON_CELLS:
{
- getArray()->setContigPartOfSelectedValues2(_start,arrr,offset,offset+nbOfCells,1);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,offset,offset+nbOfCells,1);
_end=_start+nbOfCells;
_nval=nbOfCells;
break;
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr=field->getDiscretization()->getOffsetArr(field->getMesh());
const int *arrPtr=arr->getConstPointer();
- getArray()->setContigPartOfSelectedValues2(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,arrPtr[offset],arrPtr[offset+nbOfCells],1);
_end=_start+(arrPtr[offset+nbOfCells]-arrPtr[offset]);
_nval=nbOfCells;
break;
}
std::ostringstream oss2; oss2 << "Loc_" << nasc.getName() << "_" << INTERP_KERNEL::CellModel::GetCellModel(getGeoType()).getRepr() << "_" << _loc_id;
_localization=oss2.str();
- getArray()->setContigPartOfSelectedValues(_start,arrr,da4);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,da4);
_end=_start+_nval*nbi;
glob.appendLoc(_localization.c_str(),getGeoType(),gsLoc.getRefCoords(),gsLoc.getGaussCoords(),gsLoc.getWeights());
break;
case ON_NODES:
{
_nval=idsInPfl->getNumberOfTuples();
- getArray()->setContigPartOfSelectedValues2(_start,arrr,0,arrr->getNumberOfTuples(),1);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,arrr->getNumberOfTuples(),1);
_end=_start+_nval;
break;
}
case ON_CELLS:
{
_nval=idsInPfl->getNumberOfTuples();
- getArray()->setContigPartOfSelectedValues(_start,arrr,idsInPfl);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,idsInPfl);
_end=_start+_nval;
break;
}
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=idsInPfl->buildExplicitArrByRanges(arr3);
int trueNval=tmp->getNumberOfTuples();
_nval=idsInPfl->getNumberOfTuples();
- getArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
_end=_start+trueNval;
break;
}
*tmpPtr++=j;
//
_nval=da4->getNumberOfTuples();
- getArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues(_start,arrr,tmp);
_end=_start+trueNval;
oss << "_loc_" << _loc_id;
if(locIds)
{
_start=start;
_nval=arrr->getNumberOfTuples();
- getArray()->setContigPartOfSelectedValues2(_start,arrr,0,_nval,1);
+ getOrCreateAndGetArray()->setContigPartOfSelectedValues2(_start,arrr,0,_nval,1);
_end=_start+_nval;
start=_end;
}
return _father;
}
-void MEDFileFieldPerMeshPerTypePerDisc::prepareLoading(med_idt fid, int profileIt, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::loadOnlyStructureOfDataRecursively(med_idt fid, int profileIt, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
{
INTERP_KERNEL::AutoPtr<char> locname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> pflname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
}
}
-void MEDFileFieldPerMeshPerTypePerDisc::finishLoading(med_idt fid, int profileIt, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerTypePerDisc::loadBigArray(med_idt fid, int profileIt, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
{
std::string fieldName=nasc.getName();
std::string meshName=getMeshName();
INTERP_KERNEL::NormalizedCellType geoType=getGeoType();
med_geometry_type mgeoti;
med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti);
- DataArray *arr=getArray();
+ if(_start>_end)
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : internal error in range !");
+ if(_start==_end)
+ return ;
+ DataArray *arr=getOrCreateAndGetArray();//arr is not null due to the spec of getOrCreateAndGetArray
+ if(_start<0 || _start>=arr->getNumberOfTuples())
+ {
+ std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(_end<0 || _end>arr->getNumberOfTuples())
+ {
+ std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : Invalid start ("<< _start << ") regarding admissible range of allocated array [0," << arr->getNumberOfTuples() << "] !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ med_int tmp1,nbi;
+ INTERP_KERNEL::AutoPtr<char> locname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_int nbValsInFile=MEDfieldnValueWithProfileByName(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile.c_str(),MED_COMPACT_PFLMODE,&tmp1,locname,&nbi);
+ int nbOfCompo=arr->getNumberOfComponents();
+ if(_end-_start!=nbValsInFile*nbi)
+ {
+ std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::loadBigArray : The number of tuples to read is " << nbValsInFile << "*" << nbi << " (nb integration points) ! But in data structure it values " << _end-_start << " is expected !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
DataArrayDouble *arrD=dynamic_cast<DataArrayDouble *>(arr);
if(arrD)
{
- double *startFeeding=arrD->getPointer()+_start*arrD->getNumberOfComponents();
+ double *startFeeding=arrD->getPointer()+_start*nbOfCompo;
MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,
_profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,reinterpret_cast<unsigned char*>(startFeeding));
return ;
DataArrayInt *arrI=dynamic_cast<DataArrayInt *>(arr);
if(arrI)
{
- int *startFeeding=arrI->getPointer()+_start*arrI->getNumberOfComponents();
+ int *startFeeding=arrI->getPointer()+_start*nbOfCompo;
MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,
_profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,reinterpret_cast<unsigned char*>(startFeeding));
return ;
return _end-_start;
}
-DataArray *MEDFileFieldPerMeshPerTypePerDisc::getArray()
-{
- return _father->getArray();
-}
-
-const DataArray *MEDFileFieldPerMeshPerTypePerDisc::getArray() const
-{
- const MEDFileFieldPerMeshPerType *fath=_father;
- return fath->getArray();
-}
-
-DataArrayDouble *MEDFileFieldPerMeshPerTypePerDisc::getArrayDouble()
+DataArray *MEDFileFieldPerMeshPerTypePerDisc::getOrCreateAndGetArray()
{
- return _father->getArrayDouble();
+ return _father->getOrCreateAndGetArray();
}
-const DataArrayDouble *MEDFileFieldPerMeshPerTypePerDisc::getArrayDouble() const
+const DataArray *MEDFileFieldPerMeshPerTypePerDisc::getOrCreateAndGetArray() const
{
const MEDFileFieldPerMeshPerType *fath=_father;
- return fath->getArrayDouble();
+ return fath->getOrCreateAndGetArray();
}
const std::vector<std::string>& MEDFileFieldPerMeshPerTypePerDisc::getInfo() const
INTERP_KERNEL::NormalizedCellType geoType=getGeoType();
med_geometry_type mgeoti;
med_entity_type menti=MEDFileFieldPerMeshPerType::ConvertIntoMEDFileType(type,geoType,mgeoti);
- const DataArray *arr=getArray();
+ const DataArray *arr=getOrCreateAndGetArray();
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : no array set !");
const DataArrayDouble *arrD=dynamic_cast<const DataArrayDouble *>(arr);
return _father->getNumberOfComponents();
}
-DataArray *MEDFileFieldPerMeshPerType::getArray()
+DataArray *MEDFileFieldPerMeshPerType::getOrCreateAndGetArray()
{
- return _father->getArray();
-}
-
-const DataArray *MEDFileFieldPerMeshPerType::getArray() const
-{
- const MEDFileFieldPerMesh *fath=_father;
- return fath->getArray();
-}
-
-DataArrayDouble *MEDFileFieldPerMeshPerType::getArrayDouble()
-{
- return _father->getArrayDouble();
+ return _father->getOrCreateAndGetArray();
}
-const DataArrayDouble *MEDFileFieldPerMeshPerType::getArrayDouble() const
+const DataArray *MEDFileFieldPerMeshPerType::getOrCreateAndGetArray() const
{
const MEDFileFieldPerMesh *fath=_father;
- return fath->getArrayDouble();
+ return fath->getOrCreateAndGetArray();
}
const std::vector<std::string>& MEDFileFieldPerMeshPerType::getInfo() const
}
}
-void MEDFileFieldPerMeshPerType::prepareLoading(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::loadOnlyStructureOfDataRecursively(med_idt fid, int &start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
{
int pflId=0;
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,pflId++)
{
- (*it)->prepareLoading(fid,pflId+1,start,nasc);//tony
+ (*it)->loadOnlyStructureOfDataRecursively(fid,pflId+1,start,nasc);//tony
}
}
-void MEDFileFieldPerMeshPerType::finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMeshPerType::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
{
int pflId=0;
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldPerMeshPerTypePerDisc> >::iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,pflId++)
{
- (*it)->finishLoading(fid,pflId+1,nasc);//tony
+ (*it)->loadBigArray(fid,pflId+1,nasc);//tony
}
}
_field_pm_pt[pos]->assignNodeFieldProfile(start,pfl,field,arr,glob,nasc);
}
-void MEDFileFieldPerMesh::prepareLoading(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::loadOnlyStructureOfDataRecursively(med_idt fid, int& start, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
{
for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
- (*it)->prepareLoading(fid,start,nasc);
+ (*it)->loadOnlyStructureOfDataRecursively(fid,start,nasc);
}
-void MEDFileFieldPerMesh::finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+void MEDFileFieldPerMesh::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
{
for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
- (*it)->finishLoading(fid,nasc);
+ (*it)->loadBigArraysRecursively(fid,nasc);
}
void MEDFileFieldPerMesh::writeLL(med_idt fid, const MEDFileFieldNameScope& nasc) const throw(INTERP_KERNEL::Exception)
return _father->getNumberOfComponents();
}
-DataArray *MEDFileFieldPerMesh::getArray()
+DataArray *MEDFileFieldPerMesh::getOrCreateAndGetArray()
{
if(!_father)
- throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArray : no father ! internal error !");
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getOrCreateAndGetArray : no father ! internal error !");
return _father->getOrCreateAndGetArray();
}
-const DataArray *MEDFileFieldPerMesh::getArray() const
+const DataArray *MEDFileFieldPerMesh::getOrCreateAndGetArray() const
{
if(!_father)
- throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArray : no father ! internal error !");
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getOrCreateAndGetArray : no father ! internal error !");
return _father->getOrCreateAndGetArray();
}
-DataArrayDouble *MEDFileFieldPerMesh::getArrayDouble()
-{
- MEDFileField1TSWithoutSDA *fatherC=dynamic_cast<MEDFileField1TSWithoutSDA *>(_father);
- if(!fatherC)
- throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArrayDouble : Expected to be called on double array !");
- return fatherC->getOrCreateAndGetArrayDouble();
-}
-
-const DataArrayDouble *MEDFileFieldPerMesh::getArrayDouble() const
-{
- const MEDFileField1TSWithoutSDA *fatherC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(_father);
- if(!fatherC)
- throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::getArrayDouble : Expected to be called on double array !");
- return fatherC->getOrCreateAndGetArrayDouble();
-}
-
const std::vector<std::string>& MEDFileFieldPerMesh::getInfo() const
{
return _father->getInfo();
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> entriesKept;
std::vector< const MEDFileFieldPerMeshPerTypePerDisc *> otherEntries;
getUndergroundDataArrayExt(entries);
- DataArrayDouble *arr=getArrayDouble();
+ DataArray *arr0=getOrCreateAndGetArray();//tony
+ if(!arr0)
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values of field is null !");
+ DataArrayDouble *arr=dynamic_cast<DataArrayDouble *>(arr0);//tony
+ if(!arr0)
+ throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArray storing values is double ! Not managed for the moment !");
int sz=0;
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh : DataArrayDouble storing values of field is null !");
isPfl=false;
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(type,ONE_TIME);
ret->setMesh(mesh); ret->setName(nasc.getName().c_str()); ret->setTime(getTime(),getIteration(),getOrder()); ret->setTimeUnit(nasc.getDtUnit().c_str());
- MEDCouplingAutoRefCountObjectPtr<DataArray> da=getArray()->selectByTupleRanges(dads);
+ MEDCouplingAutoRefCountObjectPtr<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
const std::vector<std::string>& infos=getInfo();
da->setInfoOnComponents(infos);
da->setName("");
pflOut->incrRef();
}
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> safePfl(pflOut);
- MEDCouplingAutoRefCountObjectPtr<DataArray> da=getArray()->selectByTupleRanges(dads);
+ MEDCouplingAutoRefCountObjectPtr<DataArray> da=getOrCreateAndGetArray()->selectByTupleRanges(dads);
const std::vector<std::string>& infos=getInfo();
int nbOfComp=infos.size();
for(int i=0;i<nbOfComp;i++)
return ret;
}
-MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit)
+MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit),_nb_of_tuples_to_be_allocated(-2)
{
}
-MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA():_iteration(-1),_order(-1),_dt(0.),_csit(-1)
+MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA():_iteration(-1),_order(-1),_dt(0.),_csit(-1),_nb_of_tuples_to_be_allocated(-1)
{
}
_field_per_mesh[0]->writeLL(fid,nasc);
}
-void MEDFileAnyTypeField1TSWithoutSDA::finishLoading(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+/*!
+ * This methods returns true is the allocation has been needed leading to a modification of state in \a this->_nb_of_tuples_to_be_allocated.
+ * If false is returned the memory allocation is not required.
+ */
+bool MEDFileAnyTypeField1TSWithoutSDA::allocIfNecessaryTheArrayToReceiveDataFromFile() throw(INTERP_KERNEL::Exception)
+{
+ if(_nb_of_tuples_to_be_allocated>=0)
+ {
+ getOrCreateAndGetArray()->alloc(_nb_of_tuples_to_be_allocated,getNumberOfComponents());
+ _nb_of_tuples_to_be_allocated=-2;
+ return true;
+ }
+ if(_nb_of_tuples_to_be_allocated==-2 || _nb_of_tuples_to_be_allocated==-3)
+ return false;
+ if(_nb_of_tuples_to_be_allocated==-1)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocIfNecessaryTheArrayToReceiveDataFromFile : trying to read from a file an empty instance ! Need to prepare the structure before !");
+ if(_nb_of_tuples_to_be_allocated<-3)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocIfNecessaryTheArrayToReceiveDataFromFile : internal error !");
+
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::loadOnlyStructureOfDataRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
{
med_int numdt,numit;
med_float dt;
MEDfieldComputingStepInfo(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt);
MEDfield23ComputingStepMeshInfo(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit);
if(_iteration!=numdt || _order!=numit)
- throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::finishLoading : unexpected exception internal error !");
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively : unexpected exception internal error !");
_field_per_mesh.resize(nmesh);
for(int i=0;i<nmesh;i++)
_field_per_mesh[i]=MEDFileFieldPerMesh::NewOnRead(fid,this,i+1,meshnumdt,meshnumit,nasc);//tony
- int start=0;
- for(int i=0;i<nmesh;i++)
- {
- _field_per_mesh[i]->prepareLoading(fid,start,nasc);
- }
- getOrCreateAndGetArray()->alloc(start,getNumberOfComponents());
+ _nb_of_tuples_to_be_allocated=0;
for(int i=0;i<nmesh;i++)
+ _field_per_mesh[i]->loadOnlyStructureOfDataRecursively(fid,_nb_of_tuples_to_be_allocated,nasc);
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+{
+ allocIfNecessaryTheArrayToReceiveDataFromFile();
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->loadBigArraysRecursively(fid,nasc);
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+{
+ if(allocIfNecessaryTheArrayToReceiveDataFromFile())
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ (*it)->loadBigArraysRecursively(fid,nasc);
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::loadStructureAndBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+{
+ loadOnlyStructureOfDataRecursively(fid,nasc);
+ loadBigArraysRecursively(fid,nasc);
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::releaseArrays() throw(INTERP_KERNEL::Exception)
+{
+ DataArray *thisArr(getUndergroundDataArray());
+ if(thisArr && thisArr->isAllocated())
{
- _field_per_mesh[i]->finishLoading(fid,nasc);
+ _nb_of_tuples_to_be_allocated=thisArr->getNumberOfTuples();
+ thisArr->desallocate();
}
}
}
}
+/*!
+ * \param [in] newNbOfTuples - The new nb of tuples to be allocated.
+ */
+void MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile(int newNbOfTuples) throw(INTERP_KERNEL::Exception)
+{
+ if(_nb_of_tuples_to_be_allocated>=0)
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::allocNotFromFile : the object is expected to be appended to a data coming from a file but not loaded ! Load before appending data !");
+ DataArray *arr(getOrCreateAndGetArray());
+ arr->alloc(newNbOfTuples,arr->getNumberOfComponents());
+ _nb_of_tuples_to_be_allocated=-3;
+}
+
/*!
* Copies tiny info and allocates \a this->_arr instance of DataArrayDouble to
* append data of a given MEDCouplingFieldDouble. So that the size of \a this->_arr becomes
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : unsupported fields with no name in MED file !");
if(!arr)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : no array set !");
+ if(!arr->isAllocated())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : array is not allocated !");
_dt=field->getTime(_iteration,_order);
int nbOfComponents=arr->getNumberOfComponents();
getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(arr->getInfoOnComponents());
if(!getOrCreateAndGetArray()->isAllocated())
{
- getOrCreateAndGetArray()->alloc(arr->getNumberOfTuples(),arr->getNumberOfComponents());
+ allocNotFromFile(arr->getNumberOfTuples());
return 0;
}
else
{
int oldNbOfTuples=getOrCreateAndGetArray()->getNumberOfTuples();
int newNbOfTuples=oldNbOfTuples+arr->getNumberOfTuples();
- MEDCouplingAutoRefCountObjectPtr<DataArray> tmp=createNewEmptyDataArrayInstance();
- tmp->alloc(newNbOfTuples,nbOfComponents);
- tmp->copyStringInfoFrom(*getOrCreateAndGetArray());
- DataArray *arrr=getOrCreateAndGetArray();
- tmp->setContigPartOfSelectedValues2(0,arrr,0,oldNbOfTuples,1);
- setArray(tmp);
+ getOrCreateAndGetArray()->reAlloc(newNbOfTuples);
+ _nb_of_tuples_to_be_allocated=-3;
return oldNbOfTuples;
}
}
void MEDFileField1TSWithoutSDA::setArray(DataArray *arr) throw(INTERP_KERNEL::Exception)
{
if(!arr)
- _arr=0;
+ {
+ _nb_of_tuples_to_be_allocated=-1;
+ _arr=0;
+ return ;
+ }
DataArrayDouble *arrC=dynamic_cast<DataArrayDouble *>(arr);
if(!arrC)
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::setArray : the input not null array is not of type DataArrayDouble !");
+ else
+ _nb_of_tuples_to_be_allocated=-3;
arrC->incrRef();
_arr=arrC;
}
void MEDFileIntField1TSWithoutSDA::setArray(DataArray *arr) throw(INTERP_KERNEL::Exception)
{
if(!arr)
- _arr=0;
+ {
+ _nb_of_tuples_to_be_allocated=-1;
+ _arr=0;
+ return ;
+ }
DataArrayInt *arrC=dynamic_cast<DataArrayInt *>(arr);
if(!arrC)
throw INTERP_KERNEL::Exception("MEDFileIntField1TSWithoutSDA::setArray : the input not null array is not of type DataArrayInt !");
+ else
+ _nb_of_tuples_to_be_allocated=-3;
arrC->incrRef();
_arr=arrC;
}
//= MEDFileAnyTypeField1TS
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
med_field_type typcha;
//
MEDfieldComputingStepInfo(fid,fieldName.c_str(),1,&numdt,&numit,&dt);
ret->setTime(numdt,numit,dt);
ret->_csit=1;
- ret->finishLoading(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+ if(loadAll)
+ ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+ else
+ ret->loadOnlyStructureOfDataRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
return ret.retn();
}
-MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldGlobsReal(fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- _content=BuildContentFrom(fid,fileName);
+ _content=BuildContentFrom(fid,fileName,loadAll);
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
throw e;
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
med_field_type typcha;
std::vector<std::string> infos;
MEDfieldComputingStepInfo(fid,fieldName,1,&numdt,&numit,&dt);
ret->setTime(numdt,numit,dt);
ret->_csit=1;
- ret->finishLoading(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+ if(loadAll)
+ ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+ else
+ ret->loadOnlyStructureOfDataRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
return ret.retn();
}
-MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldGlobsReal(fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- _content=BuildContentFrom(fid,fileName,fieldName);
+ _content=BuildContentFrom(fid,fileName,fieldName,loadAll);
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
}
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,loadAll);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) throw(INTERP_KERNEL::Exception)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,iteration,order);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) throw(INTERP_KERNEL::Exception)
{
med_field_type typcha;
std::vector<std::string> infos;
oss << "(" << (*iter).first << "," << (*iter).second << "), ";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- ret->finishLoading(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+ if(loadAll)
+ ret->loadStructureAndBigArraysRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
+ else
+ ret->loadOnlyStructureOfDataRecursively(fid,*((const MEDFileAnyTypeField1TSWithoutSDA*)ret));
return ret.retn();
}
-MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldGlobsReal(fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- _content=BuildContentFrom(fid,fileName,fieldName,iteration,order);
+ _content=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll);
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
writeLL(fid);
}
+/*!
+ * This method alloc the arrays and load potentially huge arrays contained in this field.
+ * This method should be called when a MEDFileAnyTypeField1TS::New constructor has been with false as the last parameter.
+ * This method can be also called to refresh or reinit values from a file.
+ *
+ * \throw If the fileName is not set or points to a non readable MED file.
+ * \sa MEDFileAnyTypeField1TS::loadArraysIfNecessary
+ */
+void MEDFileAnyTypeField1TS::loadArrays() throw(INTERP_KERNEL::Exception)
+{
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+ contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
+}
+
+/*!
+ * This method behaves as MEDFileAnyTypeField1TS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
+ * But once data loaded once, this method does nothing.
+ *
+ * \throw If the fileName is not set or points to a non readable MED file.
+ * \sa MEDFileAnyTypeField1TS::loadArrays, MEDFileAnyTypeField1TS::releaseArrays
+ */
+void MEDFileAnyTypeField1TS::loadArraysIfNecessary() throw(INTERP_KERNEL::Exception)
+{
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+ contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+}
+
+/*!
+ * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
+ * This method does not release arrays set outside the context of a MED file.
+ *
+ * \sa MEDFileAnyTypeField1TS::loadArrays, MEDFileAnyTypeField1TS::loadArraysIfNecessary
+ */
+void MEDFileAnyTypeField1TS::releaseArrays() throw(INTERP_KERNEL::Exception)
+{
+ contentNotNullBase()->releaseArrays();
+}
+
void MEDFileAnyTypeField1TS::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
{
int nbComp=getNumberOfComponents();
* is to delete this field using decrRef() as it is no more needed.
* \throw If reading the file fails.
*/
-MEDFileField1TS *MEDFileField1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileField1TS *MEDFileField1TS::New(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,loadAll);
ret->contentNotNull();
return ret.retn();
}
* \throw If reading the file fails.
* \throw If there is no field named \a fieldName in the file.
*/
-MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName,loadAll);
ret->contentNotNull();
return ret.retn();
}
* \throw If there is no field named \a fieldName in the file.
* \throw If the required time step is missing from the file.
*/
-MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName,iteration,order);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll);
ret->contentNotNull();
return ret.retn();
}
return arrOutC;
}
-MEDFileField1TS::MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeField1TS(fileName)
+MEDFileField1TS::MEDFileField1TS(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeField1TS(fileName,fieldName)
+MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order)
+MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
return ret.retn();
}
-MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,loadAll);
ret->contentNotNull();
return ret.retn();
}
-MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName,loadAll);
ret->contentNotNull();
return ret.retn();
}
-MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName,iteration,order);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll);
ret->contentNotNull();
return ret.retn();
}
_content=new MEDFileIntField1TSWithoutSDA;
}
-MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeField1TS(fileName)
+MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeField1TS(fileName,fieldName)
+MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order)
+MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
/*!
* \param [in] fieldId field id in C mode
*/
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll) throw(INTERP_KERNEL::Exception)
{
med_field_type typcha;
std::string dtunitOut;
int nbOfStep=MEDFileAnyTypeField1TS::LocateField2(fid,"",fieldId,false,_name,typcha,_infos,dtunitOut);
setDtUnit(dtunitOut.c_str());
- finishLoading(fid,nbOfStep,typcha);
+ loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll);
}
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldNameScope(fieldName),_infos(infos)
{
setDtUnit(dtunit.c_str());
- finishLoading(fid,nbOfStep,fieldTyp);
+ loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,fieldTyp,loadAll);
}
catch(INTERP_KERNEL::Exception& e)
{
}
}
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::finishLoading(med_idt fid, int nbPdt, med_field_type fieldTyp) throw(INTERP_KERNEL::Exception)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll) throw(INTERP_KERNEL::Exception)
{
_time_steps.resize(nbPdt);
for(int i=0;i<nbPdt;i++)
break;
}
default:
- throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::finishLoading : managed field type are : FLOAT64, INT32 !");
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32 !");
}
- _time_steps[i]->finishLoading(fid,*this);
+ if(loadAll)
+ _time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this);
+ else
+ _time_steps[i]->loadOnlyStructureOfDataRecursively(fid,*this);
}
}
_time_steps[i]->writeLL(fid,opts,*this);
}
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+ if(elt)
+ elt->loadBigArraysRecursively(fid,nasc);
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::loadBigArraysRecursivelyIfNecessary(med_idt fid, const MEDFileFieldNameScope& nasc) throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+ if(elt)
+ elt->loadBigArraysRecursivelyIfNecessary(fid,nasc);
+ }
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::releaseArrays() throw(INTERP_KERNEL::Exception)
+{
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ {
+ MEDFileAnyTypeField1TSWithoutSDA *elt(*it);
+ if(elt)
+ elt->releaseArrays();
+ }
+}
+
int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNumberOfTS() const
{
return _time_steps.size();
//= MEDFileFieldMultiTSWithoutSDA
-MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit);
+ return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll);
}
MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA()
/*!
* \param [in] fieldId field id in C mode
*/
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId)
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit)
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{
}
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldGlobsReal(fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- _content=BuildContentFrom(fid,fileName);
+ _content=BuildContentFrom(fid,fileName,loadAll);
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
throw e;
}
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
med_field_type typcha;
std::vector<std::string> infos;
{
case MED_FLOAT64:
{
- ret=new MEDFileFieldMultiTSWithoutSDA(fid,i);
+ ret=new MEDFileFieldMultiTSWithoutSDA(fid,i,loadAll);
break;
}
case MED_INT32:
{
- ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i);
+ ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i,loadAll);
break;
}
default:
return ret.retn();
}
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
med_field_type typcha;
//
{
case MED_FLOAT64:
{
- ret=new MEDFileFieldMultiTSWithoutSDA(fid,0);
+ ret=new MEDFileFieldMultiTSWithoutSDA(fid,0,loadAll);
break;
}
case MED_INT32:
{
- ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0);
+ ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0,loadAll);
break;
}
default:
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
}
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldGlobsReal(fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- _content=BuildContentFrom(fid,fileName,fieldName);
+ _content=BuildContentFrom(fid,fileName,fieldName,loadAll);
loadGlobals(fid);
}
catch(INTERP_KERNEL::Exception& e)
//= MEDFileIntFieldMultiTSWithoutSDA
-MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit);
+ return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll);
}
MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA()
{
}
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit)
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
/*!
* \param [in] fieldId field id in C mode
*/
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId)
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
* is to delete this field using decrRef() as it is no more needed.
* \throw If reading the file fails.
*/
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
* \throw If reading the file fails.
* \throw If there is no field named \a fieldName in the file.
*/
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
MEDFileUtilities::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,loadAll);
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
ret->loadGlobals(fid);
return ret.retn();
writeLL(fid);
}
+/*!
+ * This method alloc the arrays and load potentially huge arrays contained in this field.
+ * This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
+ * This method can be also called to refresh or reinit values from a file.
+ *
+ * \throw If the fileName is not set or points to a non readable MED file.
+ */
+void MEDFileAnyTypeFieldMultiTS::loadArrays() throw(INTERP_KERNEL::Exception)
+{
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+ contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
+}
+
+/*!
+ * This method behaves as MEDFileAnyTypeFieldMultiTS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
+ * But once data loaded once, this method does nothing.
+ *
+ * \throw If the fileName is not set or points to a non readable MED file.
+ * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::releaseArrays
+ */
+void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary() throw(INTERP_KERNEL::Exception)
+{
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+ contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+}
+
+/*!
+ * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
+ * This method does not release arrays set outside the context of a MED file.
+ *
+ * \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary
+ */
+void MEDFileAnyTypeFieldMultiTS::releaseArrays() throw(INTERP_KERNEL::Exception)
+{
+ contentNotNullBase()->releaseArrays();
+}
+
std::string MEDFileAnyTypeFieldMultiTS::simpleRepr() const
{
std::ostringstream oss;
}
/*!
- * This method returns as MEDFileAnyTypeField1TS new instances as number of components in \a this.
+ * This method returns as MEDFileAnyTypeFieldMultiTS new instances as number of components in \a this.
* The returned instances are deep copy of \a this except that for globals that are share with those contained in \a this.
* ** WARNING ** do no forget to rename the ouput instances to avoid to write n-times in the same MED file field !
*/
* is to delete this field using decrRef() as it is no more needed.
* \throw If reading the file fails.
*/
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,loadAll);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
* \throw If reading the file fails.
* \throw If there is no field named \a fieldName in the file.
*/
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,fieldName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
_content=new MEDFileFieldMultiTSWithoutSDA;
}
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTS(fileName)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
* is to delete this field using decrRef() as it is no more needed.
* \throw If reading the file fails.
*/
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,loadAll);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
* \throw If reading the file fails.
* \throw If there is no field named \a fieldName in the file.
*/
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll);
ret->contentNotNull();//to check that content type matches with \a this type.
return ret.retn();
}
{
}
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTS(fileName)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
{ throw e; }
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
-try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll) throw(INTERP_KERNEL::Exception)
+try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll)
{
}
catch(INTERP_KERNEL::Exception& e)
return new MEDFileFields;
}
-MEDFileFields *MEDFileFields::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileFields *MEDFileFields::New(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
{
- return new MEDFileFields(fileName);
+ return new MEDFileFields(fileName,loadAll);
}
std::size_t MEDFileFields::getHeapMemorySize() const
{
}
-MEDFileFields::MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileFields::MEDFileFields(const char *fileName, bool loadAll) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldGlobsReal(fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
{
case MED_FLOAT64:
{
- _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit);
+ _fields[i]=MEDFileFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll);
break;
}
case MED_INT32:
{
- _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit);
+ _fields[i]=MEDFileIntFieldMultiTSWithoutSDA::New(fid,fieldName.c_str(),typcha,infos,nbOfStep,dtunit,loadAll);
break;
}
default:
writeLL(fid);
}
+/*!
+ * This method alloc the arrays and load potentially huge arrays contained in this field.
+ * This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
+ * This method can be also called to refresh or reinit values from a file.
+ *
+ * \throw If the fileName is not set or points to a non readable MED file.
+ */
+void MEDFileFields::loadArrays() throw(INTERP_KERNEL::Exception)
+{
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ {
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
+ if(elt)
+ elt->loadBigArraysRecursively(fid,*elt);
+ }
+}
+
+/*!
+ * This method behaves as MEDFileFields::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
+ * But once data loaded once, this method does nothing.
+ *
+ * \throw If the fileName is not set or points to a non readable MED file.
+ * \sa MEDFileFields::loadArrays, MEDFileFields::releaseArrays
+ */
+void MEDFileFields::loadArraysIfNecessary() throw(INTERP_KERNEL::Exception)
+{
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ {
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
+ if(elt)
+ elt->loadBigArraysRecursivelyIfNecessary(fid,*elt);
+ }
+}
+
+/*!
+ * This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
+ * This method does not release arrays set outside the context of a MED file.
+ *
+ * \sa MEDFileFields::loadArrays, MEDFileFields::loadArraysIfNecessary
+ */
+void MEDFileFields::releaseArrays() throw(INTERP_KERNEL::Exception)
+{
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ {
+ MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
+ if(elt)
+ elt->releaseArrays();
+ }
+}
+
std::vector<std::string> MEDFileFields::getPflsReallyUsed() const
{
std::vector<std::string> ret;