setInfoOnComponent(compoIds[i],other.getInfoOnComponent((int)i).c_str());
}
-bool DataArray::areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const
+bool DataArray::areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception)
{
std::ostringstream oss;
if(_name!=other._name)
* \param [in] other - another instance of DataArray to compare the textual data of.
* \return bool - \a true if the textual information is same, \a false else.
*/
-bool DataArray::areInfoEquals(const DataArray& other) const
+bool DataArray::areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception)
{
std::string tmp;
return areInfoEqualsIfNotWhy(other,tmp);
}
-void DataArray::reprWithoutNameStream(std::ostream& stream) const
+void DataArray::reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
stream << "Number of components : "<< getNumberOfComponents() << "\n";
stream << "Info of these components : ";
_info_on_compo=info;
}
-std::vector<std::string> DataArray::getVarsOnComponent() const
+std::vector<std::string> DataArray::getVarsOnComponent() const throw(INTERP_KERNEL::Exception)
{
int nbOfCompo=(int)_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
return ret;
}
-std::vector<std::string> DataArray::getUnitsOnComponent() const
+std::vector<std::string> DataArray::getUnitsOnComponent() const throw(INTERP_KERNEL::Exception)
{
int nbOfCompo=(int)_info_on_compo.size();
std::vector<std::string> ret(nbOfCompo);
* in \ref MEDCouplingArrayBasicsTuplesAndCompo "DataArrays infos" for more information.
* \return bool - \a true if the raw data is allocated, \a false else.
*/
-bool DataArrayDouble::isAllocated() const
+bool DataArrayDouble::isAllocated() const throw(INTERP_KERNEL::Exception)
{
return getConstPointer()!=0;
}
* \ref MEDCouplingArrayBasicsCopyDeep.
* \return DataArrayDouble * - a new instance of DataArrayDouble.
*/
-DataArrayDouble *DataArrayDouble::deepCpy() const
+DataArrayDouble *DataArrayDouble::deepCpy() const throw(INTERP_KERNEL::Exception)
{
return new DataArrayDouble(*this);
}
* \return DataArrayDouble * - either a new instance of DataArrayDouble (if \a dCpy
* == \a true) or \a this instance (if \a dCpy == \a false).
*/
-DataArrayDouble *DataArrayDouble::performCpy(bool dCpy) const
+DataArrayDouble *DataArrayDouble::performCpy(bool dCpy) const throw(INTERP_KERNEL::Exception)
{
if(dCpy)
return deepCpy();
* \param [in] nbOfCompo - number of components of data to allocate.
* \throw If \a nbOfTuple < 0 or \a nbOfCompo < 0.
*/
-void DataArrayDouble::allocIfNecessary(int nbOfTuple, int nbOfCompo)
+void DataArrayDouble::allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
if(isAllocated())
{
* DataArrayDouble. This text is shown when a DataArrayDouble is printed in Python.
* \return std::string - text describing \a this DataArrayDouble.
*/
-std::string DataArrayDouble::repr() const
+std::string DataArrayDouble::repr() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream ret;
reprStream(ret);
return ret.str();
}
-std::string DataArrayDouble::reprZip() const
+std::string DataArrayDouble::reprZip() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream ret;
reprZipStream(ret);
ofs << std::endl << idt << "</DataArray>\n";
}
-void DataArrayDouble::reprStream(std::ostream& stream) const
+void DataArrayDouble::reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
stream << "Name of double array : \"" << _name << "\"\n";
reprWithoutNameStream(stream);
}
-void DataArrayDouble::reprZipStream(std::ostream& stream) const
+void DataArrayDouble::reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
stream << "Name of double array : \"" << _name << "\"\n";
reprZipWithoutNameStream(stream);
}
-void DataArrayDouble::reprWithoutNameStream(std::ostream& stream) const
+void DataArrayDouble::reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
DataArray::reprWithoutNameStream(stream);
stream.precision(17);
_mem.repr(getNumberOfComponents(),stream);
}
-void DataArrayDouble::reprZipWithoutNameStream(std::ostream& stream) const
+void DataArrayDouble::reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
DataArray::reprWithoutNameStream(stream);
stream.precision(17);
_mem.reprZip(getNumberOfComponents(),stream);
}
-void DataArrayDouble::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayDouble::reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
const double *data=getConstPointer();
* \param [out] reason In case of inequality returns the reason.
* \sa DataArrayDouble::isEqual
*/
-bool DataArrayDouble::isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const
+bool DataArrayDouble::isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception)
{
if(!areInfoEqualsIfNotWhy(other,reason))
return false;
* \param [in] prec - precision value to compare numeric data of the arrays.
* \return bool - \a true if the two arrays are equal, \a false else.
*/
-bool DataArrayDouble::isEqual(const DataArrayDouble& other, double prec) const
+bool DataArrayDouble::isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
{
std::string tmp;
return isEqualIfNotWhy(other,prec,tmp);
* \param [in] prec - precision value to compare numeric data of the arrays.
* \return bool - \a true if the values of two arrays are equal, \a false else.
*/
-bool DataArrayDouble::isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const
+bool DataArrayDouble::isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
{
std::string tmp;
return _mem.isEqual(other._mem,prec,tmp);
* \param [in] old2New - C array of length equal to \a this->getNumberOfTuples()
* giving a new position for i-th old value.
*/
-void DataArrayDouble::renumberInPlace(const int *old2New)
+void DataArrayDouble::renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
* \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
* is to delete using decrRef() as it is no more needed.
*/
-void DataArrayDouble::renumberInPlaceR(const int *new2Old)
+void DataArrayDouble::renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
* is to delete using decrRef() as it is no more needed.
* \throw If \a this is not allocated.
*/
-DataArrayDouble *DataArrayDouble::renumber(const int *old2New) const
+DataArrayDouble *DataArrayDouble::renumber(const int *old2New) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayDouble *ret=DataArrayDouble::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const double *iptr=getConstPointer();
for(int i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*i,iptr+nbOfCompo*(i+1),optr+nbOfCompo*old2New[i]);
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
* \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
* is to delete using decrRef() as it is no more needed.
*/
-DataArrayDouble *DataArrayDouble::renumberR(const int *new2Old) const
+DataArrayDouble *DataArrayDouble::renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayDouble *ret=DataArrayDouble::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const double *iptr=getConstPointer();
for(int i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*new2Old[i],iptr+nbOfCompo*(new2Old[i]+1),optr+i*nbOfCompo);
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
* \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
* is to delete using decrRef() as it is no more needed.
*/
-DataArrayDouble *DataArrayDouble::renumberAndReduce(const int *old2New, int newNbOfTuple) const
+DataArrayDouble *DataArrayDouble::renumberAndReduce(const int *old2New, int newNbOfTuple) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayDouble *ret=DataArrayDouble::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(newNbOfTuple,nbOfCompo);
const double *iptr=getConstPointer();
double *optr=ret->getPointer();
std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo);
}
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
DataArrayDouble *DataArrayDouble::changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- DataArrayDouble *ret=DataArrayDouble::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const double *oldc=getConstPointer();
double *nc=ret->getPointer();
for(int i=0;i<dim;i++)
ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
ret->setName(getName().c_str());
- return ret;
+ return ret.retn();
}
/*!
* \param [in] nbOfTuple - new number of tuples in \a this.
* \param [in] nbOfCompo - new number of components in \a this.
*/
-void DataArrayDouble::useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo)
+void DataArrayDouble::useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
_mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo);
declareAsNew();
}
-void DataArrayDouble::useExternalArrayWithRWAccess(const double *array, int nbOfTuple, int nbOfCompo)
+void DataArrayDouble::useExternalArrayWithRWAccess(const double *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
_mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
declareAsNew();
}
-DataArrayDoubleIterator *DataArrayDouble::iterator()
+DataArrayDoubleIterator *DataArrayDouble::iterator() throw(INTERP_KERNEL::Exception)
{
return new DataArrayDoubleIterator(this);
}
throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : Nb of components mismatch for array aggregation !");
nbt+=(*it)->getNumberOfTuples();
}
- DataArrayDouble *ret=DataArrayDouble::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
ret->alloc(nbt,nbOfComp);
double *pt=ret->getPointer();
for(it=a.begin();it!=a.end();it++)
pt=std::copy((*it)->getConstPointer(),(*it)->getConstPointer()+(*it)->getNbOfElems(),pt);
ret->copyStringInfoFrom(*(a[0]));
- return ret;
+ return ret.retn();
}
/*!
_da->decrRef();
}
-DataArrayDoubleTuple *DataArrayDoubleIterator::nextt()
+DataArrayDoubleTuple *DataArrayDoubleIterator::nextt() throw(INTERP_KERNEL::Exception)
{
if(_tuple_id<_nb_tuple)
{
}
-std::string DataArrayDoubleTuple::repr() const
+std::string DataArrayDoubleTuple::repr() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream oss; oss.precision(17); oss << "(";
for(int i=0;i<_nb_of_compo-1;i++)
* in \ref MEDCouplingArrayBasicsTuplesAndCompo "DataArrays infos" for more information.
* \return bool - \a true if the raw data is allocated, \a false else.
*/
-bool DataArrayInt::isAllocated() const
+bool DataArrayInt::isAllocated() const throw(INTERP_KERNEL::Exception)
{
return getConstPointer()!=0;
}
* \ref MEDCouplingArrayBasicsCopyDeep.
* \return DataArrayInt * - a new instance of DataArrayInt.
*/
-DataArrayInt *DataArrayInt::deepCpy() const
+DataArrayInt *DataArrayInt::deepCpy() const throw(INTERP_KERNEL::Exception)
{
return new DataArrayInt(*this);
}
* \return DataArrayInt * - either a new instance of DataArrayInt (if \a dCpy
* == \a true) or \a this instance (if \a dCpy == \a false).
*/
-DataArrayInt *DataArrayInt::performCpy(bool dCpy) const
+DataArrayInt *DataArrayInt::performCpy(bool dCpy) const throw(INTERP_KERNEL::Exception)
{
if(dCpy)
return deepCpy();
* \param [in] nbOfCompo - number of components of data to allocate.
* \throw If \a nbOfTuple < 0 or \a nbOfCompo < 0.
*/
-void DataArrayInt::allocIfNecessary(int nbOfTuple, int nbOfCompo)
+void DataArrayInt::allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
if(isAllocated())
{
* DataArrayInt. This text is shown when a DataArrayInt is printed in Python.
* \return std::string - text describing \a this DataArrayInt.
*/
-std::string DataArrayInt::repr() const
+std::string DataArrayInt::repr() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream ret;
reprStream(ret);
return ret.str();
}
-std::string DataArrayInt::reprZip() const
+std::string DataArrayInt::reprZip() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream ret;
reprZipStream(ret);
ofs << std::endl << idt << "</DataArray>\n";
}
-void DataArrayInt::reprStream(std::ostream& stream) const
+void DataArrayInt::reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
stream << "Name of int array : \"" << _name << "\"\n";
reprWithoutNameStream(stream);
}
-void DataArrayInt::reprZipStream(std::ostream& stream) const
+void DataArrayInt::reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
stream << "Name of int array : \"" << _name << "\"\n";
reprZipWithoutNameStream(stream);
}
-void DataArrayInt::reprWithoutNameStream(std::ostream& stream) const
+void DataArrayInt::reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
DataArray::reprWithoutNameStream(stream);
_mem.repr(getNumberOfComponents(),stream);
}
-void DataArrayInt::reprZipWithoutNameStream(std::ostream& stream) const
+void DataArrayInt::reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
DataArray::reprWithoutNameStream(stream);
_mem.reprZip(getNumberOfComponents(),stream);
}
-void DataArrayInt::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayInt::reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception)
{
int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
const int *data=getConstPointer();
* \param [out] reason In case of inequality returns the reason.
* \sa DataArrayInt::isEqual
*/
-bool DataArrayInt::isEqualIfNotWhy(const DataArrayInt& other, std::string& reason) const
+bool DataArrayInt::isEqualIfNotWhy(const DataArrayInt& other, std::string& reason) const throw(INTERP_KERNEL::Exception)
{
if(!areInfoEqualsIfNotWhy(other,reason))
return false;
* \param [in] other - an instance of DataArrayInt to compare with \a this one.
* \return bool - \a true if the two arrays are equal, \a false else.
*/
-bool DataArrayInt::isEqual(const DataArrayInt& other) const
+bool DataArrayInt::isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
{
std::string tmp;
return isEqualIfNotWhy(other,tmp);
* \param [in] other - an instance of DataArrayInt to compare with \a this one.
* \return bool - \a true if the values of two arrays are equal, \a false else.
*/
-bool DataArrayInt::isEqualWithoutConsideringStr(const DataArrayInt& other) const
+bool DataArrayInt::isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
{
std::string tmp;
return _mem.isEqual(other._mem,0,tmp);
* \param [in] nbOfTuple - new number of tuples in \a this.
* \param [in] nbOfCompo - new number of components in \a this.
*/
-void DataArrayInt::useArray(const int *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo)
+void DataArrayInt::useArray(const int *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
_mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo);
declareAsNew();
}
-void DataArrayInt::useExternalArrayWithRWAccess(const int *array, int nbOfTuple, int nbOfCompo)
+void DataArrayInt::useExternalArrayWithRWAccess(const int *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
_mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
* \param [in] old2New - C array of length equal to \a this->getNumberOfTuples()
* giving a new position for i-th old value.
*/
-void DataArrayInt::renumberInPlace(const int *old2New)
+void DataArrayInt::renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
* \return DataArrayInt * - the new instance of DataArrayInt that the caller
* is to delete using decrRef() as it is no more needed.
*/
-void DataArrayInt::renumberInPlaceR(const int *new2Old)
+void DataArrayInt::renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
* is to delete using decrRef() as it is no more needed.
* \throw If \a this is not allocated.
*/
-DataArrayInt *DataArrayInt::renumber(const int *old2New) const
+DataArrayInt *DataArrayInt::renumber(const int *old2New) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayInt *ret=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const int *iptr=getConstPointer();
for(int i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*i,iptr+nbOfCompo*(i+1),optr+nbOfCompo*old2New[i]);
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
* \return DataArrayInt * - the new instance of DataArrayInt that the caller
* is to delete using decrRef() as it is no more needed.
*/
-DataArrayInt *DataArrayInt::renumberR(const int *new2Old) const
+DataArrayInt *DataArrayInt::renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayInt *ret=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const int *iptr=getConstPointer();
for(int i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*new2Old[i],iptr+nbOfCompo*(new2Old[i]+1),optr+nbOfCompo*i);
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
* \return DataArrayInt * - the new instance of DataArrayInt that the caller
* is to delete using decrRef() as it is no more needed.
*/
-DataArrayInt *DataArrayInt::renumberAndReduce(const int *old2New, int newNbOfTuple) const
+DataArrayInt *DataArrayInt::renumberAndReduce(const int *old2New, int newNbOfTuple) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayInt *ret=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(newNbOfTuple,nbOfCompo);
const int *iptr=getConstPointer();
int *optr=ret->getPointer();
std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo);
}
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
DataArrayInt *DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- DataArrayInt *ret=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const int *oldc=getConstPointer();
int *nc=ret->getPointer();
for(int i=0;i<dim;i++)
ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
ret->setName(getName().c_str());
- return ret;
+ return ret.retn();
}
/*!
}
}
-DataArrayIntIterator *DataArrayInt::iterator()
+DataArrayIntIterator *DataArrayInt::iterator() throw(INTERP_KERNEL::Exception)
{
return new DataArrayIntIterator(this);
}
throw INTERP_KERNEL::Exception("DataArrayInt::Aggregate : Nb of components mismatch for array aggregation !");
nbt+=(*it)->getNumberOfTuples();
}
- DataArrayInt *ret=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
ret->alloc(nbt,nbOfComp);
int *pt=ret->getPointer();
for(it=a.begin();it!=a.end();it++)
pt=std::copy((*it)->getConstPointer(),(*it)->getConstPointer()+(*it)->getNbOfElems(),pt);
ret->copyStringInfoFrom(*(a[0]));
- return ret;
+ return ret.retn();
}
/*!
_da->decrRef();
}
-DataArrayIntTuple *DataArrayIntIterator::nextt()
+DataArrayIntTuple *DataArrayIntIterator::nextt() throw(INTERP_KERNEL::Exception)
{
if(_tuple_id<_nb_tuple)
{
{
}
-std::string DataArrayIntTuple::repr() const
+std::string DataArrayIntTuple::repr() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream oss; oss << "(";
for(int i=0;i<_nb_of_compo-1;i++)
MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const;
- MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const;
- MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
+ MEDCOUPLING_EXPORT bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::string getName() const { return _name; }
MEDCOUPLING_EXPORT const std::vector<std::string> &getInfoOnComponents() const { return _info_on_compo; }
MEDCOUPLING_EXPORT std::vector<std::string> &getInfoOnComponents() { return _info_on_compo; }
MEDCOUPLING_EXPORT void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT std::vector<std::string> getVarsOnComponent() const;
- MEDCOUPLING_EXPORT std::vector<std::string> getUnitsOnComponent() const;
+ MEDCOUPLING_EXPORT std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getNumberOfComponents() const { return (int)_info_on_compo.size(); }
- MEDCOUPLING_EXPORT virtual int getNumberOfTuples() const = 0;
- MEDCOUPLING_EXPORT virtual int getNbOfElems() const = 0;
+ MEDCOUPLING_EXPORT virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT virtual int getNbOfElems() const throw(INTERP_KERNEL::Exception) = 0;
MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT virtual void reprCppStream(const char *varName, std::ostream& stream) const = 0;
+ MEDCOUPLING_EXPORT virtual void reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT virtual void reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT virtual void reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT virtual void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT virtual void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
protected:
DataArray() { }
protected:
{
public:
MEDCOUPLING_EXPORT static DataArrayDouble *New();
- MEDCOUPLING_EXPORT bool isAllocated() const;
+ MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
- MEDCOUPLING_EXPORT int getNbOfElems() const { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
+ MEDCOUPLING_EXPORT int getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double doubleValue() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT DataArrayDouble *deepCpy() const;
- MEDCOUPLING_EXPORT DataArrayDouble *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double popBackSilent() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
+ MEDCOUPLING_EXPORT int getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithZero() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void iota(double init=0.) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reverse() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT std::string reprZip() const;
+ MEDCOUPLING_EXPORT std::string repr() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::string reprZip() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const char *nameInFile) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const;
- MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const;
+ MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDouble& other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
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 void renumberInPlace(const int *old2New);
- MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old);
- MEDCOUPLING_EXPORT DataArrayDouble *renumber(const int *old2New) const;
- MEDCOUPLING_EXPORT DataArrayDouble *renumberR(const int *new2Old) const;
- MEDCOUPLING_EXPORT DataArrayDouble *renumberAndReduce(const int *old2New, int newNbOfTuple) const;
+ MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayDouble *renumberAndReduce(const int *old2New, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayDouble *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
+ MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
MEDCOUPLING_EXPORT double back() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
- MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
- MEDCOUPLING_EXPORT double *getPointer() { return _mem.getPointer(); }
+ MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
+ MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
+ MEDCOUPLING_EXPORT double *getPointer() throw(INTERP_KERNEL::Exception) { return _mem.getPointer(); }
MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet);
- MEDCOUPLING_EXPORT const double *getConstPointer() const { return _mem.getConstPointer(); }
- MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator();
- MEDCOUPLING_EXPORT const double *begin() const { return getConstPointer(); }
- MEDCOUPLING_EXPORT const double *end() const { return getConstPointer()+getNbOfElems(); }
- MEDCOUPLING_EXPORT void useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
- MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const double *array, int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT const double *getConstPointer() const throw(INTERP_KERNEL::Exception) { return _mem.getConstPointer(); }
+ MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator() throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT const double *begin() const throw(INTERP_KERNEL::Exception) { return getConstPointer(); }
+ MEDCOUPLING_EXPORT const double *end() const throw(INTERP_KERNEL::Exception) { return getConstPointer()+getNbOfElems(); }
+ MEDCOUPLING_EXPORT void useArray(const double *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const double *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
template<class InputIterator>
void insertAtTheEnd(InputIterator first, InputIterator last) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void writeOnPlace(int id, double element0, const double *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
public:
DataArrayDoubleIterator(DataArrayDouble *da);
~DataArrayDoubleIterator();
- DataArrayDoubleTuple *nextt();
+ DataArrayDoubleTuple *nextt() throw(INTERP_KERNEL::Exception);
private:
DataArrayDouble *_da;
double *_pt;
{
public:
DataArrayDoubleTuple(double *pt, int nbOfComp);
- std::string repr() const;
+ std::string repr() const throw(INTERP_KERNEL::Exception);
int getNumberOfCompo() const { return _nb_of_compo; }
const double *getConstPointer() const { return _pt; }
double *getPointer() { return _pt; }
{
public:
MEDCOUPLING_EXPORT static DataArrayInt *New();
- MEDCOUPLING_EXPORT bool isAllocated() const;
+ MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
- MEDCOUPLING_EXPORT int getNbOfElems() const { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
+ MEDCOUPLING_EXPORT int getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int intValue() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getHashCode() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT DataArrayInt *deepCpy() const;
- MEDCOUPLING_EXPORT DataArrayInt *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT DataArrayInt *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackValsSilent(const int *valsBg, const int *valsEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int popBackSilent() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
+ MEDCOUPLING_EXPORT int getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
- MEDCOUPLING_EXPORT bool isEqual(const DataArrayInt& other) const;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayInt& other, std::string& reason) const;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayInt& other) const;
+ MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayInt& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithZero() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void iota(int init=0) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT std::string reprZip() const;
+ MEDCOUPLING_EXPORT std::string repr() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::string reprZip() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const char *type, const char *nameInFile) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const;
+ MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd,
MEDCOUPLING_EXPORT DataArrayDouble *convertToDblArr() const;
MEDCOUPLING_EXPORT DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New);
- MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old);
- MEDCOUPLING_EXPORT DataArrayInt *renumber(const int *old2New) const;
- MEDCOUPLING_EXPORT DataArrayInt *renumberR(const int *new2Old) const;
- MEDCOUPLING_EXPORT DataArrayInt *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const;
+ MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayInt *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
MEDCOUPLING_EXPORT DataArrayInt *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayInt*a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
- MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
+ MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception) { std::copy(_mem.getConstPointerLoc(tupleId*((int)_info_on_compo.size())),_mem.getConstPointerLoc((tupleId+1)*((int)_info_on_compo.size())),res); }
+ MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception) { return _mem[tupleId*((int)_info_on_compo.size())+compoId]; }
MEDCOUPLING_EXPORT int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int back() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
- MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
- MEDCOUPLING_EXPORT int *getPointer() { return _mem.getPointer(); }
+ MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; declareAsNew(); }
+ MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
+ MEDCOUPLING_EXPORT int *getPointer() throw(INTERP_KERNEL::Exception) { return _mem.getPointer(); }
MEDCOUPLING_EXPORT static void SetArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet);
- MEDCOUPLING_EXPORT const int *getConstPointer() const { return _mem.getConstPointer(); }
- MEDCOUPLING_EXPORT DataArrayIntIterator *iterator();
- MEDCOUPLING_EXPORT const int *begin() const { return getConstPointer(); }
- MEDCOUPLING_EXPORT const int *end() const { return getConstPointer()+getNbOfElems(); }
+ MEDCOUPLING_EXPORT const int *getConstPointer() const throw(INTERP_KERNEL::Exception) { return _mem.getConstPointer(); }
+ MEDCOUPLING_EXPORT DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT const int *begin() const throw(INTERP_KERNEL::Exception) { return getConstPointer(); }
+ MEDCOUPLING_EXPORT const int *end() const throw(INTERP_KERNEL::Exception) { return getConstPointer()+getNbOfElems(); }
MEDCOUPLING_EXPORT DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getIdsEqualList(const int *valsBg, const int *valsEnd) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::vector<DataArrayInt *> partitionByDifferentValues(std::vector<int>& differentIds) const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void useArray(const int *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
- MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const int *array, int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT void useArray(const int *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const int *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
template<class InputIterator>
void insertAtTheEnd(InputIterator first, InputIterator last) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void writeOnPlace(int id, int element0, const int *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); }
public:
DataArrayIntIterator(DataArrayInt *da);
~DataArrayIntIterator();
- DataArrayIntTuple *nextt();
+ DataArrayIntTuple *nextt() throw(INTERP_KERNEL::Exception);
private:
DataArrayInt *_da;
int *_pt;
{
public:
DataArrayIntTuple(int *pt, int nbOfComp);
- std::string repr() const;
+ std::string repr() const throw(INTERP_KERNEL::Exception);
int getNumberOfCompo() const { return _nb_of_compo; }
const int *getConstPointer() const { return _pt; }
int *getPointer() { return _pt; }
int _nb_of_compo;
};
- class DataArrayCharIterator;
-
class DataArrayChar : public DataArray
{
public:
- MEDCOUPLING_EXPORT static DataArrayChar *New();
- MEDCOUPLING_EXPORT bool isAllocated() const;
+ MEDCOUPLING_EXPORT virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception) = 0;
+ MEDCOUPLING_EXPORT bool isAllocated() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void checkAllocated() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNumberOfTuples() const { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
- MEDCOUPLING_EXPORT int getNbOfElems() const { return _mem.getNbOfElem(); }
+ MEDCOUPLING_EXPORT int getNumberOfTuples() const throw(INTERP_KERNEL::Exception) { return _info_on_compo.empty()?0:_mem.getNbOfElem()/getNumberOfComponents(); }
+ MEDCOUPLING_EXPORT int getNbOfElems() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElem(); }
MEDCOUPLING_EXPORT std::size_t getHeapMemorySize() const;
MEDCOUPLING_EXPORT void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT char charValue() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getHashCode() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool empty() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT DataArrayChar *deepCpy() const;
- MEDCOUPLING_EXPORT DataArrayChar *performCpy(bool deepCpy) const;
MEDCOUPLING_EXPORT void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT char popBackSilent() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT int getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
+ MEDCOUPLING_EXPORT int getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception) { return _mem.getNbOfElemAllocated(); }
MEDCOUPLING_EXPORT void alloc(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo);
- MEDCOUPLING_EXPORT bool isEqual(const DataArrayChar& other) const;
- MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
- MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayChar& other) const;
+ MEDCOUPLING_EXPORT void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithZero() throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT std::string repr() const;
- MEDCOUPLING_EXPORT std::string reprZip() const;
- MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
- MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const;
+ MEDCOUPLING_EXPORT std::string repr() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT std::string reprZip() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const;
- MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New);
- MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old);
- MEDCOUPLING_EXPORT DataArrayChar *renumber(const int *old2New) const;
- MEDCOUPLING_EXPORT DataArrayChar *renumberR(const int *new2Old) const;
- MEDCOUPLING_EXPORT DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const;
+ MEDCOUPLING_EXPORT DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setIJSilent(int tupleId, int compoId, char newVal) { _mem[tupleId*((int)_info_on_compo.size())+compoId]=newVal; }
MEDCOUPLING_EXPORT char *getPointer() { return _mem.getPointer(); }
MEDCOUPLING_EXPORT const char *getConstPointer() const { return _mem.getConstPointer(); }
- MEDCOUPLING_EXPORT DataArrayCharIterator *iterator();
- MEDCOUPLING_EXPORT const char *begin() const { return getConstPointer(); }
- MEDCOUPLING_EXPORT const char *end() const { return getConstPointer()+getNbOfElems(); }
+ MEDCOUPLING_EXPORT const char *begin() const throw(INTERP_KERNEL::Exception) { return getConstPointer(); }
+ MEDCOUPLING_EXPORT const char *end() const throw(INTERP_KERNEL::Exception) { return getConstPointer()+getNbOfElems(); }
MEDCOUPLING_EXPORT DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int search(const std::vector<char>& vals) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int locateValue(char value) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int locateValue(const std::vector<char>& vals) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool presenceOfValue(char value) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<char>& vals) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT static DataArrayChar *Meld(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
- MEDCOUPLING_EXPORT void useArray(const char *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo);
- MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const char *array, int nbOfTuple, int nbOfCompo);
+ MEDCOUPLING_EXPORT void useArray(const char *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void useExternalArrayWithRWAccess(const char *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void updateTime() const { }
public:
//MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector<int>& tinyInfo) const;
//MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector<std::string>& tinyInfo) const;
//MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector<int>& tinyInfoI);
//MEDCOUPLING_EXPORT void finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS);
- private:
+ protected:
DataArrayChar() { }
- private:
+ protected:
MemArray<char> _mem;
};
+
+ class DataArrayByteIterator;
+
+ class DataArrayByte : public DataArrayChar
+ {
+ public:
+ MEDCOUPLING_EXPORT static DataArrayByte *New();
+ MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayByteIterator *iterator();
+ MEDCOUPLING_EXPORT DataArrayByte *deepCpy() const;
+ MEDCOUPLING_EXPORT DataArrayByte *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT char byteValue() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ private:
+ DataArrayByte() { }
+ };
+
+ class DataArrayByteTuple;
+
+ class MEDCOUPLING_EXPORT DataArrayByteIterator
+ {
+ public:
+ DataArrayByteIterator(DataArrayByte *da);
+ ~DataArrayByteIterator();
+ DataArrayByteTuple *nextt() throw(INTERP_KERNEL::Exception);
+ private:
+ DataArrayByte *_da;
+ char *_pt;
+ int _tuple_id;
+ int _nb_comp;
+ int _nb_tuple;
+ };
+
+ class MEDCOUPLING_EXPORT DataArrayByteTuple
+ {
+ public:
+ DataArrayByteTuple(char *pt, int nbOfComp);
+ std::string repr() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfCompo() const { return _nb_of_compo; }
+ const char *getConstPointer() const { return _pt; }
+ char *getPointer() { return _pt; }
+ char byteValue() const throw(INTERP_KERNEL::Exception);
+ DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
+ private:
+ char *_pt;
+ int _nb_of_compo;
+ };
+
+ class DataArrayAsciiCharIterator;
+
+ class DataArrayAsciiChar : public DataArrayChar
+ {
+ public:
+ MEDCOUPLING_EXPORT static DataArrayAsciiChar *New();
+ MEDCOUPLING_EXPORT DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT DataArrayAsciiCharIterator *iterator();
+ MEDCOUPLING_EXPORT DataArrayAsciiChar *deepCpy() const;
+ MEDCOUPLING_EXPORT DataArrayAsciiChar *performCpy(bool deepCpy) const;
+ MEDCOUPLING_EXPORT char asciiCharValue() const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception);
+ MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
+ private:
+ DataArrayAsciiChar() { }
+ };
- class DataArrayCharTuple;
+ class DataArrayAsciiCharTuple;
- class MEDCOUPLING_EXPORT DataArrayCharIterator
+ class MEDCOUPLING_EXPORT DataArrayAsciiCharIterator
{
public:
- DataArrayCharIterator(DataArrayChar *da);
- ~DataArrayCharIterator();
- DataArrayCharTuple *nextt();
+ DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
+ ~DataArrayAsciiCharIterator();
+ DataArrayAsciiCharTuple *nextt() throw(INTERP_KERNEL::Exception);
private:
- DataArrayChar *_da;
+ DataArrayAsciiChar *_da;
char *_pt;
int _tuple_id;
int _nb_comp;
int _nb_tuple;
};
- class MEDCOUPLING_EXPORT DataArrayCharTuple
+ class MEDCOUPLING_EXPORT DataArrayAsciiCharTuple
{
public:
- DataArrayCharTuple(char *pt, int nbOfComp);
- std::string repr() const;
+ DataArrayAsciiCharTuple(char *pt, int nbOfComp);
+ std::string repr() const throw(INTERP_KERNEL::Exception);
int getNumberOfCompo() const { return _nb_of_compo; }
const char *getConstPointer() const { return _pt; }
char *getPointer() { return _pt; }
- char charValue() const throw(INTERP_KERNEL::Exception);
- DataArrayChar *buildDAChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
+ char asciiCharValue() const throw(INTERP_KERNEL::Exception);
+ DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
private:
char *_pt;
int _nb_of_compo;
using namespace ParaMEDMEM;
-/*!
- * Returns a new instance of DataArrayChar. The caller is to delete this array
- * using decrRef() as it is no more needed.
- */
-DataArrayChar *DataArrayChar::New()
-{
- return new DataArrayChar;
-}
-
/*!
* Checks if raw data is allocated. Read more on the raw data
* in \ref MEDCouplingArrayBasicsTuplesAndCompo "DataArrays infos" for more information.
* \return bool - \a true if the raw data is allocated, \a false else.
*/
-bool DataArrayChar::isAllocated() const
+bool DataArrayChar::isAllocated() const throw(INTERP_KERNEL::Exception)
{
return getConstPointer()!=0;
}
_info_on_compo=info;
}
-/*!
- * Returns the only one value in \a this, if and only if number of elements
- * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated.
- * \return double - the sole value stored in \a this array.
- * \throw If at least one of conditions stated above is not fulfilled.
- */
-char DataArrayChar::charValue() const throw(INTERP_KERNEL::Exception)
-{
- if(isAllocated())
- {
- if(getNbOfElems()==1)
- {
- return *getConstPointer();
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayChar::charValue : DataArrayChar instance is allocated but number of elements is not equal to 1 !");
- }
- else
- throw INTERP_KERNEL::Exception("DataArrayChar::charValue : DataArrayChar instance is not allocated !");
-}
-
/*!
* Returns an integer value characterizing \a this array, which is useful for a quick
* comparison of many instances of DataArrayInt.
return getNumberOfTuples()==0;
}
-/*!
- * Returns a full copy of \a this. For more info on copying data arrays see
- * \ref MEDCouplingArrayBasicsCopyDeep.
- * \return DataArrayChar * - a new instance of DataArrayChar.
- */
-DataArrayChar *DataArrayChar::deepCpy() const
-{
- return new DataArrayChar(*this);
-}
-
-/*!
- * Returns either a \a deep or \a shallow copy of this array. For more info see
- * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
- * \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one.
- * \return DataArrayChar * - either a new instance of DataArrayChar (if \a dCpy
- * == \a true) or \a this instance (if \a dCpy == \a false).
- */
-DataArrayChar *DataArrayChar::performCpy(bool dCpy) const
-{
- if(dCpy)
- return deepCpy();
- else
- {
- incrRef();
- return const_cast<DataArrayChar *>(this);
- }
-}
-
/*!
* Copies all the data from another DataArrayChar. For more info see
* \ref MEDCouplingArrayBasicsCopyDeepAssign.
* \param [in] nbOfCompo - number of components of data to allocate.
* \throw If \a nbOfTuple < 0 or \a nbOfCompo < 0.
*/
-void DataArrayChar::allocIfNecessary(int nbOfTuple, int nbOfCompo)
+void DataArrayChar::allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
if(isAllocated())
{
* \param [in] other - an instance of DataArrayChar to compare with \a this one.
* \return bool - \a true if the two arrays are equal, \a false else.
*/
-bool DataArrayChar::isEqual(const DataArrayChar& other) const
+bool DataArrayChar::isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
{
std::string tmp;
return isEqualIfNotWhy(other,tmp);
* \param [out] reason In case of inequality returns the reason.
* \sa DataArrayChar::isEqual
*/
-bool DataArrayChar::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const
+bool DataArrayChar::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception)
{
if(!areInfoEqualsIfNotWhy(other,reason))
return false;
* \param [in] other - an instance of DataArrayChar to compare with \a this one.
* \return bool - \a true if the values of two arrays are equal, \a false else.
*/
-bool DataArrayChar::isEqualWithoutConsideringStr(const DataArrayChar& other) const
+bool DataArrayChar::isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
{
std::string tmp;
return _mem.isEqual(other._mem,0,tmp);
* DataArrayChar. This text is shown when a DataArrayChar is printed in Python.
* \return std::string - text describing \a this DataArrayChar.
*/
-std::string DataArrayChar::repr() const
+std::string DataArrayChar::repr() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream ret;
reprStream(ret);
return ret.str();
}
-std::string DataArrayChar::reprZip() const
+std::string DataArrayChar::reprZip() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream ret;
reprZipStream(ret);
return ret.str();
}
-void DataArrayChar::reprStream(std::ostream& stream) const
-{
- stream << "Name of char array : \"" << _name << "\"\n";
- reprWithoutNameStream(stream);
-}
-
-void DataArrayChar::reprZipStream(std::ostream& stream) const
-{
- stream << "Name of char array : \"" << _name << "\"\n";
- reprZipWithoutNameStream(stream);
-}
-
-void DataArrayChar::reprWithoutNameStream(std::ostream& stream) const
-{
- DataArray::reprWithoutNameStream(stream);
- _mem.repr(getNumberOfComponents(),stream);
-}
-
-void DataArrayChar::reprZipWithoutNameStream(std::ostream& stream) const
-{
- DataArray::reprWithoutNameStream(stream);
- _mem.reprZip(getNumberOfComponents(),stream);
-}
-
-void DataArrayChar::reprCppStream(const char *varName, std::ostream& stream) const
-{
- int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
- const char *data=getConstPointer();
- stream << "DataArrayChar *" << varName << "=DataArrayChar::New();" << std::endl;
- if(nbTuples*nbComp>=1)
- {
- stream << "const char " << varName << "Data[" << nbTuples*nbComp << "]={";
- std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<char>(stream,","));
- stream << data[nbTuples*nbComp-1] << "};" << std::endl;
- stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl;
- }
- else
- stream << varName << "->alloc(" << nbTuples << "," << nbComp << ");" << std::endl;
- stream << varName << "->setName(\"" << getName() << "\");" << std::endl;
-}
-
/*!
* Changes number of tuples in the array. If the new number of tuples is smaller
* than the current number the array is truncated, otherwise the array is extended.
* array to the new one.
* \return DataArrayInt * - the new instance of DataArrayChar.
*/
-DataArrayInt *DataArrayChar::convertToIntArr() const
+DataArrayInt *DataArrayChar::convertToIntArr() const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
DataArrayInt *ret=DataArrayInt::New();
* \param [in] old2New - C array of length equal to \a this->getNumberOfTuples()
* giving a new position for i-th old value.
*/
-void DataArrayChar::renumberInPlace(const int *old2New)
+void DataArrayChar::renumberInPlace(const int *old2New) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
* \param [in] new2Old - C array of length equal to \a this->getNumberOfTuples()
* giving a previous position of i-th new value.
*/
-void DataArrayChar::renumberInPlaceR(const int *new2Old)
+void DataArrayChar::renumberInPlaceR(const int *new2Old) throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
* is to delete using decrRef() as it is no more needed.
* \throw If \a this is not allocated.
*/
-DataArrayChar *DataArrayChar::renumber(const int *old2New) const
+DataArrayChar *DataArrayChar::renumber(const int *old2New) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayChar *ret=DataArrayChar::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const char *iptr=getConstPointer();
for(int i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*i,iptr+nbOfCompo*(i+1),optr+nbOfCompo*old2New[i]);
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
* \return DataArrayChar * - the new instance of DataArrayChar that the caller
* is to delete using decrRef() as it is no more needed.
*/
-DataArrayChar *DataArrayChar::renumberR(const int *new2Old) const
+DataArrayChar *DataArrayChar::renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayChar *ret=DataArrayChar::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(nbTuples,nbOfCompo);
ret->copyStringInfoFrom(*this);
const char *iptr=getConstPointer();
for(int i=0;i<nbTuples;i++)
std::copy(iptr+nbOfCompo*new2Old[i],iptr+nbOfCompo*(new2Old[i]+1),optr+nbOfCompo*i);
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
* \return DataArrayChar * - the new instance of DataArrayChar that the caller
* is to delete using decrRef() as it is no more needed.
*/
-DataArrayChar *DataArrayChar::renumberAndReduce(const int *old2New, int newNbOfTuple) const
+DataArrayChar *DataArrayChar::renumberAndReduce(const int *old2New, int newNbOfTuple) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
int nbTuples=getNumberOfTuples();
int nbOfCompo=getNumberOfComponents();
- DataArrayChar *ret=DataArrayChar::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(newNbOfTuple,nbOfCompo);
const char *iptr=getConstPointer();
char *optr=ret->getPointer();
std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo);
}
ret->copyStringInfoFrom(*this);
- return ret;
+ return ret.retn();
}
/*!
DataArrayChar *DataArrayChar::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=DataArrayChar::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
int nbComp=getNumberOfComponents();
int oldNbOfTuples=getNumberOfTuples();
ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
DataArrayChar *DataArrayChar::selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=DataArrayChar::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
int nbComp=getNumberOfComponents();
int newNbOfTuples=GetNumberOfItemGivenBES(bg,end2,step,"DataArrayInt::selectByTupleId2 : ");
ret->alloc(newNbOfTuples,nbComp);
DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- DataArrayChar *ret=DataArrayChar::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=buildEmptySpecializedDAChar();
ret->alloc(getNumberOfTuples(),newNbOfComp);
const char *oldc=getConstPointer();
char *nc=ret->getPointer();
for(int i=0;i<dim;i++)
ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
ret->setName(getName().c_str());
- return ret;
+ return ret.retn();
}
/*!
DataArrayChar *DataArrayChar::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
{
checkAllocated();
- MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret(DataArrayChar::New());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret(buildEmptySpecializedDAChar());
int newNbOfCompo=(int)compoIds.size();
int oldNbOfCompo=getNumberOfComponents();
for(std::vector<int>::const_iterator it=compoIds.begin();it!=compoIds.end();it++)
return *(getConstPointer()+nbOfTuples-1);
}
-DataArrayCharIterator *DataArrayChar::iterator()
-{
- return new DataArrayCharIterator(this);
-}
-
/*!
* Creates a new DataArrayChar containing IDs (indices) of tuples holding value equal to a
* given one.
return -1;
}
+/*!
+ * This method is an extension of DataArrayChar::presenceOfValue method because this method works for DataArrayChar with
+ * any number of components excepted 0 (an INTERP_KERNEL::Exception is thrown in this case).
+ * This method searches in \b this is there is a tuple that matched the input parameter \b tupl.
+ * This method throws an INTERP_KERNEL::Exception if the number of components in \b this mismatches with the size of
+ * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated.
+ * \sa DataArrayChar::locateTuple
+ */
+bool DataArrayChar::presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception)
+{
+ return locateTuple(tupl)!=-1;
+}
+
/*!
* Returns \a true if a given value is present within \a this one-dimensional array.
* \param [in] value - the value to find within \a this array.
throw INTERP_KERNEL::Exception("DataArrayChar::Aggregate : Nb of components mismatch for array aggregation !");
nbt+=(*it)->getNumberOfTuples();
}
- DataArrayChar *ret=DataArrayChar::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayChar> ret=a[0]->buildEmptySpecializedDAChar();
ret->alloc(nbt,nbOfComp);
char *pt=ret->getPointer();
for(it=a.begin();it!=a.end();it++)
pt=std::copy((*it)->getConstPointer(),(*it)->getConstPointer()+(*it)->getNbOfElems(),pt);
ret->copyStringInfoFrom(*(a[0]));
- return ret;
+ return ret.retn();
}
/*!
pts[i]=(*it)->getConstPointer();
}
int totalNbOfComp=std::accumulate(nbc.begin(),nbc.end(),0);
- DataArrayChar *ret=DataArrayChar::New();
+ DataArrayChar *ret=a[0]->buildEmptySpecializedDAChar();
ret->alloc(nbOfTuples,totalNbOfComp);
char *retPtr=ret->getPointer();
for(int i=0;i<nbOfTuples;i++)
* \param [in] nbOfTuple - new number of tuples in \a this.
* \param [in] nbOfCompo - new number of components in \a this.
*/
-void DataArrayChar::useArray(const char *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo)
+void DataArrayChar::useArray(const char *array, bool ownership, DeallocType type, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
_mem.useArray(array,ownership,type,nbOfTuple*nbOfCompo);
declareAsNew();
}
-void DataArrayChar::useExternalArrayWithRWAccess(const char *array, int nbOfTuple, int nbOfCompo)
+void DataArrayChar::useExternalArrayWithRWAccess(const char *array, int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception)
{
_info_on_compo.resize(nbOfCompo);
_mem.useExternalArrayWithRWAccess(array,nbOfTuple*nbOfCompo);
declareAsNew();
}
-DataArrayCharIterator::DataArrayCharIterator(DataArrayChar *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+/*!
+ * Returns a new instance of DataArrayByte. The caller is to delete this array
+ * using decrRef() as it is no more needed.
+ */
+DataArrayByte *DataArrayByte::New()
+{
+ return new DataArrayByte;
+}
+
+DataArrayByteIterator *DataArrayByte::iterator()
+{
+ return new DataArrayByteIterator(this);
+}
+
+/*!
+ * Returns a full copy of \a this. For more info on copying data arrays see
+ * \ref MEDCouplingArrayBasicsCopyDeep.
+ * \return DataArrayByte * - a new instance of DataArrayByte.
+ */
+DataArrayByte *DataArrayByte::deepCpy() const
+{
+ return new DataArrayByte(*this);
+}
+
+/*!
+ * Returns either a \a deep or \a shallow copy of this array. For more info see
+ * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
+ * \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one.
+ * \return DataArrayByte * - either a new instance of DataArrayByte (if \a dCpy
+ * == \a true) or \a this instance (if \a dCpy == \a false).
+ */
+DataArrayByte *DataArrayByte::performCpy(bool dCpy) const
+{
+ if(dCpy)
+ return deepCpy();
+ else
+ {
+ incrRef();
+ return const_cast<DataArrayByte *>(this);
+ }
+}
+
+/*!
+ * Returns the only one value in \a this, if and only if number of elements
+ * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated.
+ * \return double - the sole value stored in \a this array.
+ * \throw If at least one of conditions stated above is not fulfilled.
+ */
+char DataArrayByte::byteValue() const throw(INTERP_KERNEL::Exception)
+{
+ if(isAllocated())
+ {
+ if(getNbOfElems()==1)
+ {
+ return *getConstPointer();
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayByte::byteValue : DataArrayByte instance is allocated but number of elements is not equal to 1 !");
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayByte::byteValue : DataArrayByte instance is not allocated !");
+}
+
+DataArrayChar *DataArrayByte::buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception)
+{
+ return DataArrayByte::New();
+}
+
+void DataArrayByte::reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ stream << "Name of byte array : \"" << _name << "\"\n";
+ reprWithoutNameStream(stream);
+}
+
+void DataArrayByte::reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ stream << "Name of byte array : \"" << _name << "\"\n";
+ reprZipWithoutNameStream(stream);
+}
+
+void DataArrayByte::reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ DataArray::reprWithoutNameStream(stream);
+ _mem.repr(getNumberOfComponents(),stream);
+}
+
+void DataArrayByte::reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ DataArray::reprWithoutNameStream(stream);
+ _mem.reprZip(getNumberOfComponents(),stream);
+}
+
+void DataArrayByte::reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
+ const char *data=getConstPointer();
+ stream << "DataArrayByte *" << varName << "=DataArrayByte::New();" << std::endl;
+ if(nbTuples*nbComp>=1)
+ {
+ stream << "const char " << varName << "Data[" << nbTuples*nbComp << "]={";
+ std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<char>(stream,","));
+ stream << data[nbTuples*nbComp-1] << "};" << std::endl;
+ stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl;
+ }
+ else
+ stream << varName << "->alloc(" << nbTuples << "," << nbComp << ");" << std::endl;
+ stream << varName << "->setName(\"" << getName() << "\");" << std::endl;
+}
+
+bool DataArrayByte::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception)
+{
+ const DataArrayByte *otherC=dynamic_cast<const DataArrayByte *>(&other);
+ if(!otherC)
+ { reason="this is of type DataArrayByte whereas other is not a DataArrayByte instance"; return false; }
+ return DataArrayChar::isEqualIfNotWhy(other,reason);
+}
+
+DataArrayByteIterator::DataArrayByteIterator(DataArrayByte *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
+{
+ if(_da)
+ {
+ _da->incrRef();
+ if(_da->isAllocated())
+ {
+ _nb_comp=da->getNumberOfComponents();
+ _nb_tuple=da->getNumberOfTuples();
+ _pt=da->getPointer();
+ }
+ }
+}
+
+DataArrayByteIterator::~DataArrayByteIterator()
+{
+ if(_da)
+ _da->decrRef();
+}
+
+DataArrayByteTuple *DataArrayByteIterator::nextt() throw(INTERP_KERNEL::Exception)
+{
+ if(_tuple_id<_nb_tuple)
+ {
+ _tuple_id++;
+ DataArrayByteTuple *ret=new DataArrayByteTuple(_pt,_nb_comp);
+ _pt+=_nb_comp;
+ return ret;
+ }
+ else
+ return 0;
+}
+
+DataArrayByteTuple::DataArrayByteTuple(char *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+{
+}
+
+std::string DataArrayByteTuple::repr() const throw(INTERP_KERNEL::Exception)
+{
+ std::ostringstream oss; oss << "(";
+ for(int i=0;i<_nb_of_compo-1;i++)
+ oss << _pt[i] << ", ";
+ oss << _pt[_nb_of_compo-1] << ")";
+ return oss.str();
+}
+
+char DataArrayByteTuple::byteValue() const throw(INTERP_KERNEL::Exception)
+{
+ if(_nb_of_compo==1)
+ return *_pt;
+ throw INTERP_KERNEL::Exception("DataArrayByteTuple::byteValue : DataArrayByteTuple instance has not exactly 1 component -> Not possible to convert it into an character !");
+}
+
+/*!
+ * This method returns a newly allocated instance the caller should dealed with by a ParaMEDMEM::DataArrayByte::decrRef.
+ * This method performs \b no copy of data. The content is only referenced using ParaMEDMEM::DataArrayByte::useArray with ownership set to \b false.
+ * This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
+ * \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
+ */
+DataArrayByte *DataArrayByteTuple::buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception)
+{
+ if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
+ {
+ DataArrayByte *ret=DataArrayByte::New();
+ ret->useExternalArrayWithRWAccess(_pt,nbOfTuples,nbOfCompo);
+ return ret;
+ }
+ else
+ {
+ std::ostringstream oss; oss << "DataArrayByteTuple::buildDAByte : unable to build a requested DataArrayByte instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
+ oss << ".\nBecause the number of elements in this is " << _nb_of_compo << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+/*!
+ * Returns a new instance of DataArrayAsciiChar. The caller is to delete this array
+ * using decrRef() as it is no more needed.
+ */
+DataArrayAsciiChar *DataArrayAsciiChar::New()
+{
+ return new DataArrayAsciiChar;
+}
+
+DataArrayAsciiCharIterator *DataArrayAsciiChar::iterator()
+{
+ return new DataArrayAsciiCharIterator(this);
+}
+
+/*!
+ * Returns a full copy of \a this. For more info on copying data arrays see
+ * \ref MEDCouplingArrayBasicsCopyDeep.
+ * \return DataArrayAsciiChar * - a new instance of DataArrayAsciiChar.
+ */
+DataArrayAsciiChar *DataArrayAsciiChar::deepCpy() const
+{
+ return new DataArrayAsciiChar(*this);
+}
+
+/*!
+ * Returns either a \a deep or \a shallow copy of this array. For more info see
+ * \ref MEDCouplingArrayBasicsCopyDeep and \ref MEDCouplingArrayBasicsCopyShallow.
+ * \param [in] dCpy - if \a true, a deep copy is returned, else, a shallow one.
+ * \return DataArrayAsciiChar * - either a new instance of DataArrayAsciiChar (if \a dCpy
+ * == \a true) or \a this instance (if \a dCpy == \a false).
+ */
+DataArrayAsciiChar *DataArrayAsciiChar::performCpy(bool dCpy) const
+{
+ if(dCpy)
+ return deepCpy();
+ else
+ {
+ incrRef();
+ return const_cast<DataArrayAsciiChar *>(this);
+ }
+}
+
+/*!
+ * Returns the only one value in \a this, if and only if number of elements
+ * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated.
+ * \return double - the sole value stored in \a this array.
+ * \throw If at least one of conditions stated above is not fulfilled.
+ */
+char DataArrayAsciiChar::asciiCharValue() const throw(INTERP_KERNEL::Exception)
+{
+ if(isAllocated())
+ {
+ if(getNbOfElems()==1)
+ {
+ return *getConstPointer();
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::asciiCharValue : DataArrayAsciiChar instance is allocated but number of elements is not equal to 1 !");
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::asciiCharValue : DataArrayAsciiChar instance is not allocated !");
+}
+
+DataArrayChar *DataArrayAsciiChar::buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception)
+{
+ return DataArrayAsciiChar::New();
+}
+
+void DataArrayAsciiChar::reprStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ stream << "Name of ASCII char array : \"" << _name << "\"\n";
+ reprWithoutNameStream(stream);
+}
+
+void DataArrayAsciiChar::reprZipStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ stream << "Name of ASCII char array : \"" << _name << "\"\n";
+ reprZipWithoutNameStream(stream);
+}
+
+void DataArrayAsciiChar::reprWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ DataArray::reprWithoutNameStream(stream);
+ _mem.repr(getNumberOfComponents(),stream);
+}
+
+void DataArrayAsciiChar::reprZipWithoutNameStream(std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ DataArray::reprWithoutNameStream(stream);
+ _mem.reprZip(getNumberOfComponents(),stream);
+}
+
+void DataArrayAsciiChar::reprCppStream(const char *varName, std::ostream& stream) const throw(INTERP_KERNEL::Exception)
+{
+ int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
+ const char *data=getConstPointer();
+ stream << "DataArrayAsciiChar *" << varName << "=DataArrayAsciiChar::New();" << std::endl;
+ if(nbTuples*nbComp>=1)
+ {
+ stream << "const char " << varName << "Data[" << nbTuples*nbComp << "]={";
+ std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator<char>(stream,","));
+ stream << data[nbTuples*nbComp-1] << "};" << std::endl;
+ stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl;
+ }
+ else
+ stream << varName << "->alloc(" << nbTuples << "," << nbComp << ");" << std::endl;
+ stream << varName << "->setName(\"" << getName() << "\");" << std::endl;
+}
+
+bool DataArrayAsciiChar::isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const throw(INTERP_KERNEL::Exception)
+{
+ const DataArrayAsciiChar *otherC=dynamic_cast<const DataArrayAsciiChar *>(&other);
+ if(!otherC)
+ { reason="this is of type DataArrayAsciiChar whereas other is not a DataArrayAsciiChar instance"; return false; }
+ return DataArrayChar::isEqualIfNotWhy(other,reason);
+}
+
+DataArrayAsciiCharIterator::DataArrayAsciiCharIterator(DataArrayAsciiChar *da):_da(da),_pt(0),_tuple_id(0),_nb_comp(0),_nb_tuple(0)
{
if(_da)
{
}
}
-DataArrayCharIterator::~DataArrayCharIterator()
+DataArrayAsciiCharIterator::~DataArrayAsciiCharIterator()
{
if(_da)
_da->decrRef();
}
-DataArrayCharTuple *DataArrayCharIterator::nextt()
+DataArrayAsciiCharTuple *DataArrayAsciiCharIterator::nextt() throw(INTERP_KERNEL::Exception)
{
if(_tuple_id<_nb_tuple)
{
_tuple_id++;
- DataArrayCharTuple *ret=new DataArrayCharTuple(_pt,_nb_comp);
+ DataArrayAsciiCharTuple *ret=new DataArrayAsciiCharTuple(_pt,_nb_comp);
_pt+=_nb_comp;
return ret;
}
return 0;
}
-DataArrayCharTuple::DataArrayCharTuple(char *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
+DataArrayAsciiCharTuple::DataArrayAsciiCharTuple(char *pt, int nbOfComp):_pt(pt),_nb_of_compo(nbOfComp)
{
}
-std::string DataArrayCharTuple::repr() const
+std::string DataArrayAsciiCharTuple::repr() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream oss; oss << "(";
for(int i=0;i<_nb_of_compo-1;i++)
return oss.str();
}
-char DataArrayCharTuple::charValue() const throw(INTERP_KERNEL::Exception)
+char DataArrayAsciiCharTuple::asciiCharValue() const throw(INTERP_KERNEL::Exception)
{
if(_nb_of_compo==1)
return *_pt;
- throw INTERP_KERNEL::Exception("DataArrayCharTuple::charValue : DataArrayCharTuple instance has not exactly 1 component -> Not possible to convert it into an character !");
+ throw INTERP_KERNEL::Exception("DataArrayAsciiCharTuple::asciiCharValue : DataArrayAsciiCharTuple instance has not exactly 1 component -> Not possible to convert it into an character !");
}
/*!
- * This method returns a newly allocated instance the caller should dealed with by a ParaMEDMEM::DataArrayChar::decrRef.
- * This method performs \b no copy of data. The content is only referenced using ParaMEDMEM::DataArrayChar::useArray with ownership set to \b false.
+ * This method returns a newly allocated instance the caller should dealed with by a ParaMEDMEM::DataArrayAsciiChar::decrRef.
+ * This method performs \b no copy of data. The content is only referenced using ParaMEDMEM::DataArrayAsciiChar::useArray with ownership set to \b false.
* This method throws an INTERP_KERNEL::Exception is it is impossible to match sizes of \b this that is too say \b nbOfCompo=this->_nb_of_elem and \bnbOfTuples==1 or
* \b nbOfCompo=1 and \bnbOfTuples==this->_nb_of_elem.
*/
-DataArrayChar *DataArrayCharTuple::buildDAChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception)
+DataArrayAsciiChar *DataArrayAsciiCharTuple::buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception)
{
if((_nb_of_compo==nbOfCompo && nbOfTuples==1) || (_nb_of_compo==nbOfTuples && nbOfCompo==1))
{
- DataArrayChar *ret=DataArrayChar::New();
+ DataArrayAsciiChar *ret=DataArrayAsciiChar::New();
ret->useExternalArrayWithRWAccess(_pt,nbOfTuples,nbOfCompo);
return ret;
}
else
{
- std::ostringstream oss; oss << "DataArrayCharTuple::buildDAChar : unable to build a requested DataArrayChar instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
+ std::ostringstream oss; oss << "DataArrayAsciiCharTuple::buildDAAsciiChar : unable to build a requested DataArrayAsciiChar instance with nbofTuple=" << nbOfTuples << " and nbOfCompo=" << nbOfCompo;
oss << ".\nBecause the number of elements in this is " << _nb_of_compo << " !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
$result=convertMultiFields($1,$owner);
}
+%typemap(out) ParaMEDMEM::DataArrayChar*
+{
+ $result=convertDataArrayChar($1,$owner);
+}
+
#ifdef WITH_NUMPY2
%init %{ import_array(); %}
#endif
%newobject ParaMEDMEM::DataArrayInt::__mod__;
%newobject ParaMEDMEM::DataArrayInt::__rmod__;
%newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
+%newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
+%newobject ParaMEDMEM::DataArrayChar::renumber;
+%newobject ParaMEDMEM::DataArrayChar::renumberR;
+%newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
+%newobject ParaMEDMEM::DataArrayChar::selectByTupleIdSafe;
+%newobject ParaMEDMEM::DataArrayChar::selectByTupleId2;
+%newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
+%newobject ParaMEDMEM::DataArrayChar::keepSelectedComponents;
+%newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
+%newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
+%newobject ParaMEDMEM::DataArrayChar::Aggregate;
+%newobject ParaMEDMEM::DataArrayChar::Meld;
+%newobject ParaMEDMEM::DataArrayByte::New;
+%newobject ParaMEDMEM::DataArrayByte::__iter__;
+%newobject ParaMEDMEM::DataArrayByte::deepCpy;
+%newobject ParaMEDMEM::DataArrayByte::performCpy;
+%newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
+%newobject ParaMEDMEM::DataArrayAsciiChar::New;
+%newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
+%newobject ParaMEDMEM::DataArrayAsciiChar::deepCpy;
+%newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
+%newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
%newobject ParaMEDMEM::DataArrayDouble::New;
%newobject ParaMEDMEM::DataArrayDouble::__iter__;
%newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
%ignore ParaMEDMEM::DataArrayIntIterator::nextt;
%ignore ParaMEDMEM::DataArrayIntTuple::repr;
%ignore ParaMEDMEM::DataArrayIntTuple::intValue;
+%ignore ParaMEDMEM::DataArrayByteIterator::nextt;
+%ignore ParaMEDMEM::DataArrayByteTuple::repr;
+%ignore ParaMEDMEM::DataArrayByteTuple::byteValue;
+%ignore ParaMEDMEM::DataArrayAsciiCharIterator::nextt;
+%ignore ParaMEDMEM::DataArrayAsciiCharTuple::repr;
+%ignore ParaMEDMEM::DataArrayAsciiCharTuple::asciiCharValue;
%ignore ParaMEDMEM::DataArrayDoubleIterator::nextt;
%ignore ParaMEDMEM::DataArrayDoubleTuple::repr;
%ignore ParaMEDMEM::DataArrayDoubleTuple::doubleValue;
static MEDCouplingMesh *MergeMeshes(PyObject *li) throw(INTERP_KERNEL::Exception)
{
- std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
- convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
- return MEDCouplingMesh::MergeMeshes(tmp);
+ std::vector<const ParaMEDMEM::MEDCouplingMesh *> tmp;
+ convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingMesh,"MEDCouplingMesh",tmp);
+ return MEDCouplingMesh::MergeMeshes(tmp);
+ }
+ }
+ };
+}
+
+%extend ParaMEDMEM::DataArray
+{
+ PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
+ {
+ const std::vector<std::string>& comps=self->getInfoOnComponents();
+ PyObject *ret=PyList_New((int)comps.size());
+ for(int i=0;i<(int)comps.size();i++)
+ PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
+ return ret;
+ }
+
+ void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ self->copyPartOfStringInfoFrom(other,tmp);
+ }
+
+ void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ self->copyPartOfStringInfoFrom2(tmp,other);
+ }
+}
+
+%extend ParaMEDMEM::DataArrayInt
+{
+ void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ int szArr,sw,iTypppArr;
+ std::vector<int> stdvecTyyppArr;
+ const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+ self->pushBackValsSilent(tmp,tmp+szArr);
+ }
+
+ PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> ret1;
+ std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
+ std::size_t sz=ret0.size();
+ PyObject *pyRet=PyTuple_New(2);
+ PyObject *pyRet0=PyList_New((int)sz);
+ PyObject *pyRet1=PyList_New((int)sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
+ }
+ PyTuple_SetItem(pyRet,0,pyRet0);
+ PyTuple_SetItem(pyRet,1,pyRet1);
+ return pyRet;
+ }
+}
+
+%extend ParaMEDMEM::DataArrayChar
+{
+ int __len__() const throw(INTERP_KERNEL::Exception)
+ {
+ if(self->isAllocated())
+ {
+ return self->getNumberOfTuples();
+ }
+ else
+ {
+ throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
+ }
+ }
+
+ PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string ret1;
+ bool ret0=self->isEqualIfNotWhy(other,ret1);
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyTuple_SetItem(ret,0,ret0Py);
+ PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
+ return ret;
+ }
+
+ void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlace(tmp);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlace(da2->getConstPointer());
+ }
+ }
+
+ void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlaceR(tmp);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ self->renumberInPlaceR(da2->getConstPointer());
+ }
+ }
+
+ DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumber(tmp);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumber(da2->getConstPointer());
+ }
+ }
+
+ DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(tmp);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberR(da2->getConstPointer());
+ }
+ }
+
+ DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(tmp,newNbOfTuple);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ int size=self->getNumberOfTuples();
+ if(size!=self->getNumberOfTuples())
+ {
+ throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
+ }
+ return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
+ }
+ }
+
+ DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ void *da=0;
+ int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
+ if (!SWIG_IsOK(res1))
+ {
+ int size;
+ INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
+ return self->selectByTupleIdSafe(tmp,tmp+size);
+ }
+ else
+ {
+ DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
+ if(!da2)
+ throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
+ da2->checkAllocated();
+ return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
+ }
+ }
+
+ DataArrayChar *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> tmp;
+ convertPyToNewIntArr3(li,tmp);
+ return self->keepSelectedComponents(tmp);
+ }
+
+ static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
+ convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
+ return DataArrayChar::Aggregate(tmp);
+ }
+
+ static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
+ convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
+ return DataArrayChar::Meld(tmp);
+ }
+}
+
+%extend ParaMEDMEM::DataArrayByteTuple
+{
+ std::string __str__() const
+ {
+ return self->repr();
+ }
+
+ char __int__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->byteValue();
+ }
+
+ DataArrayByte *buildDAByte()
+ {
+ return self->buildDAByte(1,self->getNumberOfCompo());
+ }
+}
+
+%extend ParaMEDMEM::DataArrayByteIterator
+{
+ PyObject *next()
+ {
+ DataArrayByteTuple *ret=self->nextt();
+ if(ret)
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayByteTuple,SWIG_POINTER_OWN | 0);
+ else
+ {
+ PyErr_SetString(PyExc_StopIteration,"No more data.");
+ return 0;
+ }
+ }
+}
+
+%extend ParaMEDMEM::DataArrayByte
+{
+ DataArrayByte() throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayByte::New();
+ }
+
+ static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
+ {
+ const char *msg="ParaMEDMEM::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !";
+ if(PyList_Check(elt0) || PyTuple_Check(elt0))
+ {
+ if(nbOfTuples)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {
+ int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
+ if(nbOfComp)
+ {
+ if(PyInt_Check(nbOfComp))
+ {//DataArrayByte.New([1,3,4,5],2,2)
+ int nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
+ ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayByte.New([1,3,4],3)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ int tmpp1=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
+ ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {// DataArrayByte.New([1,3,4])
+ MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ int tmpp1=-1,tmpp2=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
+ ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else if(PyInt_Check(elt0))
+ {
+ int nbOfTuples1=PyInt_AS_LONG(elt0);
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
+ if(nbOfTuples)
+ {
+ if(!nbOfComp)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {//DataArrayByte.New(5,2)
+ int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ ret->alloc(nbOfTuples1,nbOfCompo);
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayByte.New(5)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
+ ret->alloc(nbOfTuples1,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+
+ DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
+ {
+ return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
+ }
+
+ int __int__() const throw(INTERP_KERNEL::Exception)
+ {
+ return (int) self->byteValue();
+ }
+
+ DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
+ {
+ return self->iterator();
+ }
+
+ int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
+ {
+ return (int)self->getIJ(tupleId,compoId);
+ }
+
+ int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
+ {
+ return (int)self->getIJSafe(tupleId,compoId);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->repr();
+ }
+
+ PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
+ {
+ const char *vals=self->getConstPointer();
+ int nbOfComp=self->getNumberOfComponents();
+ int nbOfTuples=self->getNumberOfTuples();
+ return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+ }
+
+ bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=-1,sw=-1;
+ int ival=-1; std::vector<int> ivval;
+ const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+ std::vector<char> vals(sz);
+ std::copy(pt,pt+sz,vals.begin());
+ return self->presenceOfTuple(vals);
+ }
+
+ bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=-1,sw=-1;
+ int ival=-1; std::vector<int> ivval;
+ const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+ std::vector<char> vals2(sz);
+ std::copy(pt,pt+sz,vals2.begin());
+ return self->presenceOfValue(vals2);
+ }
+
+ int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=-1,sw=-1;
+ int ival=-1; std::vector<int> ivval;
+ const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
+ std::vector<char> vals2(sz);
+ std::copy(pt,pt+sz,vals2.begin());
+ return self->locateValue(vals2);
+ }
+
+ int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=-1,sw=-1;
+ int ival=-1; std::vector<int> ivval;
+ const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
+ std::vector<char> vals(sz);
+ std::copy(pt,pt+sz,vals.begin());
+ return self->locateTuple(vals);
+ }
+
+ int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
+ {
+ int sz=-1,sw=-1;
+ int ival=-1; std::vector<int> ivval;
+ const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
+ std::vector<char> vals(sz);
+ std::copy(pt,pt+sz,vals.begin());
+ return self->search(vals);
+ }
+
+ PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
+ self->getTuple(tupleId,tmp);
+ PyObject *ret=PyTuple_New(sz);
+ for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
+ return ret;
+ }
+
+ PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
+ {
+ int tmp;
+ int r1=(int)self->getMaxValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
+ {
+ int tmp;
+ int r1=(int)self->getMinValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
+ {
+ int nbOfCompo=self->getNumberOfComponents();
+ switch(nbOfCompo)
+ {
+ case 1:
+ {
+ if(PyInt_Check(obj))
+ {
+ int val=(int)PyInt_AS_LONG(obj);
+ return self->locateValue(val);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
+ }
+ default:
+ return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
+ }
+ }
+
+ bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
+ {
+ int nbOfCompo=self->getNumberOfComponents();
+ switch(nbOfCompo)
+ {
+ case 0:
+ return false;
+ case 1:
+ {
+ if(PyInt_Check(obj))
+ {
+ int val=(int)PyInt_AS_LONG(obj);
+ return self->presenceOfValue(val);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
}
+ default:
+ return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
}
- };
+ }
}
-%extend ParaMEDMEM::DataArray
+%extend ParaMEDMEM::DataArrayAsciiCharTuple
{
- PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
- {
- const std::vector<std::string>& comps=self->getInfoOnComponents();
- PyObject *ret=PyList_New((int)comps.size());
- for(int i=0;i<(int)comps.size();i++)
- PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
- return ret;
- }
-
- void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
+ std::string __str__() const
{
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->copyPartOfStringInfoFrom(other,tmp);
+ return self->repr();
}
- void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
+ DataArrayAsciiChar *buildDAAsciiChar()
{
- std::vector<int> tmp;
- convertPyToNewIntArr3(li,tmp);
- self->copyPartOfStringInfoFrom2(tmp,other);
+ return self->buildDAAsciiChar(1,self->getNumberOfCompo());
}
}
-%extend ParaMEDMEM::DataArrayInt
+%extend ParaMEDMEM::DataArrayAsciiCharIterator
{
- void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- int szArr,sw,iTypppArr;
- std::vector<int> stdvecTyyppArr;
- const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
- self->pushBackValsSilent(tmp,tmp+szArr);
- }
-
- PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
+ PyObject *next()
{
- std::vector<int> ret1;
- std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
- std::size_t sz=ret0.size();
- PyObject *pyRet=PyTuple_New(2);
- PyObject *pyRet0=PyList_New((int)sz);
- PyObject *pyRet1=PyList_New((int)sz);
- for(std::size_t i=0;i<sz;i++)
+ DataArrayAsciiCharTuple *ret=self->nextt();
+ if(ret)
+ return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
+ else
{
- PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
+ PyErr_SetString(PyExc_StopIteration,"No more data.");
+ return 0;
}
- PyTuple_SetItem(pyRet,0,pyRet0);
- PyTuple_SetItem(pyRet,1,pyRet1);
- return pyRet;
}
}
+%extend ParaMEDMEM::DataArrayAsciiChar
+{
+ DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
+ {
+ return DataArrayAsciiChar::New();
+ }
+
+ static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
+ {
+ const char *msg="ParaMEDMEM::DataArrayAsciiChar::New : Available API are : \n-DataArrayAsciiChar.New()\n--DataArrayAsciiChar.New([1,3,4])\n-DataArrayAsciiChar.New([1,3,4],3)\n-DataArrayAsciiChar.New([1,3,4,5],2,2)\n-DataArrayAsciiChar.New(5)\n-DataArrayAsciiChar.New(5,2) !";
+ if(PyList_Check(elt0) || PyTuple_Check(elt0))
+ {
+ if(nbOfTuples)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {
+ int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
+ if(nbOfComp)
+ {
+ if(PyInt_Check(nbOfComp))
+ {//DataArrayAsciiChar.New([1,3,4,5],2,2)
+ int nbOfCompo=PyInt_AS_LONG(nbOfComp);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
+ ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayAsciiChar.New([1,3,4],3)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ int tmpp1=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
+ ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {// DataArrayAsciiChar.New([1,3,4])
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ int tmpp1=-1,tmpp2=-1;
+ std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
+ ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else if(PyInt_Check(elt0))
+ {
+ int nbOfTuples1=PyInt_AS_LONG(elt0);
+ if(nbOfTuples1<0)
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
+ if(nbOfTuples)
+ {
+ if(!nbOfComp)
+ {
+ if(PyInt_Check(nbOfTuples))
+ {//DataArrayAsciiChar.New(5,2)
+ int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
+ if(nbOfCompo<0)
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ ret->alloc(nbOfTuples1,nbOfCompo);
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+ else
+ {//DataArrayAsciiChar.New(5)
+ MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
+ ret->alloc(nbOfTuples1,1);
+ ret->incrRef();
+ return ret;
+ }
+ }
+ else
+ throw INTERP_KERNEL::Exception(msg);
+ }
+
+ DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
+ {
+ return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
+ }
+
+ DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
+ {
+ return self->iterator();
+ }
+
+ std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
+ {
+ char tmp[2]; tmp[1]='\0';
+ tmp[0]=self->getIJ(tupleId,compoId);
+ return std::string(tmp);
+ }
+
+ std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
+ {
+ char tmp[2]; tmp[1]='\0';
+ tmp[0]=self->getIJSafe(tupleId,compoId);
+ return std::string(tmp);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->repr();
+ }
+
+ PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
+ {
+ const char *vals=self->getConstPointer();
+ int nbOfComp=self->getNumberOfComponents();
+ int nbOfTuples=self->getNumberOfTuples();
+ return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
+ }
+
+ bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyString_Check(tupl))
+ {
+ Py_ssize_t sz=PyString_Size(tupl);
+ std::vector<char> vals(sz);
+ std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
+ return self->presenceOfTuple(vals);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
+ }
+
+ bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyString_Check(vals))
+ {
+ Py_ssize_t sz=PyString_Size(vals);
+ std::vector<char> vals2(sz);
+ std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
+ return self->presenceOfValue(vals2);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
+ }
+
+ int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyString_Check(vals))
+ {
+ Py_ssize_t sz=PyString_Size(vals);
+ std::vector<char> vals2(sz);
+ std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
+ return self->locateValue(vals2);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
+ }
+
+ int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyString_Check(tupl))
+ {
+ Py_ssize_t sz=PyString_Size(tupl);
+ std::vector<char> vals(sz);
+ std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
+ return self->locateTuple(vals);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
+ }
+
+ int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyString_Check(strOrListOfInt))
+ {
+ Py_ssize_t sz=PyString_Size(strOrListOfInt);
+ std::vector<char> vals(sz);
+ std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
+ return self->search(vals);
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
+ }
+
+ PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
+ {
+ int sz=self->getNumberOfComponents();
+ INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
+ self->getTuple(tupleId,tmp);
+ return PyString_FromString(tmp);
+ }
+
+ PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
+ {
+ int tmp;
+ char tmp2[2]; tmp2[1]='\0';
+ tmp2[0]=self->getMaxValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
+ {
+ int tmp;
+ char tmp2[2]; tmp2[1]='\0';
+ tmp2[0]=self->getMinValue(tmp);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
+ PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+ return ret;
+ }
+
+ int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
+ {
+ int nbOfCompo=self->getNumberOfComponents();
+ switch(nbOfCompo)
+ {
+ case 1:
+ {
+ if(PyString_Check(obj))
+ {
+ Py_ssize_t sz=PyString_Size(obj);
+ char *pt=PyString_AsString(obj);
+ if(sz==1)
+ return self->locateValue(pt[0]);
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
+ }
+ default:
+ return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
+ }
+ }
+
+ bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
+ {
+ int nbOfCompo=self->getNumberOfComponents();
+ switch(nbOfCompo)
+ {
+ case 0:
+ return false;
+ case 1:
+ {
+ if(PyString_Check(obj))
+ {
+ Py_ssize_t sz=PyString_Size(obj);
+ char *pt=PyString_AsString(obj);
+ if(sz==1)
+ return self->presenceOfValue(pt[0]);
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
+ }
+ else
+ throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
+ }
+ default:
+ return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
+ }
+ }
+}
+
%extend ParaMEDMEM::MEDCouplingFieldDiscretization
{
MEDCouplingFieldDiscretization *clonePart(PyObject *li)
%ignore ParaMEDMEM::DataArrayInt::partitionByDifferentValues;
%ignore ParaMEDMEM::MEDCouplingFieldDiscretizationPerCell::getArrayOfDiscIds;
%ignore ParaMEDMEM::MEDCouplingFieldDiscretization::clonePart;
+%ignore ParaMEDMEM::DataArrayChar::getIJ;
+%ignore ParaMEDMEM::DataArrayChar::getIJSafe;
+%ignore ParaMEDMEM::DataArrayChar::search;
+%ignore ParaMEDMEM::DataArrayChar::locateValue;
+%ignore ParaMEDMEM::DataArrayChar::presenceOfValue;
%include "MEDCouplingMemArray.hxx"
%include "NormalizedUnstructuredMesh.hxx"
INTERP_KERNEL::NormalizedCellType getType() const;
%extend
{
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->repr();
}
- PyObject *getAllConn() const
+ PyObject *getAllConn() const throw(INTERP_KERNEL::Exception)
{
int ret2;
const int *r=self->getAllConn(ret2);
return self->simpleRepr();
}
- MEDCouplingUMeshCellIterator *__iter__()
+ MEDCouplingUMeshCellIterator *__iter__() throw(INTERP_KERNEL::Exception)
{
return self->cellIterator();
}
%extend ParaMEDMEM::DataArrayDoubleTuple
{
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->repr();
}
self->pushBackValsSilent(tmp,tmp+nbTuples);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->repr();
}
throw INTERP_KERNEL::Exception(msg);
}
- PyObject *getValues() throw(INTERP_KERNEL::Exception)
+ PyObject *getValues() const throw(INTERP_KERNEL::Exception)
{
- const double *vals=self->getPointer();
+ const double *vals=self->getConstPointer();
return convertDblArrToPyList(vals,self->getNbOfElems());
}
return ret;
}
- PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
+ PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
{
- const double *vals=self->getPointer();
+ const double *vals=self->getConstPointer();
int nbOfComp=self->getNumberOfComponents();
int nbOfTuples=self->getNumberOfTuples();
return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
%extend ParaMEDMEM::DataArrayIntTuple
{
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->repr();
}
return self->intValue();
}
- DataArrayInt *buildDAInt()
+ DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
{
return self->buildDAInt(1,self->getNumberOfCompo());
}
return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->repr();
}
throw INTERP_KERNEL::Exception(msg);
}
- PyObject *getValues() throw(INTERP_KERNEL::Exception)
+ PyObject *getValues() const throw(INTERP_KERNEL::Exception)
{
- const int *vals=self->getPointer();
+ const int *vals=self->getConstPointer();
return convertIntArrToPyList(vals,self->getNbOfElems());
}
return ret;
}
- PyObject *getValuesAsTuple() throw(INTERP_KERNEL::Exception)
+ PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
{
- const int *vals=self->getPointer();
+ const int *vals=self->getConstPointer();
int nbOfComp=self->getNumberOfComponents();
int nbOfTuples=self->getNumberOfTuples();
return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
std::vector<double> getHotSpotsTime() const;
%extend
{
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
std::ostringstream oss;
self->appendRepr(oss);
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+#include "InterpKernelAutoPtr.hxx"
+
#ifdef WITH_NUMPY2
#include <numpy/arrayobject.h>
#endif
return ret;
}
+static PyObject *convertDataArrayChar(ParaMEDMEM::DataArrayChar *dac, int owner) throw(INTERP_KERNEL::Exception)
+{
+ PyObject *ret=0;
+ if(dynamic_cast<ParaMEDMEM::DataArrayByte *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayByte,owner);
+ if(dynamic_cast<ParaMEDMEM::DataArrayAsciiChar *>(dac))
+ ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar,owner);
+ if(!ret)
+ throw INTERP_KERNEL::Exception("Not recognized type of DataArrayChar on downcast !");
+ return ret;
+}
+
static PyObject* convertMultiFields(ParaMEDMEM::MEDCouplingMultiFields *mfs, int owner) throw(INTERP_KERNEL::Exception)
{
PyObject *ret=0;
return ret;
}
+static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
+{
+ PyObject *ret=PyList_New(nbOfTuples);
+ INTERP_KERNEL::AutoPtr<char> tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0';
+ for(int i=0;i<nbOfTuples;i++)
+ {
+ std::copy(vals+i*nbOfComp,vals+(i+1)*nbOfComp,(char *)tmp);
+ PyList_SetItem(ret,i,PyString_FromString(tmp));
+ }
+ return ret;
+}
+
static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL::Exception)
{
if(PyList_Check(pyLi))