-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019 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
#include "MEDLoader.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
MEDCalculatorDBSliceField::MEDCalculatorDBSliceField(int iter, int order):_iteration(iter),_order(order),_field(0),_work(0)
{
MEDCouplingFieldDouble *myF=const_cast<MEDCouplingFieldDouble *>(_field);
myF->setName(n.c_str());
myF->setDescription(d.c_str());
- MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fName,_field);
+ WriteFieldUsingAlreadyWrittenMesh(fName,_field);
myF->setName(kn.c_str());
myF->setDescription(kd.c_str());
}
MEDCouplingFieldDouble *MEDCalculatorDBSliceField::getField(TypeOfField type, const std::string& fname, const std::string& mname, const std::string& fieldName) const
{
if(!_field)
- _field=MEDLoader::ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order);
+ {
+ MCAuto<MEDCouplingField> tmpp(ReadField(type,fname.c_str(),mname.c_str(),0,fieldName.c_str(),_iteration,_order));
+ MCAuto<MEDCouplingFieldDouble> tmp(DynamicCast<MEDCouplingField,MEDCouplingFieldDouble>(tmpp));
+ _field=tmp.retn();
+ }
return _field;
}
*/
MEDCouplingFieldDouble *MEDCalculatorDBSliceField::getFieldWithoutQuestion(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
return _field->keepSelectedComponents(tIds);
}
void MEDCalculatorDBSliceField::assign(const MEDCalculatorDBSliceField* other, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=other->_field->keepSelectedComponents(oIds);
_field->setSelectedComponents(f1,tIds);
}
-MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::add(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
+MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::add(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const
{
if(cc!=0 || nc!=0)
throw INTERP_KERNEL::Exception("Slice::add : not implemented yet node/cell permutation !");
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ MCAuto<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
f2->setMesh(f1->getMesh());
MEDCouplingFieldDouble *f3=(*f1)+(*f2);
return new MEDCalculatorDBSliceField(f3);
}
-MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::substract(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
+MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::substract(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const
{
if(cc!=0 || nc!=0)
throw INTERP_KERNEL::Exception("Slice::substract : not implemented yet node/cell permutation !");
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ MCAuto<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
f2->setMesh(f1->getMesh());
MEDCouplingFieldDouble *f3=(*f1)-(*f2);
return new MEDCalculatorDBSliceField(f3);
}
-MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::multiply(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
+MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::multiply(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const
{
if(cc!=0 || nc!=0)
throw INTERP_KERNEL::Exception("Slice::multiply : not implemented yet node/cell permutation !");
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ MCAuto<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
f2->setMesh(f1->getMesh());
MEDCouplingFieldDouble *f3=(*f1)*(*f2);
return new MEDCalculatorDBSliceField(f3);
}
-MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::divide(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
+MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::divide(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const
{
if(cc!=0 || nc!=0)
throw INTERP_KERNEL::Exception("Slice::divide : not implemented yet node/cell permutation !");
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ MCAuto<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
f2->setMesh(f1->getMesh());
MEDCouplingFieldDouble *f3=(*f1)/(*f2);
return new MEDCalculatorDBSliceField(f3);
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::dot(const MEDCalculatorDBSliceField* other, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ MCAuto<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
f2->setMesh(f1->getMesh());
MEDCouplingFieldDouble *f3=f1->dot(*f2);
return new MEDCalculatorDBSliceField(f3);
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::crossProduct(const MEDCalculatorDBSliceField* other, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC) const
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ MCAuto<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
f2->setMesh(f1->getMesh());
MEDCouplingFieldDouble *f3=f1->crossProduct(*f2);
return new MEDCalculatorDBSliceField(f3);
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::doublyContractedProduct(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->doublyContractedProduct();
return new MEDCalculatorDBSliceField(f2);
}
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::determinant(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->determinant();
return new MEDCalculatorDBSliceField(f2);
}
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::eigenValues(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->eigenValues();
return new MEDCalculatorDBSliceField(f2);
}
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::eigenVectors(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->eigenVectors();
return new MEDCalculatorDBSliceField(f2);
}
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::inverse(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->inverse();
return new MEDCalculatorDBSliceField(f2);
}
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::trace(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->trace();
return new MEDCalculatorDBSliceField(f2);
}
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::deviator(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->deviator();
return new MEDCalculatorDBSliceField(f2);
}
MEDCalculatorDBSliceField *MEDCalculatorDBSliceField::magnitude(int sizeCThis, const MEDCalculatorDBRangeSelection& thisC) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
MEDCouplingFieldDouble *f2=f1->magnitude();
return new MEDCalculatorDBSliceField(f2);
}
void MEDCalculatorDBSliceField::applyFunc(const char *func, int sizeCThis, const MEDCalculatorDBRangeSelection& thisC)
{
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
f1->applyFunc(func);
_field->setSelectedComponents(f1,tIds);
}
-bool MEDCalculatorDBSliceField::isEqual(const MEDCalculatorDBSliceField* other, const DataArrayInt *cc, const DataArrayInt *nc,
+bool MEDCalculatorDBSliceField::isEqual(const MEDCalculatorDBSliceField* other, const DataArrayIdType *cc, const DataArrayIdType *nc,
int sizeCThis, const MEDCalculatorDBRangeSelection& thisC,
int sizeCOther, const MEDCalculatorDBRangeSelection& otherC, double prec) const
{
if(cc!=0 || nc!=0)
throw INTERP_KERNEL::Exception("Slice::isEqual : not implemented yet node/cell permutation !");
- std::vector<int> tIds=thisC.getIds(sizeCThis);
- std::vector<int> oIds=otherC.getIds(sizeCOther);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
+ std::vector<std::size_t> tIds=thisC.getIds(sizeCThis);
+ std::vector<std::size_t> oIds=otherC.getIds(sizeCOther);
+ MCAuto<MEDCouplingFieldDouble> f1=_field->keepSelectedComponents(tIds);
+ MCAuto<MEDCouplingFieldDouble> f2=other->_field->keepSelectedComponents(oIds);
f2->setMesh(f1->getMesh());
return f1->isEqualWithoutConsideringStr(f2,0,prec);
}