32 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
34 const std::size_t
size,
35 const ValueType initVal)
45 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
48 const ValueType initVal)
71 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
78 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
91 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
103 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
112 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
118 *
this = std::move(u);
121 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
128 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
135 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
142 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
149 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
156 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
174 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
185 rhs.d_data =
nullptr;
190 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
201 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
212 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
217 ValueType *tempData =
d_data;
218 const std::size_t tempSize =
d_size;
225 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
231 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
238 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
239 template <dftfe::utils::MemorySpace memorySpaceDst>
246 "The allocated size of destination MemoryStorage is insufficient to "
247 "copy from the the MemoryStorage.");
252 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
253 template <dftfe::utils::MemorySpace memorySpaceDst>
258 const std::size_t srcOffset,
259 const std::size_t dstOffset)
const
263 "The offset and copy size specified for the source MemoryStorage"
264 " is out of range for it.");
267 dstOffset + N <= dstMemoryStorage.
size(),
268 "The offset and size specified for the destination MemoryStorage"
269 " is out of range for it.");
272 N, dstMemoryStorage.
begin() + dstOffset, this->begin() + srcOffset);
276 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
277 template <dftfe::utils::MemorySpace memorySpaceSrc>
284 "The allocated size of the MemoryStorage is insufficient to "
285 " copy from the source MemoryStorage.");
287 srcMemoryStorage.
size(), this->begin(), srcMemoryStorage.
begin());
290 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
291 template <dftfe::utils::MemorySpace memorySpaceSrc>
296 const std::size_t srcOffset,
297 const std::size_t dstOffset)
300 srcOffset + N <= srcMemoryStorage.
size(),
301 "The offset and copy size specified for the source MemoryStorage"
302 " is out of range for it.");
306 "The offset and size specified for the destination MemoryStorage"
307 " is out of range for it.");
310 N, this->
begin() + dstOffset, srcMemoryStorage.begin() + srcOffset);
313 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
314 template <dftfe::utils::MemorySpace memorySpaceDst>
323 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
324 template <dftfe::utils::MemorySpace memorySpaceDst>
329 const std::size_t srcOffset,
330 const std::size_t dstOffset)
const
334 "The offset and copy size specified for the source MemoryStorage"
335 " is out of range for it.");
337 N, dst + dstOffset, this->
begin() + srcOffset);
341 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
342 template <dftfe::utils::MemorySpace memorySpaceSrc>
351 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
352 template <dftfe::utils::MemorySpace memorySpaceSrc>
356 const std::size_t srcOffset,
357 const std::size_t dstOffset)
361 "The offset and size specified for the destination MemoryStorage"
362 " is out of range for it.");
365 N, this->
begin() + dstOffset, src + srcOffset);
368 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
371 std::vector<ValueType> &dst)
const
377 d_size, dst.data(), this->begin());
380 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
383 std::vector<ValueType> &dst,
385 const std::size_t srcOffset,
386 const std::size_t dstOffset)
const
390 "The offset and copy size specified for the source MemoryStorage"
391 " is out of range for it.");
392 if (dst.size() < N + dstOffset)
393 dst.resize(N + dstOffset);
396 N, dst.data() + dstOffset, this->begin() + srcOffset);
400 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
403 const std::vector<ValueType> &src)
407 "The allocated size of the MemoryStorage is insufficient to copy from "
408 "the source STL vector");
414 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
417 const std::vector<ValueType> &src,
419 const std::size_t srcOffset,
420 const std::size_t dstOffset)
424 "The offset and size specified for the destination MemoryStorage"
425 " is out of range for it.");
428 srcOffset + N <= src.size(),
429 "The offset and size specified for the source STL vector "
430 " is out of range for it.");
433 N, this->
begin() + dstOffset, src.data() + srcOffset);
436 template <
typename ValueType, utils::MemorySpace memorySpaceDst>
442 src.size(), returnValue.
begin(), src.data());
static void deallocate(ValueType *ptr)
static void allocate(std::size_t size, ValueType **ptr)
static void set(std::size_t size, ValueType *ptr, ValueType val)
Definition MemoryStorage.h:33
ValueType * iterator
Definition MemoryStorage.h:54
ValueType & reference
Definition MemoryStorage.h:52
iterator end()
Return iterator pointing to the end of Vector data.
Definition MemoryStorage.t.cc:144
void resize(std::size_t size, ValueType initVal=ValueType())
Deallocates and then resizes Vector with new size and initial value arguments.
Definition MemoryStorage.t.cc:47
std::size_t d_size
Definition MemoryStorage.h:501
~MemoryStorage()
Destructor.
Definition MemoryStorage.t.cc:72
void swap(MemoryStorage &rhs)
Definition MemoryStorage.t.cc:214
std::size_t size() const
Returns the dimension of the Vector.
Definition MemoryStorage.t.cc:123
ValueType * d_data
Definition MemoryStorage.h:500
iterator begin()
Return iterator pointing to the beginning of point data.
Definition MemoryStorage.t.cc:130
void clear()
clear and set to d_data to nullptr
Definition MemoryStorage.t.cc:80
ValueType * data() noexcept
Return the raw pointer to the Vector.
Definition MemoryStorage.t.cc:227
const ValueType & const_reference
Definition MemoryStorage.h:53
MemoryStorage & operator=(const MemoryStorage &rhs)
Copy assignment operator.
Definition MemoryStorage.t.cc:158
void setValue(const ValueType val)
Set all the entries to a given value.
Definition MemoryStorage.t.cc:105
const ValueType * const_iterator
Definition MemoryStorage.h:55
reference operator[](std::size_t i)
Operator to get a reference to a element of the Vector.
Definition MemoryStorage.t.cc:192
void copyTo(MemoryStorage< ValueType, memorySpaceDst > &dstMemoryStorage) const
Copies the data to a MemoryStorage object in a different memory space. This provides a seamless inter...
Definition MemoryStorage.t.cc:241
void copyFrom(const MemoryStorage< ValueType, memorySpaceSrc > &srcMemoryStorage)
Copies data from a MemoryStorage object in a different memory space. This provides a seamless interfa...
Definition MemoryStorage.t.cc:279
static void copy(std::size_t size, ValueType *dst, const ValueType *src)
Copy array from the memory space of source to the memory space of destination.
void throwException(bool condition, std::string msg="")
MemoryStorage< ValueType, memorySpaceDst > memoryStorageFromSTL(const std::vector< ValueType > &src)
Create a MemoryStorage object from an input C++ STL vector.
Definition MemoryStorage.t.cc:438
Definition pseudoPotentialToDftfeConverter.cc:34