MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
block_fespace_operator.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, 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 MFEM_BLOCK_FESPACE_OPERATOR
13#define MFEM_BLOCK_FESPACE_OPERATOR
14
15#include "mfem.hpp"
16
17namespace mfem
18{
19
20/// @brief Operator for block systems arising from different arbitrarily many finite element spaces.
21///
22/// This operator can be used with FormLinearSystem to impose boundary
23/// conditions for block systems arise from mixing many types of
24/// finite element spaces. Each block is intended to operate on
25/// L-Vectors. For example, a block may be a BilinearForm.
27{
28 using FESVector = std::vector<const FiniteElementSpace*>;
29
30 /// Offsets for the square "A" operator.
31 Array<int> offsets;
32 /// Column offsets for the prolongation operator.
33 Array<int> prolongColOffsets;
34 /// Row offsets for the prolongation operator.
35 Array<int> restrictRowOffsets;
36 /// The "A" part of "RAP".
38 /// Maps local dofs of each block to true dofs.
39 BlockOperator prolongation;
40 /// Maps true dofs of each block to local dofs.
41 BlockOperator restriction;
42 /// Computes height for parent operator.
43 static int GetHeight(const FESVector &fespaces);
44 /// Computes offsets for A BlockOperator.
45 static Array<int> GetBlockOffsets(const FESVector &fespaces);
46 /// Computes col_offsets for prolongation operator.
47 static Array<int> GetProColBlockOffsets(const FESVector &fespaces);
48 /// Computes row_offsets for restriction operator.
49 static Array<int> GetResRowBlockOffsets(const FESVector &fespaces);
50
51public:
52 /// @brief Constructor for BlockFESpaceOperator.
53 /// @param[in] fespaces Finite element spaces for diagonal blocks. Spaces are not owned.
54 BlockFESpaceOperator(const FESVector &fespaces);
55 const Operator* GetProlongation () const override;
56 const Operator* GetRestriction () const override;
57 void Mult(const Vector &x, Vector &y) const override {A.Mult(x,y);};
58 /// @brief Wraps BlockOperator::SetBlock. Eventually would like this class to inherit
59 /// from BlockOperator instead, but can't easily due to ownership of offset data
60 /// in BlockOperator being by reference.
61 void SetBlock(int iRow, int iCol, Operator *op, real_t c = 1.0) { A.SetBlock(iRow, iCol, op, c); };
62};
63
64} // namespace mfem
65
66#endif // MFEM_BLOCK_FESPACE_OPERATOR
Operator for block systems arising from different arbitrarily many finite element spaces.
const Operator * GetProlongation() const override
Prolongation operator from linear algebra (linear system) vectors, to input vectors for the operator....
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
BlockFESpaceOperator(const FESVector &fespaces)
Constructor for BlockFESpaceOperator.
const Operator * GetRestriction() const override
Restriction operator from input vectors for the operator to linear algebra (linear system) vectors....
void SetBlock(int iRow, int iCol, Operator *op, real_t c=1.0)
Wraps BlockOperator::SetBlock. Eventually would like this class to inherit from BlockOperator instead...
A class to handle Block systems in a matrix-free implementation.
void Mult(const Vector &x, Vector &y) const override
Operator application.
void SetBlock(int iRow, int iCol, Operator *op, real_t c=1.0)
Add a block op in the block-entry (iblock, jblock).
Abstract operator.
Definition operator.hpp:25
Vector data type.
Definition vector.hpp:82
float real_t
Definition config.hpp:46