Changeset 2639
- Timestamp:
- 07/19/24 08:25:26 (7 months ago)
- Location:
- XIOS3/dev/XIOS_KOKKOS/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/dev/XIOS_KOKKOS/src/array_workflow.hpp
r2636 r2639 59 59 60 60 CArray_WF(const xios::CArray_WF<T_numtype,N_rank>& array) 61 { 62 this->resize(array.numElements()); 63 for (int i=0;i<array.numElements();i++) (*this)(i) = array(i); 61 : Kokkos::View<T_numtype*,Kokkos::DefaultExecutionSpace::memory_space>( array ) 62 { 64 63 } 65 64 66 65 CArray_WF(xios::CArray_WF<T_numtype,N_rank>& array) 67 { 68 this->resize(array.numElements()); 69 for (int i=0;i<array.numElements();i++) (*this)(i) = array(i); 66 : Kokkos::View<T_numtype*,Kokkos::DefaultExecutionSpace::memory_space>( array ) 67 { 70 68 } 71 69 … … 107 105 : initialized(true) { this->resize(length0*length1*length2*length3*length4*length5*length6*length7); } 108 106 109 T_numtype* dataFirst() {return this->data();} 110 const T_numtype* dataFirst() const {return this->data();} 111 112 void resize( int sizeIn ) {Kokkos::resize(*this,sizeIn); } // mdspan ? 113 114 int shape() {return this->extent(0);} 115 int shape() const {return this->extent(0);} 116 117 size_t numElements() {return this->extent(0);} 118 size_t numElements() const {return this->extent(0);} 107 inline T_numtype* dataFirst() {return this->data();} 108 inline const T_numtype* dataFirst() const {return this->data();} 109 110 inline void resize( int sizeIn ) 111 { 112 if (this->numElements()!=sizeIn) 113 Kokkos::resize(*this,sizeIn); 114 } // mdspan ? 115 116 inline int shape() {return this->extent(0);} 117 inline int shape() const {return this->extent(0);} 118 119 inline size_t numElements() {return this->extent(0);} 120 inline size_t numElements() const {return this->extent(0);} 119 121 120 122 //inline T_numtype& operator()(int index) … … 132 134 this->resize( array.numElements() ); 133 135 for (int i=0;i<array.numElements();i++) (*this)(i) = (array(i)); 134 135 136 initialized = array.initialized; 136 137 } … … 190 191 inline CArray_WF<T_numtype,N_rank>& operator=(const T_numtype& value) 191 192 { 192 for (int i=0;i<this->numElements();i++) (*this) [i]= value;193 for (int i=0;i<this->numElements();i++) (*this)(i) = value; 193 194 return *this; 194 195 } … … 196 197 inline CArray_WF<T_numtype,N_rank>& operator+=(const CArray_WF<T_numtype,N_rank>& array) 197 198 { 198 for (int i=0;i<this->numElements();i++) (*this) [i] += array[i];199 for (int i=0;i<this->numElements();i++) (*this)(i) += array(i); 199 200 return *this; 200 201 } … … 202 203 inline CArray_WF<T_numtype,N_rank>& operator/=(const int& val) 203 204 { 204 for (int i=0;i<this->numElements();i++) (*this) [i]/= (T_numtype)val;205 for (int i=0;i<this->numElements();i++) (*this)(i) /= (T_numtype)val; 205 206 return *this; 206 207 } … … 208 209 inline CArray_WF<T_numtype,N_rank>& operator-( const T_numtype& val) 209 210 { 210 for (int i=0;i<this->numElements();i++) (*this) [i]-= (T_numtype)val;211 for (int i=0;i<this->numElements();i++) (*this)(i) -= (T_numtype)val; 211 212 return *this; 212 213 } … … 214 215 inline CArray_WF<T_numtype,N_rank>& operator/( const T_numtype& val) 215 216 { 216 for (int i=0;i<this->numElements();i++) (*this) [i]/= (T_numtype)val;217 for (int i=0;i<this->numElements();i++) (*this)(i) /= (T_numtype)val; 217 218 return *this; 218 219 } … … 220 221 inline CArray_WF<T_numtype,N_rank>& operator*( const T_numtype& val) 221 222 { 222 for (int i=0;i<this->numElements();i++) (*this) [i]*= (T_numtype)val;223 for (int i=0;i<this->numElements();i++) (*this)(i) *= (T_numtype)val; 223 224 return *this; 224 225 } … … 226 227 inline CArray_WF<T_numtype,N_rank>& operator+( const T_numtype& val) 227 228 { 228 for (int i=0;i<this->numElements();i++) (*this) [i]+= (T_numtype)val;229 for (int i=0;i<this->numElements();i++) (*this)(i) += (T_numtype)val; 229 230 return *this; 230 231 } … … 245 246 } 246 247 247 248 inline CArray_WF<T_numtype,N_rank>& operator=( const CArray_WF<T_numtype,N_rank>& array)249 {250 this->resize( array.numElements() );251 for (int i=0;i<array.numElements();i++) (*this)(i) = array(i);252 return *this;253 }254 248 255 249 }; … … 272 266 template <typename T_numtype,int N_rank> inline CArray_WF<T_numtype,N_rank>& round( CArray_WF<T_numtype,N_rank>& array ) 273 267 { 274 for (int i=0;i<array.numElements();i++) (array) [i] = std::round( array[i]);268 for (int i=0;i<array.numElements();i++) (array)(i) = std::round( array(i) ); 275 269 if (!array.numElements()) ERROR("inline CArray_WF<>& operator<=(const double& value)", << "Size = 0."); 276 270 return array; -
XIOS3/dev/XIOS_KOKKOS/src/functor.cpp
r2636 r2639 44 44 //--------------------------------------------------------------- 45 45 46 CArray_WF<double,1> CFunctor::operator ()(const CArray_WF<double,1>& dinput)46 CArray_WF<double,1>& CFunctor::operator ()(const CArray_WF<double,1>& dinput) 47 47 { 48 48 this->nbcall++; -
XIOS3/dev/XIOS_KOKKOS/src/functor.hpp
r2636 r2639 22 22 CArray_WF<double,1> getDataOutput(void) const; 23 23 /// Opérateur /// 24 CArray_WF<double,1> operator ()(const CArray_WF<double,1>& dinput);24 CArray_WF<double,1>& operator ()(const CArray_WF<double,1>& dinput); 25 25 virtual ETimeType timeType(void) = 0 ; 26 26
Note: See TracChangeset
for help on using the changeset viewer.