Line data Source code
1 : // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 : // SPDX-License-Identifier: Apache-2.0
3 :
4 : #ifndef PALACE_LINALG_HCURL_HPP
5 : #define PALACE_LINALG_HCURL_HPP
6 :
7 : #include <memory>
8 : #include <vector>
9 : #include "linalg/ksp.hpp"
10 : #include "linalg/operator.hpp"
11 : #include "linalg/vector.hpp"
12 :
13 : namespace mfem
14 : {
15 :
16 : template <typename T>
17 : class Array;
18 :
19 : } // namespace mfem
20 :
21 : namespace palace
22 : {
23 :
24 : class FiniteElementSpaceHierarchy;
25 : class MaterialOperator;
26 :
27 : //
28 : // This solver implements a solver for the operator K + M in a Nedelec space.
29 : //
30 : template <typename VecType>
31 : class WeightedHCurlNormSolver
32 : {
33 : using OperType = typename std::conditional<std::is_same<VecType, ComplexVector>::value,
34 : ComplexOperator, Operator>::type;
35 :
36 : private:
37 : // H(curl) norm operator A = K + M and its projection Gáµ€ A G.
38 : std::unique_ptr<OperType> A;
39 :
40 : // Linear solver for the linear system A y = x;
41 : std::unique_ptr<BaseKspSolver<OperType>> ksp;
42 :
43 : public:
44 : WeightedHCurlNormSolver(const MaterialOperator &mat_op,
45 : FiniteElementSpaceHierarchy &nd_fespaces,
46 : FiniteElementSpaceHierarchy &h1_fespaces,
47 : const std::vector<mfem::Array<int>> &nd_dbc_tdof_lists,
48 : const std::vector<mfem::Array<int>> &h1_dbc_tdof_lists,
49 : double tol, int max_it, int print);
50 :
51 0 : const OperType &GetOperator() { return *A; }
52 :
53 0 : void Mult(const VecType &x, VecType &y) const { ksp->Mult(x, y); }
54 : };
55 :
56 : } // namespace palace
57 :
58 : #endif // PALACE_LINALG_HCURL_HPP
|