+ /*!
+ * Returns the maximal absolute value in \a this and the first occurrence location associated to it.
+ * \return the element in this (positive or negative) having the max abs value in \a this.
+ * \throw If \a this is not allocated.
+ * \throw If \a this is non one component array.
+ * \throw If \a this is empty.
+ */
+ template<class T>
+ T DataArrayTemplate<T>::getMaxAbsValue(std::size_t& tupleId) const
+ {
+ checkAllocated();
+ if(getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxAbsValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !");
+ std::size_t nbTuples(this->getNumberOfTuples());
+ if(nbTuples==0)
+ throw INTERP_KERNEL::Exception("DataArrayTemplate<T>::getMaxAbsValue : empty array !");
+ T ret((T)-1);
+ tupleId=0;
+ const T *pt(begin());
+ for(std::size_t i=0;i<nbTuples;i++,pt++)
+ {
+ T cand(std::abs(*pt));
+ if(cand>ret)
+ {
+ ret=cand;
+ tupleId=i;
+ }
+ }
+ return this->getIJ(tupleId,0);
+ }
+
+ /*!
+ * Returns the maximal absolute value in \a this.
+ * \throw If \a this is not allocated.
+ * \throw If \a this is non one component array.
+ * \throw If \a this is empty.
+ */
+ template<class T>
+ T DataArrayTemplate<T>::getMaxAbsValueInArray() const
+ {
+ std::size_t dummy;
+ return getMaxAbsValue(dummy);
+ }
+