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


Ignore:
Timestamp:
Jul 27, 2000, 2:00:10 AM (25 years ago)
Author:
ansari
Message:

Suite operations entre matrices de <> MemOrg, Amelioration des Sequences - Reza 27/7/2000

File:
1 edited

Legend:

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

    r1099 r1103  
    200200{
    201201  string exmsg = "TArray<T>::CloneOrShare()";
    202   if (!UpdateSizes(a.ndim_, a.size_, a.step_, a.offset_, exmsg))  throw( ParmError(exmsg) );
     202  if (!UpdateSizes(a, exmsg))  throw( ParmError(exmsg) );
    203203  mNDBlock.CloneOrShare(a.mNDBlock);
     204  if (mInfo) {delete mInfo; mInfo = NULL;}
     205  if (a.mInfo) mInfo = new DVList(*(a.mInfo));
    204206}
    205207
     
    209211{
    210212  string exmsg = "TArray<T>::Share()";
    211   if (!UpdateSizes(a.ndim_, a.size_, a.step_, a.offset_, exmsg))  throw( ParmError(exmsg) );
     213  if (!UpdateSizes(a, exmsg))  throw( ParmError(exmsg) );
    212214  mNDBlock.Share(a.mNDBlock);
     215  if (mInfo) {delete mInfo; mInfo = NULL;}
     216  if (a.mInfo) mInfo = new DVList(*(a.mInfo));
    213217}
    214218
     
    363367 */
    364368template <class T>
    365 TArray<T>& TArray<T>::SetSeq(Sequence seq)
     369TArray<T>& TArray<T>::SetSeq(Sequence const & seq)
    366370{
    367371  if (NbDimensions() < 1)
    368372    throw RangeCheckError("TArray<T>::SetSeq(Sequence ) - Not Allocated Array ! ");
     373 
    369374  T * pe;
    370375  uint_8 j,k;
    371   if (AvgStep() > 0)   {  // regularly spaced elements
    372     uint_8 step = AvgStep();
    373     pe = Data();
    374     for(k=0; k<totsize_; k++ )  pe[k*step] = (T) seq(k);
    375   }
    376   else {    // Non regular data spacing ...
    377     //    uint_4 ka = MaxSizeKA();
    378     uint_4 ka = 0;
    379     uint_8 step = Step(ka);
    380     uint_8 gpas = Size(ka);
    381     uint_8 naxa = Size()/Size(ka);
    382     for(j=0; j<naxa; j++)  {
    383       pe = mNDBlock.Begin()+Offset(ka,j);
    384       for(k=0; k<gpas; k++)  pe[k*step] = (T) seq(j*gpas+k);
    385     }
     376  int ka;
     377  if (arrtype_ == 0)  ka = 0;
     378  else ka = macoli_;
     379  uint_8 step = Step(ka);
     380  uint_8 gpas = Size(ka);
     381  uint_8 naxa = Size()/Size(ka);
     382  for(j=0; j<naxa; j++)  {
     383    pe = mNDBlock.Begin()+Offset(ka,j);
     384#if !defined(__GNUG__)
     385    for(k=0; k<gpas; k++)  pe[k*step] = (T) seq(j*gpas+k);
     386#else
     387    // g++ (up to 2.95.1) se melange les pinceaux  s'il y a le cast (T) pour l'instanciation des complexes
     388    for(k=0; k<gpas; k++)  pe[k*step] = seq(j*gpas+k);
     389#endif
    386390  }
    387391  return(*this);
Note: See TracChangeset for help on using the changeset viewer.