DFT-EFE
 
Loading...
Searching...
No Matches
CFEConstraintsLocalDealii.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 dftefeCFEConstraintsLocalDealii_h
27#define dftefeCFEConstraintsLocalDealii_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 CFEConstraintsLocalDealii(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 void
83 ValueTypeBasisCoeff constraintValue) override;
84
85 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>> *
86 getConstraintEntries(const global_size_type lineDof) const override;
87
88 bool
89 isInhomogeneouslyConstrained(const global_size_type index) const override;
90
91 ValueTypeBasisCoeff
92 getInhomogeneity(const global_size_type lineDof) const override;
93
94 void
97 & vectorData,
98 size_type blockSize) const override;
99 void
102 & vectorData,
103 size_type blockSize) const override;
104
105 void
108 & vectorData,
109 size_type blockSize) const override;
110
111 void
113 memorySpace> &vectorData,
114 size_type blockSize,
115 ValueTypeBasisCoeff alpha) const override;
116
117 //
118 // dealii function
119 //
120 const dealii::AffineConstraints<ValueTypeBasisCoeff> &
121 getAffineConstraints() const;
122
123 //
124 // private functions
125 //
126 private:
127 void
129 const global_size_type constrainedDofIndex,
130 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>>
131 &colWeightPairs);
132
133 void
136 &constraintsDataIn);
137
138 void
140
141 void
142 addLine(const global_size_type lineDof);
143
144 bool
145 isGhostEntry(const global_size_type globalId) const;
146
147 bool
148 inLocallyOwnedRanges(const global_size_type globalId) const;
149
151 globalToLocal(const global_size_type globalId) const;
152
153
154 dealii::AffineConstraints<ValueTypeBasisCoeff>
158
164
168
170
171 std::vector<std::pair<global_size_type, global_size_type>>
173 std::vector<global_size_type> d_ghostIndices;
174 std::unordered_map<global_size_type, size_type> d_globalToLocalMap;
175 };
176
177 } // namespace basis
178} // namespace dftefe
180#endif // dftefeCFEConstraintsLocalDealii_h
Definition: CFEConstraintsLocalDealii.h:46
SizeTypeVector d_rowConstraintsSizes
Definition: CFEConstraintsLocalDealii.h:169
bool d_isClosed
Definition: CFEConstraintsLocalDealii.h:157
void close() override
Definition: CFEConstraintsLocalDealii.t.cpp:96
dealii::AffineConstraints< ValueTypeBasisCoeff > d_dealiiAffineConstraintMatrix
Definition: CFEConstraintsLocalDealii.h:155
void copyConstraintsDataFromDealiiToDealii(const CFEConstraintsLocalDealii< ValueTypeBasisCoeff, memorySpace, dim > &constraintsDataIn)
Definition: CFEConstraintsLocalDealii.t.cpp:190
void addEntries(const global_size_type constrainedDofIndex, const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > &colWeightPairs)
Definition: CFEConstraintsLocalDealii.t.cpp:465
bool isConstrained(global_size_type basisId) const override
Definition: CFEConstraintsLocalDealii.t.cpp:138
GlobalSizeTypeVector d_columnConstraintsIdsGlobal
Definition: CFEConstraintsLocalDealii.h:163
std::vector< global_size_type > d_ghostIndices
Definition: CFEConstraintsLocalDealii.h:173
void setConstrainedNodesToZero(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: CFEConstraintsLocalDealii.t.cpp:532
void distributeParentToChild(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: CFEConstraintsLocalDealii.t.cpp:489
utils::MemoryStorage< double, memorySpace > d_columnConstraintsValues
Definition: CFEConstraintsLocalDealii.h:165
bool isClosed() const override
Definition: CFEConstraintsLocalDealii.t.cpp:127
void setInhomogeneity(global_size_type basisId, ValueTypeBasisCoeff constraintValue) override
Definition: CFEConstraintsLocalDealii.t.cpp:109
bool isInhomogeneouslyConstrained(const global_size_type index) const override
Definition: CFEConstraintsLocalDealii.t.cpp:168
GlobalSizeTypeVector d_rowConstraintsIdsGlobal
Definition: CFEConstraintsLocalDealii.h:159
SizeTypeVector d_columnConstraintsIdsLocal
Definition: CFEConstraintsLocalDealii.h:161
SizeTypeVector d_constraintRowSizesAccumulated
Definition: CFEConstraintsLocalDealii.h:162
const dealii::AffineConstraints< ValueTypeBasisCoeff > & getAffineConstraints() const
Definition: CFEConstraintsLocalDealii.t.cpp:148
bool isGhostEntry(const global_size_type globalId) const
Definition: CFEConstraintsLocalDealii.t.cpp:565
bool inLocallyOwnedRanges(const global_size_type globalId) const
Definition: CFEConstraintsLocalDealii.t.cpp:581
const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > * getConstraintEntries(const global_size_type lineDof) const override
Definition: CFEConstraintsLocalDealii.t.cpp:158
SizeTypeVector d_rowConstraintsIdsLocal
Definition: CFEConstraintsLocalDealii.h:160
void distributeChildToParent(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: CFEConstraintsLocalDealii.t.cpp:511
bool d_isCleared
Definition: CFEConstraintsLocalDealii.h:156
void addLine(const global_size_type lineDof)
Definition: CFEConstraintsLocalDealii.t.cpp:478
void copyFrom(const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > &constraintsLocalIn) override
Definition: CFEConstraintsLocalDealii.t.cpp:60
size_type globalToLocal(const global_size_type globalId) const
Definition: CFEConstraintsLocalDealii.t.cpp:600
std::vector< std::pair< global_size_type, global_size_type > > d_locallyOwnedRanges
Definition: CFEConstraintsLocalDealii.h:172
void setConstrainedNodes(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize, ValueTypeBasisCoeff alpha) const override
Definition: CFEConstraintsLocalDealii.t.cpp:548
utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_constraintsInhomogenities
Definition: CFEConstraintsLocalDealii.h:167
ValueTypeBasisCoeff getInhomogeneity(const global_size_type lineDof) const override
Definition: CFEConstraintsLocalDealii.t.cpp:179
void copyConstraintsDataFromDealiiToDftefe()
Definition: CFEConstraintsLocalDealii.t.cpp:288
std::unordered_map< global_size_type, size_type > d_globalToLocalMap
Definition: CFEConstraintsLocalDealii.h:174
void clear() override
Definition: CFEConstraintsLocalDealii.t.cpp:85
Definition: ConstraintsLocal.h:43
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