return false;
}
+bool MEDFileFieldPerMesh::presenceOfStructureElements() const
+{
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ if((*it).isNotNull())
+ {
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
+ if(pt)
+ return true;
+ }
+ return false;
+}
+
+bool MEDFileFieldPerMesh::onlyStructureElements() const
+{
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ if((*it).isNotNull())
+ {
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
+ if(!pt)
+ return false;
+ }
+ return true;
+}
+
+void MEDFileFieldPerMesh::killStructureElements()
+{
+ std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > > res;
+ for(std::vector< MCAuto< MEDFileFieldPerMeshPerTypeCommon > >::iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++)
+ {
+ if((*it).isNotNull())
+ {
+ const MEDFileFieldPerMeshPerTypeDyn *pt(dynamic_cast<const MEDFileFieldPerMeshPerTypeDyn *>((const MEDFileFieldPerMeshPerTypeCommon *)*it));
+ if(!pt)
+ res.push_back(*it);
+ }
+ }
+ _field_pm_pt=res;
+}
+
DataArray *MEDFileFieldPerMesh::getOrCreateAndGetArray()
{
if(!_father)
return false;
}
+bool MEDFileAnyTypeField1TSWithoutSDA::presenceOfStructureElements() const
+{
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ if((*it)->presenceOfStructureElements())
+ return true;
+ return false;
+}
+
+bool MEDFileAnyTypeField1TSWithoutSDA::onlyStructureElements() const
+{
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::const_iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ if(!(*it)->onlyStructureElements())
+ return false;
+ return true;
+}
+
+void MEDFileAnyTypeField1TSWithoutSDA::killStructureElements()
+{
+ for(std::vector< MCAuto< MEDFileFieldPerMesh > >::iterator it=_field_per_mesh.begin();it!=_field_per_mesh.end();it++)
+ if((*it).isNotNull())
+ (*it)->killStructureElements();
+}
+
MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::fieldOnMesh(const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MCAuto<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
{
static const char MSG0[]="MEDFileAnyTypeField1TSWithoutSDA::fieldOnMesh : the field is too complex to be able to be extracted with \"field\" method ! Call getFieldOnMeshAtLevel method instead to deal with complexity !";
{
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const
+MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::shallowCpy() const
{
MCAuto<MEDFileField1TSWithoutSDA> ret(new MEDFileField1TSWithoutSDA(*this));
ret->deepCpyLeavesFrom(*this);
return ret.retn();
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const
+MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::deepCopy() const
{
- MCAuto<MEDFileField1TSWithoutSDA> ret=static_cast<MEDFileField1TSWithoutSDA *>(shallowCpy());
- if((const DataArrayDouble *)_arr)
+ MCAuto<MEDFileField1TSWithoutSDA> ret(shallowCpy());
+ if(_arr.isNotNull())
ret->_arr=_arr->deepCopy();
return ret.retn();
}
return getUndergroundDataArrayTemplate();
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const
+MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::shallowCpy() const
{
MCAuto<MEDFileIntField1TSWithoutSDA> ret(new MEDFileIntField1TSWithoutSDA(*this));
ret->deepCpyLeavesFrom(*this);
return ret.retn();
}
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const
+MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::deepCopy() const
{
- MCAuto<MEDFileIntField1TSWithoutSDA> ret=static_cast<MEDFileIntField1TSWithoutSDA *>(shallowCpy());
- if((const DataArrayInt *)_arr)
+ MCAuto<MEDFileIntField1TSWithoutSDA> ret(shallowCpy());
+ if(_arr.isNotNull())
ret->_arr=_arr->deepCopy();
return ret.retn();
}
contentNotNull()->setFieldProfile(field,field->getArray(),mesh,meshDimRelToMax,profile,*this,*contentNotNull());
}
-MEDFileAnyTypeField1TS *MEDFileField1TS::shallowCpy() const
+MEDFileField1TS *MEDFileField1TS::shallowCpy() const
{
return new MEDFileField1TS(*this);
}
{
}
-MEDFileAnyTypeField1TS *MEDFileIntField1TS::shallowCpy() const
+MEDFileIntField1TS *MEDFileIntField1TS::shallowCpy() const
{
return new MEDFileIntField1TS(*this);
}
return buildFromTimeStepIds(ids->begin(),ids->end());
}
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfStructureElements() const
+{
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
+ if((*it)->presenceOfStructureElements())
+ return true;
+ return false;
+}
+
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::onlyStructureElements() const
+{
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
+ if(!(*it)->onlyStructureElements())
+ return false;
+ return true;
+}
+
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::killStructureElements()
+{
+ std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> > res;
+ for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::iterator it=_time_steps.begin();it!=_time_steps.end();it++)
+ if((*it).isNotNull())
+ {
+ if((*it)->presenceOfStructureElements())
+ {
+ if(!(*it)->onlyStructureElements())
+ {
+ (*it)->killStructureElements();
+ res.push_back(*it);
+ }
+ }
+ else
+ {
+ res.push_back(*it);
+ }
+ }
+ _time_steps=res;
+}
+
bool MEDFileAnyTypeFieldMultiTSWithoutSDA::presenceOfMultiDiscPerGeoType() const
{
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++)
return ret.retn();
}
+bool MEDFileFields::presenceOfStructureElements() const
+{
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
+ if((*it)->presenceOfStructureElements())
+ return true;
+ return false;
+}
+
+void MEDFileFields::killStructureElements()
+{
+ std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
+ for(std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+ if((*it).isNotNull())
+ {
+ if((*it)->presenceOfStructureElements())
+ {
+ if(!(*it)->onlyStructureElements())
+ {
+ (*it)->killStructureElements();
+ ret.push_back(*it);
+ }
+ }
+ }
+ else
+ {
+ ret.push_back(*it);
+ }
+ _fields=ret;
+}
+
+MCAuto<MEDFileFields> MEDFileFields::partOfThisOnStructureElements() const
+{
+ throw INTERP_KERNEL::Exception("partOfThisOnStructureElements : not implemented yet !");
+}
+
MEDFileFieldsIterator *MEDFileFields::iterator()
{
return new MEDFileFieldsIterator(this);
std::string getMeshName() const { return _mesh_name; }
int getNumberOfComponents() const;
bool presenceOfMultiDiscPerGeoType() const;
+ bool presenceOfStructureElements() const;
+ bool onlyStructureElements() const;
+ void killStructureElements();
DataArray *getOrCreateAndGetArray();
const DataArray *getOrCreateAndGetArray() const;
const std::vector<std::string>& getInfo() const;
MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
MEDLOADER_EXPORT std::vector<std::string>& getInfo();
MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
+ MEDLOADER_EXPORT bool presenceOfStructureElements() const;
+ MEDLOADER_EXPORT bool onlyStructureElements() const;
+ MEDLOADER_EXPORT void killStructureElements();
MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& infos);
MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
public:
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA();
MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
- MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *shallowCpy() const;
+ MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *deepCopy() const;
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *convertToInt() const;
public:
static const char TYPE_STR[];
public:
MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA();
MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
- MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCopy() const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const;
+ MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *deepCopy() const;
+ MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA *shallowCpy() const;
MEDLOADER_EXPORT const char *getTypeStr() const;
MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
MEDLOADER_EXPORT void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
// direct forwarding to MEDFileField1TSWithoutSDA instance _content
public:
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const;
+ MEDLOADER_EXPORT MEDFileField1TS *shallowCpy() const;
MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray() const;
MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
MEDLOADER_EXPORT static MEDFileIntField1TS *New(med_idt fid, const std::string& fieldName, int iteration, int order, bool loadAll=true);
MEDLOADER_EXPORT static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
- MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const;
+ MEDLOADER_EXPORT MEDFileIntField1TS *shallowCpy() const;
//
MEDLOADER_EXPORT MEDCouplingFieldInt *field(const MEDFileMesh *mesh) const;
MEDLOADER_EXPORT MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *buildFromTimeStepIds2(int bg, int end, int step) const;
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
+ MEDLOADER_EXPORT bool presenceOfStructureElements() const;
+ MEDLOADER_EXPORT bool onlyStructureElements() const;
+ MEDLOADER_EXPORT void killStructureElements();
MEDLOADER_EXPORT int getPosOfTimeStep(int iteration, int order) const;
MEDLOADER_EXPORT int getPosGivenTime(double time, double eps=1e-8) const;
MEDLOADER_EXPORT std::vector< std::pair<int,int> > getIterations() const;
MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
MEDLOADER_EXPORT bool presenceOfMultiDiscPerGeoType() const;
+ MEDLOADER_EXPORT void killStructureElements();
MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& info);
MEDLOADER_EXPORT int getNumberOfComponents() const;
MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
MEDLOADER_EXPORT MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
+ MEDLOADER_EXPORT bool presenceOfStructureElements() const;
+ MEDLOADER_EXPORT void killStructureElements();
+ MEDLOADER_EXPORT MCAuto<MEDFileFields> partOfThisOnStructureElements() const;
MEDLOADER_EXPORT MEDFileFieldsIterator *iterator();
MEDLOADER_EXPORT void destroyFieldAtPos(int i);
MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds);
%newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
%newobject MEDCoupling::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
%newobject MEDCoupling::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
+%newobject MEDCoupling::MEDFileFields::partOfThisOnStructureElements;
%newobject MEDCoupling::MEDFileFields::__iter__;
%newobject MEDCoupling::MEDFileFields::extractPart;
MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception);
+ bool presenceOfStructureElements() const throw(INTERP_KERNEL::Exception);
+ void killStructureElements() throw(INTERP_KERNEL::Exception);
void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
bool removeFieldsWithoutAnyTimeStep() throw(INTERP_KERNEL::Exception);
%extend
{
return self->simpleRepr();
}
-
+
+ MEDFileFields *partOfThisOnStructureElements() const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<MEDFileFields> ret(self->partOfThisOnStructureElements());
+ return ret.retn();
+ }
+
static MEDFileFields *LoadSpecificEntities(const std::string& fileName, PyObject *entities, bool loadAll=true) throw(INTERP_KERNEL::Exception)
{
std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));