Skip to content

Commit a8bbf6d

Browse files
committed
Merge branch 'release/0.1.2'
2 parents 87c6403 + f729750 commit a8bbf6d

31 files changed

+1557
-1601
lines changed

fobos

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ $CSHARED_INT = -cpp -c -fpic -assume realloc_lhs
1010
$LSHARED = -shared
1111
$CSTATIC_GNU = -cpp -c -frealloc-lhs
1212
$CSTATIC_INT = -cpp -c -assume realloc_lhs
13-
$DEBUG_GNU = -Og -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan
14-
; $DEBUG_GNU = -Og -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan -std=f2008 -fall-intrinsics
13+
$DEBUG_GNU = -Og -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan -std=f2008 -fall-intrinsics
1514
$DEBUG_INT = -O0 -debug all -check all -warn all -extend-source 132 -traceback -gen-interfaces#-fpe-all=0 -fp-stack-check -fstack-protector-all -ftrapuv -no-ftz -std08
1615
$OPTIMIZE = -O2
1716
$EXDIRS = FLAP/src/tests/ PENF/src/tests/ pyplot-fortran/src/tests/
@@ -121,6 +120,7 @@ jobs = 2
121120
compiler = gnu
122121
cflags = $CSHARED_GNU $DEBUG_GNU
123122
lflags = $LSHARED $DEBUG_GNU
123+
preproc = -DDEBUG
124124
exclude_dirs = $EXDIRS
125125
mod_dir = ./mod/
126126
obj_dir = ./obj/
@@ -134,6 +134,7 @@ jobs = 2
134134
compiler = gnu
135135
cflags = $CSTATIC_GNU $DEBUG_GNU
136136
lflags = $DEBUG_GNU
137+
preproc = -DDEBUG
137138
exclude_dirs = $EXDIRS
138139
mod_dir = ./mod/
139140
obj_dir = ./obj/
@@ -173,6 +174,7 @@ jobs = 2
173174
compiler = intel
174175
cflags = $CSHARED_INT $DEBUG_INT
175176
lflags = $LSHARED $DEBUG_INT
177+
preproc = -DDEBUG
176178
exclude_dirs = $EXDIRS
177179
mod_dir = ./mod/
178180
obj_dir = ./obj/
@@ -186,6 +188,7 @@ jobs = 2
186188
compiler = intel
187189
cflags = $CSTATIC_INT $DEBUG_INT
188190
lflags = $DEBUG_INT
191+
preproc = -DDEBUG
189192
exclude_dirs = $EXDIRS
190193
mod_dir = ./mod/
191194
obj_dir = ./obj/
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
!< Abstract alpha (non linear weights) object.
2+
module wenoof_alpha_object
3+
!< Abstract alpha (non linear weights) object.
4+
5+
use penf, only : I_P, R_P
6+
use wenoof_base_object
7+
use wenoof_beta_object
8+
use wenoof_kappa_object
9+
10+
implicit none
11+
private
12+
public :: alpha_object
13+
public :: alpha_object_constructor
14+
15+
type, extends(base_object_constructor) :: alpha_object_constructor
16+
!< Abstract alpha (non linear weights) object constructor.
17+
contains
18+
endtype alpha_object_constructor
19+
20+
type, extends(base_object), abstract :: alpha_object
21+
!< Abstract alpha (non linear weights) object.
22+
real(R_P), allocatable :: values(:,:) !< Alpha coefficients [1:2,0:S-1].
23+
real(R_P), allocatable :: values_sum(:) !< Sum of alpha coefficients [1:2].
24+
contains
25+
! public deferred methods
26+
procedure(compute_interface), pass(self), deferred :: compute !< Compute alpha.
27+
endtype alpha_object
28+
29+
abstract interface
30+
!< Abstract interfaces of [[alpha_object]].
31+
pure subroutine compute_interface(self, beta, kappa)
32+
!< Compute alpha.
33+
import :: alpha_object, beta_object, kappa_object
34+
class(alpha_object), intent(inout) :: self !< Alpha.
35+
class(beta_object), intent(in) :: beta !< Beta.
36+
class(kappa_object), intent(in) :: kappa !< Kappa.
37+
endsubroutine compute_interface
38+
endinterface
39+
40+
endmodule wenoof_alpha_object
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
!< Abstract base object, the ancestor of all.
2+
module wenoof_base_object
3+
!< Abstract base object, the ancestor of all.
4+
!<
5+
!< Define a minimal, base, object that is used as ancestor of all objects, e.g. smoothness indicator, optimal weights, etc...
6+
7+
use penf
8+
9+
implicit none
10+
private
11+
public :: base_object
12+
public :: base_object_constructor
13+
14+
real(R_P), parameter :: EPS_DEF=10._R_P**(-6) !< Small epsilon to avoid division by zero, default value.
15+
16+
type :: base_object_constructor
17+
!< Abstract base object constructor.
18+
integer(I_P) :: S=0_I_P !< Stencils dimension.
19+
logical :: face_left=.true. !< Activate left-face interpolation computation.
20+
logical :: face_right=.true. !< Activate right-face interpolation computation.
21+
real(R_P) :: eps=EPS_DEF !< Small epsilon to avoid division by zero.
22+
endtype base_object_constructor
23+
24+
type, abstract :: base_object
25+
!< Abstract base object, the ancestor of all.
26+
!<
27+
!< Define a minimal, base, object that is used as ancestor of all objects, e.g. smoothness indicator, optimal weights, etc...
28+
integer(I_P) :: S=0_I_P !< Stencils dimension.
29+
integer(I_P) :: f1=1_I_P !< Lower bound of faces index.
30+
integer(I_P) :: f2=2_I_P !< Upper bound of faces index.
31+
integer(I_P) :: ff=0_I_P !< Offset (step) of faces index.
32+
real(R_P) :: eps=EPS_DEF !< Small epsilon to avoid division by zero.
33+
contains
34+
! public deferred methods
35+
procedure(create_interface), pass(self), deferred :: create !< Create object.
36+
procedure(description_interface), pass(self), deferred :: description !< Return object string-description.
37+
procedure(destroy_interface), pass(self), deferred :: destroy !< Destroy object.
38+
! public non overridable methods
39+
procedure, pass(self), non_overridable :: create_ !< Create object.
40+
procedure, pass(self), non_overridable :: destroy_ !< Destroy object.
41+
endtype base_object
42+
43+
abstract interface
44+
!< Abstract interfaces of [[base_object]].
45+
subroutine create_interface(self, constructor)
46+
!< Create object.
47+
!<
48+
!< @note Before call this method a concrete constructor must be instantiated.
49+
import :: base_object, base_object_constructor
50+
class(base_object), intent(inout) :: self !< Object.
51+
class(base_object_constructor), intent(in) :: constructor !< Object constructor.
52+
endsubroutine create_interface
53+
54+
pure function description_interface(self) result(string)
55+
!< Return object string-description.
56+
import :: base_object
57+
class(base_object), intent(in) :: self !< Object.
58+
character(len=:), allocatable :: string !< String-description.
59+
endfunction description_interface
60+
61+
elemental subroutine destroy_interface(self)
62+
!< Destroy object.
63+
import :: base_object
64+
class(base_object), intent(inout) :: self !< Object.
65+
endsubroutine destroy_interface
66+
endinterface
67+
68+
contains
69+
! public non overridable methods
70+
subroutine create_(self, constructor)
71+
!< Create object.
72+
class(base_object), intent(inout) :: self !< Object.
73+
class(base_object_constructor), intent(in) :: constructor !< Object constructor.
74+
75+
call self%destroy_
76+
select type(constructor)
77+
class is(base_object_constructor)
78+
self%S = constructor%S
79+
if (constructor%face_left.and.constructor%face_right) then
80+
self%f1 = 1_I_P; self%f2 = 2_I_P; self%ff = 0_I_P
81+
elseif (constructor%face_left) then
82+
self%f1 = 1_I_P; self%f2 = 1_I_P; self%ff = 0_I_P
83+
elseif (constructor%face_right) then
84+
self%f1 = 2_I_P; self%f2 = 2_I_P; self%ff = -1_I_P
85+
endif
86+
self%eps = constructor%eps
87+
endselect
88+
endsubroutine create_
89+
90+
elemental subroutine destroy_(self)
91+
!< Destroy object.
92+
class(base_object), intent(inout) :: self !< Object.
93+
94+
self%S = 0_I_P
95+
self%f1 = 1_I_P
96+
self%f2 = 2_I_P
97+
self%ff = 0_I_P
98+
self%eps = EPS_DEF
99+
endsubroutine destroy_
100+
endmodule wenoof_base_object
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
!< Abstract Beta coefficients (smoothness indicators of stencil interpolations) object.
2+
module wenoof_beta_object
3+
!< Abstract Beta coefficients (smoothness indicators of stencil interpolations) object.
4+
5+
use penf, only : I_P, R_P
6+
use wenoof_base_object
7+
8+
implicit none
9+
private
10+
public :: beta_object
11+
public :: beta_object_constructor
12+
13+
type, extends(base_object_constructor) :: beta_object_constructor
14+
!< Abstract Beta coefficients object constructor.
15+
endtype beta_object_constructor
16+
17+
type, extends(base_object), abstract :: beta_object
18+
!< Abstract Beta coefficients (smoothness indicators of stencil interpolations) object.
19+
real(R_P), allocatable :: values(:,:) !< Beta values [1:2,0:S-1].
20+
contains
21+
! public deferred methods
22+
procedure(compute_interface), pass(self), deferred :: compute !< Compute beta.
23+
endtype beta_object
24+
25+
abstract interface
26+
!< Abstract interfaces of [[beta_object]].
27+
pure subroutine compute_interface(self, stencil)
28+
!< Compute beta.
29+
import :: beta_object, R_P
30+
class(beta_object), intent(inout) :: self !< Beta.
31+
real(R_P), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S].
32+
endsubroutine compute_interface
33+
endinterface
34+
35+
endmodule wenoof_beta_object
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
!< Abstract interpolations object.
2+
module wenoof_interpolations_object
3+
!< Abstract interpolations object.
4+
5+
use penf, only : I_P, R_P
6+
use wenoof_base_object
7+
8+
implicit none
9+
private
10+
public :: interpolations_object
11+
public :: interpolations_object_constructor
12+
13+
type, extends(base_object_constructor) :: interpolations_object_constructor
14+
!< Abstract interpolations object constructor.
15+
endtype interpolations_object_constructor
16+
17+
type, extends(base_object), abstract :: interpolations_object
18+
!< Abstract interpolations object.
19+
real(R_P), allocatable :: values(:,:) !< Stencil interpolations values [1:2,0:S-1].
20+
contains
21+
! public deferred methods
22+
procedure(compute_interface), pass(self), deferred :: compute !< Compute beta.
23+
endtype interpolations_object
24+
25+
abstract interface
26+
!< Abstract interfaces of [[interpolations_object]].
27+
pure subroutine compute_interface(self, stencil)
28+
!< Compute interpolations.
29+
import :: interpolations_object, R_P
30+
class(interpolations_object), intent(inout) :: self !< Interpolations.
31+
real(R_P), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S].
32+
endsubroutine compute_interface
33+
endinterface
34+
35+
endmodule wenoof_interpolations_object
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
!< Abstract interpolator object.
2+
module wenoof_interpolator_object
3+
!< Abstract interpolator object.
4+
5+
use penf, only : I_P, R_P
6+
use wenoof_base_object
7+
use wenoof_interpolations_object
8+
use wenoof_weights_object
9+
10+
implicit none
11+
private
12+
public :: interpolator_object
13+
public :: interpolator_object_constructor
14+
15+
type, extends(base_object_constructor) :: interpolator_object_constructor
16+
!< Abstract interpolator object constructor.
17+
!<
18+
!< @note Every concrete WENO interpolator implementations must define their own constructor type.
19+
class(interpolations_object_constructor), allocatable :: interpolations_constructor !< Stencil interpolations constructor.
20+
class(weights_object_constructor), allocatable :: weights_constructor !< Weights of interpolations constructor.
21+
endtype interpolator_object_constructor
22+
23+
type, extends(base_object), abstract :: interpolator_object
24+
!< Abstract interpolator object.
25+
!<
26+
!< @note Do not implement any actual interpolator: provide the interface for the different interpolators implemented.
27+
class(interpolations_object), allocatable :: interpolations !< Stencil interpolations.
28+
class(weights_object), allocatable :: weights !< Weights of interpolations.
29+
contains
30+
! public deferred methods
31+
procedure(interpolate_debug_interface), pass(self), deferred :: interpolate_debug !< Interpolate values, debug mode.
32+
procedure(interpolate_standard_interface), pass(self), deferred :: interpolate_standard !< Interpolate values, standard mode.
33+
! public methods
34+
generic :: interpolate => interpolate_standard, interpolate_debug !< Interpolate values.
35+
endtype interpolator_object
36+
37+
abstract interface
38+
!< Abstract interfaces of [[interpolator_object]].
39+
pure subroutine interpolate_debug_interface(self, stencil, interpolation, si, weights)
40+
!< Interpolate values (providing also debug values).
41+
import :: interpolator_object, R_P
42+
class(interpolator_object), intent(inout) :: self !< Interpolator.
43+
real(R_P), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S].
44+
real(R_P), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2].
45+
real(R_P), intent(out) :: si(1:, 0:) !< Computed values of smoothness indicators [1:2, 0:S-1].
46+
real(R_P), intent(out) :: weights(1:, 0:) !< Weights of the stencils, [1:2, 0:S-1].
47+
endsubroutine interpolate_debug_interface
48+
49+
pure subroutine interpolate_standard_interface(self, stencil, interpolation)
50+
!< Interpolate values (without providing debug values).
51+
import :: interpolator_object, R_P
52+
class(interpolator_object), intent(inout) :: self !< Interpolator.
53+
real(R_P), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S].
54+
real(R_P), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2].
55+
endsubroutine interpolate_standard_interface
56+
endinterface
57+
58+
endmodule wenoof_interpolator_object
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
!< Abstract Kappa (optimal, linear weights of stencil interpolations) object.
2+
module wenoof_kappa_object
3+
!< Abstract Kappa (optimal, linear weights of stencil interpolations) object.
4+
5+
use penf, only : I_P, R_P
6+
use wenoof_base_object
7+
8+
implicit none
9+
private
10+
public :: kappa_object
11+
public :: kappa_object_constructor
12+
13+
type, extends(base_object_constructor) :: kappa_object_constructor
14+
!< Abstract kappa object constructor.
15+
endtype kappa_object_constructor
16+
17+
type, extends(base_object), abstract :: kappa_object
18+
!< Kappa (optimal, linear weights of stencil interpolations) object.
19+
real(R_P), allocatable :: values(:,:) !< Kappa coefficients values [1:2,0:S-1].
20+
contains
21+
! public deferred methods
22+
procedure(compute_interface), pass(self), deferred :: compute !< Compute kappa.
23+
endtype kappa_object
24+
25+
abstract interface
26+
!< Abstract interfaces of [[kappa_object]].
27+
pure subroutine compute_interface(self)
28+
!< Compute kappa.
29+
import :: kappa_object
30+
class(kappa_object), intent(inout) :: self !< Kappa.
31+
endsubroutine compute_interface
32+
endinterface
33+
34+
endmodule wenoof_kappa_object
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
!< Abstract weights object.
2+
module wenoof_weights_object
3+
!< Abstract weights object.
4+
5+
use penf, only : I_P, R_P
6+
use wenoof_base_object
7+
8+
implicit none
9+
private
10+
public :: weights_object
11+
public :: weights_object_constructor
12+
13+
type, extends(base_object_constructor) :: weights_object_constructor
14+
!< Abstract weights object constructor.
15+
endtype weights_object_constructor
16+
17+
type, extends(base_object), abstract :: weights_object
18+
!< Weights of stencil interpolations object.
19+
real(R_P), allocatable :: values(:,:) !< Weights values of stencil interpolations [1:2,0:S-1].
20+
contains
21+
! deferred public methods
22+
procedure(compute_interface), pass(self), deferred :: compute !< Compute weights.
23+
endtype weights_object
24+
25+
abstract interface
26+
!< Abstract interfaces of [[weights_object]].
27+
pure subroutine compute_interface(self, stencil)
28+
!< Compute beta.
29+
import :: weights_object, R_P
30+
class(weights_object), intent(inout) :: self !< Weights.
31+
real(R_P), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S].
32+
endsubroutine compute_interface
33+
endinterface
34+
35+
endmodule wenoof_weights_object

0 commit comments

Comments
 (0)