Changeset 1393 in Sophya for trunk/SophyaLib/TArray/tarray.cc


Ignore:
Timestamp:
Feb 12, 2001, 6:09:03 PM (25 years ago)
Author:
ansari
Message:

Ajout methodes ReSize(TArray &) - Reza 12/2/2001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/tarray.cc

    r1389 r1393  
    230230
    231231
    232 //! Resize array
     232//! Sets or changes the array size
    233233/*!
    234234  \param ndim : number of dimensions
     
    245245       throw( ParmError("TArray<T>::ReSize(,siz[0]>1 && size[1]>1) for Vector" ) );
    246246  }
    247   string exmsg = "TArray<T>::ReSize()";
     247  string exmsg = "TArray<T>::ReSize(int_4 ...)";
    248248  if (!UpdateSizes(ndim, siz, step, 0, exmsg))  throw( ParmError(exmsg) );
    249249  mNDBlock.ReSize(totsize_);   
     250}
     251
     252//! Sets or changes the array size.
     253/*!
     254  The array size and memory layout are copied from the array \b a.
     255  \param a : Array used as template for setting the size and memory layout.
     256 */
     257template <class T>
     258void TArray<T>::ReSize(const TArray<T>& a)
     259{
     260  if (arrtype_ != 0) {
     261    if (a.NbDimensions() != 2)
     262       throw( ParmError("TArray<T>::ReSize(a.NbDimensions()!=2,...) for Matrix" ) );
     263    if ((arrtype_ == 2) && (a.Size(0) > 1) && (a.Size(1) > 1))
     264       throw( ParmError("TArray<T>::ReSize(a.Size(0)>1 && a.Size(1)>1) for Vector" ) );
     265  }
     266  string exmsg = "TArray<T>::ReSize(const TArray<T>&)";
     267  if (!UpdateSizes(a, exmsg))  throw( ParmError(exmsg) );
     268  mNDBlock.ReSize(totsize_);     
    250269}
    251270
Note: See TracChangeset for help on using the changeset viewer.