std::size_t MEDFileMeshStruct::getHeapMemorySize() const
{
- return 0;
+ std::size_t ret(0);
+ for(std::vector< std::vector<int> >::const_iterator it0=_geo_types_distrib.begin();it0!=_geo_types_distrib.end();it0++)
+ ret+=(*it0).capacity()*sizeof(int);
+ ret+=_geo_types_distrib.capacity()*sizeof(std::vector<int>);
+ return ret;
}
MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh)
}
}
+std::size_t MEDFileField1TSStructItem2::getHeapMemorySize() const
+{
+ std::size_t ret(0);
+ const DataArrayInt *pfl(_pfl);
+ if(pfl)
+ ret+=pfl->getHeapMemorySize();
+ ret+=_loc.capacity();
+ return ret;
+}
+
//=
MEDFileField1TSStructItem::MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b):_computed(false),_type(a),_items(b)
return _items[i];
}
+std::size_t MEDFileField1TSStructItem::getHeapMemorySize() const
+{
+ std::size_t ret(0);
+ for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++)
+ ret+=(*it).getHeapMemorySize();
+ ret+=_items.size()*sizeof(MEDFileField1TSStructItem2);
+ return ret;
+}
+
+MEDCouplingMesh *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
+{
+ return 0;//tony
+}
+
//=
MEDFileField1TSStruct *MEDFileField1TSStruct::New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst) throw(INTERP_KERNEL::Exception)
std::size_t MEDFileField1TSStruct::getHeapMemorySize() const
{
- return 0;
+ std::size_t ret(0);
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++)
+ ret+=(*it).getHeapMemorySize();
+ ret+=_already_checked.capacity()*sizeof(MEDFileField1TSStructItem);
+ return ret;
}
MEDFileField1TSStructItem MEDFileField1TSStruct::BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt)
return ret;
}
+MEDCouplingMesh *MEDFileField1TSStruct::buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
+{
+ if(_already_checked.empty())
+ throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::buildFromScratchDataSetSupport : No outline structure in this !");
+ int pos0(-1),pos1(-1);
+ if(presenceOfCellDiscr(pos0))
+ {
+ if(!presenceOfPartialNodeDiscr(pos1))
+ return _already_checked[pos0].buildFromScratchDataSetSupportOnCells(mst,globs);
+ else
+ throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::buildFromScratchDataSetSupport : tony do it very soon !");
+ }
+ else
+ {
+ if(!presenceOfPartialNodeDiscr(pos1))
+ {//we have only all nodes, no cell definition info -> level 0;
+ return mst->getTheMesh()->getGenMeshAtLevel(0);
+ }
+ }
+}
+
+/*!
+ * Returns true if presence in \a this of discretization ON_CELLS, ON_GAUSS_PT, ON_GAUSS_NE.
+ * If true is returned the pos of the easiest is returned. The easiest is the first element in \a this having the less splitted subparts.
+ */
+bool MEDFileField1TSStruct::presenceOfCellDiscr(int& pos) const throw(INTERP_KERNEL::Exception)
+{
+ std::size_t refSz(std::numeric_limits<std::size_t>::max());
+ bool ret(false);
+ int i(0);
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
+ {
+ if((*it).getType()!=ON_NODES)
+ {
+ ret=true;
+ std::size_t sz((*it).getNumberOfItems());
+ if(refSz>sz)
+ { pos=i; refSz=sz; }
+ }
+ }
+ if(refSz==0)
+ throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::presenceOfCellDiscr : an element in this on entity CELL is empty !");
+ return ret;
+}
+
+/*!
+ * Returns true if presence in \a this of discretization ON_NODES.
+ * If true is returned the pos of the first element containing the single subpart.
+ */
+bool MEDFileField1TSStruct::presenceOfPartialNodeDiscr(int& pos) const throw(INTERP_KERNEL::Exception)
+{
+ int i(0);
+ for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++,i++)
+ {
+ if((*it).getType()==ON_NODES)
+ {
+ std::size_t sz((*it).getNumberOfItems());
+ if(sz==1)
+ {
+ if(!(*it)[0].getPflName().empty())
+ { pos=i; return true; }
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileField1TSStruct::presenceOfPartialNodeDiscr : an element in this on entity NODE is split into several parts !");
+ }
+ }
+ return false;
+}
+
//=
MEDFileFastCellSupportComparator *MEDFileFastCellSupportComparator::New(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception)
std::size_t MEDFileFastCellSupportComparator::getHeapMemorySize() const
{
- /*std::size_t part1=sizeof(MEDFileFastCellSupportComparator)+_mesh_name.capacity()+_already_passed_code1.capacity()*sizeof(std::vector<int>)+_already_passed_code2.capacity()*sizeof(void*)+_m_geo_types_distrib.capacity()*sizeof(std::vector<int>);
- std::size_t part2=0;
- for(std::vector< std::vector<int> >::const_iterator it=_already_passed_code1.begin();it!=_already_passed_code1.end();it++)
- part2+=(*it).capacity()*(sizeof(int)+sizeof(const DataArrayInt *));
- for(std::vector< std::vector<int> >::const_iterator it2=_m_geo_types_distrib.begin();it2!=_m_geo_types_distrib.end();it2++)
- part2+=(*it2).capacity()*sizeof(int);
- return part1+part2;*/
- return 0;
+ std::size_t ret(0);
+ const MEDFileMeshStruct *mst(_mesh_comp);
+ if(mst)
+ ret+=mst->getHeapMemorySize();
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct> >::const_iterator it=_f1ts_cmps.begin();it!=_f1ts_cmps.end();it++)
+ {
+ const MEDFileField1TSStruct *cur(*it);
+ if(cur)
+ ret+=cur->getHeapMemorySize()+sizeof(MEDFileField1TSStruct);
+ }
+ ret+=_f1ts_cmps.capacity()*sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct>);
+ return ret;
}
bool MEDFileFastCellSupportComparator::isEqual(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception)
}
return true;
}
+
+MEDCouplingMesh *MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception)
+{
+ if(timeStepId<0 || timeStepId>=(int)_f1ts_cmps.size())
+ {
+ std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport : requested time step id #" << timeStepId << " is not in [0," << _f1ts_cmps.size() << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ const MEDFileField1TSStruct *obj(_f1ts_cmps[timeStepId]);
+ if(!obj)
+ {
+ std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::buildFromScratchDataSetSupport : at time step id #" << timeStepId << " no field structure overview defined !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ return obj->buildFromScratchDataSetSupport(_mesh_comp,globs);
+}
namespace ParaMEDMEM
{
class DataArrayInt;
+ class MEDCouplingMesh;
class MEDFileMesh;
class MEDFileFieldGlobs;
+ class MEDFileFieldGlobsReal;
class MEDFileAnyTypeField1TS;
class MEDFileAnyTypeFieldMultiTS;
std::vector< std::vector<int> > _geo_types_distrib;
};
- class MEDFileField1TSStructItem2
+ class MEDFileField1TSStructItem2 : public RefCountObject
{
public:
MEDFileField1TSStructItem2();
void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
//
+ std::size_t getHeapMemorySize() const;
+ //
INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; }
std::string getPflName() const;
//! warning this method also set _nb_of_entity attribute !
int _nb_of_entity;
};
- class MEDFileField1TSStructItem
+ class MEDFileField1TSStructItem : public RefCountObject
{
public:
MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b);
void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
bool operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception);
+ std::size_t getHeapMemorySize() const;
bool isEntityCell() const;
bool isComputed() const { return _computed; }
+ TypeOfField getType() const { return _type; }
std::size_t getNumberOfItems() const { return _items.size(); }
const MEDFileField1TSStructItem2& operator[](std::size_t i) const throw(INTERP_KERNEL::Exception);
//
MEDFileField1TSStructItem simplifyMeOnCellEntity(const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception);
bool isCompatibleWithNodesDiscr(const MEDFileField1TSStructItem& other, const MEDFileMeshStruct *meshSt, const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception);
bool isFullyOnOneLev(const MEDFileMeshStruct *meshSt, int& theFirstLevFull) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingMesh *buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
private:
bool _computed;
TypeOfField _type;
bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const throw(INTERP_KERNEL::Exception);
bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception);
bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception);
+ MEDCouplingMesh *buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
private:
MEDFileField1TSStruct(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst);
static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
+ bool presenceOfCellDiscr(int& pos) const throw(INTERP_KERNEL::Exception);
+ bool presenceOfPartialNodeDiscr(int& pos) const throw(INTERP_KERNEL::Exception);
private:
std::vector<MEDFileField1TSStructItem> _already_checked;
};
{
public:
static MEDFileFastCellSupportComparator *New(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception);
+ MEDCouplingMesh *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
+ bool isDataSetSupportEqualToThePreviousOne(int timeStepId) const throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception);
bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception);
std::size_t getHeapMemorySize() const;