MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
pderefmat_op.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_PDEREFMAT_OP
13#define MFEM_PDEREFMAT_OP
14
15#include "../config/config.hpp"
16
17#ifdef MFEM_USE_MPI
18
19#include "pfespace.hpp"
20
21#include "kernel_dispatch.hpp"
22
23#include <vector>
24
25namespace mfem
26{
27
28/// \cond DO_NOT_DOCUMENT
29struct ParDerefineMatrixOp : public Operator
30{
31 ParFiniteElementSpace *fespace;
32 /// offsets into block_storage for diagonal
33 Array<int> block_offsets;
34 /// offsets into row_idcs for diagonal
35 Array<int> block_row_idcs_offsets;
36 /// offsets into col_idcs for diagonal
37 Array<int> block_col_idcs_offsets;
38
39 /// offsets into block_storage for off-diagonal
40 Array<int> off_diag_block_offsets;
41 /// offsets into row_idcs for off-diagonal
42 Array<int> block_off_diag_row_idcs_offsets;
43 Array<int> block_off_diag_col_offsets;
44 Array<int> block_off_diag_widths;
45 /// mapping for row dofs, INT_MAX indicates the block row should be ignored.
46 /// negative means the row data should be negated.
47 /// only for diagonal blocks
48 Array<int> row_idcs;
49 /// mapping for col dofs, negative means the col data should be negated.
50 /// only for diagonal blocks
51 Array<int> col_idcs;
52
53 Array<int> pack_col_idcs;
54
55 /// mapping for row dofs, INT_MAX indicates the block row should be ignored.
56 /// negative means the row data should be negated.
57 /// only for off-diagonal blocks
58 Array<int> row_off_diag_idcs;
59 /// dense block matrices which can be reused to construct the full matrix
60 /// operation. These are stored contiguously and blocks have no restrictions
61 /// on shape (can be rectangle and differ from block to block).
62 /// This is only for the diagonal block.
63 Vector block_storage;
64 /// maximum height of any block in block_storage for GPU
65 /// parallelization, or 1 for CPU runs.
66 int max_rows;
67
68 /// quasi Ordering::byNODES, broken into sections by ranks we need to send
69 /// the data to
70 mutable Vector xghost_send;
71 /// quasi Ordering::byNODES, broken into sections by ranks we received
72 /// the data from
73 mutable Vector xghost_recv;
74 /// maps off-diagonal k to segment
75 Array<int> recv_segment_idcs;
76 /// cumulative count of dofs which will be received from other ranks
77 Array<int> recv_segments;
78 /// Source rank of each recv segment
79 Array<int> recv_ranks;
80 /// What send segment each entry in send_permutations corresponds to
81 Array<int> send_segment_idcs;
82 /// cumulative count of dofs which will be sent to other ranks
83 Array<int> send_segments;
84 /// Destination rank of each send segment
85 Array<int> send_ranks;
86 /// how to permute/sign change values from our local x to send to other ranks
87 Array<int> send_permutations;
88 /// internal buffer for MPI requests
89 mutable std::vector<MPI_Request> requests;
90
91 using MultKernelType = void (*)(const ParDerefineMatrixOp &, const Vector &,
92 Vector &);
93 /// template args: ordering, atomic
94 MFEM_REGISTER_KERNELS(MultKernel, MultKernelType, (Ordering::Type, bool));
95
96 struct Kernels
97 {
98 Kernels();
99 };
100
101 void Mult(const Vector &x, Vector &y) const;
102
103 ParDerefineMatrixOp(ParFiniteElementSpace &fespace_, int old_ndofs,
104 const Table *old_elem_dof, const Table *old_elem_fos);
105};
106/// \endcond DO_NOT_DOCUMENT
107} // namespace mfem
108
109#endif
110
111#endif
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition table.cpp:505
SchrodingerBaseKernels< ParMesh, ParFiniteElementSpace, ParComplexGridFunction, ParGridFunction, ParBilinearForm, ParMixedBilinearForm, ParLinearForm > Kernels