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(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 void
84 ValueTypeBasisCoeff constraintValue) override;
85
86 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>> *
87 getConstraintEntries(const global_size_type lineDof) const override;
88
89 bool
90 isInhomogeneouslyConstrained(const global_size_type index) const override;
91
92 ValueTypeBasisCoeff
93 getInhomogeneity(const global_size_type lineDof) const override;
94
95 void
98 & vectorData,
99 size_type blockSize) const override;
100 void
103 & vectorData,
104 size_type blockSize) const override;
105
106 void
109 & vectorData,
110 size_type blockSize) const override;
111
112 void
114 memorySpace> &vectorData,
115 size_type blockSize,
116 ValueTypeBasisCoeff alpha) const override;
117
118 //
119 // dealii function
120 //
121 const dealii::AffineConstraints<ValueTypeBasisCoeff> &
122 getAffineConstraints() const;
123
124 //
125 // private functions
126 //
127 private:
128 void
130 const global_size_type constrainedDofIndex,
131 const std::vector<std::pair<global_size_type, ValueTypeBasisCoeff>>
132 &colWeightPairs);
133
134 void
137 &constraintsDataIn);
138
139 void
141
142 void
143 addLine(const global_size_type lineDof);
144
145 bool
146 isGhostEntry(const global_size_type globalId) const;
147
148 bool
149 inLocallyOwnedRanges(const global_size_type globalId) const;
150
152 globalToLocal(const global_size_type globalId) const;
153
154
155 dealii::AffineConstraints<ValueTypeBasisCoeff>
159
165
169
171
172 std::vector<std::pair<global_size_type, global_size_type>>
174 std::vector<global_size_type> d_ghostIndices;
175 std::unordered_map<global_size_type, size_type> d_globalToLocalMap;
176 };
177
178 } // namespace basis
179} // namespace dftefe
181#endif // dftefeCFEConstraintsLocalDealii_h
Definition: CFEConstraintsLocalDealii.h:46
SizeTypeVector d_rowConstraintsSizes
Definition: CFEConstraintsLocalDealii.h:170
bool d_isClosed
Definition: CFEConstraintsLocalDealii.h:158
void close() override
Definition: CFEConstraintsLocalDealii.t.cpp:98
dealii::AffineConstraints< ValueTypeBasisCoeff > d_dealiiAffineConstraintMatrix
Definition: CFEConstraintsLocalDealii.h:156
void copyConstraintsDataFromDealiiToDealii(const CFEConstraintsLocalDealii< ValueTypeBasisCoeff, memorySpace, dim > &constraintsDataIn)
Definition: CFEConstraintsLocalDealii.t.cpp:192
void addEntries(const global_size_type constrainedDofIndex, const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > &colWeightPairs)
Definition: CFEConstraintsLocalDealii.t.cpp:467
bool isConstrained(global_size_type basisId) const override
Definition: CFEConstraintsLocalDealii.t.cpp:140
GlobalSizeTypeVector d_columnConstraintsIdsGlobal
Definition: CFEConstraintsLocalDealii.h:164
std::vector< global_size_type > d_ghostIndices
Definition: CFEConstraintsLocalDealii.h:174
void setConstrainedNodesToZero(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: CFEConstraintsLocalDealii.t.cpp:534
void distributeParentToChild(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: CFEConstraintsLocalDealii.t.cpp:491
utils::MemoryStorage< double, memorySpace > d_columnConstraintsValues
Definition: CFEConstraintsLocalDealii.h:166
bool isClosed() const override
Definition: CFEConstraintsLocalDealii.t.cpp:129
void setInhomogeneity(global_size_type basisId, ValueTypeBasisCoeff constraintValue) override
Definition: CFEConstraintsLocalDealii.t.cpp:111
bool isInhomogeneouslyConstrained(const global_size_type index) const override
Definition: CFEConstraintsLocalDealii.t.cpp:170
GlobalSizeTypeVector d_rowConstraintsIdsGlobal
Definition: CFEConstraintsLocalDealii.h:160
SizeTypeVector d_columnConstraintsIdsLocal
Definition: CFEConstraintsLocalDealii.h:162
SizeTypeVector d_constraintRowSizesAccumulated
Definition: CFEConstraintsLocalDealii.h:163
const dealii::AffineConstraints< ValueTypeBasisCoeff > & getAffineConstraints() const
Definition: CFEConstraintsLocalDealii.t.cpp:150
bool isGhostEntry(const global_size_type globalId) const
Definition: CFEConstraintsLocalDealii.t.cpp:567
bool inLocallyOwnedRanges(const global_size_type globalId) const
Definition: CFEConstraintsLocalDealii.t.cpp:583
const std::vector< std::pair< global_size_type, ValueTypeBasisCoeff > > * getConstraintEntries(const global_size_type lineDof) const override
Definition: CFEConstraintsLocalDealii.t.cpp:160
SizeTypeVector d_rowConstraintsIdsLocal
Definition: CFEConstraintsLocalDealii.h:161
void distributeChildToParent(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize) const override
Definition: CFEConstraintsLocalDealii.t.cpp:513
bool d_isCleared
Definition: CFEConstraintsLocalDealii.h:157
void addLine(const global_size_type lineDof)
Definition: CFEConstraintsLocalDealii.t.cpp:480
void copyFrom(const ConstraintsLocal< ValueTypeBasisCoeff, memorySpace > &constraintsLocalIn) override
Definition: CFEConstraintsLocalDealii.t.cpp:62
size_type globalToLocal(const global_size_type globalId) const
Definition: CFEConstraintsLocalDealii.t.cpp:602
std::vector< std::pair< global_size_type, global_size_type > > d_locallyOwnedRanges
Definition: CFEConstraintsLocalDealii.h:173
void setConstrainedNodes(linearAlgebra::MultiVector< ValueTypeBasisCoeff, memorySpace > &vectorData, size_type blockSize, ValueTypeBasisCoeff alpha) const override
Definition: CFEConstraintsLocalDealii.t.cpp:550
utils::MemoryStorage< ValueTypeBasisCoeff, memorySpace > d_constraintsInhomogenities
Definition: CFEConstraintsLocalDealii.h:168
ValueTypeBasisCoeff getInhomogeneity(const global_size_type lineDof) const override
Definition: CFEConstraintsLocalDealii.t.cpp:181
void copyConstraintsDataFromDealiiToDftefe()
Definition: CFEConstraintsLocalDealii.t.cpp:290
std::unordered_map< global_size_type, size_type > d_globalToLocalMap
Definition: CFEConstraintsLocalDealii.h:175
void clear() override
Definition: CFEConstraintsLocalDealii.t.cpp:87
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