Peano
Loading...
Searching...
No Matches
IntergridOperators.py
Go to the documentation of this file.
1
import
numpy
as
np
2
from
.finiteelement
import
DGScalarElement
3
4
class
IntergridOperators
:
5
6
def
__init__
(self, dim, coarse_order, fine_order):
7
self.
coarse_order
= coarse_order
8
self.
fine_order
= fine_order
9
self.
coarse_element
=
DGScalarElement
(dim, coarse_order)
10
self.
fine_element
=
DGScalarElement
(dim, fine_order)
11
12
def
prolongation
(self):
13
"""
14
Return the local prolongation matrix of size fine_element.ndof x coarse_element.ndof
15
"""
16
coarse_ndof = self.
coarse_element
.ndof
17
fine_ndof = self.
fine_element
.ndof
18
Prolongation_matrix = np.zeros((fine_ndof, coarse_ndof))
19
for
i
in
range(fine_ndof):
20
for
j
in
range(coarse_ndof):
21
Prolongation_matrix[i, j] = self.
coarse_element
.evaluate(j, self.
fine_element
.nodes[i])
22
23
return
Prolongation_matrix
24
25
def
restriction
(self):
26
"""
27
Return the local restriction matrix of size coarse_element.ndof x fine_element.ndof
28
This is the transposed prolongation matrix
29
"""
30
return
np.transpose(self.
prolongation
())
31
32
def
injection
(self):
33
"""
34
Return the local "injection" or "interpolation" matrix of size coarse_element.ndof x fine_element.ndof
35
"""
36
coarse_ndof = self.
coarse_element
.ndof
37
fine_ndof = self.
fine_element
.ndof
38
Injection_matrix = np.zeros((coarse_ndof, fine_ndof))
39
for
i
in
range(coarse_ndof):
40
for
j
in
range(fine_ndof):
41
Injection_matrix[i, j] = self.
fine_element
.evaluate(j, self.
coarse_element
.nodes[i])
42
43
return
Injection_matrix
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators
Definition
IntergridOperators.py:4
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.fine_order
fine_order
Definition
IntergridOperators.py:8
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.restriction
restriction(self)
Return the local restriction matrix of size coarse_element.ndof x fine_element.ndof This is the trans...
Definition
IntergridOperators.py:25
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.fine_element
fine_element
Definition
IntergridOperators.py:10
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.coarse_order
coarse_order
Definition
IntergridOperators.py:7
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.coarse_element
coarse_element
Definition
IntergridOperators.py:9
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.injection
injection(self)
Return the local "injection" or "interpolation" matrix of size coarse_element.ndof x fine_element....
Definition
IntergridOperators.py:32
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.__init__
__init__(self, dim, coarse_order, fine_order)
Definition
IntergridOperators.py:6
mghype.api.matrixgenerators.blockmatrix.IntergridOperators.IntergridOperators.prolongation
prolongation(self)
Return the local prolongation matrix of size fine_element.ndof x coarse_element.ndof.
Definition
IntergridOperators.py:12
mghype.api.matrixgenerators.blockmatrix.finiteelement.DGScalarElement
Scalar DG finite element on cells.
Definition
finiteelement.py:61
src
mghype
api
matrixgenerators
blockmatrix
IntergridOperators.py
Generated on Fri Apr 11 2025 10:17:54 for Peano by
1.10.0