-
Notifications
You must be signed in to change notification settings - Fork 2
/
MODULE_COMPUTATIONALSYSTEM.f90
72 lines (51 loc) · 1.92 KB
/
MODULE_COMPUTATIONALSYSTEM.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
MODULE MODULE_COMPUTATIONALSYSTEM
USE MODULE_PRECISION
USE MODULE_MATHUTILITY
USE MODULE_CORRECTIONPOLYNOMIAL
IMPLICIT NONE
TYPE, PUBLIC :: COMPUTATIONALSYSTEM
INTEGER(IP) :: ORDER
REAL(WP), DIMENSION(:) , POINTER :: R
REAL(WP), DIMENSION(:,:), POINTER :: V
REAL(WP), DIMENSION(:,:), POINTER :: INV_V
REAL(WP), DIMENSION(:,:), POINTER :: DR
REAL(WP) :: DX_MAX
TYPE(CORRECTIONPOLYNOMIAL), POINTER :: CP_COEF
CONTAINS
PROCEDURE :: MAKE => MAKE_COMPUTATIONALSYSTEM
PROCEDURE :: DELETE => DELETE_COMPUTATIONALSYSTEM
END TYPE COMPUTATIONALSYSTEM
CONTAINS
SUBROUTINE MAKE_COMPUTATIONALSYSTEM(THIS, ORDER, CP_COEF)
IMPLICIT NONE
INTEGER(IP), INTENT(IN) :: ORDER
CLASS(COMPUTATIONALSYSTEM), INTENT(INOUT) :: THIS
TYPE(CORRECTIONPOLYNOMIAL), INTENT(IN), TARGET :: CP_COEF
INTEGER(IP) :: N1, I
N1 = ORDER+1
THIS%ORDER = ORDER
ALLOCATE(THIS%R(N1))
ALLOCATE(THIS%V(N1,N1))
ALLOCATE(THIS%INV_V(N1,N1))
ALLOCATE(THIS%DR(N1,N1))
THIS%R = JACOBIGL(0._WP, 0._WP, THIS%ORDER)
THIS%V = VANDERMONDE1D(THIS%ORDER, THIS%R)
THIS%DR = DMATRIX1D(THIS%ORDER, THIS%R, THIS%V)
CALL INVERSEMAT(N1, THIS%V, THIS%INV_V)
THIS%CP_COEF => CP_COEF
THIS%DX_MAX = 0._WP
DO I = 1, ORDER
IF (THIS%DX_MAX <= DABS(THIS%R(I+1)-THIS%R(I))) THIS%DX_MAX = DABS(THIS%R(I+1)-THIS%R(I))
END DO
END SUBROUTINE MAKE_COMPUTATIONALSYSTEM
SUBROUTINE DELETE_COMPUTATIONALSYSTEM(THIS)
IMPLICIT NONE
CLASS(COMPUTATIONALSYSTEM), INTENT(INOUT) :: THIS
THIS%ORDER = 0
DEALLOCATE(THIS%R)
DEALLOCATE(THIS%V)
DEALLOCATE(THIS%INV_V)
DEALLOCATE(THIS%DR)
NULLIFY(THIS%CP_COEF)
END SUBROUTINE DELETE_COMPUTATIONALSYSTEM
END MODULE MODULE_COMPUTATIONALSYSTEM