Changeset 1156 in Sophya for trunk/SophyaLib/TArray/basarr.h
- Timestamp:
- Aug 29, 2000, 6:10:32 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/TArray/basarr.h
r1099 r1156 40 40 41 41 // threshold for parallel routine call 42 static void SetOpenMPSizeThreshold( uint_8thr=200000);42 static void SetOpenMPSizeThreshold(sa_size_t thr=200000); 43 43 //! Get Size threshold for parallel routine call 44 static inline uint_8GetOpenMPSizeThreshold() { return openmp_size_threshold; }45 46 static void SetMaxPrint( uint_4 nprt=50, uint_4 lev=0);44 static inline sa_size_t GetOpenMPSizeThreshold() { return openmp_size_threshold; } 45 46 static void SetMaxPrint(int_4 nprt=50, int_4 lev=0); 47 47 //! Get maximum number of printed elements 48 static inline uint_4 GetMaxPrint() { return max_nprt_; }49 //! Maximum number of printed elements arintlevel50 static inline uint_4 GetPrintLevel() { return prt_lev_; }48 static inline int_4 GetMaxPrint() { return max_nprt_; } 49 //! Get print level 50 static inline int_4 GetPrintLevel() { return prt_lev_; } 51 51 52 52 static short SetDefaultMemoryMapping(short mm=CMemoryMapping); … … 70 70 // Array dimensions 71 71 //! Return number of dimensions 72 inline uint_4 NbDimensions() const { return( ndim_ ); }72 inline int_4 NbDimensions() const { return( ndim_ ); } 73 73 74 74 //! Return total size of the array 75 inline uint_8Size() const { return(totsize_); }75 inline sa_size_t Size() const { return(totsize_); } 76 76 //! Return size along the first dimension 77 inline uint_4SizeX() const { return(size_[0]); }77 inline sa_size_t SizeX() const { return(size_[0]); } 78 78 //! Return size along the second dimension 79 inline uint_4SizeY() const { return(size_[1]); }79 inline sa_size_t SizeY() const { return(size_[1]); } 80 80 //! Return size along the third dimension 81 inline uint_4SizeZ() const { return(size_[2]); }81 inline sa_size_t SizeZ() const { return(size_[2]); } 82 82 //! Return size along the \b ka th dimension 83 inline uint_4 Size(intka) const { return(size_[CheckDI(ka,1)]); }84 85 int MaxSizeKA() const ;83 inline sa_size_t Size(int_4 ka) const { return(size_[CheckDI(ka,1)]); } 84 85 int_4 MaxSizeKA() const ; 86 86 87 87 //! Get memory organization … … 89 89 { return ( (marowi_ == 1) ? CMemoryMapping : FortranMemoryMapping) ; } 90 90 //! line index dimension 91 inline int RowsKA() const {return marowi_; }91 inline int_4 RowsKA() const {return marowi_; } 92 92 //! column index dimension 93 inline int ColsKA() const {return macoli_; }93 inline int_4 ColsKA() const {return macoli_; } 94 94 //! Index dimension of the elements of a vector 95 inline int VectKA() const {return veceli_; }95 inline int_4 VectKA() const {return veceli_; } 96 96 void SetMemoryMapping(short mm=AutoMemoryMapping); 97 97 … … 111 111 inline bool IsPackedZ() const { return(step_[2] == 1); } 112 112 //! return true if array is packed along the \b ka th dimension 113 inline bool IsPacked(int ka) const { return(step_[CheckDI(ka,2)] == 1); }113 inline bool IsPacked(int_4 ka) const { return(step_[CheckDI(ka,2)] == 1); } 114 114 115 115 //! return the minimum step value along all the dimensions 116 inline uint_4MinStep() const { return(minstep_); }116 inline sa_size_t MinStep() const { return(minstep_); } 117 117 //! return the average step value along all the dimensions 118 inline uint_4AvgStep() const { return(moystep_); }118 inline sa_size_t AvgStep() const { return(moystep_); } 119 119 //! return the step along the first dimension 120 inline uint_4StepX() const { return(step_[0]); }120 inline sa_size_t StepX() const { return(step_[0]); } 121 121 //! return the step along the second dimension 122 inline uint_4StepY() const { return(step_[1]); }122 inline sa_size_t StepY() const { return(step_[1]); } 123 123 //! return the step along the third dimension 124 inline uint_4StepZ() const { return(step_[2]); }124 inline sa_size_t StepZ() const { return(step_[2]); } 125 125 //! return the step along the \b ka th dimension 126 inline uint_4 Step(intka) const { return(step_[CheckDI(ka,3)]); }127 128 int MinStepKA() const ;126 inline sa_size_t Step(int_4 ka) const { return(step_[CheckDI(ka,3)]); } 127 128 int_4 MinStepKA() const ; 129 129 130 130 // Offset of element ip 131 uint_8 Offset(uint_8ip=0) const ;131 sa_size_t Offset(sa_size_t ip=0) const ; 132 132 // Offset of the i'th vector along axe ka 133 uint_8 Offset(uint_4 ka, uint_8i) const ;134 inline uint_8 Offset(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it=0, uint_4iu=0) const;133 sa_size_t Offset(int_4 ka, sa_size_t i) const ; 134 inline sa_size_t Offset(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it=0, sa_size_t iu=0) const; 135 135 136 136 // an abstract element acces methode 137 virtual MuTyV & ValueAtPosition( uint_8ip) const = 0;137 virtual MuTyV & ValueAtPosition(sa_size_t ip) const = 0; 138 138 139 139 // Pour recuperer pas et numero d'axe pour operations sur deux arrays 140 void GetOpeParams(const BaseArray& a, bool smo, int & ax, int& axa, uint_8& step,141 uint_8& stepa, uint_8& gpas, uint_8& naxa);140 void GetOpeParams(const BaseArray& a, bool smo, int_4& ax, int_4& axa, sa_size_t& step, 141 sa_size_t& stepa, sa_size_t& gpas, sa_size_t& naxa); 142 142 // Impression, I/O, ... 143 143 void Show(ostream& os, bool si=false) const; … … 150 150 151 151 protected: 152 inline int CheckDI(intka, int msg) const ;153 inline void CheckBound( uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4iu, int msg) const ;152 inline int_4 CheckDI(int_4 ka, int msg) const ; 153 inline void CheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu, int msg) const ; 154 154 // Changing Sizes/NDim ... return true if OK 155 bool UpdateSizes( uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8offset, string & exmsg);156 bool UpdateSizes( uint_4 ndim, const uint_4 * siz, const uint_4 * step, uint_8offset, string & exmsg);155 bool UpdateSizes(sa_size_t ndim, const sa_size_t * siz, sa_size_t step, sa_size_t offset, string & exmsg); 156 bool UpdateSizes(sa_size_t ndim, const sa_size_t * siz, const sa_size_t * step, sa_size_t offset, string & exmsg); 157 157 bool UpdateSizes(const BaseArray& a, string & exmsg); 158 static uint_8 ComputeTotalSize(uint_4 ndim, const uint_4 * siz, uint_4 step, uint_8offset) ;158 static sa_size_t ComputeTotalSize(sa_size_t ndim, const sa_size_t * siz, sa_size_t step, sa_size_t offset) ; 159 159 // Organisation memoire 160 160 static short SelectMemoryMapping(short mm); … … 164 164 165 165 // Pour Extraction de sous-tableau 166 virtual void UpdateSubArraySizes(BaseArray & ra, uint_4 ndim, uint_4 * siz, uint_4 * pos, uint_4* step) const;167 168 uint_4ndim_; //!< number of dimensions of array169 uint_4size_[BASEARRAY_MAXNDIMS]; //!< array of the size in each dimension170 uint_8totsize_; //!< Total number of elements171 uint_8offset_; //!< global offset -\> position of elem[0] in DataBlock166 virtual void UpdateSubArraySizes(BaseArray & ra, sa_size_t ndim, sa_size_t * siz, sa_size_t * pos, sa_size_t * step) const; 167 168 int_4 ndim_; //!< number of dimensions of array 169 sa_size_t size_[BASEARRAY_MAXNDIMS]; //!< array of the size in each dimension 170 sa_size_t totsize_; //!< Total number of elements 171 sa_size_t offset_; //!< global offset -\> position of elem[0] in DataBlock 172 172 //! two consecutive elements distance in a given dimension 173 uint_4step_[BASEARRAY_MAXNDIMS];174 uint_4minstep_; //!< minimal step (in any axes)175 uint_4moystep_; //!< mean step, if == 0 --\> non regular steps173 sa_size_t step_[BASEARRAY_MAXNDIMS]; 174 sa_size_t minstep_; //!< minimal step (in any axes) 175 sa_size_t moystep_; //!< mean step, if == 0 --\> non regular steps 176 176 int_2 marowi_; //!< For matrices, Row index in dimensions 177 177 int_2 macoli_; //!< For matrices, Column index in dimensions … … 181 181 182 182 static char * ck_op_msg_[6]; //!< Operation messages for CheckDI() CheckBound() 183 static uint_4 max_nprt_; //!< maximum number of printed elements184 static uint_4 prt_lev_; //!< Print level183 static int_4 max_nprt_; //!< maximum number of printed elements 184 static int_4 prt_lev_; //!< Print level 185 185 static short default_memory_mapping; //!< Default memory mapping 186 186 static short default_vector_type; //!< Default vector type Row/Column 187 static uint_8openmp_size_threshold; //!< Size limit for parallel routine calls187 static sa_size_t openmp_size_threshold; //!< Size limit for parallel routine calls 188 188 }; 189 189 … … 192 192 // -------------------------------------------------- 193 193 //! to verify the compatibility of the dimension index 194 inline int BaseArray::CheckDI(intka, int msg) const194 inline int_4 BaseArray::CheckDI(int_4 ka, int msg) const 195 195 { 196 if ( (ka < 0) || ( (uint_4)ka >= ndim_) ) {196 if ( (ka < 0) || (ka >= ndim_) ) { 197 197 string txt = "BaseArray::CheckDimensionIndex/Error "; txt += ck_op_msg_[msg]; 198 198 throw(RangeCheckError(txt)); … … 202 202 203 203 //! to verify the compatibility of the indexes in all dimensions 204 inline void BaseArray::CheckBound( uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4iu, int msg) const204 inline void BaseArray::CheckBound(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu, int msg) const 205 205 { 206 if ( (ix >= size_[0]) || (iy >= size_[1]) || (iz > size_[2]) || 207 (it >= size_[3]) || (iu >= size_[4]) ) { 206 if ( (ix >= size_[0]) || (ix < 0) || (iy >= size_[1]) || (iy < 0) || 207 (iz >= size_[2]) || (iz < 0) || (it >= size_[3]) || (it < 0) || 208 (iu >= size_[4]) || (iu < 0) ) { 208 209 string txt = "BaseArray::CheckArrayBound/Error "; txt += ck_op_msg_[msg]; 209 210 throw(RangeCheckError(txt)); … … 218 219 // -------------------------------------------------- 219 220 //! Offset of element (ix,iy,iz,it,iu) 220 inline uint_8 BaseArray::Offset(uint_4 ix, uint_4 iy, uint_4 iz, uint_4 it, uint_4iu) const221 inline sa_size_t BaseArray::Offset(sa_size_t ix, sa_size_t iy, sa_size_t iz, sa_size_t it, sa_size_t iu) const 221 222 { 222 223 #ifdef SO_BOUNDCHECKING
Note:
See TracChangeset
for help on using the changeset viewer.