X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDFileData.cxx;h=e5493423a44c989933bc9ac3946180a10cc48a82;hb=29f721b8ca46ed5d7872a8a23dd891c46d74ba10;hp=fbabd4709e1fb50064f3bba2aaa411de901aadad;hpb=887d0e1efce4f46f68d2596dcd801f02f5c1f99e;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDFileData.cxx b/src/MEDLoader/MEDFileData.cxx index fbabd4709..e5493423a 100644 --- a/src/MEDLoader/MEDFileData.cxx +++ b/src/MEDLoader/MEDFileData.cxx @@ -40,8 +40,11 @@ MEDFileData *MEDFileData::deepCpy() const throw(INTERP_KERNEL::Exception) MEDCouplingAutoRefCountObjectPtr meshes; if((const MEDFileMeshes *)_meshes) meshes=_meshes->deepCpy(); + MEDCouplingAutoRefCountObjectPtr params; + if((const MEDFileParameters *)_params) + params=_params->deepCpy(); MEDCouplingAutoRefCountObjectPtr ret=MEDFileData::New(); - ret->_fields=fields; ret->_meshes=meshes; + ret->_fields=fields; ret->_meshes=meshes; ret->_params=params; return ret.retn(); } @@ -52,6 +55,8 @@ std::size_t MEDFileData::getHeapMemorySize() const ret+=_fields->getHeapMemorySize(); if((const MEDFileMeshes *)_meshes) ret+=_meshes->getHeapMemorySize(); + if((const MEDFileParameters *)_params) + ret+=_params->getHeapMemorySize(); return ret; } @@ -65,22 +70,32 @@ MEDFileMeshes *MEDFileData::getMeshes() const return const_cast(static_cast(_meshes)); } +MEDFileParameters *MEDFileData::getParams() const +{ + return const_cast(static_cast(_params)); +} + void MEDFileData::setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception) { - if(!fields) - throw INTERP_KERNEL::Exception("MEDFileData::setFields : input pointer is null !"); - fields->incrRef(); + if(fields) + fields->incrRef(); _fields=fields; } void MEDFileData::setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception) { - if(!meshes) - throw INTERP_KERNEL::Exception("MEDFileData::setMeshes : input pointer is null !"); - meshes->incrRef(); + if(meshes) + meshes->incrRef(); _meshes=meshes; } +void MEDFileData::setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception) +{ + if(params) + params->incrRef(); + _params=params; +} + int MEDFileData::getNumberOfFields() const throw(INTERP_KERNEL::Exception) { const MEDFileFields *f=_fields; @@ -97,6 +112,14 @@ int MEDFileData::getNumberOfMeshes() const throw(INTERP_KERNEL::Exception) return m->getNumberOfMeshes(); } +int MEDFileData::getNumberOfParams() const throw(INTERP_KERNEL::Exception) +{ + const MEDFileParameters *p=_params; + if(!p) + throw INTERP_KERNEL::Exception("MEDFileData::getNumberOfParams : no params set !"); + return p->getNumberOfParams(); +} + std::string MEDFileData::simpleRepr() const { std::ostringstream oss; @@ -116,7 +139,15 @@ std::string MEDFileData::simpleRepr() const tmp2->simpleReprWithoutHeader(oss); } else - oss << "No meshes set !!!\n"; + oss << "No meshes set !!!\n\n"; + oss << "Params part :\n*************\n\n"; + const MEDFileParameters *tmp3=_params; + if(tmp3) + { + tmp3->simpleReprWithoutHeader(oss); + } + else + oss << "params set !!!\n"; return oss.str(); } @@ -191,6 +222,7 @@ try { _fields=MEDFileFields::New(fileName); _meshes=MEDFileMeshes::New(fileName); + _params=MEDFileParameters::New(fileName); } catch(INTERP_KERNEL::Exception& e) { @@ -207,4 +239,7 @@ void MEDFileData::write(const char *fileName, int mode) const throw(INTERP_KERNE const MEDFileFields *fs=_fields; if(fs) fs->writeLL(fid); + const MEDFileParameters *ps=_params; + if(ps) + ps->writeLL(fid); }