MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
block_fespace_operator.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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{
28private:
29 /// Offsets for the square "A" operator.
30 Array<int> offsets;
31 /// Column offsets for the prolongation operator.
32 Array<int> prolongColOffsets;
33 /// Row offsets for the prolongation operator.
34 Array<int> restrictRowOffsets;
35 /// The "A" part of "RAP".
37 /// Maps local dofs of each block to true dofs.
38 BlockOperator prolongation;
39 /// Maps true dofs of each block to local dofs.
40 BlockOperator restriction;
41 /// Computes height for parent operator.
42 static int GetHeight(const std::vector<const FiniteElementSpace*>
43 &fespaces);
44 /// Computes offsets for A BlockOperator.
45 static Array<int> GetBlockOffsets(const std::vector<const FiniteElementSpace*>
46 &fespaces);
47 /// Computes col_offsets for prolongation operator.
48 static Array<int> GetProColBlockOffsets(const
49 std::vector<const FiniteElementSpace*> &fespaces);
50 /// Computes row_offsets for restriction operator.
51 static Array<int> GetResRowBlockOffsets(const
52 std::vector<const FiniteElementSpace*> &fespaces);
53public:
54 /// @brief Constructor for BlockFESpaceOperator.
55 /// @param[in] fespaces Finite element spaces for diagonal blocks. Spaces are not owned.
56 BlockFESpaceOperator(const std::vector<const FiniteElementSpace*> &fespaces);
57 const Operator* GetProlongation () const override;
58 const Operator* GetRestriction () const override;
59 void Mult(const Vector &x, Vector &y) const override {A.Mult(x,y);};
60 /// @brief Wraps BlockOperator::SetBlock. Eventually would like this class to inherit
61 /// from BlockOperator instead, but can't easily due to ownership of offset data
62 /// in BlockOperator being by reference.
63 void SetBlock( int iRow,
64 int iCol,
65 Operator * op,
66 real_t c = 1.0) {A.SetBlock(iRow, iCol, op, c);};
67};
68
69} // namespace mfem
70
71#endif
Operator for block systems arising from different arbitrarily many finite element spaces.
BlockFESpaceOperator(const std::vector< const FiniteElementSpace * > &fespaces)
Constructor for BlockFESpaceOperator.
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).
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 SetBlock(int iRow, int iCol, Operator *op, real_t c=1.0)
Add a block op in the block-entry (iblock, jblock).
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
Abstract operator.
Definition operator.hpp:25
Vector data type.
Definition vector.hpp:80
float real_t
Definition config.hpp:43