DFT-EFE
 
Loading...
Searching...
No Matches
EFEBasisDofHandlerDealii.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 dftefeEFEBasisDofHandlerDealii_h
27# define dftefeEFEBasisDofHandlerDealii_h
28
29# include <utils/TypeConfig.h>
30# include <utils/Point.h>
32# include <memory>
33# include <deal.II/fe/fe_q.h>
36# include <utils/Exceptions.h>
37# include <utils/MPITypes.h>
38# include <utils/MPIWrapper.h>
40
42# include <deal.II/dofs/dof_handler.h>
43# include <deal.II/matrix_free/matrix_free.h>
44namespace dftefe
45{
46 namespace basis
47 {
52 template <typename ValueTypeBasisCoeff,
53 typename ValueTypeBasisData,
55 size_type dim>
57 : public EFEBasisDofHandler<ValueTypeBasisCoeff,
58 ValueTypeBasisData,
59 memorySpace,
60 dim>
61 {
62 public:
64 std::shared_ptr<const EnrichmentClassicalInterfaceSpherical<
65 ValueTypeBasisData,
66 memorySpace,
67 dim>> enrichmentClassicalInterface,
68 const utils::mpi::MPIComm &mpiComm);
69
71 std::shared_ptr<
72 const EnrichmentClassicalInterfaceSpherical<ValueTypeBasisData,
73 memorySpace,
74 dim>>
75 enrichmentClassicalInterface);
76
77 double
78 getBasisFunctionValue(const size_type basisId,
79 const utils::Point &point) const override;
80 std::vector<double>
82 const size_type basisId,
83 const utils::Point &point,
84 const size_type derivativeOrder = 1) const override;
85
87 void
89 ValueTypeBasisData,
90 memorySpace,
91 dim>> enrichmentClassicalInterface,
92 const utils::mpi::MPIComm &mpiComm);
93
94 void
96 ValueTypeBasisData,
97 memorySpace,
98 dim>> enrichmentClassicalInterface);
99
100 std::shared_ptr<const TriangulationBase>
101 getTriangulation() const override;
102
104 nLocalCells() const override;
106 nLocallyOwnedCells() const override;
107
109 nGlobalCells() const override;
111 getFEOrder(size_type cellId) const override;
112
114 nCellDofs(size_type cellId) const override;
115
116 bool
117 isVariableDofsPerCell() const override;
118
120 nLocalNodes() const override;
121
122 std::vector<std::pair<global_size_type, global_size_type>>
123 getLocallyOwnedRanges() const override;
124
125 std::vector<std::pair<global_size_type, global_size_type>>
126 getGlobalRanges() const override;
127
128 std::map<BasisIdAttribute, size_type>
129 getBasisAttributeToRangeIdMap() const override;
130
132 nGlobalNodes() const override;
133
134 std::vector<size_type>
135 getLocalNodeIds(size_type cellId) const override;
136
137 std::vector<size_type>
138 getGlobalNodeIds() const override;
139
140 void
142 size_type cellId,
143 std::vector<global_size_type> &vecGlobalNodeId) const override;
144
145 const std::vector<global_size_type> &
146 getBoundaryIds() const override;
147
149 FECellIterator
150 beginLocallyOwnedCells() override;
151
153 FECellIterator
154 endLocallyOwnedCells() override;
155
157 const_FECellIterator
158 beginLocallyOwnedCells() const override;
159
161 const_FECellIterator
162 endLocallyOwnedCells() const override;
163
165 FECellIterator
166 beginLocalCells() override;
168 FECellIterator
169 endLocalCells() override;
171 const_FECellIterator
172 beginLocalCells() const override;
174 const_FECellIterator
175 endLocalCells() const override;
176 unsigned int
177 getDim() const override;
178
180 nCumulativeLocallyOwnedCellDofs() const override;
181
183 nCumulativeLocalCellDofs() const override;
184
185 // This assumes a linear cell mapping
186 void
188 std::map<global_size_type, utils::Point> &dofCoords) const override;
189
190 // Additional functions for getting geometric constriants matrix
191 // Additional functions for getting the communication pattern object
192 // for MPI case
193
194 std::shared_ptr<const ConstraintsLocal<ValueTypeBasisCoeff, memorySpace>>
195 getIntrinsicConstraints() const override;
196
197 // use this to add extra constraints on top of geometric constraints
198 std::shared_ptr<ConstraintsLocal<ValueTypeBasisCoeff, memorySpace>>
199 createConstraintsStart() const override;
200
201 // call this after calling start
202 void
205 constraintsLocal) const override;
206
207 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
208 getMPIPatternP2P() const override;
209
210 bool
211 isDistributed() const override;
212
213 //
214 // dealii specific functions
215 //
216 std::shared_ptr<const dealii::DoFHandler<dim>>
217 getDoFHandler() const;
218
219 const dealii::FiniteElement<dim> &
220 getReferenceFE(const size_type cellId) const;
221
222 // Enrichment functions with dealii mesh. The enrichedid is the cell local
223 // id.
224 double
225 getEnrichmentValue(const size_type cellId,
226 const size_type cellLocalEnrichmentId,
227 const dftefe::utils::Point &point) const override;
228
229 std::vector<double>
231 const size_type cellLocalEnrichmentId,
232 const dftefe::utils::Point &point) const override;
233
234 std::vector<double>
235 getEnrichmentHessian(const size_type cellId,
236 const size_type cellLocalEnrichmentId,
237 const dftefe::utils::Point &point) const override;
238
239 std::vector<global_size_type>
240 getGhostEnrichmentGlobalIds() const override;
241
243 nGlobalEnrichmentNodes() const override;
244
245 std::shared_ptr<const EnrichmentIdsPartition<dim>>
246 getEnrichmentIdsPartition() const override;
247
248 std::shared_ptr<
249 const EnrichmentClassicalInterfaceSpherical<ValueTypeBasisData,
250 memorySpace,
251 dim>>
252 getEnrichmentClassicalInterface() const override;
253
254 bool
255 isOrthogonalized() const override;
256
258 totalRanges() const override;
259
260
261 private:
262 std::shared_ptr<dealii::DoFHandler<dim>> d_dofHandler;
264 std::vector<std::shared_ptr<FECellBase>> d_localCells;
265 std::vector<std::shared_ptr<FECellBase>> d_locallyOwnedCells;
268 std::shared_ptr<const EnrichmentIdsPartition<dim>>
270 std::vector<std::vector<global_size_type>>
273 std::vector<std::pair<global_size_type, global_size_type>>
275 std::vector<std::pair<global_size_type, global_size_type>> d_globalRanges;
276 std::vector<global_size_type> d_ghostEnrichmentGlobalIds;
277 std::shared_ptr<const atoms::AtomSphericalDataContainer>
279 std::vector<std::string> d_atomSymbolVec;
280 std::vector<utils::Point> d_atomCoordinatesVec;
281 std::string d_fieldName;
283 std::shared_ptr<
284 const EnrichmentClassicalInterfaceSpherical<ValueTypeBasisData,
285 memorySpace,
286 dim>>
288
289 std::vector<global_size_type> d_boundaryIds;
291 std::shared_ptr<const utils::mpi::MPIPatternP2P<memorySpace>>
293 std::shared_ptr<const ConstraintsLocal<ValueTypeBasisCoeff, memorySpace>>
295
296 void
298 const std::pair<global_size_type, global_size_type> &locallyOwnedRanges,
299 std::vector<std::pair<global_size_type, global_size_type>>
300 & allOwnedRanges,
301 const utils::mpi::MPIComm &mpiComm) const;
302
303 }; // end of EFEBasisDofHandlerDealii
304 } // end of namespace basis
305} // end of namespace dftefe
307#endif // dftefeEFEBasisDofHandlerDealii_h
308//
Definition: ConstraintsLocal.h:43
Definition: EFEBasisDofHandlerDealii.h:61
size_type d_numCumulativeLocallyOwnedCellDofs
Definition: EFEBasisDofHandlerDealii.h:266
std::vector< std::shared_ptr< FECellBase > > d_localCells
Definition: EFEBasisDofHandlerDealii.h:264
bool d_isDistributed
Definition: EFEBasisDofHandlerDealii.h:290
std::map< BasisIdAttribute, size_type > getBasisAttributeToRangeIdMap() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1086
unsigned int getDim() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1321
bool isDistributed() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1749
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > d_mpiPatternP2P
Definition: EFEBasisDofHandlerDealii.h:292
void createConstraintsEnd(std::shared_ptr< ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > > constraintsLocal) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1721
size_type d_totalRanges
Definition: EFEBasisDofHandlerDealii.h:272
const dealii::FiniteElement< dim > & getReferenceFE(const size_type cellId) const
Definition: EFEBasisDofHandlerDealii.t.cpp:1350
std::vector< global_size_type > getGhostEnrichmentGlobalIds() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1598
bool isVariableDofsPerCell() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:957
double getBasisFunctionValue(const size_type basisId, const utils::Point &point) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:838
std::vector< std::vector< global_size_type > > d_overlappingEnrichmentIdsInCells
Definition: EFEBasisDofHandlerDealii.h:271
bool isOrthogonalized() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1653
std::shared_ptr< const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > > d_constraintsLocal
Definition: EFEBasisDofHandlerDealii.h:294
FEBasisDofHandler< ValueTypeBasisCoeff, memorySpace, dim >::FECellIterator beginLocallyOwnedCells() override
Definition: EFEBasisDofHandlerDealii.t.cpp:1210
std::vector< size_type > getGlobalNodeIds() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1137
size_type nLocalNodes() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:970
void getCellDofsGlobalIds(size_type cellId, std::vector< global_size_type > &vecGlobalNodeId) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1157
std::shared_ptr< const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > > getIntrinsicConstraints() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1682
std::vector< std::pair< global_size_type, global_size_type > > getGlobalRanges() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1073
size_type getFEOrder(size_type cellId) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:929
std::vector< std::pair< global_size_type, global_size_type > > d_globalRanges
Definition: EFEBasisDofHandlerDealii.h:275
std::shared_ptr< const EnrichmentClassicalInterfaceSpherical< ValueTypeBasisData, memorySpace, dim > > getEnrichmentClassicalInterface() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1640
size_type nLocalCells() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:889
const std::vector< global_size_type > & getBoundaryIds() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1196
std::shared_ptr< const atoms::AtomSphericalDataContainer > d_atomSphericalDataContainer
Definition: EFEBasisDofHandlerDealii.h:278
std::vector< double > getEnrichmentDerivative(const size_type cellId, const size_type cellLocalEnrichmentId, const dftefe::utils::Point &point) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1491
FEBasisDofHandler< ValueTypeBasisCoeff, memorySpace, dim >::FECellIterator beginLocalCells() override
Definition: EFEBasisDofHandlerDealii.t.cpp:1266
size_type nCumulativeLocallyOwnedCellDofs() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1408
std::vector< global_size_type > d_ghostEnrichmentGlobalIds
Definition: EFEBasisDofHandlerDealii.h:276
std::shared_ptr< const EnrichmentClassicalInterfaceSpherical< ValueTypeBasisData, memorySpace, dim > > d_enrichClassIntfce
Definition: EFEBasisDofHandlerDealii.h:287
std::shared_ptr< const TriangulationBase > getTriangulation() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:876
global_size_type nGlobalEnrichmentNodes() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1611
void reinit(std::shared_ptr< const EnrichmentClassicalInterfaceSpherical< ValueTypeBasisData, memorySpace, dim > > enrichmentClassicalInterface, const utils::mpi::MPIComm &mpiComm)
Definition: EFEBasisDofHandlerDealii.t.cpp:175
std::vector< std::string > d_atomSymbolVec
Definition: EFEBasisDofHandlerDealii.h:279
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > getMPIPatternP2P() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1736
size_type nCellDofs(size_type cellId) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:942
std::vector< std::shared_ptr< FECellBase > > d_locallyOwnedCells
Definition: EFEBasisDofHandlerDealii.h:265
size_type d_numCumulativeLocalCellDofs
Definition: EFEBasisDofHandlerDealii.h:267
size_type nLocallyOwnedCells() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:902
size_type totalRanges() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1666
size_type nCumulativeLocalCellDofs() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1421
double getEnrichmentValue(const size_type cellId, const size_type cellLocalEnrichmentId, const dftefe::utils::Point &point) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1437
std::vector< std::pair< global_size_type, global_size_type > > getLocallyOwnedRanges() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1008
std::vector< size_type > getLocalNodeIds(size_type cellId) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1119
std::shared_ptr< ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > > createConstraintsStart() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1695
std::string d_fieldName
Definition: EFEBasisDofHandlerDealii.h:281
void getBasisCenters(std::map< global_size_type, utils::Point > &dofCoords) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1370
FEBasisDofHandler< ValueTypeBasisCoeff, memorySpace, dim >::FECellIterator endLocallyOwnedCells() override
Definition: EFEBasisDofHandlerDealii.t.cpp:1224
FEBasisDofHandler< ValueTypeBasisCoeff, memorySpace, dim >::FECellIterator endLocalCells() override
Definition: EFEBasisDofHandlerDealii.t.cpp:1280
void getAllOwnedClassicalRanges(const std::pair< global_size_type, global_size_type > &locallyOwnedRanges, std::vector< std::pair< global_size_type, global_size_type > > &allOwnedRanges, const utils::mpi::MPIComm &mpiComm) const
Definition: EFEBasisDofHandlerDealii.t.cpp:1022
std::shared_ptr< const EnrichmentIdsPartition< dim > > getEnrichmentIdsPartition() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1624
global_size_type nGlobalNodes() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:989
std::vector< global_size_type > d_boundaryIds
Definition: EFEBasisDofHandlerDealii.h:289
bool d_isOrthogonalized
Definition: EFEBasisDofHandlerDealii.h:282
std::vector< std::pair< global_size_type, global_size_type > > d_locallyOwnedRanges
Definition: EFEBasisDofHandlerDealii.h:274
std::shared_ptr< const EnrichmentIdsPartition< dim > > d_enrichmentIdsPartition
Definition: EFEBasisDofHandlerDealii.h:269
bool d_isVariableDofsPerCell
Definition: EFEBasisDofHandlerDealii.h:263
std::vector< double > getEnrichmentHessian(const size_type cellId, const size_type cellLocalEnrichmentId, const dftefe::utils::Point &point) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:1545
std::vector< double > getBasisFunctionDerivative(const size_type basisId, const utils::Point &point, const size_type derivativeOrder=1) const override
Definition: EFEBasisDofHandlerDealii.t.cpp:856
std::shared_ptr< const dealii::DoFHandler< dim > > getDoFHandler() const
Definition: EFEBasisDofHandlerDealii.t.cpp:1337
std::shared_ptr< dealii::DoFHandler< dim > > d_dofHandler
Definition: EFEBasisDofHandlerDealii.h:262
size_type nGlobalCells() const override
Definition: EFEBasisDofHandlerDealii.t.cpp:915
std::vector< utils::Point > d_atomCoordinatesVec
Definition: EFEBasisDofHandlerDealii.h:280
Definition: EFEBasisDofHandler.h:57
Class to get the interface between Classical and Enrichment basis. It takes as the classical basis as...
Definition: EnrichmentClassicalInterfaceSpherical.h:72
Definition: FEBasisDofHandler.h:57
Definition: PointImpl.h:13
int MPIComm
Definition: MPITypes.h:83
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8
unsigned long int global_size_type
Definition: TypeConfig.h:9