|
STK++ 1.0
|
Templated one dimensional horizontal Array. More...
#include <STK_ArrayHo.h>

Public Types | |
| typedef IArrayBase< TYPE * > | _IArrayBaseType |
| Type for the Base reference Class. | |
| typedef IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > > | _IArrayHoType |
| Type for the Implementation Class. | |
Public Member Functions | |
| ArrayHo (Range const &I=Range()) | |
| Default constructor : beg_ =1 and end_ =0. | |
| ArrayHo (Range const &I, TYPE const &v) | |
| Misc constructor with beg and end, initialization with a constant. | |
| ArrayHo (const ArrayHo &T, bool ref=false) | |
| Copy constructor. | |
| ArrayHo (const ArrayHo< TYPE > &T, Range const &I) | |
| constructor by reference, ref_=1. | |
| ArrayHo (const _IArrayBaseType &T, Range const &I, Integer row) | |
| constructor by reference, ref_=1. | |
| virtual | ~ArrayHo () |
| virtual destructor. | |
| TYPE const & | elt (Integer const &pos) const |
| Get one element const. | |
| TYPE & | elt (Integer const &pos) |
| Get one element. | |
| ArrayHo | elt (Range const &J) const |
| access to many elements. | |
| void | clear () |
| clear the object. | |
| void | freeMem () |
| Method for memory deallocation. | |
| void | initialize (Range const &I) |
| function for memory allocation and initialization. | |
| void | insert (Range const &I, TYPE const &v) |
Insert element v in the range I of the Container. | |
| void | pushBack (Integer const &n=1) |
| Add n elements to the container. | |
| void | popBack (Integer const &n=1) |
| Delete last elts of the container. | |
| void | erase (Integer const &pos, Integer const &n=1) |
| Delete n elts at the pos index to the container. | |
| ArrayHo & | operator= (const ArrayHo &T) |
| operator = : overwrite the ArrayHo with the ArrayHo T. | |
| ArrayHo & | operator= (TYPE const &v) |
| operator= : set the container to a constant value. | |
| template<class LEAF > | |
| ArrayHo & | operator= (const ITContainer1D< TYPE, LEAF > &T) |
| operator = : overwrite the ArrayHo with the container T. | |
Protected Member Functions | |
| void | insertElt (Integer const &pos, Integer const &n=1) |
| Insert n elts at the position pos of the container. | |
Private Member Functions | |
| void | initElts (Range const &J) |
| Method for elements memory allocation. | |
| void | freeElt (Integer const &pos) |
| Method for elements memory deallocation. | |
| void | freeElts (Range const &J) |
| void | initElt (Integer const &pos) |
| function for the the allocation of memory of element pos. | |
Templated one dimensional horizontal Array.
A ArrayHo is a horizontal container. In STK, the objects are vertical (column) or horizontal (rows).
By default the index of the first element is 1 but this can be modified using the appropriate constructor or using the method shift.
Definition at line 57 of file STK_ArrayHo.h.
| typedef IArrayBase<TYPE*> STK::ArrayHo< TYPE >::_IArrayBaseType |
Type for the Base reference Class.
Reimplemented from STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >.
Definition at line 61 of file STK_ArrayHo.h.
| typedef IArray1DBase<TYPE, TYPE*, ArrayHo<TYPE> > STK::ArrayHo< TYPE >::_IArrayHoType |
Type for the Implementation Class.
Definition at line 64 of file STK_ArrayHo.h.
| STK::ArrayHo< TYPE >::ArrayHo | ( | Range const & | I = Range() | ) | [inline] |
Default constructor : beg_ =1 and end_ =0.
| I | range of the container |
Definition at line 69 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::initElts().
Referenced by STK::ArrayHo< Real >::elt(), and STK::ArrayHo< TYPE >::elt().
: _IArrayHoType(I) { this->initElts(I);}
| STK::ArrayHo< TYPE >::ArrayHo | ( | Range const & | I, |
| TYPE const & | v | ||
| ) | [inline] |
Misc constructor with beg and end, initialization with a constant.
| I | range of the container |
| v | initial value of the container |
Definition at line 77 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::elt(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), STK::ArrayHo< TYPE >::initElts(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last().
| STK::ArrayHo< TYPE >::ArrayHo | ( | const ArrayHo< TYPE > & | T, |
| bool | ref = false |
||
| ) | [inline] |
Copy constructor.
| T | the container to copy |
| ref | true if this is a wrapper of T |
Definition at line 90 of file STK_ArrayHo.h.
References STK::IArrayBase< DATA >::data(), STK::IArrayBase< TYPE * >::data(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), STK::IArray1DBase< TYPE, PTRELT, TArray1D >::getIndex(), STK::ArrayHo< TYPE >::initElts(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last(), and STK::ITContainer1D< TYPE, TContainer1D >::range().
: _IArrayHoType(T, ref) { // check if we want just a reference if (!ref) { // if this is not a reference, initialize the container this->initElts(T.range()); // this and T have the same row : save time const Integer row(T.getIndex()); // and copy the data for (Integer j=this->first(); j<=this->last(); j++) this->data(j)[row] = T.data(j)[row]; } }
| STK::ArrayHo< TYPE >::ArrayHo | ( | const ArrayHo< TYPE > & | T, |
| Range const & | I | ||
| ) | [inline] |
constructor by reference, ref_=1.
| T | the container to wrap |
| I | the range of the data to wrap |
Definition at line 110 of file STK_ArrayHo.h.
: _IArrayHoType(T, I) { ;}
| STK::ArrayHo< TYPE >::ArrayHo | ( | const _IArrayBaseType & | T, |
| Range const & | I, | ||
| Integer | row | ||
| ) | [inline] |
constructor by reference, ref_=1.
| T | the container to wrap |
| I | the range of the data to wrap |
| row | the index of the row to wrap |
Definition at line 119 of file STK_ArrayHo.h.
: _IArrayHoType(T, I, row) { ;}
| virtual STK::ArrayHo< TYPE >::~ArrayHo | ( | ) | [inline, virtual] |
virtual destructor.
Definition at line 124 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::freeElts(), STK::IContainerRef::isRef(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::range().
| TYPE const& STK::ArrayHo< TYPE >::elt | ( | Integer const & | pos | ) | const [inline] |
Get one element const.
| pos | index of the element (const) |
Reimplemented from STK::ITContainer1D< TYPE, ArrayHo< TYPE > >.
Definition at line 132 of file STK_ArrayHo.h.
References STK::IArrayBase< TYPE * >::data(), and STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::getIndex().
Referenced by STK::ArrayHo< Real >::ArrayHo(), STK::ArrayHo< TYPE >::ArrayHo(), STK::ArrayHo< Real >::operator*=(), STK::ArrayHo< Real >::operator+=(), STK::ArrayHo< Real >::operator-=(), STK::ArrayHo< Real >::operator/=(), STK::ArrayHo< Real >::operator=(), and STK::ArrayHo< TYPE >::operator=().
| TYPE& STK::ArrayHo< TYPE >::elt | ( | Integer const & | pos | ) | [inline] |
Get one element.
| pos | index of the element |
Reimplemented from STK::ITContainer1D< TYPE, ArrayHo< TYPE > >.
Definition at line 138 of file STK_ArrayHo.h.
References STK::IArrayBase< TYPE * >::data(), and STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::getIndex().
| ArrayHo STK::ArrayHo< TYPE >::elt | ( | Range const & | J | ) | const [inline] |
access to many elements.
| J | Range of the elements |
Reimplemented from STK::ITContainer1D< TYPE, ArrayHo< TYPE > >.
Definition at line 144 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::ArrayHo(), and STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::getIndex().
| void STK::ArrayHo< TYPE >::clear | ( | ) | [inline, virtual] |
clear the object.
Implements STK::IContainer1D.
Definition at line 148 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::freeMem(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::setRange().
Referenced by STK::ArrayHo< Real >::initialize(), and STK::ArrayHo< TYPE >::initialize().
| void STK::ArrayHo< TYPE >::freeMem | ( | ) | [inline] |
Method for memory deallocation.
Memory is liberated but the range of the container is not updated.
Definition at line 157 of file STK_ArrayHo.h.
References STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::free1D(), STK::ArrayHo< TYPE >::freeElts(), STK::IContainerRef::isRef(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::range().
Referenced by STK::ArrayHo< Real >::clear(), STK::ArrayHo< TYPE >::clear(), STK::ArrayHo< Real >::erase(), STK::ArrayHo< TYPE >::erase(), STK::ArrayHo< Real >::popBack(), and STK::ArrayHo< TYPE >::popBack().
| void STK::ArrayHo< TYPE >::initialize | ( | Range const & | I | ) | [inline] |
function for memory allocation and initialization.
This method will free all allocated memory owned by this container before initialization.
| I | range of the container |
Definition at line 169 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::clear(), STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::init1D(), STK::ArrayHo< TYPE >::initElts(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::setRange(), and STK::IContainerRef::setRef().
Referenced by STK::ArrayHo< Real >::pushBack(), and STK::ArrayHo< TYPE >::pushBack().
{
// check if there is memory allocated
this->clear();
// if we initialize the memory the container is not a reference
this->setRef(false);
// try to allocate memory
this->init1D(I);
// initialize Horizontally the container
this->initElts(I);
// set the range of the container if init1D is successful
this->setRange(I);
}
| void STK::ArrayHo< TYPE >::insert | ( | Range const & | I, |
| TYPE const & | v | ||
| ) | [inline] |
Insert element v in the range I of the Container.
| I | range of the index where to insert elements |
| v | the value tu insert |
Reimplemented from STK::ITContainer1D< TYPE, ArrayHo< TYPE > >.
Definition at line 187 of file STK_ArrayHo.h.
{ ITContainer1D<TYPE, ArrayHo<TYPE> >::insert(I, v);}
| void STK::ArrayHo< TYPE >::pushBack | ( | Integer const & | n = 1 | ) | [inline, virtual] |
Add n elements to the container.
| n | number of elements to add |
Implements STK::IContainer1D.
Definition at line 193 of file STK_ArrayHo.h.
References STK::IContainer1D::empty(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), STK::ArrayHo< TYPE >::initialize(), STK::ArrayHo< TYPE >::insertElt(), STK::IContainerRef::isRef(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last().
{
// if n<=0 nothing to do
if (n <= 0) return;
// is this structure just a pointer?
if (this->isRef())
{ throw std::runtime_error("ArrayHo::pushBack(n) "
"can't operate on references.");
}
// If the container is empty : create it
if (this->empty())
this->initialize(Range(this->first(), this->first()+n-1));
else
this->insertElt(this->last()+1, n);
}
| void STK::ArrayHo< TYPE >::popBack | ( | Integer const & | n = 1 | ) | [inline, virtual] |
Delete last elts of the container.
| n | number of elts to delete |
Implements STK::IContainer1D.
Definition at line 212 of file STK_ArrayHo.h.
References STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::decLast(), STK::ArrayHo< TYPE >::freeElts(), STK::ArrayHo< TYPE >::freeMem(), STK::IContainerRef::isRef(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::size().
{
// if n<=0 nothing to do
if (n <= 0) return;
// is this structure just a pointer?
if (this->isRef())
{ throw std::runtime_error("ArrayHo::popBack() "
"can't operate on references.");
}
#ifdef STK_BOUNDS_CHECK
// if there is elts to erase
if (this->size()<n)
{ throw std::out_of_range("ArrayHo::popBack(n) "
"this->size() < n");
}
#endif
// delete each elt
this->freeElts(Range(this->last()-n+1, this->last()));
// update range
this->decLast(n);
// if there is no more elements
if (this->size() == 0) this->freeMem();
}
| void STK::ArrayHo< TYPE >::erase | ( | Integer const & | pos, |
| Integer const & | n = 1 |
||
| ) | [inline, virtual] |
Delete n elts at the pos index to the container.
| pos | index where to delete elements |
| n | number of elements to delete (default 1) |
Implements STK::IContainer1D.
Definition at line 240 of file STK_ArrayHo.h.
References STK::IArrayBase< TYPE * >::data(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::decLast(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), STK::ArrayHo< TYPE >::freeElts(), STK::ArrayHo< TYPE >::freeMem(), STK::IContainerRef::isRef(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last(), STK::IArrayBase< TYPE * >::setData(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::size().
{
// if n==0 nothing to do
if (n<=0) return;
// is this structure just a pointer?
if (this->isRef())
{ throw std::runtime_error("ArrayHo::erase(pos, n) "
"can't operate on references.");
}
#ifdef STK_BOUNDS_CHECK
// check bounds
if (this->first() > pos)
{ throw std::out_of_range("ArrayHo::erase(pos, n) "
"this->first() > pos");
}
if (this->last() < pos)
{ throw std::out_of_range("ArrayHo::erase(pos, n)"
" this->last() < pos");
}
if (this->last() < pos+n-1)
{ throw std::out_of_range("ArrayHo::erase(pos, n)"
" this->last() < pos+n-1");
}
#endif
// delete each col
freeElts(Range(pos, pos+n-1));
// shift elements
const Integer last = this->last()-n;
for (Integer k=pos; k<=last; k++)
this->setData(k, this->data(k+n));
// update rangeHo_
this->decLast(n);
// if there is no more elements
if (this->size() == 0) this->freeMem();
}
| ArrayHo& STK::ArrayHo< TYPE >::operator= | ( | const ArrayHo< TYPE > & | T | ) | [inline] |
operator = : overwrite the ArrayHo with the ArrayHo T.
We resize the object if this and T does not have the same size but if they have the same size, we don't modify the range of the object.
| T | the container to copy |
Definition at line 282 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::elt(), STK::ITContainer1D< TYPE, TContainer1D >::first(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last(), STK::ITContainer1D< TYPE, TContainer1D >::last(), STK::ITContainer1D< TYPE, TContainer1D >::range(), STK::IContainer1D::resize(), STK::ITContainer1D< TYPE, TContainer1D >::size(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::size().
{ // We have to resize if this and T does not have the same size
// but if they have the same size, we don't scale the index
if (this->size()!=T.size()) this->resize(T.range());
// copy without ovelapping
if (this->first() < T.first())
{ for (Integer j=this->first(), i=T.first(); i<=T.last(); j++, i++)
elt(j) = T.elt(i);
}
else
{ for (Integer j=this->last(), i=T.last(); i>=T.first(); j--, i--)
elt(j) = T.elt(i);
}
return *this;
}
| ArrayHo& STK::ArrayHo< TYPE >::operator= | ( | TYPE const & | v | ) | [inline] |
operator= : set the container to a constant value.
| v | the value to set |
Definition at line 302 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::elt(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last().
| ArrayHo& STK::ArrayHo< TYPE >::operator= | ( | const ITContainer1D< TYPE, LEAF > & | T | ) | [inline] |
operator = : overwrite the ArrayHo with the container T.
We resize the object if this and T does not have the same size but if they have the same size, we don't modify the range of the object.
| T | the container to copy |
Definition at line 316 of file STK_ArrayHo.h.
References STK::ArrayHo< TYPE >::elt(), STK::ITContainer1D< TYPE, TContainer1D >::first(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last(), STK::ITContainer1D< TYPE, TContainer1D >::last(), STK::ITContainer1D< TYPE, TContainer1D >::range(), STK::IContainer1D::resize(), STK::ITContainer1D< TYPE, TContainer1D >::size(), and STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::size().
{ // We have to resize if this and T does not have the same size
// but if they have the same size, we don't scale the index
if (this->size()!=T.size()) this->resize(T.range());
// copy without ovelapping
if (this->first() < T.first())
{ for (Integer j=this->first(), i=T.first(); i<=T.last(); j++, i++)
elt(j) = T[i];
}
else
{ for (Integer j=this->last(), i=T.last(); i>=T.first(); j--, i--)
elt(j) = T[i];
}
return *this;
}
| void STK::ArrayHo< TYPE >::insertElt | ( | Integer const & | pos, |
| Integer const & | n = 1 |
||
| ) | [inline, protected, virtual] |
Insert n elts at the position pos of the container.
The bound last_ should be modified at the very end of the insertion as pos can be a reference to it.
| pos | index where to insert elements |
| n | number of elements to insert (default 1) |
Implements STK::IContainer1D.
Definition at line 340 of file STK_ArrayHo.h.
References STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::capacity(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::first(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::incLast(), STK::Range::incLast(), STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::init1D(), STK::ArrayHo< TYPE >::initElts(), STK::IContainerRef::isRef(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::last(), STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::moveElt(), STK::ITContainer1D< TYPE, TContainer1D >::range(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::range(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::setRange(), STK::ITContainer1D< TYPE, ArrayHo< TYPE > >::size(), and STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::swap().
Referenced by STK::ArrayHo< Real >::pushBack(), and STK::ArrayHo< TYPE >::pushBack().
{
// if n<=0 nothing to do
if (n <= 0) return;
// is this structure just a pointer?
if (this->isRef())
{ throw std::runtime_error("ArrayHo::insertElt(pos, n) "
"can't operate on references.");
}
#ifdef STK_BOUNDS_CHECK
// check indices
if (this->first() > pos)
{ throw std::out_of_range("ArrayHo::insertElt(pos, n) "
"this->first() > pos");
}
if (this->last()+1 < pos)
{ throw std::out_of_range("ArrayHo::insertElt(pos, n) "
"this->last()+1 < pos");
}
#endif
// allocate, if necessary, the mem for the elts
if (this->capacity() < this->size()+n)
{
// compute range of the container after insertion
Range range(this->range());
range.incLast(n);
// temporary empty container
ArrayHo Taux;
// save elements in Taux
this->swap(Taux);
// initialize elements of the container
try
{
this->init1D(range);
}
catch (std::runtime_error & error) // if an error occur
{
this->swap(Taux); // restore container
throw error; // and send again the exception
}
// reset initial stored in range
this->setRange(Taux.range());
// move first elements from Taux to this
for (Integer k=this->first(); k<pos; k++)
this->moveElt(k, Taux, k);
// translate and copy last elements from Taux to this
for (Integer k=this->last(); k>=pos; k--)
this->moveElt(k+n, Taux, k);
}
else // enough space -> initialize and shift the last elts
{
// translate data
for (Integer k=this->last(); k>=pos; k--)
this->moveElt(k+n, *this, k);
}
// initialize the elements in the range pos:pos+n-1
initElts(Range(pos, pos+n-1));
// update range
this->incLast(n);
}
| void STK::ArrayHo< TYPE >::initElts | ( | Range const & | J | ) | [inline, private] |
Method for elements memory allocation.
| J | the range of the elements to initialize |
Definition at line 404 of file STK_ArrayHo.h.
References STK::Range::first(), STK::ArrayHo< TYPE >::freeElt(), STK::ArrayHo< TYPE >::initElt(), STK::Range::last(), and STK::IArrayBase< TYPE * >::setData().
Referenced by STK::ArrayHo< Real >::ArrayHo(), STK::ArrayHo< TYPE >::ArrayHo(), STK::ArrayHo< Real >::initialize(), STK::ArrayHo< TYPE >::initialize(), STK::ArrayHo< Real >::insertElt(), and STK::ArrayHo< TYPE >::insertElt().
{
// for each col
for (Integer j=J.first(); j<=J.last(); j++)
{
// try to Allocate mem for the jth elt
try
{
this->initElt(j);
}
catch (std::runtime_error & error) // if an error occur
{
// for each column allocated
for (Integer k=J.first(); k<j; k++)
this->freeElt(k);
// put default parameters for the elts j to end
for (Integer k=j; k<=J.last(); k++)
this->setData(k);
// and throw an exception
throw error;
}
}
}
| void STK::ArrayHo< TYPE >::freeElt | ( | Integer const & | pos | ) | [inline, private] |
Method for elements memory deallocation.
| pos | the position of the elements to liberate |
Definition at line 431 of file STK_ArrayHo.h.
References STK::IArrayBase< TYPE * >::data(), STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::getIndex(), and STK::IArrayBase< TYPE * >::setData().
Referenced by STK::ArrayHo< Real >::freeElts(), STK::ArrayHo< TYPE >::freeElts(), STK::ArrayHo< Real >::initElts(), and STK::ArrayHo< TYPE >::initElts().
| void STK::ArrayHo< TYPE >::freeElts | ( | Range const & | J | ) | [inline, private] |
Definition at line 440 of file STK_ArrayHo.h.
References STK::Range::first(), STK::ArrayHo< TYPE >::freeElt(), and STK::Range::last().
Referenced by STK::ArrayHo< Real >::erase(), STK::ArrayHo< TYPE >::erase(), STK::ArrayHo< Real >::freeMem(), STK::ArrayHo< TYPE >::freeMem(), STK::ArrayHo< Real >::popBack(), STK::ArrayHo< TYPE >::popBack(), STK::ArrayHo< Real >::~ArrayHo(), and STK::ArrayHo< TYPE >::~ArrayHo().
| void STK::ArrayHo< TYPE >::initElt | ( | Integer const & | pos | ) | [inline, private] |
function for the the allocation of memory of element pos.
| pos | the number of the elt to initialize |
Definition at line 451 of file STK_ArrayHo.h.
References STK::IArrayBase< TYPE * >::data(), STK::IArray1DBase< TYPE, TYPE *, ArrayHo< TYPE > >::getIndex(), and STK::IArrayBase< TYPE * >::setData().
Referenced by STK::ArrayHo< Real >::initElts(), and STK::ArrayHo< TYPE >::initElts().
{
// try to Allocate mem for each col
try
{
this->setData(pos, new TYPE);
this->data(pos) -= this->getIndex();
}
catch (std::bad_alloc & error) // if an alloc error occur
{
// set default
this->setData(pos);
// throw an exception
throw std::runtime_error("ArrayHo::initElt(pos) "
"memory allocation failed.");
}
}