Changeset 813 in Sophya for trunk/SophyaLib/TArray/basarr.h


Ignore:
Timestamp:
Apr 5, 2000, 5:44:19 PM (25 years ago)
Author:
ansari
Message:

Correction bug/amelioarions TArray,TMatrix,TVector - Reza 5/4/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/basarr.h

    r804 r813  
    2222public:
    2323  //  To define Array / Matrix memory mapping
    24   enum { AutoMemoryMapping = -1, SameMemoryMapping = 0,
     24  enum MemoryMapping { AutoMemoryMapping = -1, SameMemoryMapping = 0,
    2525         CMemoryMapping = 1, FortranMemoryMapping = 2 };
     26  //  Vector type
     27  enum VectorType {AutoVectorType = -1, SameVectorType = 0,
     28                   ColumnVector = 1, RowVector = 2};
    2629
    27   //    Max Nb of printed elements
    28   static void    SetMaxPrint(uint_4 nprt=50);   
    29   //   Memory organisation (for matrices)
     30  //    Size threshold for parallel routine call
     31  static void    SetOpenMPSizeThreshold(uint_8 thr=200000);
     32  static inline uint_8 GetOpenMPSizeThreshold() { return openmp_size_threshold; }
     33  //    Max Nb of printed elements and print level
     34  static void    SetMaxPrint(uint_4 nprt=50, uint_4 lev=0);   
     35  static inline uint_4 GetMaxPrint() { return max_nprt_; }
     36  static inline uint_4 GetPrintLevel() { return prt_lev_; }
     37
     38  //   Memory organisation (for matrices) and vector type
    3039  static short   SetDefaultMemoryMapping(short mm=CMemoryMapping);
    3140  static inline short GetDefaultMemoryMapping() { return default_memory_mapping; }
     41  static short   SetDefaultVectorType(short vt=ColumnVector);
     42  static inline short GetDefaultVectorType() { return default_vector_type; }
    3243 
    3344  // Creation / destruction
     
    5364  uint_4 MaxSizeKA() const ;
    5465
    55   // memory organisation - packing information
     66  // memory organisation
    5667  inline short  GetMemoryMapping() const
    57                 {return ( (marowi_ == 1) ? CMemoryMapping : FortranMemoryMapping) ; }
     68                { return ( (marowi_ == 1) ? CMemoryMapping : FortranMemoryMapping) ; }
    5869
    59   inline uint_4 RowsKA() const {return marowi_; }    // Dimension correspondant aux lignes
    60   inline uint_4 ColsKA() const {return macoli_; }    // Dimension correspondant aux colonnes
    61   inline uint_4 VectKA() const {return veceli_; }    // Dimension corr. aux elts d'un vecteur
     70  inline uint_4 RowsKA() const {return marowi_; }    // Dimension des index de lignes
     71  inline uint_4 ColsKA() const {return macoli_; }    // Dimension des index de colonnes
     72  inline uint_4 VectKA() const {return veceli_; }    // Dimension des index des elts d'un vecteur
     73  void          SetMemoryMapping(short mm=AutoMemoryMapping);
    6274
     75  // Vector type   Line or Column vector
     76  inline short  GetVectorType() const
     77                { return((marowi_ == veceli_) ? ColumnVector : RowVector); }
     78  void          SetVectorType(short vt=AutoVectorType);
     79
     80  // memory organisation  - packing information
    6381  inline bool   IsPacked() const { return(moystep_ == 1); }
    6482  inline bool   IsPackedX() const { return(step_[0] == 1); }
     
    7694  uint_4 MinStepKA() const ;
    7795
     96  // Offset of element ip
    7897  uint_8 Offset(uint_8 ip=0) const ;
     98  // Offset of the i'th vector along axe ka
     99  uint_8  Offset(uint_4 ka, uint_8 i) const ;
    79100  inline uint_8  Offset(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4 iu=0) const; 
    80101
     
    85106  void           Show(ostream& os, bool si=false) const;
    86107  inline void    Show() const { Show(cout); }
    87   virtual string DataType() const = 0;
     108  virtual string InfoString() const;
    88109
    89110//  Objet DVList info
     
    102123  //  Organisation memoire
    103124  static short SelectMemoryMapping(short mm);
    104   void UpdateMemoryMapping(short mm, uint_4 & nx, uint_4 & ny);
     125  static short SelectVectorType(short vt);
     126  void UpdateMemoryMapping(short mm);
    105127  void UpdateMemoryMapping(BaseArray const & a, short mm);
    106128
     
    113135  uint_4 step_[BASEARRAY_MAXNDIMS];     // two consecutive elements distance in a given dimension
    114136  uint_4 minstep_;                   // minimal step (in any axes)
    115   uint_4 moystep_;                   // mean step 0 non regular steps
     137  uint_4 moystep_;                   // mean step if == 0 --> non regular steps
    116138  uint_8 offset_;              // global offset -> position of elem[0] in DataBlock
    117139  uint_4 marowi_, macoli_;     // For matrices, Row index and column index in dimensions
    118140  uint_4 veceli_;              // For vectors,  dimension index = marowi_/macoli_ (Row/Col vectors)
    119 
     141  bool ck_memo_vt_;            // if true, check MemoryOrg./VectorType for CompareSize
    120142  DVList* mInfo;               // Infos (variables) attachees au tableau
    121143
    122144  static char * ck_op_msg_[6];  // Operation messages for CheckDI() CheckBound()
    123145  static uint_4 max_nprt_;      // Nb maxi d'elements imprimes
     146  static uint_4 prt_lev_;        // Niveau de print 0 ou 1
    124147  static short default_memory_mapping;  // Default memory mapping
     148  static short default_vector_type;     // Default vector type Row/Column
     149  static uint_8 openmp_size_threshold;  // Size limit for parallel routine calls
    125150};
    126151
     
    132157  if ( (ka < 0) || (ka >= ndim_) ) {
    133158    string txt = "BaseArray::CheckDimensionIndex/Error ";   txt += ck_op_msg_[msg];
    134     throw(ParmError(txt));
     159    throw(RangeCheckError(txt));
    135160  }
    136161  return(ka);
     
    142167       (it >= size_[3]) || (iu >= size_[4]) ) {
    143168    string txt = "BaseArray::CheckArrayBound/Error ";   txt += ck_op_msg_[msg];
    144     throw(ParmError(txt));
     169    throw(RangeCheckError(txt));
    145170  }
    146171  return;
    147172}
     173
    148174
    149175
Note: See TracChangeset for help on using the changeset viewer.