DFT-EFE
 
Loading...
Searching...
No Matches
PoissonSolverDealiiMatrixFreeFE.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 dftefePoissonSolverDealiiMatrixFreeFE_h
27#define dftefePoissonSolverDealiiMatrixFreeFE_h
28
29#include <utils/TypeConfig.h>
39#include <vector>
40#include <memory>
41#include <utils/Profiler.h>
42
43namespace dftefe
44{
45 namespace electrostatics
46 {
68 template <typename ValueTypeOperator,
69 typename ValueTypeOperand,
70 utils::MemorySpace memorySpace,
71 size_type dim>
73 {
74 public:
82 template <typename T>
85
86 using ValueType =
88 ValueTypeOperand>;
89
90 public:
95 std::shared_ptr<const basis::FEBasisManager<ValueTypeOperand,
96 ValueTypeOperator,
97 memorySpace,
98 dim>> feBasisManagerField,
99 std::shared_ptr<
101 feBasisDataStorageStiffnessMatrix,
102 const std::map<
103 std::string,
104 std::shared_ptr<
106 &feBasisDataStorageRhs,
107 const std::map<
108 std::string,
110 & inpRhs,
112
117 std::shared_ptr<const basis::FEBasisManager<ValueTypeOperand,
118 ValueTypeOperator,
119 memorySpace,
120 dim>> feBasisManagerField,
121 std::shared_ptr<
123 feBasisDataStorageStiffnessMatrix,
124 std::shared_ptr<
126 feBasisDataStorageRhs,
128 & inpRhs,
130
131 void
132 reinit(
133 std::shared_ptr<const basis::FEBasisManager<ValueTypeOperand,
134 ValueTypeOperator,
135 memorySpace,
136 dim>> feBasisManagerField,
137 const std::map<
138 std::string,
140 &inpRhs);
141
142 void
144 std::shared_ptr<const basis::FEBasisManager<ValueTypeOperand,
145 ValueTypeOperator,
146 memorySpace,
147 dim>> feBasisManagerField,
149 &inpRhs);
150
152
153 void
154 solve(const double absTolerance, const unsigned int maxNumberIterations);
155
156 void
158
159 const utils::mpi::MPIComm &
160 getMPIComm() const;
161
162 private:
164 getRhs() const;
165
167 getInitialGuess() const;
168
169 void
171
172 void
174 const std::map<
175 std::string,
178 ValueTypeOperand>,
179 memorySpace> &> &inpRhs);
180
181 void
183
184 void
186 const distributedCPUVec<double> &src) const;
187
188 void
190
191 void
192 AX(const dealii::MatrixFree<dim, double> & matrixFreeData,
194 const distributedCPUVec<double> & src,
195 const std::pair<unsigned int, unsigned int> &cell_range) const;
196
197 void
198 CGsolve(const double absTolerance,
199 const unsigned int maxNumberIterations,
200 bool distributeFlag);
201
203 std::shared_ptr<
204 const basis::
205 FEBasisManager<ValueTypeOperand, ValueTypeOperator, memorySpace, dim>>
209
210
211 std::shared_ptr<
212 basis::
213 FEBasisManager<ValueTypeOperand, ValueTypeOperator, memorySpace, dim>>
215
217 std::shared_ptr<dealii::MatrixFree<dim, ValueTypeOperator>>
219 std::shared_ptr<const dealii::DoFHandler<dim>> d_dealiiDofHandler;
220 const dealii::AffineConstraints<ValueTypeOperand>
222 const dealii::AffineConstraints<ValueTypeOperand> *d_constraintsInfo;
224 std::map<std::string, unsigned int> d_num1DQuadPointsRhs;
226 unsigned int d_dofHandlerIndex;
227
228 std::map<
229 std::string,
230 std::shared_ptr<
233
235 std::map<dealii::CellId, unsigned int> d_cellIdToCellIndexMap;
236
237 std::vector<dealii::Quadrature<dim>> d_dealiiQuadratureRuleVec;
238 dealii::MappingQ1<dim, dim> d_mappingDealii;
239 // dealii::IndexSet d_ghostIndexSet, d_locallyOwnedIndexSet;
241
242 }; // end of class PoissonSolverDealiiMatrixFreeFE
243 } // namespace electrostatics
244} // end of namespace dftefe
246#endif // dftefePoissonSolverDealiiMatrixFreeFE_h
An abstract class to store and access data for a given basis, such as the basis function values on a ...
Definition: FEBasisDataStorage.h:54
An abstract class to encapsulate the partitioning of a finite element basis across multiple processor...
Definition: FEBasisManager.h:44
dealii::LinearAlgebra::distributed::Vector< T, dealii::MemorySpace::Host > distributedCPUVec
Definition: DealiiFEEvaluationWrapper.h:46
A derived class of linearAlgebra::LinearSolverFunction to encapsulate the Poisson partial differentia...
Definition: PoissonSolverDealiiMatrixFreeFE.h:73
const distributedCPUVec< ValueTypeOperand > & getRhs() const
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:476
void solve(const double absTolerance, const unsigned int maxNumberIterations)
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:504
linearAlgebra::PreconditionerType d_pcType
Definition: PoissonSolverDealiiMatrixFreeFE.h:207
std::map< std::string, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeOperator, memorySpace > > > d_feBasisDataStorageRhs
Definition: PoissonSolverDealiiMatrixFreeFE.h:232
void getSolution(linearAlgebra::MultiVector< ValueType, memorySpace > &solution)
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:446
void reinit(std::shared_ptr< const basis::FEBasisManager< ValueTypeOperand, ValueTypeOperator, memorySpace, dim > > feBasisManagerField, const quadrature::QuadratureValuesContainer< ValueType, memorySpace > &inpRhs)
std::vector< dealii::Quadrature< dim > > d_dealiiQuadratureRuleVec
Definition: PoissonSolverDealiiMatrixFreeFE.h:237
void vmult(distributedCPUVec< double > &Ax, distributedCPUVec< double > &x)
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:658
size_type d_feOrder
Definition: PoissonSolverDealiiMatrixFreeFE.h:225
std::shared_ptr< basis::FEBasisManager< ValueTypeOperand, ValueTypeOperator, memorySpace, dim > > d_feBasisManagerHomo
Definition: PoissonSolverDealiiMatrixFreeFE.h:214
const dealii::AffineConstraints< ValueTypeOperand > * d_dealiiAffineConstraintMatrix
Definition: PoissonSolverDealiiMatrixFreeFE.h:221
utils::ConditionalOStream pcout
Definition: PoissonSolverDealiiMatrixFreeFE.h:240
const distributedCPUVec< ValueType > & getInitialGuess() const
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:491
void computeRhs(distributedCPUVec< double > &rhs, const std::map< std::string, const quadrature::QuadratureValuesContainer< linearAlgebra::blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand >, memorySpace > & > &inpRhs)
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:680
std::shared_ptr< dealii::MatrixFree< dim, ValueTypeOperator > > d_dealiiMatrixFree
Definition: PoissonSolverDealiiMatrixFreeFE.h:218
std::map< std::string, unsigned int > d_num1DQuadPointsRhs
Definition: PoissonSolverDealiiMatrixFreeFE.h:224
void computeDiagonalA()
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:572
std::shared_ptr< const basis::FEBasisManager< ValueTypeOperand, ValueTypeOperator, memorySpace, dim > > d_feBasisManagerField
Definition: PoissonSolverDealiiMatrixFreeFE.h:206
void CGsolve(const double absTolerance, const unsigned int maxNumberIterations, bool distributeFlag)
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:863
distributedCPUVec< ValueTypeOperator > d_diagonalA
Definition: PoissonSolverDealiiMatrixFreeFE.h:216
distributedCPUVec< ValueTypeOperator > d_initial
Definition: PoissonSolverDealiiMatrixFreeFE.h:216
void reinit(std::shared_ptr< const basis::FEBasisManager< ValueTypeOperand, ValueTypeOperator, memorySpace, dim > > feBasisManagerField, const std::map< std::string, const quadrature::QuadratureValuesContainer< ValueType, memorySpace > & > &inpRhs)
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:322
unsigned int d_num1DQuadPointsStiffnessMatrix
Definition: PoissonSolverDealiiMatrixFreeFE.h:223
const dealii::AffineConstraints< ValueTypeOperand > * d_constraintsInfo
Definition: PoissonSolverDealiiMatrixFreeFE.h:222
void precondition_Jacobi(distributedCPUVec< double > &dst, const distributedCPUVec< double > &src) const
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:638
utils::Profiler d_p
Definition: PoissonSolverDealiiMatrixFreeFE.h:208
const utils::mpi::MPIComm & getMPIComm() const
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:848
distributedCPUVec< ValueTypeOperator > d_x
Definition: PoissonSolverDealiiMatrixFreeFE.h:216
void AX(const dealii::MatrixFree< dim, double > &matrixFreeData, distributedCPUVec< double > &dst, const distributedCPUVec< double > &src, const std::pair< unsigned int, unsigned int > &cell_range) const
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:522
dealii::MappingQ1< dim, dim > d_mappingDealii
Definition: PoissonSolverDealiiMatrixFreeFE.h:238
basis::FEEvaluationWrapperBase::distributedCPUVec< T > distributedCPUVec
define ValueType as the superior (bigger set) of the ValueTypeOperator and ValueTypeOperand (e....
Definition: PoissonSolverDealiiMatrixFreeFE.h:84
std::map< dealii::CellId, unsigned int > d_cellIdToCellIndexMap
Definition: PoissonSolverDealiiMatrixFreeFE.h:235
distributedCPUVec< ValueTypeOperator > d_rhs
Definition: PoissonSolverDealiiMatrixFreeFE.h:216
unsigned int d_matrixFreeQuadCompStiffnessMatrix
Definition: PoissonSolverDealiiMatrixFreeFE.h:234
PoissonSolverDealiiMatrixFreeFE(std::shared_ptr< const basis::FEBasisManager< ValueTypeOperand, ValueTypeOperator, memorySpace, dim > > feBasisManagerField, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeOperator, memorySpace > > feBasisDataStorageStiffnessMatrix, std::shared_ptr< const basis::FEBasisDataStorage< ValueTypeOperator, memorySpace > > feBasisDataStorageRhs, const quadrature::QuadratureValuesContainer< ValueType, memorySpace > &inpRhs, const linearAlgebra::PreconditionerType pcType)
This constructor creates an instance of a base LinearSolverFunction called PoissonSolverDealiiMatrixF...
std::shared_ptr< const dealii::DoFHandler< dim > > d_dealiiDofHandler
Definition: PoissonSolverDealiiMatrixFreeFE.h:219
unsigned int d_dofHandlerIndex
Definition: PoissonSolverDealiiMatrixFreeFE.h:226
linearAlgebra::blasLapack::scalar_type< ValueTypeOperator, ValueTypeOperand > ValueType
Definition: PoissonSolverDealiiMatrixFreeFE.h:88
size_type d_numComponents
Definition: PoissonSolverDealiiMatrixFreeFE.h:202
void setSolution(const distributedCPUVec< ValueType > &x)
Definition: PoissonSolverDealiiMatrixFreeFE.t.cpp:432
An class template to encapsulate a MultiVector. A MultiVector is a collection of vectors belonging t...
Definition: MultiVector.h:134
Definition: QuadratureValuesContainer.h:39
Provides an interface to print based on whether a certain condition is met or not....
Definition: ConditionalOStream.h:47
Definition: Profiler.h:44
blas::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:70
PreconditionerType
Definition: LinearAlgebraTypes.h:41
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