DFT-EFE
 
Loading...
Searching...
No Matches
QuadratureValuesContainer.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#ifndef dftefeQuadratureValuesContainer_h
26#define dftefeQuadratureValuesContainer_h
27
28#include <utils/TypeConfig.h>
30#include <utils/MemoryStorage.h>
33namespace dftefe
34{
35 namespace quadrature
36 {
37 template <typename ValueType, utils::MemorySpace memorySpace>
39 {
40 public:
43 using pointer =
45 using reference =
46 typename dftefe::utils::MemoryStorage<ValueType,
47 memorySpace>::reference;
49 typename dftefe::utils::MemoryStorage<ValueType,
50 memorySpace>::const_reference;
51 using iterator =
54 typename dftefe::utils::MemoryStorage<ValueType,
55 memorySpace>::const_iterator;
56
57 public:
60 std::shared_ptr<const QuadratureRuleContainer> quadratureRuleContainer,
61 const size_type numberComponents,
62 const ValueType initVal = ValueType());
63
65
66 void
67 reinit(
68 std::shared_ptr<const QuadratureRuleContainer> quadratureRuleContainer,
69 const size_type numberComponents,
70 const ValueType initVal = ValueType());
71
74
77
80
81 template <utils::MemorySpace memorySpaceSrc>
82 void
83 setCellValues(const size_type cellId, const ValueType *values);
84
85 template <utils::MemorySpace memorySpaceSrc>
86 void
87 setCellQuadValues(const size_type cellId,
88 const size_type quadId,
89 const ValueType *values);
90
91 void
92 setValue(const ValueType value);
93
94 template <utils::MemorySpace memorySpaceDst>
95 void
96 getCellValues(const size_type cellId, ValueType *values) const;
97
98 template <utils::MemorySpace memorySpaceDst>
99 void
100 getCellQuadValues(const size_type cellId,
101 const size_type quadId,
102 ValueType * values) const;
103
104 std::shared_ptr<const QuadratureRuleContainer>
106
108 getNumberComponents() const;
109
111 nCells() const;
113 nQuadraturePoints() const;
115 nEntries() const;
116
118 nCellQuadraturePoints(const size_type cellId) const;
120 nCellEntries(const size_type cellId) const;
122 cellStartId(const size_type cellId) const;
123
124 const SizeTypeVector &
125 getCellStartIds() const;
126 const SizeTypeVector &
127 getNumberCellEntries() const;
128
130 begin();
131
133 begin() const;
134
136 end();
137
139 end() const;
140
142 begin(const size_type cellId);
143
145 begin(const size_type cellId) const;
146
148 end(const size_type cellId);
149
151 end(const size_type cellId) const;
152
153 ValueType *
154 data();
155
156 const ValueType *
157 data() const;
158
159 // ValueType
160 // dotProduct() const;
161
162 private:
167 std::shared_ptr<const QuadratureRuleContainer> d_quadratureRuleContainer;
168 }; // end of QuadratureValuesContainer
169
170
171 //
172 // Helper functions
173 //
174
183 template <typename ValueType1,
184 typename ValueType2,
185 dftefe::utils::MemorySpace memorySpace>
186 void
193 memorySpace> & w,
195
204 template <typename ValueType, dftefe::utils::MemorySpace memorySpace>
205 void
206 add(ValueType a,
208 ValueType b,
211
218 template <typename ValueType1,
219 typename ValueType2,
220 dftefe::utils::MemorySpace memorySpace>
221 void
222 scale(ValueType1 alpha,
226 memorySpace> & w,
228
235 template <typename ValueType, dftefe::utils::MemorySpace memorySpace>
236 void
237 scale(ValueType alpha,
240
241 } // end of namespace quadrature
242} // end of namespace dftefe
244#endif // dftefeQuadratureValuesContainer_h
Definition: LinAlgOpContext.h:38
Definition: QuadratureValuesContainer.h:39
size_type nCells() const
Definition: QuadratureValuesContainer.t.cpp:276
void setValue(const ValueType value)
Definition: QuadratureValuesContainer.t.cpp:214
typename dftefe::utils::MemoryStorage< ValueType, memorySpace >::const_iterator const_iterator
Definition: QuadratureValuesContainer.h:55
QuadratureValuesContainer & operator=(const QuadratureValuesContainer &rhs)
Definition: QuadratureValuesContainer.t.cpp:173
void reinit(std::shared_ptr< const QuadratureRuleContainer > quadratureRuleContainer, const size_type numberComponents, const ValueType initVal=ValueType())
Definition: QuadratureValuesContainer.t.cpp:123
void getCellValues(const size_type cellId, ValueType *values) const
Definition: QuadratureValuesContainer.t.cpp:236
size_type nCellQuadraturePoints(const size_type cellId) const
Definition: QuadratureValuesContainer.t.cpp:298
SizeTypeVector d_numCellEntries
Definition: QuadratureValuesContainer.h:165
typename dftefe::utils::MemoryStorage< ValueType, memorySpace >::pointer pointer
Definition: QuadratureValuesContainer.h:44
SizeTypeVector d_cellStartIds
Definition: QuadratureValuesContainer.h:164
const SizeTypeVector & getNumberCellEntries() const
Definition: QuadratureValuesContainer.t.cpp:333
typename dftefe::utils::MemoryStorage< ValueType, memorySpace >::reference reference
Definition: QuadratureValuesContainer.h:47
size_type d_numberComponents
Definition: QuadratureValuesContainer.h:163
QuadratureValuesContainer(std::shared_ptr< const QuadratureRuleContainer > quadratureRuleContainer, const size_type numberComponents, const ValueType initVal=ValueType())
std::shared_ptr< const QuadratureRuleContainer > getQuadratureRuleContainer() const
Definition: QuadratureValuesContainer.t.cpp:261
size_type cellStartId(const size_type cellId) const
Definition: QuadratureValuesContainer.t.cpp:315
void getCellQuadValues(const size_type cellId, const size_type quadId, ValueType *values) const
Definition: QuadratureValuesContainer.t.cpp:248
iterator end()
Definition: QuadratureValuesContainer.t.cpp:355
typename dftefe::utils::MemoryStorage< ValueType, memorySpace >::iterator iterator
Definition: QuadratureValuesContainer.h:52
typename dftefe::utils::MemoryStorage< ValueType, memorySpace >::const_reference const_reference
Definition: QuadratureValuesContainer.h:50
iterator begin()
Definition: QuadratureValuesContainer.t.cpp:341
ValueType * data()
Definition: QuadratureValuesContainer.t.cpp:401
void setCellQuadValues(const size_type cellId, const size_type quadId, const ValueType *values)
Definition: QuadratureValuesContainer.t.cpp:223
const SizeTypeVector & getCellStartIds() const
Definition: QuadratureValuesContainer.t.cpp:325
void setCellValues(const size_type cellId, const ValueType *values)
Definition: QuadratureValuesContainer.t.cpp:203
size_type nCellEntries(const size_type cellId) const
Definition: QuadratureValuesContainer.t.cpp:306
size_type nEntries() const
Definition: QuadratureValuesContainer.t.cpp:290
size_type getNumberComponents() const
Definition: QuadratureValuesContainer.t.cpp:268
std::shared_ptr< const QuadratureRuleContainer > d_quadratureRuleContainer
Definition: QuadratureValuesContainer.h:167
Storage d_storage
Definition: QuadratureValuesContainer.h:166
QuadratureValuesContainer()
Definition: QuadratureValuesContainer.t.cpp:87
size_type nQuadraturePoints() const
Definition: QuadratureValuesContainer.t.cpp:283
Definition: MemoryStorage.h:38
ValueType * iterator
Definition: MemoryStorage.h:59
ValueType * pointer
Definition: MemoryStorage.h:56
blas::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:70
void scale(ValueType1 alpha, const QuadratureValuesContainer< ValueType2, memorySpace > &u, QuadratureValuesContainer< linearAlgebra::blasLapack::scalar_type< ValueType1, ValueType2 >, memorySpace > &w, linearAlgebra::LinAlgOpContext< memorySpace > &linAlgOpContext)
Perform .
Definition: QuadratureValuesContainer.t.cpp:495
void add(linearAlgebra::blasLapack::scalar_type< ValueType1, ValueType2 > a, const QuadratureValuesContainer< ValueType1, memorySpace > &u, linearAlgebra::blasLapack::scalar_type< ValueType1, ValueType2 > b, const QuadratureValuesContainer< ValueType2, memorySpace > &v, QuadratureValuesContainer< linearAlgebra::blasLapack::scalar_type< ValueType1, ValueType2 >, memorySpace > &w, linearAlgebra::LinAlgOpContext< memorySpace > &linAlgOpContext)
Perform .
Definition: QuadratureValuesContainer.t.cpp:447
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8