MFEM  v4.6.0
Finite element discretization library
change_basis.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2023, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef CHANGE_BASIS_HPP
13 #define CHANGE_BASIS_HPP
14 
15 #include "mfem.hpp"
16 
17 namespace mfem
18 {
19 
20 /// @brief Change of basis operator between L2 spaces.
21 ///
22 /// This represents the change-of-basis operator from the given L2 space to a
23 /// space using the IntegratedGLL basis.
24 class ChangeOfBasis_L2 : public Operator
25 {
26 private:
27  const int ne; ///< Number of elements in the mesh.
28  mutable DofToQuad dof2quad; ///< 1D basis transformation.
29  Array<double> B_1d; ///< 1D basis transformation matrix.
30  Array<double> Bt_1d; ///< 1D basis transformation matrix transpose.
31  bool no_op; ///< If the basis types are the same, the operation is a no-op.
32 public:
34  void Mult(const Vector &x, Vector &y) const override;
35  void MultTranspose(const Vector &x, Vector &y) const override;
36 };
37 
38 /// Change of basis operator between RT spaces.
39 ///
40 /// This represents the change-of-basis operator from the given RT space to a
41 /// space using Gauss-Lobatto as the "open" basis and IntegratedGLL as the
42 /// "closed" basis.
43 class ChangeOfBasis_RT : public Operator
44 {
45 public:
46  // Should be private, nvcc limitation...
47  enum Mode
48  {
52  };
53 private:
54  FiniteElementSpace &fes; ///< The finite element space.
55  const int dim; ///< Dimension of the mesh.
56  const int ne; ///< Number of elements.
57  const int p; ///< Polynomial degree.
58  const ElementRestriction *elem_restr; ///< Element restriction operator.
59  Array<double> Bc_1d; ///< 1D closed basis transformation matrix.
60  Array<double> Bci_1d; ///< 1D closed basis transformation matrix inverse.
61  Array<double> Bct_1d; ///< 1D closed basis transformation matrix transpose.
62  Array<double> Bo_1d; ///< 1D open basis transformation matrix.
63  Array<double> Boi_1d; ///< 1D open basis transformation matrix inverse.
64  Array<double> Bot_1d; ///< 1D open basis transformation matrix transpose.
65 
66  mutable Vector x_l, y_l; ///< L-vector layout
67  mutable Vector x_e, y_e; ///< E-vector layout
68 
69  bool no_op; ///< If the spaces are the same, the operation is a no-op.
70 
71  void Mult(const Vector &x, Vector &y, Mode mode) const;
72  const double *GetOpenMap(Mode mode) const;
73  const double *GetClosedMap(Mode mode) const;
74 public:
76  void Mult(const Vector &x, Vector &y) const override;
77  void MultTranspose(const Vector &x, Vector &y) const override;
78  void MultInverse(const Vector &x, Vector &y) const;
79  // The following should be considered private, public because of compiler
80  // limitations
81  void MultRT_2D(const Vector &x, Vector &y, Mode mode) const;
82  void MultRT_3D(const Vector &x, Vector &y, Mode mode) const;
83 };
84 
85 } // namespace mfem
86 
87 #endif
void MultInverse(const Vector &x, Vector &y) const
ChangeOfBasis_RT(FiniteElementSpace &fes)
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
void MultRT_2D(const Vector &x, Vector &y, Mode mode) const
ChangeOfBasis_L2(FiniteElementSpace &fes)
Change of basis operator between L2 spaces.
Operator that converts FiniteElementSpace L-vectors to E-vectors.
Definition: restriction.hpp:37
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:219
Structure representing the matrices/tensors needed to evaluate (in reference space) the values...
Definition: fe_base.hpp:136
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
void MultRT_3D(const Vector &x, Vector &y, Mode mode) const
Vector data type.
Definition: vector.hpp:58
Abstract operator.
Definition: operator.hpp:24