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>
175 MemoryStorage<ValueType, memorySpace> &
190 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
201 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
213 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
219 const std::size_t tempSize =
d_size;
226 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
232 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
239 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
240 template <dftfe::utils::MemorySpace memorySpaceDst>
247 "The allocated size of destination MemoryStorage is insufficient to "
248 "copy from the the MemoryStorage.");
250 d_size, dstMemoryStorage.begin(), this->begin());
253 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
254 template <dftfe::utils::MemorySpace memorySpaceDst>
259 const std::size_t srcOffset,
260 const std::size_t dstOffset)
const
264 "The offset and copy size specified for the source MemoryStorage"
265 " is out of range for it.");
268 dstOffset + N <= dstMemoryStorage.
size(),
269 "The offset and size specified for the destination MemoryStorage"
270 " is out of range for it.");
273 N, dstMemoryStorage.begin() + dstOffset, this->begin() + srcOffset);
277 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
278 template <dftfe::utils::MemorySpace memorySpaceSrc>
285 "The allocated size of the MemoryStorage is insufficient to "
286 " copy from the source MemoryStorage.");
288 srcMemoryStorage.
size(), this->begin(), srcMemoryStorage.
begin());
291 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
292 template <dftfe::utils::MemorySpace memorySpaceSrc>
297 const std::size_t srcOffset,
298 const std::size_t dstOffset)
301 srcOffset + N <= srcMemoryStorage.
size(),
302 "The offset and copy size specified for the source MemoryStorage"
303 " is out of range for it.");
307 "The offset and size specified for the destination MemoryStorage"
308 " is out of range for it.");
311 N, this->
begin() + dstOffset, srcMemoryStorage.
begin() + srcOffset);
314 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
315 template <dftfe::utils::MemorySpace memorySpaceDst>
324 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
325 template <dftfe::utils::MemorySpace memorySpaceDst>
330 const std::size_t srcOffset,
331 const std::size_t dstOffset)
const
335 "The offset and copy size specified for the source MemoryStorage"
336 " is out of range for it.");
338 N, dst + dstOffset, this->
begin() + srcOffset);
342 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
343 template <dftfe::utils::MemorySpace memorySpaceSrc>
352 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
353 template <dftfe::utils::MemorySpace memorySpaceSrc>
357 const std::size_t srcOffset,
358 const std::size_t dstOffset)
362 "The offset and size specified for the destination MemoryStorage"
363 " is out of range for it.");
366 N, this->
begin() + dstOffset, src + srcOffset);
369 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
372 std::vector<ValueType> &dst)
const
378 d_size, dst.data(), this->begin());
381 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
384 std::vector<ValueType> &dst,
386 const std::size_t srcOffset,
387 const std::size_t dstOffset)
const
391 "The offset and copy size specified for the source MemoryStorage"
392 " is out of range for it.");
393 if (dst.size() < N + dstOffset)
394 dst.resize(N + dstOffset);
397 N, dst.data() + dstOffset, this->begin() + srcOffset);
401 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
404 const std::vector<ValueType> &src)
408 "The allocated size of the MemoryStorage is insufficient to copy from "
409 "the source STL vector");
415 template <
typename ValueType, dftfe::utils::MemorySpace memorySpace>
418 const std::vector<ValueType> &src,
420 const std::size_t srcOffset,
421 const std::size_t dstOffset)
425 "The offset and size specified for the destination MemoryStorage"
426 " is out of range for it.");
429 srcOffset + N <= src.size(),
430 "The offset and size specified for the source STL vector "
431 " is out of range for it.");
434 N, this->
begin() + dstOffset, src.data() + srcOffset);
437 template <
typename ValueType, utils::MemorySpace memorySpaceDst>
443 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:499
~MemoryStorage()
Destructor.
Definition MemoryStorage.t.cc:72
void swap(MemoryStorage &rhs)
Definition MemoryStorage.t.cc:215
std::size_t size() const
Returns the dimension of the Vector.
Definition MemoryStorage.t.cc:123
ValueType * d_data
Definition MemoryStorage.h:498
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:228
const ValueType & const_reference
Definition MemoryStorage.h:53
MemoryStorage & operator=(const MemoryStorage &rhs)
Copy assignment operator.
Definition MemoryStorage.t.cc:159
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:242
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:280
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:439
Definition pseudoPotentialToDftfeConverter.cc:34