#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldTemplate.hxx"
+#include "MEDCouplingFieldT.txx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingTimeDiscretization.hxx"
#include "MEDCouplingFieldDiscretization.hxx"
using namespace MEDCoupling;
+template class MEDCouplingFieldT<double>;
/*!
* Creates a new MEDCouplingFieldDouble, of given spatial type and time discretization.
*/
void MEDCouplingFieldDouble::setTimeUnit(const std::string& unit)
{
- _time_discr->setTimeUnit(unit);
+ timeDiscr()->setTimeUnit(unit);
}
/*!
*/
std::string MEDCouplingFieldDouble::getTimeUnit() const
{
- return _time_discr->getTimeUnit();
+ return timeDiscr()->getTimeUnit();
}
/*!
*/
void MEDCouplingFieldDouble::synchronizeTimeWithSupport()
{
- _time_discr->synchronizeTimeWith(_mesh);
+ timeDiscr()->synchronizeTimeWith(_mesh);
}
/*!
*/
MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const
{
- MEDCouplingTimeDiscretization *tdo=_time_discr->buildNewTimeReprFromThis(td,deepCopy);
+ MEDCouplingTimeDiscretization *tdo=timeDiscr()->buildNewTimeReprFromThis(td,deepCopy);
MCAuto<MEDCouplingFieldDiscretization> disc;
if(_type)
disc=_type->clone();
const MEDCouplingFieldDouble *otherC(dynamic_cast<const MEDCouplingFieldDouble *>(other));
if(otherC)
{
- _time_discr->copyTinyStringsFrom(*otherC->_time_discr);
+ timeDiscr()->copyTinyStringsFrom(*otherC->timeDiscr());
}
}
{
if(other)
{
- _time_discr->copyTinyAttrFrom(*other->_time_discr);
+ timeDiscr()->copyTinyAttrFrom(*other->timeDiscr());
}
}
{ ret << "FieldDouble space discretization is : " << _type->getStringRepr() << "\n"; }
else
{ ret << "FieldDouble has no spatial discretization !\n"; }
- if(_time_discr)
- { ret << "FieldDouble time discretization is : " << _time_discr->getStringRepr() << "\n"; }
+ if(timeDiscr())
+ { ret << "FieldDouble time discretization is : " << timeDiscr()->getStringRepr() << "\n"; }
else
{ ret << "FieldDouble has no time discretization !\n"; }
ret << "FieldDouble nature of field is : \"" << MEDCouplingNatureOfField::GetReprNoThrow(_nature) << "\"\n";
{ ret << "FieldDouble space discretization is : " << _type->getStringRepr() << "\n"; }
else
{ ret << "FieldDouble has no space discretization set !\n"; }
- if(_time_discr)
- { ret << "FieldDouble time discretization is : " << _time_discr->getStringRepr() << "\n"; }
+ if(timeDiscr())
+ { ret << "FieldDouble time discretization is : " << timeDiscr()->getStringRepr() << "\n"; }
else
{ ret << "FieldDouble has no time discretization set !\n"; }
if(getArray())
else
ret << "Mesh support information : No mesh set !\n";
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
int arrayId=0;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++,arrayId++)
{
}
if(!MEDCouplingField::isEqualIfNotWhy(other,meshPrec,valsPrec,reason))
return false;
- if(!_time_discr->isEqualIfNotWhy(otherC->_time_discr,valsPrec,reason))
+ if(!timeDiscr()->isEqualIfNotWhy(otherC->timeDiscr(),valsPrec,reason))
{
reason.insert(0,"In FieldDouble time discretizations differ :");
return false;
return false;
if(!MEDCouplingField::isEqualWithoutConsideringStr(other,meshPrec,valsPrec))
return false;
- if(!_time_discr->isEqualWithoutConsideringStr(otherC->_time_discr,valsPrec))
+ if(!timeDiscr()->isEqualWithoutConsideringStr(otherC->timeDiscr(),valsPrec))
return false;
return true;
}
const MEDCouplingFieldDouble *otherC(dynamic_cast<const MEDCouplingFieldDouble *>(other));
if(!otherC)
return false;
- if(!_time_discr->areCompatible(otherC->_time_discr))
+ if(!timeDiscr()->areCompatible(otherC->timeDiscr()))
return false;
return true;
}
const MEDCouplingFieldDouble *otherC(dynamic_cast<const MEDCouplingFieldDouble *>(other));
if(!otherC)
return false;
- if(!_time_discr->areStrictlyCompatible(otherC->_time_discr,tmp))
+ if(!timeDiscr()->areStrictlyCompatible(otherC->timeDiscr(),tmp))
return false;
return true;
}
const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
if(!otherC)
return false;
- if(!_time_discr->areStrictlyCompatibleForMul(otherC->_time_discr))
+ if(!timeDiscr()->areStrictlyCompatibleForMul(otherC->timeDiscr()))
return false;
return true;
}
const MEDCouplingFieldDouble *otherC(dynamic_cast<const MEDCouplingFieldDouble *>(other));
if(!otherC)
return false;
- if(!_time_discr->areStrictlyCompatibleForDiv(otherC->_time_discr))
+ if(!timeDiscr()->areStrictlyCompatibleForDiv(otherC->timeDiscr()))
return false;
return true;
}
{
if(!MEDCouplingField::areStrictlyCompatible(other))
return false;
- if(!_time_discr->areCompatibleForMeld(other->_time_discr))
+ if(!timeDiscr()->areCompatibleForMeld(other->timeDiscr()))
return false;
return true;
}
//
_type->renumberCells(old2NewBg,check);
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
std::vector<DataArray *> arrays2(arrays.size()); std::copy(arrays.begin(),arrays.end(),arrays2.begin());
_type->renumberArraysForCell(_mesh,arrays2,old2NewBg,check);
//
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("Expecting a spatial discretization to be able to operate a renumbering !");
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
_type->renumberValuesOnNodes(eps,old2NewBg,newNbOfNodes,*iter);
ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePart(partBg,partEnd)));
ret->setMesh(m);
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
std::vector<DataArrayDouble *> arrs;
std::vector< MCAuto<DataArrayDouble> > arrsSafe;
const int *arrSelBg=arrSelect->begin();
arr=(*iter)->selectByTupleIdSafe(arrSelBg,arrSelEnd);
arrs.push_back(arr); arrsSafe.push_back(arr);
}
- ret->_time_discr->setArrays(arrs,0);
+ ret->timeDiscr()->setArrays(arrs,0);
return ret.retn();
}
ret->setDiscretization(MCAuto<MEDCouplingFieldDiscretization>(disc->clonePartRange(begin,end,step)));
ret->setMesh(m);
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
std::vector<DataArrayDouble *> arrs;
std::vector< MCAuto<DataArrayDouble> > arrsSafe;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
}
arrs.push_back(arr); arrsSafe.push_back(arr);
}
- ret->_time_discr->setArrays(arrs,0);
+ ret->timeDiscr()->setArrays(arrs,0);
return ret.retn();
}
*/
TypeOfTimeDiscretization MEDCouplingFieldDouble::getTimeDiscretization() const
{
- return _time_discr->getEnum();
+ return timeDiscr()->getEnum();
}
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingField(type),
- _time_discr(MEDCouplingTimeDiscretization::New(td))
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(TypeOfField type, TypeOfTimeDiscretization td):MEDCouplingFieldT<double>(type,MEDCouplingTimeDiscretization::New(td))
{
}
/*!
* ** WARINING : This method do not deeply copy neither mesh nor spatial discretization. Only a shallow copy (reference) is done for mesh and spatial discretization ! **
*/
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingField(ft,false),
- _time_discr(MEDCouplingTimeDiscretization::New(td))
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td):MEDCouplingFieldT<double>(ft,MEDCouplingTimeDiscretization::New(td),false)
{
}
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingField(other,deepCopy),
- _time_discr(dynamic_cast<MEDCouplingTimeDiscretization *>(other._time_discr->performCopyOrIncrRef(deepCopy)))
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(const MEDCouplingFieldDouble& other, bool deepCopy):MEDCouplingFieldT<double>(other,deepCopy)
{
}
-MEDCouplingFieldDouble::MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type):MEDCouplingField(type,n),_time_discr(td)
+MEDCouplingFieldDouble::MEDCouplingFieldDouble(NatureOfField n, MEDCouplingTimeDiscretization *td, MEDCouplingFieldDiscretization *type):MEDCouplingFieldT<double>(type,n,td)
{
}
-MEDCouplingFieldDouble::~MEDCouplingFieldDouble()
-{
- delete _time_discr;
-}
-
/*!
* Checks if \a this field is correctly defined, else an exception is thrown.
* \throw If the mesh is not set.
void MEDCouplingFieldDouble::checkConsistencyLight() const
{
MEDCouplingField::checkConsistencyLight();
- _time_discr->checkConsistencyLight();
+ timeDiscr()->checkConsistencyLight();
_type->checkCoherencyBetween(_mesh,getArray());
}
double MEDCouplingFieldDouble::getMaxValue() const
{
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
double ret=-std::numeric_limits<double>::max();
bool isExistingArr=false;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
double MEDCouplingFieldDouble::getMaxValue2(DataArrayInt*& tupleIds) const
{
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
double ret=-std::numeric_limits<double>::max();
bool isExistingArr=false;
tupleIds=0;
double MEDCouplingFieldDouble::getMinValue() const
{
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
double ret=std::numeric_limits<double>::max();
bool isExistingArr=false;
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
double MEDCouplingFieldDouble::getMinValue2(DataArrayInt*& tupleIds) const
{
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
double ret=-std::numeric_limits<double>::max();
bool isExistingArr=false;
tupleIds=0;
*/
void MEDCouplingFieldDouble::getValueOnPos(int i, int j, int k, double *res) const
{
- const DataArrayDouble *arr=_time_discr->getArray();
+ const DataArrayDouble *arr=timeDiscr()->getArray();
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOnPos");
if(!((const MEDCouplingFieldDiscretization *)_type))
*/
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double *res) const
{
- const DataArrayDouble *arr=_time_discr->getArray();
+ const DataArrayDouble *arr=timeDiscr()->getArray();
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn");
if(!((const MEDCouplingFieldDiscretization *)_type))
*/
DataArrayDouble *MEDCouplingFieldDouble::getValueOnMulti(const double *spaceLoc, int nbOfPoints) const
{
- const DataArrayDouble *arr=_time_discr->getArray();
+ const DataArrayDouble *arr=timeDiscr()->getArray();
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOnMulti");
if(!((const MEDCouplingFieldDiscretization *)_type))
*/
void MEDCouplingFieldDouble::getValueOn(const double *spaceLoc, double time, double *res) const
{
- std::vector< const DataArrayDouble *> arrs=_time_discr->getArraysForTime(time);
+ std::vector< const DataArrayDouble *> arrs=timeDiscr()->getArraysForTime(time);
if(!_mesh)
throw INTERP_KERNEL::Exception("No mesh underlying this field to perform getValueOn");
if(!((const MEDCouplingFieldDiscretization *)_type))
res2.resize(sz+(*iter)->getNumberOfComponents());
_type->getValueOn(*iter,_mesh,spaceLoc,&res2[sz]);
}
- _time_discr->getValueForTime(time,res2,res);
+ timeDiscr()->getValueForTime(time,res2,res);
}
/*!
*/
void MEDCouplingFieldDouble::applyLin(double a, double b, int compoId)
{
- _time_discr->applyLin(a,b,compoId);
+ timeDiscr()->applyLin(a,b,compoId);
}
/*!
*/
void MEDCouplingFieldDouble::applyLin(double a, double b)
{
- _time_discr->applyLin(a,b);
+ timeDiscr()->applyLin(a,b);
}
/*!
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform operator = !");
int nbOfTuple=_type->getNumberOfTuples(_mesh);
- _time_discr->setOrCreateUniformValueOnAllComponents(nbOfTuple,value);
+ timeDiscr()->setOrCreateUniformValueOnAllComponents(nbOfTuple,value);
return *this;
}
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic !");
MCAuto<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
- _time_discr->fillFromAnalytic(loc,nbOfComp,func);
+ timeDiscr()->fillFromAnalytic(loc,nbOfComp,func);
}
/*!
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalytic !");
MCAuto<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
- _time_discr->fillFromAnalytic(loc,nbOfComp,func);
+ timeDiscr()->fillFromAnalytic(loc,nbOfComp,func);
}
/*!
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalyticCompo !");
MCAuto<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
- _time_discr->fillFromAnalyticCompo(loc,nbOfComp,func);
+ timeDiscr()->fillFromAnalyticCompo(loc,nbOfComp,func);
}
/*!
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform fillFromAnalyticNamedCompo !");
MCAuto<DataArrayDouble> loc=_type->getLocalizationOfDiscValues(_mesh);
- _time_discr->fillFromAnalyticNamedCompo(loc,nbOfComp,varsOrder,func);
+ timeDiscr()->fillFromAnalyticNamedCompo(loc,nbOfComp,varsOrder,func);
}
/*!
*/
void MEDCouplingFieldDouble::applyFunc(int nbOfComp, FunctionToEvaluate func)
{
- _time_discr->applyFunc(nbOfComp,func);
+ timeDiscr()->applyFunc(nbOfComp,func);
}
/*!
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform applyFunc !");
int nbOfTuple=_type->getNumberOfTuples(_mesh);
- _time_discr->setUniformValue(nbOfTuple,nbOfComp,val);
+ timeDiscr()->setUniformValue(nbOfTuple,nbOfComp,val);
}
/*!
*/
void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func)
{
- _time_discr->applyFunc(nbOfComp,func);
+ timeDiscr()->applyFunc(nbOfComp,func);
}
*/
void MEDCouplingFieldDouble::applyFuncCompo(int nbOfComp, const std::string& func)
{
- _time_discr->applyFuncCompo(nbOfComp,func);
+ timeDiscr()->applyFuncCompo(nbOfComp,func);
}
/*!
*/
void MEDCouplingFieldDouble::applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
- _time_discr->applyFuncNamedCompo(nbOfComp,varsOrder,func);
+ timeDiscr()->applyFuncNamedCompo(nbOfComp,varsOrder,func);
}
/*!
*/
void MEDCouplingFieldDouble::applyFunc(const std::string& func)
{
- _time_discr->applyFunc(func);
+ timeDiscr()->applyFunc(func);
}
/*!
*/
void MEDCouplingFieldDouble::applyFuncFast32(const std::string& func)
{
- _time_discr->applyFuncFast32(func);
+ timeDiscr()->applyFuncFast32(func);
}
/*!
*/
void MEDCouplingFieldDouble::applyFuncFast64(const std::string& func)
{
- _time_discr->applyFuncFast64(func);
+ timeDiscr()->applyFuncFast64(func);
}
/*!
void MEDCouplingFieldDouble::updateTime() const
{
MEDCouplingField::updateTime();
- updateTimeWith(*_time_discr);
+ updateTimeWith(*timeDiscr());
}
std::size_t MEDCouplingFieldDouble::getHeapMemorySizeWithoutChildren() const
std::vector<const BigMemoryObject *> MEDCouplingFieldDouble::getDirectChildrenWithNull() const
{
std::vector<const BigMemoryObject *> ret(MEDCouplingField::getDirectChildrenWithNull());
- if(_time_discr)
+ if(timeDiscr())
{
- std::vector<const BigMemoryObject *> ret2(_time_discr->getDirectChildrenWithNull());
+ std::vector<const BigMemoryObject *> ret2(timeDiscr()->getDirectChildrenWithNull());
ret.insert(ret.end(),ret2.begin(),ret2.end());
}
return ret;
*/
void MEDCouplingFieldDouble::setArray(DataArrayDouble *array)
{
- _time_discr->setArray(array,this);
+ timeDiscr()->setArray(array,this);
}
/*!
*/
void MEDCouplingFieldDouble::setEndArray(DataArrayDouble *array)
{
- _time_discr->setEndArray(array,this);
+ timeDiscr()->setEndArray(array,this);
}
/*!
*/
void MEDCouplingFieldDouble::setArrays(const std::vector<DataArrayDouble *>& arrs)
{
- _time_discr->setArrays(arrs,this);
+ timeDiscr()->setArrays(arrs,this);
}
void MEDCouplingFieldDouble::getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const
{
tinyInfo.clear();
- _time_discr->getTinySerializationStrInformation(tinyInfo);
+ timeDiscr()->getTinySerializationStrInformation(tinyInfo);
tinyInfo.push_back(_name);
tinyInfo.push_back(_desc);
tinyInfo.push_back(getTimeUnit());
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationIntInformation !");
tinyInfo.clear();
tinyInfo.push_back((int)_type->getEnum());
- tinyInfo.push_back((int)_time_discr->getEnum());
+ tinyInfo.push_back((int)timeDiscr()->getEnum());
tinyInfo.push_back((int)_nature);
- _time_discr->getTinySerializationIntInformation(tinyInfo);
+ timeDiscr()->getTinySerializationIntInformation(tinyInfo);
std::vector<int> tinyInfo2;
_type->getTinySerializationIntInformation(tinyInfo2);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform getTinySerializationDbleInformation !");
tinyInfo.clear();
- _time_discr->getTinySerializationDbleInformation(tinyInfo);
+ timeDiscr()->getTinySerializationDbleInformation(tinyInfo);
std::vector<double> tinyInfo2;
_type->getTinySerializationDbleInformation(tinyInfo2);
tinyInfo.insert(tinyInfo.end(),tinyInfo2.begin(),tinyInfo2.end());
tinyInfoITmp.pop_back();
std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
- _time_discr->resizeForUnserialization(tinyInfoI2,arrays);
+ timeDiscr()->resizeForUnserialization(tinyInfoI2,arrays);
std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
_type->resizeForUnserialization(tinyInfoITmp3,dataInt);
}
tinyInfoITmp.pop_back();
std::vector<int> tinyInfoITmp2(tinyInfoITmp.begin(),tinyInfoITmp.end()-sz);
std::vector<int> tinyInfoI2(tinyInfoITmp2.begin()+3,tinyInfoITmp2.end());
- _time_discr->checkForUnserialization(tinyInfoI2,arrays);
+ timeDiscr()->checkForUnserialization(tinyInfoI2,arrays);
std::vector<int> tinyInfoITmp3(tinyInfoITmp.end()-sz,tinyInfoITmp.end());
_type->checkForUnserialization(tinyInfoITmp3,dataInt);
}
std::vector<double> tmp1(tmp.begin(),tmp.end()-sz);
std::vector<double> tmp2(tmp.end()-sz,tmp.end());
//
- _time_discr->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS);
+ timeDiscr()->finishUnserialization(tinyInfoI2,tmp1,tinyInfoS);
_nature=(NatureOfField)tinyInfoI[2];
_type->finishUnserialization(tmp2);
int nbOfElemS=(int)tinyInfoS.size();
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform serialize !");
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
_type->getSerializationIntArray(dataInt);
}
if(!ret)//no nodes have been merged.
return ret;
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
_type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter);
if(!ret)//no nodes have been merged.
return ret;
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
_type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter);
if(meshC2->getNumberOfNodes()!=oldNbOfNodes)
{
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
_type->renumberValuesOnNodes(epsOnVals,arr->getConstPointer(),meshC2->getNumberOfNodes(),*iter);
if(meshC2->getNumberOfCells()!=oldNbOfCells)
{
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
_type->renumberValuesOnCells(epsOnVals,meshC,arr->getConstPointer(),meshC2->getNumberOfCells(),*iter);
ret->setMesh(mesh2);
MCAuto<DataArrayInt> tupleIds=computeTupleIdsToSelectFromCellIds(cellIds->begin(),cellIds->end());
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
int i=0;
std::vector<DataArrayDouble *> newArr(arrays.size());
std::vector< MCAuto<DataArrayDouble> > newArr2(arrays.size());
if(oldNbOfCells==newNbOfCells)
return false;
std::vector<DataArrayDouble *> arrays;
- _time_discr->getArrays(arrays);
+ timeDiscr()->getArrays(arrays);
for(std::vector<DataArrayDouble *>::const_iterator iter=arrays.begin();iter!=arrays.end();iter++)
if(*iter)
_type->renumberValuesOnCellsR(_mesh,arr->getConstPointer(),arr->getNbOfElems(),*iter);
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform doublyContractedProduct !");
- MEDCouplingTimeDiscretization *td=_time_discr->doublyContractedProduct();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->doublyContractedProduct();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("DoublyContractedProduct");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform determinant !");
- MEDCouplingTimeDiscretization *td=_time_discr->determinant();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->determinant();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Determinant");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenValues !");
- MEDCouplingTimeDiscretization *td=_time_discr->eigenValues();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->eigenValues();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("EigenValues");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform eigenVectors !");
- MEDCouplingTimeDiscretization *td=_time_discr->eigenVectors();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->eigenVectors();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("EigenVectors");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform inverse !");
- MEDCouplingTimeDiscretization *td=_time_discr->inverse();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->inverse();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Inversion");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform trace !");
- MEDCouplingTimeDiscretization *td=_time_discr->trace();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->trace();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Trace");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform deviator !");
- MEDCouplingTimeDiscretization *td=_time_discr->deviator();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->deviator();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Deviator");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform magnitude !");
- MEDCouplingTimeDiscretization *td=_time_discr->magnitude();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->magnitude();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName("Magnitude");
ret->setMesh(getMesh());
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform maxPerTuple !");
- MEDCouplingTimeDiscretization *td=_time_discr->maxPerTuple();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->maxPerTuple();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
std::ostringstream oss;
oss << "Max_" << getName();
*/
void MEDCouplingFieldDouble::changeNbOfComponents(int newNbOfComp, double dftValue)
{
- _time_discr->changeNbOfComponents(newNbOfComp,dftValue);
+ timeDiscr()->changeNbOfComponents(newNbOfComp,dftValue);
}
/*!
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform keepSelectedComponents !");
- MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds);
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->keepSelectedComponents(compoIds);
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setName(getName());
ret->setMesh(getMesh());
*/
void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds)
{
- _time_discr->setSelectedComponents(f->_time_discr,compoIds);
+ timeDiscr()->setSelectedComponents(f->timeDiscr(),compoIds);
}
/*!
*/
void MEDCouplingFieldDouble::sortPerTuple(bool asc)
{
- _time_discr->sortPerTuple(asc);
+ timeDiscr()->sortPerTuple(asc);
}
/*!
if(!f1->areCompatibleForMerge(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MergeFields on them ! Check support mesh, field nature, and spatial and time discretisation.");
const MEDCouplingMesh *m1(f1->getMesh()),*m2(f2->getMesh());
- if(!f1->_time_discr)
+ if(!f1->timeDiscr())
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 !");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->aggregate(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->aggregate(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setName(f1->getName());
ret->setDescription(f1->getDescription());
{ ms[i]=a[i]->getMesh()->buildUnstructured(); ms2[i]=ms[i]; }
else
{ ms[i]=0; ms2[i]=0; }
- tds[i]=a[i]->_time_discr;
+ tds[i]=a[i]->timeDiscr();
}
MEDCouplingTimeDiscretization *td=tds[0]->aggregate(tds);
- td->copyTinyAttrFrom(*(a[0]->_time_discr));
+ td->copyTinyAttrFrom(*(a[0]->timeDiscr()));
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone());
ret->setName(a[0]->getName());
ret->setDescription(a[0]->getDescription());
{
if(!f1->areCompatibleForMeld(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MeldFields on them ! Check support mesh, field nature, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->meld(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->meld(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::DotFields : input field is NULL !");
if(!f1->areStrictlyCompatibleForMulDiv(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply DotFields on them! Check support mesh, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->dot(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->dot(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret;
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::CrossProductFields : input field is NULL !");
if(!f1->areStrictlyCompatibleForMulDiv(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply CrossProductFields on them! Check support mesh, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->crossProduct(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->crossProduct(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MaxFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MaxFields on them! Check support mesh, field nature, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->max(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->max(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MinFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MinFields on them! Check support mesh, field nature, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->min(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->min(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
{
if(!((const MEDCouplingFieldDiscretization *)_type))
throw INTERP_KERNEL::Exception("No spatial discretization underlying this field to perform negate !");
- MEDCouplingTimeDiscretization *td=_time_discr->negate();
- td->copyTinyAttrFrom(*_time_discr);
+ MEDCouplingTimeDiscretization *td=timeDiscr()->negate();
+ td->copyTinyAttrFrom(*timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
ret->setMesh(getMesh());
return ret.retn();
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::AddFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply AddFields on them! Check support mesh, field nature, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->add(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->add(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
{
if(!areStrictlyCompatible(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply += on them! Check support mesh, field nature, and spatial and time discretisation.");
- _time_discr->addEqual(other._time_discr);
+ timeDiscr()->addEqual(other.timeDiscr());
return *this;
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::SubstractFields : input field is NULL !");
if(!f1->areStrictlyCompatible(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply SubstractFields on them! Check support mesh, field nature, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->substract(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->substract(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
{
if(!areStrictlyCompatible(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply -= on them! Check support mesh, field nature, and spatial and time discretisation.");
- _time_discr->substractEqual(other._time_discr);
+ timeDiscr()->substractEqual(other.timeDiscr());
return *this;
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::MultiplyFields : input field is NULL !");
if(!f1->areCompatibleForMul(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply MultiplyFields on them! Check support mesh, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->multiply(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->multiply(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
{
if(!areCompatibleForMul(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply *= on them! Check support mesh, and spatial and time discretisation.");
- _time_discr->multiplyEqual(other._time_discr);
+ timeDiscr()->multiplyEqual(other.timeDiscr());
_nature = NoNature;
return *this;
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::DivideFields : input field is NULL !");
if(!f1->areCompatibleForDiv(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply DivideFields on them! Check support mesh, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->divide(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->divide(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
{
if(!areCompatibleForDiv(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply /= on them! Check support mesh, and spatial and time discretisation.");
- _time_discr->divideEqual(other._time_discr);
+ timeDiscr()->divideEqual(other.timeDiscr());
_nature = NoNature;
return *this;
}
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::PowFields : input field is NULL !");
if(!f1->areCompatibleForMul(f2))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply PowFields on them! Check support mesh, and spatial and time discretisation.");
- MEDCouplingTimeDiscretization *td=f1->_time_discr->pow(f2->_time_discr);
- td->copyTinyAttrFrom(*f1->_time_discr);
+ MEDCouplingTimeDiscretization *td=f1->timeDiscr()->pow(f2->timeDiscr());
+ td->copyTinyAttrFrom(*f1->timeDiscr());
MCAuto<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(NoNature,td,f1->_type->clone());
ret->setMesh(f1->getMesh());
return ret.retn();
{
if(!areCompatibleForDiv(&other))
throw INTERP_KERNEL::Exception("Fields are not compatible. Unable to apply ^= on them! Check support mesh, and spatial and time discretisation.");
- _time_discr->powEqual(other._time_discr);
+ timeDiscr()->powEqual(other.timeDiscr());
_nature = NoNature;
return *this;
}
std::string tmp(oss.str());
stream << "\nMesh info : " << tmp.substr(0,tmp.find('\n'));
}
- if(_time_discr)
+ if(timeDiscr())
{
- const DataArrayDouble *arr=_time_discr->getArray();
+ const DataArrayDouble *arr=timeDiscr()->getArray();
if(arr)
{
stream << "\n\nArray info : ";
}
}
}
+
+MEDCouplingTimeDiscretization *MEDCouplingFieldDouble::timeDiscr()
+{
+ MEDCouplingTimeDiscretizationTemplate<double> *ret(_time_discr);
+ if(!ret)
+ return 0;
+ MEDCouplingTimeDiscretization *retc(dynamic_cast<MEDCouplingTimeDiscretization *>(ret));
+ if(!retc)
+ throw INTERP_KERNEL::Exception("Field Double Null invalid type of time discr !");
+ return retc;
+}
+
+const MEDCouplingTimeDiscretization *MEDCouplingFieldDouble::timeDiscr() const
+{
+ const MEDCouplingTimeDiscretizationTemplate<double> *ret(_time_discr);
+ if(!ret)
+ return 0;
+ const MEDCouplingTimeDiscretization *retc(dynamic_cast<const MEDCouplingTimeDiscretization *>(ret));
+ if(!retc)
+ throw INTERP_KERNEL::Exception("Field Double Null invalid type of time discr !");
+ return retc;
+}