Peano
Loading...
Searching...
No Matches
IntergridOperatorsH.py
Go to the documentation of this file.
1
import
numpy
as
np
2
3
class
IntergridOperatorsH
:
4
"""!
5
Class to produce restriction/prolongation matrices for multigrid tasks.
6
7
"""
8
9
def
__init__
(self, dim=2, refinement_order=1):
10
self.
dim
= dim
11
self.
refinement_order
= refinement_order
12
13
assert
dim < 3
14
assert
refinement_order == 1
15
16
def
prolongation
(self):
17
prolong1d = np.asarray([[1, 0],
18
[2/3, 1/3],
19
[1/3, 2/3],
20
[0, 1]])
21
22
if
self.
dim
== 1:
23
result = prolong1d
24
elif
self.
dim
== 2:
25
result = np.kron(prolong1d, prolong1d)
26
27
return
result
28
29
def
restriction
(self):
30
return
self.
prolongation
().T
31
32
33
if
__name__ ==
"__main__"
:
34
operators =
IntergridOperatorsH
(dim=2, refinement_order=1)
mghype.api.matrixgenerators.blockmatrix.IntergridOperatorsH.IntergridOperatorsH
Class to produce restriction/prolongation matrices for multigrid tasks.
Definition
IntergridOperatorsH.py:3
mghype.api.matrixgenerators.blockmatrix.IntergridOperatorsH.IntergridOperatorsH.dim
dim
Definition
IntergridOperatorsH.py:10
mghype.api.matrixgenerators.blockmatrix.IntergridOperatorsH.IntergridOperatorsH.__init__
__init__(self, dim=2, refinement_order=1)
Definition
IntergridOperatorsH.py:9
mghype.api.matrixgenerators.blockmatrix.IntergridOperatorsH.IntergridOperatorsH.restriction
restriction(self)
Definition
IntergridOperatorsH.py:29
mghype.api.matrixgenerators.blockmatrix.IntergridOperatorsH.IntergridOperatorsH.prolongation
prolongation(self)
Definition
IntergridOperatorsH.py:16
mghype.api.matrixgenerators.blockmatrix.IntergridOperatorsH.IntergridOperatorsH.refinement_order
refinement_order
Definition
IntergridOperatorsH.py:11
src
mghype
api
matrixgenerators
blockmatrix
IntergridOperatorsH.py
Generated on Sat Jan 10 2026 06:34:00 for Peano by
1.10.0