return new MEDFileUMesh;
}
+MEDFileMesh *MEDFileUMesh::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret=new MEDFileUMesh(*this);
+ return ret.retn();
+}
+
+MEDFileMesh *MEDFileUMesh::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret=new MEDFileUMesh(*this);
+ if((const DataArrayDouble*)_coords)
+ ret->_coords=_coords->deepCpy();
+ if((const DataArrayInt*)_fam_coords)
+ ret->_fam_coords=_fam_coords->deepCpy();
+ if((const DataArrayInt*)_num_coords)
+ ret->_num_coords=_num_coords->deepCpy();
+ if((const DataArrayInt*)_rev_num_coords)
+ ret->_rev_num_coords=_rev_num_coords->deepCpy();
+ std::size_t i=0;
+ for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++,i++)
+ {
+ if((const MEDFileUMeshSplitL1 *)(*it))
+ ret->_ms[i]=(*it)->deepCpy();
+ }
+ return ret.retn();
+}
+
bool MEDFileUMesh::isEqual(const MEDFileMesh *other, double eps, std::string& what) const
{
if(!MEDFileMesh::isEqual(other,eps,what))
return false;
}
}
- //std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> > _ms;
return true;
}
return simpleRepr();
}
+MEDFileMesh *MEDFileCMesh::shallowCpy() const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> ret=new MEDFileCMesh(*this);
+ return ret.retn();
+}
+
+MEDFileMesh *MEDFileCMesh::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> ret=new MEDFileCMesh(*this);
+ if((const MEDCouplingCMesh*)_cmesh)
+ ret->_cmesh=static_cast<MEDCouplingCMesh*>(_cmesh->deepCpy());
+ if((const DataArrayInt*)_fam_nodes)
+ ret->_fam_nodes=_fam_nodes->deepCpy();
+ if((const DataArrayInt*)_num_nodes)
+ ret->_num_nodes=_num_nodes->deepCpy();
+ if((const DataArrayInt*)_fam_cells)
+ ret->_fam_cells=_fam_cells->deepCpy();
+ if((const DataArrayInt*)_num_cells)
+ ret->_num_cells=_num_cells->deepCpy();
+ if((const DataArrayInt*)_rev_num_nodes)
+ ret->_rev_num_nodes=_rev_num_nodes->deepCpy();
+ if((const DataArrayInt*)_rev_num_cells)
+ ret->_rev_num_cells=_rev_num_cells->deepCpy();
+ return ret.retn();
+}
+
bool MEDFileCMesh::isEqual(const MEDFileMesh *other, double eps, std::string& what) const
{
if(!MEDFileMesh::isEqual(other,eps,what))
public:
static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
+ virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception) = 0;
+ virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception) = 0;
virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
virtual void clearNonDiscrAttributes() const;
void setName(const char *name) { _name=name; }
static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
static MEDFileUMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileUMesh *New();
+ MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
void clearNonDiscrAttributes() const;
~MEDFileUMesh();
static MEDFileCMesh *New();
static MEDFileCMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
+ MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
int getMeshDimension() const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const;
if((MEDCouplingUMesh *)_m==0)
{
updateTime();
- MEDCouplingUMesh *ret=(MEDCouplingUMesh *)_st->_m_by_types->deepCpy();
- _m=ret;
+ _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types->deepCpy());
_m->renumberCells(_st->_num->getConstPointer(),true);
- ret->incrRef();
- return ret;
+ return _m.retn();
}
else
{
if(_mpt_time==_st->_m_by_types->getTimeOfThis() && _num_time==_st->_num->getTimeOfThis())
- {
- _m->incrRef();
- return _m;
- }
+ return _m.retn();
else
{
updateTime();
- MEDCouplingUMesh *ret=(MEDCouplingUMesh *)_st->_m_by_types->deepCpy();
- _m=ret;
+ _m=static_cast<MEDCouplingUMesh *>(_st->_m_by_types->deepCpy());
_m->renumberCells(_st->_num->getConstPointer(),true);
- ret->incrRef();
- return ret;
+ return _m.retn();
}
}
}
_num_time=_st->_num->getTimeOfThis();
}
+MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):_m_by_types(other._m_by_types),_fam(other._fam),_num(other._num),_rev_num(other._rev_num),_m(this)
+{
+}
+
MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id):_m(this)
{
const std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >& v=l2.getLev(id);
assignMesh(m,newOrOld);
}
+MEDFileUMeshSplitL1 *MEDFileUMeshSplitL1::deepCpy() const
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> ret=new MEDFileUMeshSplitL1(*this);
+ if((const MEDCouplingUMesh*)_m_by_types)
+ ret->_m_by_types=static_cast<MEDCouplingUMesh*>(_m_by_types->deepCpy());
+ if((const DataArrayInt *)_fam)
+ ret->_fam=_fam->deepCpy();
+ if((const DataArrayInt *)_num)
+ ret->_num=_num->deepCpy();
+ if((const DataArrayInt *)_rev_num)
+ ret->_rev_num=_rev_num->deepCpy();
+ return ret.retn();
+}
+
bool MEDFileUMeshSplitL1::isEqual(const MEDFileUMeshSplitL1 *other, double eps, std::string& what) const
{
const MEDCouplingUMesh *m1=_m_by_types;
{
friend class MEDFileUMeshPermCompute;
public:
+ MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other);
MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id);
MEDFileUMeshSplitL1(MEDCouplingUMesh *m);
MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld);
+ MEDFileUMeshSplitL1 *deepCpy() const;
bool isEqual(const MEDFileUMeshSplitL1 *other, double eps, std::string& what) const;
void clearNonDiscrAttributes() const;
void synchronizeTinyInfo(const MEDFileMesh& master) const;
%newobject MEDLoader::ReadFieldGauss;
%newobject MEDLoader::ReadFieldGaussNE;
%newobject ParaMEDMEM::MEDFileMesh::New;
+%newobject ParaMEDMEM::MEDFileMesh::deepCpy;
+%newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
%newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
%newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
%newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
public:
static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1);
+ virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
+ virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
virtual void clearNonDiscrAttributes() const;
void setName(const char *name);
const char *getName();
t=mm.getGroupArr(0,"GrpOnAllCell")
self.assertTrue(t.getValues()==range(5))
#
- mm.write(outFileName,2);
+ mmCpy=mm.deepCpy()
+ self.assertTrue(mm.isEqual(mmCpy,1e-12)[0]) ; del mm
+ mmCpy.write(outFileName,2);
#
mm=MEDFileMesh.New(outFileName)
mbis=mm.getMeshAtLevel(0)