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(const dealii::IndexSet &locally_owned_dofs,
53 const dealii::IndexSet &locally_relevant_dofs);
54
56 dealii::AffineConstraints<ValueTypeBasisCoeff>
57 &dealiiAffineConstraintMatrix,
58 std::vector<std::pair<global_size_type, global_size_type>>
59 & locallyOwnedRanges,
60 std::vector<global_size_type> &ghostIndices,
61 std::unordered_map<global_size_type, size_type>
62 &globalToLocalMapLocalDofs);
63
65
66 //
67 // Copy function - note one has to call close after calling copyFrom
68 //
69 void
71 &constraintsLocalIn) override;
72
73 void
74 clear() override;
75 bool
76 isConstrained(global_size_type basisId) const override;
77 void
78 close() override;
79 bool
80 isClosed() const override;
81
82 //
83 // TODO : Modify this function to take into basisId as enrichment id
84 // i.e. check if basisId >= nClassicalDofs
85 //
86 void
88 ValueTypeBasisCoeff constraintValue) override;
89
90 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>> *
91 getConstraintEntries(const global_size_type lineDof) const override;
92
93 bool
94 isInhomogeneouslyConstrained(const global_size_type index) const override;
95
96 ValueTypeBasisCoeff
97 getInhomogeneity(const global_size_type lineDof) const override;
98
99 void
102 & vectorData,
103 size_type blockSize) const override;
104 void
107 & vectorData,
108 size_type blockSize) const override;
109
110 void
113 & vectorData,
114 size_type blockSize) const override;
115
116 void
118 memorySpace> &vectorData,
119 size_type blockSize,
120 ValueTypeBasisCoeff alpha) const override;
121
122 //
123 // dealii function
124 //
125 const dealii::AffineConstraints<ValueTypeBasisCoeff> &
126 getAffineConstraints() const;
127
128 //
129 // private functions
130 //
131 private:
132 void
134 const global_size_type constrainedDofIndex,
135 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>>
136 &colWeightPairs);
137
138 void
141 &constraintsDataIn);
142
143 void
145
146 void
147 addLine(const global_size_type lineDof);
148
149 bool
150 isGhostEntry(const global_size_type globalId) const;
151
152 bool
153 inLocallyOwnedRanges(const global_size_type globalId) const;
154
156 globalToLocal(const global_size_type globalId) const;
157
158
159 dealii::AffineConstraints<ValueTypeBasisCoeff>
163
169
173
175
176 std::vector<std::pair<global_size_type, global_size_type>>
178 std::vector<global_size_type> d_ghostIndices;
179 std::unordered_map<global_size_type, size_type> d_globalToLocalMap;
180 };
181
182 } // namespace basis
183} // namespace dftefe
185#endif // dftefeEFEConstraintsLocalDealii_h
Definition: ConstraintsLocal.h:43
Definition: EFEConstraintsLocalDealii.h:46
ValueTypeBasisCoeff getInhomogeneity(const global_size_type lineDof) const override
Definition: EFEConstraintsLocalDealii.t.cpp:181
void setInhomogeneity(global_size_type basisId, ValueTypeBasisCoeff constraintValue) override
Definition: EFEConstraintsLocalDealii.t.cpp:111
SizeTypeVector d_rowConstraintsIdsLocal
Definition: EFEConstraintsLocalDealii.h:165
void setConstrainedNodesToZero(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: EFEConstraintsLocalDealii.t.cpp:534
void copyFrom(const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > &constraintsLocalIn) override
Definition: EFEConstraintsLocalDealii.t.cpp:62
bool isInhomogeneouslyConstrained(const global_size_type index) const override
Definition: EFEConstraintsLocalDealii.t.cpp:170
void clear() override
Definition: EFEConstraintsLocalDealii.t.cpp:87
GlobalSizeTypeVector d_columnConstraintsIdsGlobal
Definition: EFEConstraintsLocalDealii.h:168
SizeTypeVector d_rowConstraintsSizes
Definition: EFEConstraintsLocalDealii.h:174
void distributeChildToParent(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: EFEConstraintsLocalDealii.t.cpp:513
bool d_isCleared
Definition: EFEConstraintsLocalDealii.h:161
bool d_isClosed
Definition: EFEConstraintsLocalDealii.h:162
std::unordered_map< global_size_type, size_type > d_globalToLocalMap
Definition: EFEConstraintsLocalDealii.h:179
utils::MemoryStorage< double, memorySpace > d_columnConstraintsValues
Definition: EFEConstraintsLocalDealii.h:170
bool inLocallyOwnedRanges(const global_size_type globalId) const
Definition: EFEConstraintsLocalDealii.t.cpp:583
void distributeParentToChild(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: EFEConstraintsLocalDealii.t.cpp:491
void copyConstraintsDataFromDealiiToDftefe()
Definition: EFEConstraintsLocalDealii.t.cpp:290
void addEntries(const global_size_type constrainedDofIndex, const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > &colWeightPairs)
Definition: EFEConstraintsLocalDealii.t.cpp:467
GlobalSizeTypeVector d_rowConstraintsIdsGlobal
Definition: EFEConstraintsLocalDealii.h:164
SizeTypeVector d_constraintRowSizesAccumulated
Definition: EFEConstraintsLocalDealii.h:167
std::vector< global_size_type > d_ghostIndices
Definition: EFEConstraintsLocalDealii.h:178
dealii::AffineConstraints< ValueTypeBasisCoeff > d_dealiiAffineConstraintMatrix
Definition: EFEConstraintsLocalDealii.h:160
bool isClosed() const override
Definition: EFEConstraintsLocalDealii.t.cpp:129
size_type globalToLocal(const global_size_type globalId) const
Definition: EFEConstraintsLocalDealii.t.cpp:602
void setConstrainedNodes(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize, ValueTypeBasisCoeff alpha) const override
Definition: EFEConstraintsLocalDealii.t.cpp:550
utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_constraintsInhomogenities
Definition: EFEConstraintsLocalDealii.h:172
const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > * getConstraintEntries(const global_size_type lineDof) const override
Definition: EFEConstraintsLocalDealii.t.cpp:160
void copyConstraintsDataFromDealiiToDealii(const EFEConstraintsLocalDealii< ValueTypeBasisCoeff, memorySpace, dim > &constraintsDataIn)
Definition: EFEConstraintsLocalDealii.t.cpp:192
bool isGhostEntry(const global_size_type globalId) const
Definition: EFEConstraintsLocalDealii.t.cpp:567
bool isConstrained(global_size_type basisId) const override
Definition: EFEConstraintsLocalDealii.t.cpp:140
std::vector< std::pair< global_size_type, global_size_type > > d_locallyOwnedRanges
Definition: EFEConstraintsLocalDealii.h:177
void close() override
Definition: EFEConstraintsLocalDealii.t.cpp:98
const dealii::AffineConstraints< ValueTypeBasisCoeff > & getAffineConstraints() const
Definition: EFEConstraintsLocalDealii.t.cpp:150
void addLine(const global_size_type lineDof)
Definition: EFEConstraintsLocalDealii.t.cpp:480
SizeTypeVector d_columnConstraintsIdsLocal
Definition: EFEConstraintsLocalDealii.h:166
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