*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::cloneWithMesh(bool recDeepCpy) const
{
- MEDCouplingFieldDouble *ret=clone(recDeepCpy);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=clone(recDeepCpy);
if(_mesh)
{
- MEDCouplingMesh *mCpy=_mesh->deepCpy();
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mCpy=_mesh->deepCpy();
ret->setMesh(mCpy);
- mCpy->decrRef();
}
- return ret;
+ return ret.retn();
}
/*!
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretization> disc;
if(_type)
disc=_type->clone();
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn());
ret->setMesh(getMesh());
ret->setName(getName());
ret->setDescription(getDescription());
- return ret;
+ return ret.retn();
}
/*!
std::vector<DataArrayDouble *> arrays;
_time_discr->getArrays(arrays);
std::vector<DataArrayDouble *> arrs;
+ std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrsSafe;
const int *arrSelBg=arrSelect->begin();
const int *arrSelEnd=arrSelect->end();
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
DataArrayDouble *arr=0;
if(*iter)
arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd);
- arrs.push_back(arr);
+ arrs.push_back(arr); arrsSafe.push_back(arr);
}
ret->_time_discr->setArrays(arrs,0);
- for(std::vector<DataArrayDouble *>::const_iterator iter=arrs.begin();iter!=arrs.end();iter++)
- if(*iter)
- (*iter)->decrRef();
return ret.retn();
}
double ret=-std::numeric_limits<double>::max();
bool isExistingArr=false;
tupleIds=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
if(*iter)
isExistingArr=true;
DataArrayInt *tmp;
ret=std::max(ret,(*iter)->getMaxValue2(tmp));
- if(!tupleIds)
- tupleIds=tmp;
- else
- tmp->decrRef();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpSafe(tmp);
+ if(!((const DataArrayInt *)ret1))
+ ret1=tmpSafe;
}
}
if(!isExistingArr)
throw INTERP_KERNEL::Exception("getMaxValue2 : No arrays defined !");
+ tupleIds=ret1.retn();
return ret;
}
double ret=-std::numeric_limits<double>::max();
bool isExistingArr=false;
tupleIds=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
{
if(*iter)
isExistingArr=true;
DataArrayInt *tmp;
ret=std::max(ret,(*iter)->getMinValue2(tmp));
- if(!tupleIds)
- tupleIds=tmp;
- else
- tmp->decrRef();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmpSafe(tmp);
+ if(!((const DataArrayInt *)ret1))
+ ret1=tmpSafe;
}
}
if(!isExistingArr)
throw INTERP_KERNEL::Exception("getMinValue2 : No arrays defined !");
+ tupleIds=ret1.retn();
return ret;
}
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform doublyContractedProduct !");
MEDCouplingTimeDiscretization *td=_time_discr->doublyContractedProduct();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("DoublyContractedProduct");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::determinant() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform determinant !");
MEDCouplingTimeDiscretization *td=_time_discr->determinant();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Determinant");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::eigenValues() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenValues !");
MEDCouplingTimeDiscretization *td=_time_discr->eigenValues();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("EigenValues");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::eigenVectors() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenVectors !");
MEDCouplingTimeDiscretization *td=_time_discr->eigenVectors();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("EigenVectors");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::inverse() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform inverse !");
MEDCouplingTimeDiscretization *td=_time_discr->inverse();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Inversion");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::trace() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform trace !");
MEDCouplingTimeDiscretization *td=_time_discr->trace();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Trace");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::deviator() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform deviator !");
MEDCouplingTimeDiscretization *td=_time_discr->deviator();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
- ret->setName("Trace");
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ ret->setName("Deviator");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::magnitude() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform magnitude !");
MEDCouplingTimeDiscretization *td=_time_discr->magnitude();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Magnitude");
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::maxPerTuple() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform maxPerTuple !");
MEDCouplingTimeDiscretization *td=_time_discr->maxPerTuple();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
std::ostringstream oss;
oss << "Max_" << getName();
ret->setName(oss.str().c_str());
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
void MEDCouplingFieldDouble::changeNbOfComponents(int newNbOfComp, double dftValue) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform keepSelectedComponents !");
MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds);
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName(getName());
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : no time discr of f1 !");
if(!f1->_type)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MergeFields : no spatial discr of f1 !");
- MEDCouplingMesh *m=m1->mergeMyselfWith(m2);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=m1->mergeMyselfWith(m2);
MEDCouplingTimeDiscretization *td=f1->_time_discr->aggregate(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(m);
- m->decrRef();
ret->setName(f1->getName());
ret->setDescription(f1->getDescription());
- return ret;
+ return ret.retn();
}
/*!
m->setName(ms2[0]->getName()); m->setDescription(ms2[0]->getDescription());
MEDCouplingTimeDiscretization *td=tds[0]->aggregate(tds);
td->copyTinyAttrFrom(*(a[0]->_time_discr));
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone());
ret->setMesh(m);
ret->setName(a[0]->getName());
ret->setDescription(a[0]->getDescription());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MeldFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MeldFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->meld(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::DotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply CrossProductFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->crossProduct(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MaxFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MaxFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->max(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::MinFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MinFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->min(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::negate() const throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform negate !");
MEDCouplingTimeDiscretization *td=_time_discr->negate();
td->copyTinyAttrFrom(*_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setMesh(getMesh());
- return ret;
+ return ret.retn();
}
MEDCouplingFieldDouble *MEDCouplingFieldDouble::AddFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply AddFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->add(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator+=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply SubstractFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->substract(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator-=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply MultiplyFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->multiply(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator*=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply DivideFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->divide(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator/=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception)
throw INTERP_KERNEL::Exception("Fields are not compatible ; unable to apply PowFields on them !");
MEDCouplingTimeDiscretization *td=f1->_time_discr->pow(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
- MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
- return ret;
+ return ret.retn();
}
/*!