DFT-EFE
 
Loading...
Searching...
No Matches
EFEConstraintsLocalDealii.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 Vishal Subramanian, Avirup Sircar
24 */
25
26#ifndef dftefeEFEConstraintsLocalDealii_h
27#define dftefeEFEConstraintsLocalDealii_h
28
30#include <utils/TypeConfig.h>
31#include <deal.II/lac/affine_constraints.h>
32#include <utils/MemoryStorage.h>
34#include <unordered_map>
35
37namespace dftefe
38{
39 namespace basis
40 {
41 template <typename ValueTypeBasisCoeff,
42 utils::MemorySpace memorySpace,
43 size_type dim>
45 : public ConstraintsLocal<ValueTypeBasisCoeff, memorySpace>
46 {
47 public:
51
52 EFEConstraintsLocalDealii(dealii::IndexSet &locally_relevant_dofs);
53
55 dealii::AffineConstraints<ValueTypeBasisCoeff>
56 &dealiiAffineConstraintMatrix,
57 std::vector<std::pair<global_size_type, global_size_type>>
58 & locallyOwnedRanges,
59 std::vector<global_size_type> &ghostIndices,
60 std::unordered_map<global_size_type, size_type>
61 &globalToLocalMapLocalDofs);
62
64
65 //
66 // Copy function - note one has to call close after calling copyFrom
67 //
68 void
70 &constraintsLocalIn) override;
71
72 void
73 clear() override;
74 bool
75 isConstrained(global_size_type basisId) const override;
76 void
77 close() override;
78 bool
79 isClosed() const override;
80
81 //
82 // TODO : Modify this function to take into basisId as enrichment id
83 // i.e. check if basisId >= nClassicalDofs
84 //
85 void
87 ValueTypeBasisCoeff constraintValue) override;
88
89 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>> *
90 getConstraintEntries(const global_size_type lineDof) const override;
91
92 bool
93 isInhomogeneouslyConstrained(const global_size_type index) const override;
94
95 ValueTypeBasisCoeff
96 getInhomogeneity(const global_size_type lineDof) const override;
97
98 void
101 & vectorData,
102 size_type blockSize) const override;
103 void
106 & vectorData,
107 size_type blockSize) const override;
108
109 void
112 & vectorData,
113 size_type blockSize) const override;
114
115 void
117 memorySpace> &vectorData,
118 size_type blockSize,
119 ValueTypeBasisCoeff alpha) const override;
120
121 //
122 // dealii function
123 //
124 const dealii::AffineConstraints<ValueTypeBasisCoeff> &
125 getAffineConstraints() const;
126
127 //
128 // private functions
129 //
130 private:
131 void
133 const global_size_type constrainedDofIndex,
134 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>>
135 &colWeightPairs);
136
137 void
140 &constraintsDataIn);
141
142 void
144
145 void
146 addLine(const global_size_type lineDof);
147
148 bool
149 isGhostEntry(const global_size_type globalId) const;
150
151 bool
152 inLocallyOwnedRanges(const global_size_type globalId) const;
153
155 globalToLocal(const global_size_type globalId) const;
156
157
158 dealii::AffineConstraints<ValueTypeBasisCoeff>
162
168
172
174
175 std::vector<std::pair<global_size_type, global_size_type>>
177 std::vector<global_size_type> d_ghostIndices;
178 std::unordered_map<global_size_type, size_type> d_globalToLocalMap;
179 };
180
181 } // namespace basis
182} // namespace dftefe
184#endif // dftefeEFEConstraintsLocalDealii_h
Definition: ConstraintsLocal.h:43
Definition: EFEConstraintsLocalDealii.h:46
ValueTypeBasisCoeff getInhomogeneity(const global_size_type lineDof) const override
Definition: EFEConstraintsLocalDealii.t.cpp:179
void setInhomogeneity(global_size_type basisId, ValueTypeBasisCoeff constraintValue) override
Definition: EFEConstraintsLocalDealii.t.cpp:109
SizeTypeVector d_rowConstraintsIdsLocal
Definition: EFEConstraintsLocalDealii.h:164
void setConstrainedNodesToZero(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: EFEConstraintsLocalDealii.t.cpp:532
void copyFrom(const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > &constraintsLocalIn) override
Definition: EFEConstraintsLocalDealii.t.cpp:60
bool isInhomogeneouslyConstrained(const global_size_type index) const override
Definition: EFEConstraintsLocalDealii.t.cpp:168
void clear() override
Definition: EFEConstraintsLocalDealii.t.cpp:85
GlobalSizeTypeVector d_columnConstraintsIdsGlobal
Definition: EFEConstraintsLocalDealii.h:167
SizeTypeVector d_rowConstraintsSizes
Definition: EFEConstraintsLocalDealii.h:173
void distributeChildToParent(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: EFEConstraintsLocalDealii.t.cpp:511
bool d_isCleared
Definition: EFEConstraintsLocalDealii.h:160
bool d_isClosed
Definition: EFEConstraintsLocalDealii.h:161
std::unordered_map< global_size_type, size_type > d_globalToLocalMap
Definition: EFEConstraintsLocalDealii.h:178
utils::MemoryStorage< double, memorySpace > d_columnConstraintsValues
Definition: EFEConstraintsLocalDealii.h:169
bool inLocallyOwnedRanges(const global_size_type globalId) const
Definition: EFEConstraintsLocalDealii.t.cpp:581
void distributeParentToChild(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: EFEConstraintsLocalDealii.t.cpp:489
void copyConstraintsDataFromDealiiToDftefe()
Definition: EFEConstraintsLocalDealii.t.cpp:288
void addEntries(const global_size_type constrainedDofIndex, const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > &colWeightPairs)
Definition: EFEConstraintsLocalDealii.t.cpp:465
GlobalSizeTypeVector d_rowConstraintsIdsGlobal
Definition: EFEConstraintsLocalDealii.h:163
SizeTypeVector d_constraintRowSizesAccumulated
Definition: EFEConstraintsLocalDealii.h:166
std::vector< global_size_type > d_ghostIndices
Definition: EFEConstraintsLocalDealii.h:177
dealii::AffineConstraints< ValueTypeBasisCoeff > d_dealiiAffineConstraintMatrix
Definition: EFEConstraintsLocalDealii.h:159
bool isClosed() const override
Definition: EFEConstraintsLocalDealii.t.cpp:127
size_type globalToLocal(const global_size_type globalId) const
Definition: EFEConstraintsLocalDealii.t.cpp:600
void setConstrainedNodes(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize, ValueTypeBasisCoeff alpha) const override
Definition: EFEConstraintsLocalDealii.t.cpp:548
utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_constraintsInhomogenities
Definition: EFEConstraintsLocalDealii.h:171
const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > * getConstraintEntries(const global_size_type lineDof) const override
Definition: EFEConstraintsLocalDealii.t.cpp:158
void copyConstraintsDataFromDealiiToDealii(const EFEConstraintsLocalDealii< ValueTypeBasisCoeff, memorySpace, dim > &constraintsDataIn)
Definition: EFEConstraintsLocalDealii.t.cpp:190
bool isGhostEntry(const global_size_type globalId) const
Definition: EFEConstraintsLocalDealii.t.cpp:565
bool isConstrained(global_size_type basisId) const override
Definition: EFEConstraintsLocalDealii.t.cpp:138
std::vector< std::pair< global_size_type, global_size_type > > d_locallyOwnedRanges
Definition: EFEConstraintsLocalDealii.h:176
void close() override
Definition: EFEConstraintsLocalDealii.t.cpp:96
const dealii::AffineConstraints< ValueTypeBasisCoeff > & getAffineConstraints() const
Definition: EFEConstraintsLocalDealii.t.cpp:148
void addLine(const global_size_type lineDof)
Definition: EFEConstraintsLocalDealii.t.cpp:478
SizeTypeVector d_columnConstraintsIdsLocal
Definition: EFEConstraintsLocalDealii.h:165
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
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