return new DataArrayDouble;
}
+bool DataArrayDouble::isAllocated() const
+{
+ return getConstPointer()!=0;
+}
+
+void DataArrayDouble::checkAllocated() const throw(INTERP_KERNEL::Exception)
+{
+ if(!isAllocated())
+ throw INTERP_KERNEL::Exception("DataArrayDouble::checkAllocated : Array is defined but not allocated ! Call alloc or setValues method first !");
+}
+
DataArrayDouble *DataArrayDouble::deepCopy() const
{
return new DataArrayDouble(*this);
return _mem.isEqual(other._mem,prec);
}
-void DataArrayDouble::reAlloc(int nbOfTuples)
+void DataArrayDouble::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
_mem.reAlloc(_info_on_compo.size()*nbOfTuples);
_nb_of_tuples=nbOfTuples;
declareAsNew();
*/
DataArrayDouble *DataArrayDouble::changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
DataArrayDouble *ret=DataArrayDouble::New();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const double *oldc=getConstPointer();
DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
int newNbOfCompo=compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
return ret/nbOfTuples;
}
-void DataArrayDouble::accumulate(double *res) const
+void DataArrayDouble::accumulate(double *res) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
const double *ptr=getConstPointer();
int nbTuple=getNumberOfTuples();
int nbComps=getNumberOfComponents();
std::transform(ptr+i*nbComps,ptr+(i+1)*nbComps,res,res,std::plus<double>());
}
-double DataArrayDouble::accumulate(int compId) const
+double DataArrayDouble::accumulate(int compId) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
const double *ptr=getConstPointer();
int nbTuple=getNumberOfTuples();
int nbComps=getNumberOfComponents();
return ret;
}
-DataArrayDouble *DataArrayDouble::fromPolarToCart() const
+DataArrayDouble *DataArrayDouble::fromPolarToCart() const throw(INTERP_KERNEL::Exception)
{
int nbOfComp=getNumberOfComponents();
if(nbOfComp!=2)
return ret;
}
-DataArrayDouble *DataArrayDouble::fromCylToCart() const
+DataArrayDouble *DataArrayDouble::fromCylToCart() const throw(INTERP_KERNEL::Exception)
{
int nbOfComp=getNumberOfComponents();
if(nbOfComp!=3)
return ret;
}
-DataArrayDouble *DataArrayDouble::fromSpherToCart() const
+DataArrayDouble *DataArrayDouble::fromSpherToCart() const throw(INTERP_KERNEL::Exception)
{
int nbOfComp=getNumberOfComponents();
if(nbOfComp!=3)
DataArrayDouble *DataArrayDouble::determinant() const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
DataArrayDouble *ret=DataArrayDouble::New();
int nbOfTuple=getNumberOfTuples();
ret->alloc(nbOfTuple,1);
DataArrayDouble *DataArrayDouble::magnitude() const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
int nbOfComp=getNumberOfComponents();
DataArrayDouble *ret=DataArrayDouble::New();
int nbOfTuple=getNumberOfTuples();
DataArrayDouble *DataArrayDouble::maxPerTuple() const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
int nbOfComp=getNumberOfComponents();
DataArrayDouble *ret=DataArrayDouble::New();
int nbOfTuple=getNumberOfTuples();
void DataArrayDouble::sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
double *pt=getPointer();
int nbOfTuple=getNumberOfTuples();
int nbOfComp=getNumberOfComponents();
declareAsNew();
}
-void DataArrayDouble::applyLin(double a, double b, int compoId)
+void DataArrayDouble::applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
double *ptr=getPointer()+compoId;
int nbOfComp=getNumberOfComponents();
int nbOfTuple=getNumberOfTuples();
DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
DataArrayDouble *newArr=DataArrayDouble::New();
int nbOfTuples=getNumberOfTuples();
int oldNbOfComp=getNumberOfComponents();
DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
std::set<std::string> vars;
DataArrayDouble *DataArrayDouble::applyFunc(const char *func) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
expr.prepareExprEvaluationVec();
return newArr;
}
-void DataArrayDouble::applyFuncFast32(const char *func)
+void DataArrayDouble::applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
char *funcStr=expr.compileX86();
declareAsNew();
}
-void DataArrayDouble::applyFuncFast64(const char *func)
+void DataArrayDouble::applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
INTERP_KERNEL::ExprParser expr(func);
expr.parse();
char *funcStr=expr.compileX86_64();
DataArrayInt *DataArrayDouble::getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception)
{
if(getNumberOfComponents()!=1)
- throw INTERP_KERNEL::Exception("DataArrayDouble::getIdsInRange : the default array must have only one component !");
+ throw INTERP_KERNEL::Exception("DataArrayDouble::getIdsInRange : this must have exactly one component !");
const double *cptr=getConstPointer();
std::vector<int> res;
int nbOfTuples=getNumberOfTuples();
DataArrayDouble *DataArrayDouble::dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception)
{
+ a1->checkAllocated();
+ a2->checkAllocated();
int nbOfComp=a1->getNumberOfComponents();
if(nbOfComp!=a2->getNumberOfComponents())
throw INTERP_KERNEL::Exception("Nb of components mismatch for array dot !");
return new DataArrayInt;
}
+bool DataArrayInt::isAllocated() const
+{
+ return getConstPointer()!=0;
+}
+
+void DataArrayInt::checkAllocated() const throw(INTERP_KERNEL::Exception)
+{
+ if(!isAllocated())
+ throw INTERP_KERNEL::Exception("DataArrayInt::checkAllocated : Array is defined but not allocated ! Call alloc or setValues method first !");
+}
+
DataArrayInt *DataArrayInt::deepCopy() const
{
return new DataArrayInt(*this);
*/
DataArrayInt *DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
DataArrayInt *ret=DataArrayInt::New();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const int *oldc=getConstPointer();
return ret;
}
-void DataArrayInt::reAlloc(int nbOfTuples)
+void DataArrayInt::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
_mem.reAlloc(_info_on_compo.size()*nbOfTuples);
_nb_of_tuples=nbOfTuples;
declareAsNew();
DataArrayInt *DataArrayInt::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
{
+ checkAllocated();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
int newNbOfCompo=compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
{
public:
MEDCOUPLING_EXPORT static DataArrayDouble *New();
+ MEDCOUPLING_EXPORT bool isAllocated() const;
+ MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *deepCopy() const;
MEDCOUPLING_EXPORT DataArrayDouble *performCpy(bool deepCpy) const;
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo);
MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const;
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const;
//!alloc or useArray should have been called before.
- MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples);
+ MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const;
MEDCOUPLING_EXPORT DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt*& tupleIds) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getAverageValue() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void accumulate(double *res) const;
- MEDCOUPLING_EXPORT double accumulate(int compId) const;
- MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const;
- MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const;
- MEDCOUPLING_EXPORT DataArrayDouble *fromSpherToCart() const;
+ MEDCOUPLING_EXPORT void accumulate(double *res) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId);
+ MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void applyFuncFast32(const char *func);
- MEDCOUPLING_EXPORT void applyFuncFast64(const char *func);
+ MEDCOUPLING_EXPORT void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayDouble *aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayDouble *dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
{
public:
MEDCOUPLING_EXPORT static DataArrayInt *New();
+ MEDCOUPLING_EXPORT bool isAllocated() const;
+ MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *deepCopy() const;
MEDCOUPLING_EXPORT DataArrayInt *performCpy(bool deepCpy) const;
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo);
MEDCOUPLING_EXPORT DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const;
MEDCOUPLING_EXPORT DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const;
//!alloc or useArray should have been called before.
- MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples);
+ MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *convertToDblArr() const;
MEDCOUPLING_EXPORT DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);