throw INTERP_KERNEL::Exception("DataArrayChar::checkAllocated : Array is defined but not allocated ! Call alloc or setValues method first !");
}
+/*!
+ * This method desallocated \a this without modification of informations relative to the components.
+ * After call of this method, DataArrayChar::isAllocated will return false.
+ * If \a this is already not allocated, \a this is let unchanged.
+ */
+void DataArrayChar::desallocate() throw(INTERP_KERNEL::Exception)
+{
+ _mem.destroy();
+}
+
std::size_t DataArrayChar::getHeapMemorySize() const
{
std::size_t sz=_mem.getNbOfElemAllocated();
* than the current number the array is truncated, otherwise the array is extended.
* \param [in] nbOfTuples - new number of tuples.
* \throw If \a this is not allocated.
+ * \throw If \a nbOfTuples is negative.
*/
void DataArrayChar::reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception)
{
+ if(nbOfTuples<0)
+ throw INTERP_KERNEL::Exception("DataArrayChar::reAlloc : input new number of tuples should be >=0 !");
checkAllocated();
_mem.reAlloc(getNumberOfComponents()*(std::size_t)nbOfTuples);
declareAsNew();
return ret.retn();
}
+/*!
+ * Returns a shorten and permuted copy of \a this array. The new DataArrayChar is
+ * of size \a new2OldEnd - \a new2OldBg and it's values are permuted as required by
+ * \a new2OldBg array.
+ * The values are permuted so that \c new[ i ] = \c old[ \a new2OldBg[ i ]].
+ * This method is equivalent to renumberAndReduce() except that convention in input is
+ * \c new2old and \b not \c old2new.
+ * For more info on renumbering see \ref MEDCouplingArrayRenumbering.
+ * \param [in] new2OldBg - pointer to the beginning of a permutation array that gives a
+ * tuple index in \a this array to fill the i-th tuple in the new array.
+ * \param [in] new2OldEnd - specifies the end of the permutation array that starts at
+ * \a new2OldBg, so that pointer to a tuple index (\a pi) varies as this:
+ * \a new2OldBg <= \a pi < \a new2OldEnd.
+ * \return DataArrayChar * - the new instance of DataArrayChar that the caller
+ * is to delete using decrRef() as it is no more needed.
+ */
+DataArrayChar *DataArrayChar::selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const
+{
+ return selectByTupleIdSafe(new2OldBg,new2OldEnd);
+}
+
/*!
* Returns a shorten and permuted copy of \a this array. The new DataArrayChar is
* of size \a new2OldEnd - \a new2OldBg and it's values are permuted as required by
* components.
* \param [in] newNbOfComp - number of components for the new array to have.
* \param [in] dftValue - value assigned to new values added to the new array.
- * \return DataArrayDouble * - the new instance of DataArrayDouble that the caller
+ * \return DataArrayChar * - the new instance of DataArrayChar that the caller
* is to delete using decrRef() as it is no more needed.
* \throw If \a this is not allocated.
*/
}
/*!
- * Copy some tuples from another DataArrayChar (\a a) into contiguous tuples
+ * Copy some tuples from another DataArrayChar (\a aBase) into contiguous tuples
* of \a this array. Textual data is not copied. Both arrays must have equal number of
* components.
* The tuples to assign to are defined by index of the first tuple, and
* All components of selected tuples are copied.
* \param [in] tupleIdStart - index of the first tuple of \a this array to assign
* values to.
- * \param [in] a - the array to copy values from.
- * \param [in] tuplesSelec - the array specifying tuples of \a a to copy.
+ * \param [in] aBase - the array to copy values from.
+ * \param [in] tuplesSelec - the array specifying tuples of \a aBase to copy.
* \throw If \a this is not allocated.
- * \throw If \a a is NULL.
- * \throw If \a a is not allocated.
+ * \throw If \a aBase is NULL.
+ * \throw If \a aBase is not allocated.
* \throw If \a tuplesSelec is NULL.
* \throw If \a tuplesSelec is not allocated.
- * \throw If <em>this->getNumberOfComponents() != a->getNumberOfComponents()</em>.
+ * \throw If <em>this->getNumberOfComponents() != aBase->getNumberOfComponents()</em>.
* \throw If \a tuplesSelec->getNumberOfComponents() != 1.
* \throw If <em>tupleIdStart + tuplesSelec->getNumberOfTuples() > this->getNumberOfTuples().</em>
* \throw If any tuple index given by \a tuplesSelec is out of a valid range for
- * \a a array.
+ * \a aBase array.
*/
void DataArrayChar::setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
{
}
/*!
- * Copy some tuples from another DataArrayChar (\a a) into contiguous tuples
+ * Copy some tuples from another DataArrayChar (\a aBase) into contiguous tuples
* of \a this array. Textual data is not copied. Both arrays must have equal number of
* components.
* The tuples to copy are defined by three values similar to parameters of
* All components of selected tuples are copied.
* \param [in] tupleIdStart - index of the first tuple of \a this array to assign
* values to.
- * \param [in] a - the array to copy values from.
- * \param [in] bg - index of the first tuple to copy of the array \a a.
- * \param [in] end2 - index of the tuple of \a a before which the tuples to copy
+ * \param [in] aBase - the array to copy values from.
+ * \param [in] bg - index of the first tuple to copy of the array \a aBase.
+ * \param [in] end2 - index of the tuple of \a aBase before which the tuples to copy
* are located.
* \param [in] step - index increment to get index of the next tuple to copy.
* \throw If \a this is not allocated.
- * \throw If \a a is NULL.
- * \throw If \a a is not allocated.
- * \throw If <em>this->getNumberOfComponents() != a->getNumberOfComponents()</em>.
+ * \throw If \a aBase is NULL.
+ * \throw If \a aBase is not allocated.
+ * \throw If <em>this->getNumberOfComponents() != aBase->getNumberOfComponents()</em>.
* \throw If <em>tupleIdStart + len(range(bg,end2,step)) > this->getNumberOfTuples().</em>
* \throw If parameters specifying tuples to copy, do not give a
* non-empty range of increasing indices or indices are out of a valid range
- * for the array \a a.
+ * for the array \a aBase.
*/
void DataArrayChar::setContigPartOfSelectedValues2(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
{
* all values of \a this.
* \param [in] tupleId - index of tuple of interest.
* \param [in] compoId - index of component of interest.
- * \return double - value located by \a tupleId and \a compoId.
+ * \return char - value located by \a tupleId and \a compoId.
* \throw If \a this is not allocated.
* \throw If condition <em>( 0 <= tupleId < this->getNumberOfTuples() )</em> is violated.
* \throw If condition <em>( 0 <= compoId < this->getNumberOfComponents() )</em> is violated.
/*!
* Returns the maximal value and its location within \a this one-dimensional array.
* \param [out] tupleId - index of the tuple holding the maximal value.
- * \return double - the maximal value among all values of \a this array.
+ * \return char - the maximal value among all values of \a this array.
* \throw If \a this->getNumberOfComponents() != 1
* \throw If \a this->getNumberOfTuples() < 1
*/
* \ref MEDCouplingArrayBasicsCopyDeep.
* \return DataArrayByte * - a new instance of DataArrayByte.
*/
-DataArrayByte *DataArrayByte::deepCpy() const
+DataArrayByte *DataArrayByte::deepCpy() const throw(INTERP_KERNEL::Exception)
{
return new 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.
+ * \return char - 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)
* \ref MEDCouplingArrayBasicsCopyDeep.
* \return DataArrayAsciiChar * - a new instance of DataArrayAsciiChar.
*/
-DataArrayAsciiChar *DataArrayAsciiChar::deepCpy() const
+DataArrayAsciiChar *DataArrayAsciiChar::deepCpy() const throw(INTERP_KERNEL::Exception)
{
return new 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.
+ * \return char - 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)