-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "MEDFileParameter.hxx"
#include "MEDFileUtilities.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
#include "InterpKernelAutoPtr.hxx"
#include <set>
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
MEDFileParameter1TS::MEDFileParameter1TS(int iteration, int order, double time):_iteration(iteration),_order(order),_time(time)
{
return true;
}
-MEDFileParameter1TS *MEDFileParameterDouble1TSWTI::deepCpy() const throw(INTERP_KERNEL::Exception)
+MEDFileParameter1TS *MEDFileParameterDouble1TSWTI::deepCopy() const
{
return new MEDFileParameterDouble1TSWTI(*this);
}
return sizeof(MEDFileParameterDouble1TSWTI);
}
-std::vector<const BigMemoryObject *> MEDFileParameterDouble1TSWTI::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDFileParameterDouble1TSWTI::getDirectChildrenWithNull() const
{
return std::vector<const BigMemoryObject *>();
}
{
}
-void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int dt, int it, int nbOfSteps) throw(INTERP_KERNEL::Exception)
+void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int dt, int it, int nbOfSteps)
{
std::ostringstream oss; oss << "MEDFileParameterDouble1TS::finishLoading : no specified time step (" << dt << "," << it << ") ! Time steps available : ";
for(int i=0;i<nbOfSteps;i++)
{
int locDt,locIt;
double tim;
- MEDparameterComputationStepInfo(fid,name.c_str(),i+1,&locDt,&locIt,&tim);
+ MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),i+1,&locDt,&locIt,&tim));
if(dt==locDt && it==locIt)
{
_iteration=locDt; _order=locIt; _time=tim;
- MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+ MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
return ;
}
else
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-void MEDFileParameterDouble1TSWTI::readValue(med_idt fid, const std::string& name) throw(INTERP_KERNEL::Exception)
+void MEDFileParameterDouble1TSWTI::readValue(med_idt fid, const std::string& name)
{
- MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+ MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
}
-void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int timeStepId) throw(INTERP_KERNEL::Exception)
+void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int timeStepId)
{
int locDt,locIt;
double dt;
- MEDparameterComputationStepInfo(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt);
+ MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt));
_iteration=locDt; _order=locIt; _time=dt;
- MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+ MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
}
-void MEDFileParameterDouble1TSWTI::writeLL(med_idt fid, const std::string& name, const MEDFileWritable& mw) const throw(INTERP_KERNEL::Exception)
+void MEDFileParameterDouble1TSWTI::writeLL(med_idt fid, const std::string& name, const MEDFileWritable& mw) const
{
char nameW[MED_NAME_SIZE+1];
MEDLoaderBase::safeStrCpy(name.c_str(),MED_NAME_SIZE,nameW,mw.getTooLongStrPolicy());
- MEDparameterValueWr(fid,nameW,_iteration,_order,_time,reinterpret_cast<const unsigned char *>(&_arr));
+ MEDFILESAFECALLERWR0(MEDparameterValueWr,(fid,nameW,_iteration,_order,_time,reinterpret_cast<const unsigned char *>(&_arr)));
}
std::size_t MEDFileParameterTinyInfo::getHeapMemSizeOfStrings() const
return true;
}
-void MEDFileParameterTinyInfo::writeLLHeader(med_idt fid, med_parameter_type typ) const throw(INTERP_KERNEL::Exception)
+void MEDFileParameterTinyInfo::writeLLHeader(med_idt fid, med_parameter_type typ) const
{
char nameW[MED_NAME_SIZE+1],descW[MED_COMMENT_SIZE+1],dtunitW[MED_SNAME_SIZE+1];
MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,nameW,getTooLongStrPolicy());
MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,descW,getTooLongStrPolicy());
MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_SNAME_SIZE,dtunitW,getTooLongStrPolicy());
- MEDparameterCr(fid,nameW,typ,descW,dtunitW);
+ MEDFILESAFECALLERWR0(MEDparameterCr,(fid,nameW,typ,descW,dtunitW));
}
void MEDFileParameterTinyInfo::mainRepr(int bkOffset, std::ostream& oss) const
return new MEDFileParameterDouble1TS;
}
-MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName)
{
return new MEDFileParameterDouble1TS(fileName);
}
-MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName, const std::string& paramName)
{
return new MEDFileParameterDouble1TS(fileName,paramName);
}
-MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName, const std::string& paramName, int dt, int it)
{
return new MEDFileParameterDouble1TS(fileName,paramName,dt,it);
}
{
}
-MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int nbPar=MEDnParameter(fid);
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int nbPar=MEDnParameter(fid);
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int nbPar=MEDnParameter(fid);
if(nbPar<1)
{
INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
med_parameter_type paramType;
int nbOfSteps;
- MEDparameterInfo(fid,1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramType==MED_FLOAT64)
{
return true;
}
-MEDFileParameter1TS *MEDFileParameterDouble1TS::deepCpy() const throw(INTERP_KERNEL::Exception)
+MEDFileParameter1TS *MEDFileParameterDouble1TS::deepCopy() const
{
return new MEDFileParameterDouble1TS(*this);
}
return getHeapMemSizeOfStrings()+sizeof(MEDFileParameterDouble1TS);
}
-std::vector<const BigMemoryObject *> MEDFileParameterDouble1TS::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDFileParameterDouble1TS::getDirectChildrenWithNull() const
{
return std::vector<const BigMemoryObject *>();
}
-void MEDFileParameterDouble1TS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+void MEDFileParameterDouble1TS::write(const std::string& fileName, int mode) const
{
med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
MEDFileParameterTinyInfo::writeLLHeader(fid,MED_FLOAT64);
MEDFileParameterDouble1TSWTI::writeLL(fid,_name,*this);
}
return new MEDFileParameterMultiTS;
}
-MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName)
{
return new MEDFileParameterMultiTS(fileName);
}
-MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName, const std::string& paramName)
{
return new MEDFileParameterMultiTS(fileName,paramName);
}
{
const MEDFileParameter1TS *elt=_param_per_ts[i];
if(elt)
- _param_per_ts[i]=elt->deepCpy();
+ _param_per_ts[i]=elt->deepCopy();
}
}
-MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterMultiTS::MEDFileParameterMultiTS(const std::string& fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int nbPar=MEDnParameter(fid);
if(nbPar<1)
{
INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
med_parameter_type paramType;
int nbOfSteps;
- MEDparameterInfo(fid,1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
_dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
_name=paramNameCpp;
finishLoading(fid,paramType,nbOfSteps);
}
-MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+MEDFileParameterMultiTS::MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int nbPar=MEDnParameter(fid);
std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName)
{
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-void MEDFileParameterMultiTS::finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps) throw(INTERP_KERNEL::Exception)
+void MEDFileParameterMultiTS::finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps)
{
_param_per_ts.resize(nbOfSteps);
for(int i=0;i<nbOfSteps;i++)
{
int dt,it;
double tim;
- MEDparameterComputationStepInfo(fid,_name.c_str(),i+1,&dt,&it,&tim);
+ MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,_name.c_str(),i+1,&dt,&it,&tim));
switch(typ)
- {
+ {
case MED_FLOAT64:
_param_per_ts[i]=MEDFileParameterDouble1TSWTI::New(dt,it,tim);
_param_per_ts[i]->readValue(fid,_name.c_str());
break;*/
default:
throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::finishLoading : supporting only FLOAT64 !");
- }
+ }
}
}
std::size_t MEDFileParameterMultiTS::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(sizeof(MEDFileParameterMultiTS));
- ret+=sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS>)*_param_per_ts.capacity();
+ ret+=sizeof(MCAuto<MEDFileParameter1TS>)*_param_per_ts.capacity();
return ret;
}
-std::vector<const BigMemoryObject *> MEDFileParameterMultiTS::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDFileParameterMultiTS::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
- {
- const MEDFileParameter1TS *elt(*it);
- if(elt)
- ret.push_back(elt);
- }
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ ret.push_back((const MEDFileParameter1TS *)*it);
return ret;
}
-MEDFileParameterMultiTS *MEDFileParameterMultiTS::deepCpy() const throw(INTERP_KERNEL::Exception)
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::deepCopy() const
{
return new MEDFileParameterMultiTS(*this,true);
}
return true;
}
-void MEDFileParameterMultiTS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+void MEDFileParameterMultiTS::write(const std::string& fileName, int mode) const
{
med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
writeLL(fid,*this);
}
-void MEDFileParameterMultiTS::writeLL(med_idt fid, const MEDFileWritable& mw) const throw(INTERP_KERNEL::Exception)
+void MEDFileParameterMultiTS::writeLL(med_idt fid, const MEDFileWritable& mw) const
{
std::set<med_parameter_type> diffType;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(dynamic_cast<const MEDFileParameterDouble1TSWTI *>(elt))
return;
med_parameter_type typ=*diffType.begin();
MEDFileParameterTinyInfo::writeLLHeader(fid,typ);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
void MEDFileParameterMultiTS::simpleRepr2(int bkOffset, std::ostream& oss) const
{
MEDFileParameterTinyInfo::mainRepr(bkOffset,oss);
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
}
}
-void MEDFileParameterMultiTS::appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception)
+void MEDFileParameterMultiTS::appendValue(int dt, int it, double time, double val)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameterDouble1TSWTI> elt=MEDFileParameterDouble1TSWTI::New(dt,it,time);
+ MCAuto<MEDFileParameterDouble1TSWTI> elt=MEDFileParameterDouble1TSWTI::New(dt,it,time);
elt->setValue(val);
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> elt2((MEDFileParameterDouble1TSWTI*)elt); elt2->incrRef();
+ MCAuto<MEDFileParameter1TS> elt2((MEDFileParameterDouble1TSWTI*)elt); elt2->incrRef();
_param_per_ts.push_back(elt2);
}
-double MEDFileParameterMultiTS::getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+double MEDFileParameterMultiTS::getDoubleValue(int iteration, int order) const
{
int pos=getPosOfTimeStep(iteration,order);
const MEDFileParameter1TS *elt=_param_per_ts[pos];
return eltC->getValue();
}
-int MEDFileParameterMultiTS::getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+int MEDFileParameterMultiTS::getPosOfTimeStep(int iteration, int order) const
{
int ret=0;
std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosOfTimeStep : no such iteration=" << iteration << " order=" << order << " ! Possibilities are :";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
{
- if(elt->getIteration()==iteration && elt->getOrder())
+ if(elt->getIteration()==iteration && elt->getOrder()==order)
return ret;
else
oss << "(" << elt->getIteration() << "," << elt->getOrder() << "), ";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-int MEDFileParameterMultiTS::getPosGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
+int MEDFileParameterMultiTS::getPosGivenTime(double time, double eps) const
{
int ret=0;
std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosGivenTime : no such time=" << time << " ! Possibilities are :";
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
/*!
* \return an internal pointer that can be null. Warning the caller is \b not responsible of the returned pointer.
*/
-MEDFileParameter1TS *MEDFileParameterMultiTS::getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
+MEDFileParameter1TS *MEDFileParameterMultiTS::getTimeStepAtPos(int posId) const
{
if(posId<0 || posId>=(int)_param_per_ts.size())
{
return const_cast<MEDFileParameter1TS *>(static_cast<const MEDFileParameter1TS *>(_param_per_ts[posId]));
}
-void MEDFileParameterMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception)
+void MEDFileParameterMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds)
{
std::vector<bool> b(_param_per_ts.size(),true);
int len=(int)_param_per_ts.size();
std::ostringstream oss; oss << "MEDFileParameterMultiTS::eraseTimeStepIds : At pos #" << std::distance(startIds,w) << " value is " << *w << " should be in [0," << len << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str());
}
std::size_t newNb=std::count(b.begin(),b.end(),true);
- std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> > paramPerTs(newNb);
+ std::vector< MCAuto<MEDFileParameter1TS> > paramPerTs(newNb);
std::size_t j=0;
for(std::size_t i=0;i<_param_per_ts.size();i++)
if(b[i])
_param_per_ts=paramPerTs;
}
-std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getIterations() const throw(INTERP_KERNEL::Exception)
+int MEDFileParameterMultiTS::getNumberOfTS() const
+{
+ return (int) getIterations().size();
+}
+
+std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getIterations() const
{
std::vector< std::pair<int,int> > ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
/*!
* \param [out] ret1
*/
-std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception)
+std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getTimeSteps(std::vector<double>& ret1) const
{
std::vector< std::pair<int,int> > ret0;
ret1.clear();
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+ for(std::vector< MCAuto<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
{
const MEDFileParameter1TS *elt(*it);
if(elt)
return new MEDFileParameters;
}
-MEDFileParameters *MEDFileParameters::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileParameters *MEDFileParameters::New(const std::string& fileName)
{
return new MEDFileParameters(fileName);
}
-MEDFileParameters::MEDFileParameters(const char *fileName) throw(INTERP_KERNEL::Exception)
+MEDFileParameters::MEDFileParameters(const std::string& fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int nbPar=MEDnParameter(fid);
_params.resize(nbPar);
INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
- _params[i]=MEDFileParameterMultiTS::New(fileName,paramNameCpp.c_str());
+ _params[i]=MEDFileParameterMultiTS::New(fileName,paramNameCpp);
}
}
std::size_t MEDFileParameters::getHeapMemorySizeWithoutChildren() const
{
std::size_t ret(sizeof(MEDFileParameters));
- ret+=sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS>)*_params.capacity();
+ ret+=sizeof(MCAuto<MEDFileParameterMultiTS>)*_params.capacity();
return ret;
}
-std::vector<const BigMemoryObject *> MEDFileParameters::getDirectChildren() const
+std::vector<const BigMemoryObject *> MEDFileParameters::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
- {
- const MEDFileParameterMultiTS *elt(*it);
- if(elt)
- ret.push_back(elt);
- }
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+ ret.push_back((const MEDFileParameterMultiTS *)*it);
return ret;
}
-MEDFileParameters *MEDFileParameters::deepCpy() const throw(INTERP_KERNEL::Exception)
+MEDFileParameters *MEDFileParameters::deepCopy() const
{
return new MEDFileParameters(*this,true);
}
{
const MEDFileParameterMultiTS *elt=_params[i];
if(elt)
- _params[i]=elt->deepCpy();
+ _params[i]=elt->deepCopy();
}
}
-void MEDFileParameters::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+void MEDFileParameters::write(const std::string& fileName, int mode) const
{
med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
writeLL(fid);
}
-void MEDFileParameters::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+void MEDFileParameters::writeLL(med_idt fid) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
{
const MEDFileParameterMultiTS *elt(*it);
if(elt)
}
}
-std::vector<std::string> MEDFileParameters::getParamsNames() const throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDFileParameters::getParamsNames() const
{
std::vector<std::string> ret(_params.size());
int i=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,i++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,i++)
{
const MEDFileParameterMultiTS *p=(*it);
if(p)
void MEDFileParameters::simpleReprWithoutHeader(std::ostream& oss) const
{
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
{
const MEDFileParameterMultiTS *elt(*it);
if(elt)
}
}
-void MEDFileParameters::resize(int newSize) throw(INTERP_KERNEL::Exception)
+void MEDFileParameters::resize(int newSize)
{
if(newSize<0)
throw INTERP_KERNEL::Exception("MEDFileParameters::resize : should be positive !");
_params.resize(newSize);
}
-void MEDFileParameters::pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception)
+void MEDFileParameters::pushParam(MEDFileParameterMultiTS *param)
{
if(param)
param->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> elt(param);
+ MCAuto<MEDFileParameterMultiTS> elt(param);
_params.push_back(elt);
}
-void MEDFileParameters::setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception)
+void MEDFileParameters::setParamAtPos(int i, MEDFileParameterMultiTS *param)
{
if(i<0)
throw INTERP_KERNEL::Exception("MEDFileParameters::setParamAtPos : should be positive !");
_params.resize(i+1);
if(param)
param->incrRef();
- MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> elt(param);
+ MCAuto<MEDFileParameterMultiTS> elt(param);
_params[i]=elt;
}
/*!
* \return an internal pointer that can be null. Warning the caller is \b not responsible of the returned pointer.
*/
-MEDFileParameterMultiTS *MEDFileParameters::getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
+MEDFileParameterMultiTS *MEDFileParameters::getParamAtPos(int i) const
{
if(i<0 || i>=(int)_params.size())
{
/*!
* \return an internal pointer that can be null. Warning the caller is \b not responsible of the returned pointer.
*/
-MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
+MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const std::string& paramName) const
{
int pos=getPosFromParamName(paramName);
return getParamAtPos(pos);
}
-void MEDFileParameters::destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception)
+void MEDFileParameters::destroyParamAtPos(int i)
{
if(i<0 || i>=(int)_params.size())
{
std::ostringstream oss; oss << "MEDFileParameters::destroyParamAtPos : should be in [0," << _params.size() << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- _params[i]=MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS>(0);
+ _params[i]=MCAuto<MEDFileParameterMultiTS>(0);
}
-int MEDFileParameters::getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception)
+int MEDFileParameters::getPosFromParamName(const std::string& paramName) const
{
std::ostringstream oss; oss << "MEDFileParameters::getPosFromParamName : no such name=" << paramName << " ! Possibilities are :";
int ret=0;
- for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,ret++)
+ for(std::vector< MCAuto<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,ret++)
{
const MEDFileParameterMultiTS *elt(*it);
if(elt)
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-int MEDFileParameters::getNumberOfParams() const throw(INTERP_KERNEL::Exception)
+int MEDFileParameters::getNumberOfParams() const
{
return (int)_params.size();
}