18 std::vector<const FiniteElementSpace*> &fespaces):
20 offsets(GetBlockOffsets(fespaces)),
21 prolongColOffsets(GetProColBlockOffsets(fespaces)),
22 restrictRowOffsets(GetResRowBlockOffsets(fespaces)),
24 prolongation(offsets,prolongColOffsets),
25 restriction(restrictRowOffsets, offsets)
27 for (
size_t i = 0; i <fespaces.size(); i++)
32 const_cast<Operator *
>(fespaces[i]->GetProlongationMatrix()));
34 const_cast<Operator *
>(fespaces[i]->GetRestrictionOperator()));
38int BlockFESpaceOperator::GetHeight(
const std::vector<const FiniteElementSpace*>
42 for (
size_t i = 0; i < fespaces.size(); i++)
44 height += fespaces[i]->GetVSize();
49Array<int> BlockFESpaceOperator::GetBlockOffsets(
const
50 std::vector<const FiniteElementSpace*> &fespaces)
52 Array<int> offsets(fespaces.size()+1);
54 for (
size_t i = 1; i <=fespaces.size(); i++)
56 offsets[i] = fespaces[i-1]->GetVSize();
63Array<int> BlockFESpaceOperator::GetProColBlockOffsets(
const
64 std::vector<const FiniteElementSpace*> &fespaces)
66 Array<int> offsets(fespaces.size()+1);
68 for (
size_t i = 1; i <=fespaces.size(); i++)
70 const auto *prolong = fespaces[i-1]->GetProlongationMatrix();
73 offsets[i] = prolong->Width();
77 offsets[i] = fespaces[i-1]->GetVSize();
79 offsets[i] = fespaces[i-1]->GetTrueVSize();
86Array<int> BlockFESpaceOperator::GetResRowBlockOffsets(
const
87 std::vector<const FiniteElementSpace*> &fespaces)
89 Array<int> offsets(fespaces.size()+1);
90 std::cout <<
"fespaces.size() = " << fespaces.size() << std::endl;
92 for (
size_t i = 1; i <=fespaces.size(); i++)
94 const auto *restriction = fespaces[i-1]->GetRestrictionOperator();
97 offsets[i] = restriction->
Height();
101 offsets[i] = fespaces[i-1]->GetVSize();
103 offsets[i] = fespaces[i-1]->GetTrueVSize();
112 return &prolongation;
void PartialSum()
Fill the entries of the array with the cumulative sum of the entries.
void Print(std::ostream &out=mfem::out, int width=4) const
Prints array to stream with width elements per row.
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....
const Operator * GetRestriction() const override
Restriction operator from input vectors for the operator to linear algebra (linear system) vectors....
void SetDiagonalBlock(int iblock, Operator *op, real_t c=1.0)
Add block op in the block-entry (iblock, iblock).
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int height
Dimension of the output / number of rows in the matrix.