DFT-EFE
 
Loading...
Searching...
No Matches
DiscontiguousDataOperations.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Bikash Kanungo
24 */
25
26#ifndef dftefeDiscontiguousDataOperations_h
27#define dftefeDiscontiguousDataOperations_h
28
30#include <utils/MemoryStorage.h>
31#include <utils/TypeConfig.h>
32
33namespace dftefe
34{
35 namespace utils
36 {
37 template <typename ValueType, dftefe::utils::MemorySpace memorySpace>
39 {
40 public:
42
70 static void
71 copyFromDiscontiguousMemory(const ValueType *src,
72 ValueType * dst,
73 const size_type *discontIds,
74 const size_type N,
75 const size_type nComponents);
76
105 static void
106 copyToDiscontiguousMemory(const ValueType *src,
107 ValueType * dst,
108 const size_type *discontIds,
109 const size_type N,
110 const size_type nComponents);
111
140 static void
141 addToDiscontiguousMemory(const ValueType *src,
142 ValueType * dst,
143 const size_type *discontIds,
144 const size_type N,
145 const size_type nComponents);
146 }; // end of class DiscontiguousDataOperations
147
148
149// partial template specialization for DEVICE
150#ifdef DFTEFE_WITH_DEVICE
151 template <typename ValueType>
152 class DiscontiguousDataOperations<ValueType, utils::MemorySpace::DEVICE>
153 {
154 public:
155 using SizeTypeVector =
157
186 static void
187 copyFromDiscontiguousMemory(const ValueType *src,
188 ValueType * dst,
189 const size_type *discontIds,
190 const size_type N,
191 const size_type nComponents);
192
221 static void
222 copyToDiscontiguosMemory(const ValueType *src,
223 ValueType * dst,
224 const size_type *discontIds,
225 const size_type N,
226 const size_type nComponents);
227
256 static void
257 addToDiscontiguosMemory(const ValueType *src,
258 ValueType * dst,
259 const size_type *discontIds,
260 const size_type N,
261 const size_type nComponents);
262 }; // end of class DiscontiguousDataOperations for DEVICE
263#endif // DFTEFE_WITH_DEVICE
264
265 } // end of namespace utils
266} // namespace dftefe
267#endif // dftefeDiscontiguousDataOperations_h
Definition: DiscontiguousDataOperations.h:39
static void copyToDiscontiguousMemory(const ValueType *src, ValueType *dst, const size_type *discontIds, const size_type N, const size_type nComponents)
Function to copy a source array x to a destination array y, where the source is accessed contiguously...
Definition: DiscontiguousDataOperations.cpp:58
utils::MemoryStorage< size_type, memorySpace > SizeTypeVector
Definition: DiscontiguousDataOperations.h:41
static void copyFromDiscontiguousMemory(const ValueType *src, ValueType *dst, const size_type *discontIds, const size_type N, const size_type nComponents)
Function to copy a source array x to a destination array y, where the source is accessed discontiguou...
Definition: DiscontiguousDataOperations.cpp:39
static void addToDiscontiguousMemory(const ValueType *src, ValueType *dst, const size_type *discontIds, const size_type N, const size_type nComponents)
Function to add a source array x to a destination array y, where the source is accessed contiguously ...
Definition: DiscontiguousDataOperations.cpp:77
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8