DFT-EFE
 
Loading...
Searching...
No Matches
EFEBDSOnTheFlyComputeDealii.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 Avirup Sircar
24 */
25
26#ifndef dftefeEFEBDSOnTheFlyComputeDealii_h
27#define dftefeEFEBDSOnTheFlyComputeDealii_h
28
29#include <utils/TypeConfig.h>
31#include <utils/MemoryStorage.h>
40#include <memory>
41#include <map>
42#include <vector>
43namespace dftefe
44{
45 namespace basis
46 {
52 template <typename ValueTypeBasisCoeff,
53 typename ValueTypeBasisData,
55 size_type dim>
57 : public EFEBasisDataStorage<ValueTypeBasisData, memorySpace>
58 {
59 public:
62 using Storage =
64
66 std::shared_ptr<const BasisDofHandler> feBDH,
67 const quadrature::QuadratureRuleAttributes &quadratureRuleAttributes,
68 const BasisStorageAttributesBoolMap basisStorageAttributesBoolMap,
69 const size_type maxCellBlock,
71 const bool calculateEnrichmentDataOnTheFly = true,
72 const bool useMemOptGradScratchSpace = false
73 /*In gpu an extra scratch for grad helps in cuda strided gemm */
74 /* instead of varStrided gemm which is optimal*/);
75
77
78 std::shared_ptr<const BasisDofHandler>
79 getBasisDofHandler() const override;
80
81 void
83 const quadrature::QuadratureRuleAttributes &quadratureRuleAttributes,
84 const BasisStorageAttributesBoolMap basisStorageAttributesBoolMap)
85 override;
86
87 void
89 const quadrature::QuadratureRuleAttributes &quadratureRuleAttributes,
90 std::shared_ptr<const quadrature::QuadratureRuleContainer>
91 quadratureRuleContainer,
92 const BasisStorageAttributesBoolMap basisStorageAttributesBoolMap)
93 override;
94
95 void
97 const quadrature::QuadratureRuleAttributes &quadratureRuleAttributes,
98 std::vector<std::shared_ptr<const quadrature::QuadratureRule>>
99 quadratureRuleVec,
100 const BasisStorageAttributesBoolMap basisStorageAttributesBoolMap)
101 override;
102
103 void
105 const quadrature::QuadratureRuleAttributes &quadratureRuleAttributes,
106 std::shared_ptr<const quadrature::QuadratureRule>
107 baseQuadratureRuleAdaptive,
108 std::vector<std::shared_ptr<const utils::ScalarSpatialFunctionReal>>
109 & functions,
110 const std::vector<double> & absoluteTolerances,
111 const std::vector<double> & relativeTolerances,
112 const std::vector<double> & integralThresholds,
113 const double smallestCellVolume,
114 const size_type maxRecursion,
115 const BasisStorageAttributesBoolMap basisStorageAttributesBoolMap)
116 override;
117
118
119 // void
120 // evaluateBasisData(
121 // std::shared_ptr<const quadrature::QuadratureRuleContainer>
122 // quadratureRuleContainer,
123 // const QuadratureRuleAttributes & quadratureRuleAttributes,
124 // const BasisStorageAttributesBoolMap boolBasisStorageFlagsObj)
125 // override;
126
127 void
128 deleteBasisData() override;
129
130
131
132 // std::shared_ptr<const quadrature::QuadratureRuleContainer>
133 // getCellQuadratureRuleContainer(std::shared_ptr<Storage>>
134 // const QuadratureRuleAttributes &quadratureRuleAttributes) const
135 // override;
136 // functions to get data for a basis function on a given quad point in a
137 // cell
138 Storage
139 getBasisData(const QuadraturePointAttributes &attributes,
140 const size_type basisId) const override;
141 Storage
143 const size_type basisId) const override;
144 Storage
146 const size_type basisId) const override;
147
148 // functions to get data for a basis function on all quad points in a cell
149 Storage
150 getBasisDataInCell(const size_type cellId,
151 const size_type basisId) const override;
152 Storage
154 const size_type basisId) const override;
155 Storage
157 const size_type basisId) const override;
158
159 // functions to get data for all basis functions on all quad points in a
160 // cell
161 Storage
162 getBasisDataInCell(const size_type cellId) const override;
163 Storage
164 getBasisGradientDataInCell(const size_type cellId) const override;
165 Storage
166 getBasisHessianDataInCell(const size_type cellId) const override;
167
168 Storage
169 getJxWInCell(const size_type cellId) const override;
170
171 // functions to get data for all basis functions on all quad points in all
172 // cells
173 const Storage &
174 getBasisDataInAllCells() const override;
175 const Storage &
176 getBasisGradientDataInAllCells() const override;
177 const Storage &
178 getBasisHessianDataInAllCells() const override;
179
180 const Storage &
181 getJxWInAllCells() const override;
182
183 // get overlap of two basis functions in a cell
184 Storage
185 getBasisOverlap(const size_type cellId,
186 const size_type basisId1,
187 const size_type basisId2) const override;
188
189 // get overlap of all the basis functions in a cell
190 Storage
191 getBasisOverlapInCell(const size_type cellId) const override;
192
193 // get overlap of all the basis functions in all cells
194 const Storage &
195 getBasisOverlapInAllCells() const override;
196
197
198 // get the laplace operator in a cell
199 Storage
200 getBasisGradNiGradNjInCell(const size_type cellId) const override;
201
202 // get laplace operator in all cells
203 const Storage &
204 getBasisGradNiGradNjInAllCells() const override;
205
206 std::shared_ptr<const quadrature::QuadratureRuleContainer>
207 getQuadratureRuleContainer() const override;
208
209 // functions to get data for basis functions on all quad points in range
210 // of cells
211 void
212 getBasisDataInCellRange(std::pair<size_type, size_type> cellRange,
213 Storage &basisData) const override;
214 void
216 std::pair<size_type, size_type> cellRange,
217 Storage & basisGradientData) const override;
218
219 private:
221 std::shared_ptr<const EFEBasisDofHandlerDealii<ValueTypeBasisCoeff,
222 ValueTypeBasisData,
223 memorySpace,
224 dim>>
226 std::shared_ptr<const quadrature::QuadratureRuleContainer>
230 std::shared_ptr<Storage> d_basisParaCellClassQuadStorage;
231 std::shared_ptr<Storage> d_JxWStorage;
233 std::shared_ptr<Storage> d_basisJacobianInvQuadStorage;
234 std::shared_ptr<Storage> d_basisHessianQuadStorage;
235 std::vector<size_type> d_dofsInCell;
236 std::vector<size_type> d_nQuadPointsIncell;
243 std::shared_ptr<Storage> d_basisGradientEnrichQuadStorage,
247 std::shared_ptr<Storage> d_basisEnrichScratch;
248 std::shared_ptr<Storage> d_basisGradientEnrichScratch;
250
251 }; // end of EFEBDSOnTheFlyComputeDealii
252 } // end of namespace basis
253} // end of namespace dftefe
255#endif // dftefeEFEBDSOnTheFlyComputeDealii_h
An abstract class to store and access data for a given basis, such as the basis function values on a ...
Definition: EFEBDSOnTheFlyComputeDealii.h:58
const Storage & getBasisHessianDataInAllCells() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:2409
typename BasisDataStorage< ValueTypeBasisData, memorySpace >::Storage Storage
Definition: EFEBDSOnTheFlyComputeDealii.h:63
Storage getBasisOverlap(const size_type cellId, const size_type basisId1, const size_type basisId2) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3371
Storage getJxWInCell(const size_type cellId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3175
const bool d_useMemOptGradScratchSpace
Definition: EFEBDSOnTheFlyComputeDealii.h:245
std::shared_ptr< const quadrature::QuadratureRuleContainer > d_quadratureRuleContainer
Definition: EFEBDSOnTheFlyComputeDealii.h:227
std::shared_ptr< Storage > d_basisGradientEnrichQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:243
Storage getBasisGradientDataInCell(const size_type cellId, const size_type basisId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3445
const Storage & getBasisOverlapInAllCells() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3335
std::shared_ptr< Storage > d_basisEnrichQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:244
Storage getBasisGradientData(const QuadraturePointAttributes &attributes, const size_type basisId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3247
std::vector< size_type > d_nQuadPointsIncell
Definition: EFEBDSOnTheFlyComputeDealii.h:236
std::shared_ptr< const quadrature::QuadratureRuleContainer > getQuadratureRuleContainer() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3484
void getBasisGradientDataInCellRange(std::pair< size_type, size_type > cellRange, Storage &basisGradientData) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:2753
BasisStorageAttributesBoolMap d_basisStorageAttributesBoolMap
Definition: EFEBDSOnTheFlyComputeDealii.h:229
void getBasisDataInCellRange(std::pair< size_type, size_type > cellRange, Storage &basisData) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:2487
std::shared_ptr< Storage > d_basisEnrichScratch
Definition: EFEBDSOnTheFlyComputeDealii.h:247
Storage getBasisOverlapInCell(const size_type cellId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3353
std::shared_ptr< Storage > d_JxWStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:231
std::shared_ptr< Storage > d_basisGradientParaCellClassQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:232
const Storage & getBasisGradientDataInAllCells() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:2390
void evaluateBasisData(const quadrature::QuadratureRuleAttributes &quadratureRuleAttributes, const BasisStorageAttributesBoolMap basisStorageAttributesBoolMap) override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:1681
Storage getBasisHessianDataInCell(const size_type cellId, const size_type basisId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3465
std::vector< size_type > d_cellStartIdsBasisJacobianInvQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:237
std::shared_ptr< Storage > d_basisParaCellClassQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:230
const Storage & getJxWInAllCells() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:2431
std::vector< size_type > d_cellStartIdsBasisHessianQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:238
bool d_evaluateBasisData
Definition: EFEBDSOnTheFlyComputeDealii.h:220
std::shared_ptr< Storage > d_tmpGradientBlock
Definition: EFEBDSOnTheFlyComputeDealii.h:240
void deleteBasisData() override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3391
utils::MemoryStorage< ValueTypeBasisData, memorySpace > d_coeffsInAllCells
Definition: EFEBDSOnTheFlyComputeDealii.h:249
linearAlgebra::LinAlgOpContext< memorySpace > & d_linAlgOpContext
Definition: EFEBDSOnTheFlyComputeDealii.h:241
std::shared_ptr< Storage > d_basisGradientEnrichScratch
Definition: EFEBDSOnTheFlyComputeDealii.h:248
Storage getBasisData(const QuadraturePointAttributes &attributes, const size_type basisId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3210
Storage getBasisHessianData(const QuadraturePointAttributes &attributes, const size_type basisId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3288
std::vector< size_type > d_dofsInCell
Definition: EFEBDSOnTheFlyComputeDealii.h:235
const Storage & getBasisDataInAllCells() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:2374
Storage getBasisGradNiGradNjInCell(const size_type cellId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3501
std::shared_ptr< const BasisDofHandler > getBasisDofHandler() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3540
std::shared_ptr< const EFEBasisDofHandlerDealii< ValueTypeBasisCoeff, ValueTypeBasisData, memorySpace, dim > > d_efeBDH
Definition: EFEBDSOnTheFlyComputeDealii.h:225
std::shared_ptr< Storage > d_basisHessianQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:234
QuadratureRuleAttributes d_quadratureRuleAttributes
Definition: EFEBDSOnTheFlyComputeDealii.h:228
Storage getBasisDataInCell(const size_type cellId, const size_type basisId) const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3424
std::shared_ptr< Storage > d_basisGradientDataClass
Definition: EFEBDSOnTheFlyComputeDealii.h:240
size_type d_maxCellBlock
Definition: EFEBDSOnTheFlyComputeDealii.h:239
std::shared_ptr< Storage > d_basisJacobianInvQuadStorage
Definition: EFEBDSOnTheFlyComputeDealii.h:233
const bool d_calculateEnrichmentDataOnTheFly
Definition: EFEBDSOnTheFlyComputeDealii.h:246
const Storage & getBasisGradNiGradNjInAllCells() const override
Definition: EFEBDSOnTheFlyComputeDealii.t.cpp:3521
size_type d_classialDofsInCell
Definition: EFEBDSOnTheFlyComputeDealii.h:242
An abstract class to store and access data for a given basis, such as the basis function values on a ...
Definition: EFEBasisDataStorage.h:52
Definition: EFEBasisDofHandlerDealii.h:61
Definition: LinAlgOpContext.h:52
Class to store the attributes of a quad point, such as the cell Id it belongs, the quadPointId within...
Definition: QuadratureAttributes.h:171
Definition: QuadratureAttributes.h:135
std::map< BasisStorageAttributes, bool > BasisStorageAttributesBoolMap
Definition: BasisDataStorage.h:50
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
std::uint64_t size_type
Definition: TypeConfig.h:9