Skip to content

Commit e893323

Browse files
committed
clean integrator objects hierarchy
1 parent ebb7635 commit e893323

17 files changed

+136
-375
lines changed

src/lib/foodie.f90

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ module foodie
7474
use foodie_integrator_lmm_ssp, only : integrator_lmm_ssp
7575
use foodie_integrator_lmm_ssp_vss, only : integrator_lmm_ssp_vss
7676
use foodie_integrator_ms_runge_kutta_ssp, only : integrator_ms_runge_kutta_ssp
77-
use foodie_integrator_multistage_explicit_object, only : integrator_multistage_explicit_object
78-
use foodie_integrator_multistep_explicit_object, only : integrator_multistep_explicit_object
79-
use foodie_integrator_multistep_implicit_object, only : integrator_multistep_implicit_object
77+
use foodie_integrator_multistage_object, only : integrator_multistage_object
78+
use foodie_integrator_multistep_object, only : integrator_multistep_object
8079
use foodie_integrator_runge_kutta_emd, only : integrator_runge_kutta_emd
8180
use foodie_integrator_runge_kutta_low_storage, only : integrator_runge_kutta_ls
8281
use foodie_integrator_runge_kutta_lssp, only : integrator_runge_kutta_lssp
@@ -95,9 +94,8 @@ module foodie
9594
! abstract objects
9695
public :: integrand_object
9796
public :: integrator_object
98-
public :: integrator_multistage_explicit_object
99-
public :: integrator_multistep_explicit_object
100-
public :: integrator_multistep_implicit_object
97+
public :: integrator_multistage_object
98+
public :: integrator_multistep_object
10199
! concrete objects
102100
public :: integrator_adams_bashforth
103101
public :: integrator_adams_bashforth_moulton

src/lib/foodie_integrator_adams_bashforth.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module foodie_integrator_adams_bashforth
2828

2929
use foodie_error_codes, only : ERROR_UNSUPPORTED_SCHEME
3030
use foodie_integrand_object, only : integrand_object
31-
use foodie_integrator_multistep_explicit_object, only : integrator_multistep_explicit_object
31+
use foodie_integrator_multistep_object, only : integrator_multistep_object
3232
use foodie_integrator_object, only : integrator_object
3333
use penf, only : I_P, R_P
3434

@@ -56,7 +56,7 @@ module foodie_integrator_adams_bashforth
5656

5757
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
5858

59-
type, extends(integrator_multistep_explicit_object) :: integrator_adams_bashforth
59+
type, extends(integrator_multistep_object) :: integrator_adams_bashforth
6060
!< FOODIE integrator: provide an explicit class of Adams-Bashforth multi-step schemes, from 1st to 16th order accurate.
6161
!<
6262
!< @note The integrator must be created or initialized (initialize the *b* coefficients) before used.

src/lib/foodie_integrator_adams_bashforth_moulton.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module foodie_integrator_adams_bashforth_moulton
8080
use foodie_integrand_object, only : integrand_object
8181
use foodie_integrator_adams_bashforth, only : integrator_adams_bashforth
8282
use foodie_integrator_adams_moulton, only : integrator_adams_moulton
83-
use foodie_integrator_multistep_implicit_object, only : integrator_multistep_implicit_object
83+
use foodie_integrator_multistep_object, only : integrator_multistep_object
8484
use foodie_integrator_object, only : integrator_object
8585
use penf, only : I_P, R_P
8686

@@ -108,7 +108,7 @@ module foodie_integrator_adams_bashforth_moulton
108108

109109
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
110110

111-
type, extends(integrator_multistep_implicit_object) :: integrator_adams_bashforth_moulton
111+
type, extends(integrator_multistep_object) :: integrator_adams_bashforth_moulton
112112
!< FOODIE integrator: provide an explicit class of Adams-Bashforth-Moulton multi-step schemes, from 1st to 4rd order accurate.
113113
!<
114114
!< @note The integrator must be created or initialized (predictor and corrector schemes selection) before used.

src/lib/foodie_integrator_adams_moulton.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module foodie_integrator_adams_moulton
2929

3030
use foodie_error_codes, only : ERROR_UNSUPPORTED_SCHEME
3131
use foodie_integrand_object, only : integrand_object
32-
use foodie_integrator_multistep_implicit_object, only : integrator_multistep_implicit_object
32+
use foodie_integrator_multistep_object, only : integrator_multistep_object
3333
use foodie_integrator_object, only : integrator_object
3434
use penf, only : I_P, R_P
3535

@@ -57,7 +57,7 @@ module foodie_integrator_adams_moulton
5757

5858
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
5959

60-
type, extends(integrator_multistep_implicit_object) :: integrator_adams_moulton
60+
type, extends(integrator_multistep_object) :: integrator_adams_moulton
6161
!< FOODIE integrator: provide an explicit class of Adams-Moulton multi-step schemes, from 1st to 16th order accurate.
6262
!<
6363
!< @note The integrator must be created or initialized (initialize the *b* coefficients) before used.

src/lib/foodie_integrator_backward_differentiation_formula.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module foodie_integrator_backward_differentiation_formula
3535

3636
use foodie_error_codes, only : ERROR_UNSUPPORTED_SCHEME
3737
use foodie_integrand_object, only : integrand_object
38-
use foodie_integrator_multistep_implicit_object, only : integrator_multistep_implicit_object
38+
use foodie_integrator_multistep_object, only : integrator_multistep_object
3939
use foodie_integrator_object, only : integrator_object
4040
use penf, only : I_P, R_P
4141

@@ -53,7 +53,7 @@ module foodie_integrator_backward_differentiation_formula
5353

5454
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
5555

56-
type, extends(integrator_multistep_implicit_object) :: integrator_back_df
56+
type, extends(integrator_multistep_object) :: integrator_back_df
5757
!< FOODIE integrator: provide an implicit class of Backward-Differentiation-Formula multi-step schemes, from 1st to 6th order
5858
!< accurate.
5959
!<

src/lib/foodie_integrator_euler_explicit.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module foodie_integrator_euler_explicit
1616

1717
use foodie_error_codes, only : ERROR_UNSUPPORTED_SCHEME
1818
use foodie_integrand_object, only : integrand_object
19-
use foodie_integrator_multistage_explicit_object, only : integrator_multistage_explicit_object
19+
use foodie_integrator_multistage_object, only : integrator_multistage_object
2020
use foodie_integrator_object, only : integrator_object
2121
use penf, only : I_P, R_P
2222

@@ -29,7 +29,7 @@ module foodie_integrator_euler_explicit
2929

3030
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
3131

32-
type, extends(integrator_multistage_explicit_object) :: integrator_euler_explicit
32+
type, extends(integrator_multistage_object) :: integrator_euler_explicit
3333
!< FOODIE integrator: provide explicit Euler scheme, it being 1st order accurate.
3434
contains
3535
! deferred methods

src/lib/foodie_integrator_leapfrog.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module foodie_integrator_leapfrog
3838

3939
use foodie_error_codes, only : ERROR_UNSUPPORTED_SCHEME
4040
use foodie_integrand_object, only : integrand_object
41-
use foodie_integrator_multistep_explicit_object, only : integrator_multistep_explicit_object
41+
use foodie_integrator_multistep_object, only : integrator_multistep_object
4242
use foodie_integrator_object, only : integrator_object
4343
use penf, only : I_P, R_P
4444

@@ -52,7 +52,7 @@ module foodie_integrator_leapfrog
5252

5353
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
5454

55-
type, extends(integrator_multistep_explicit_object) :: integrator_leapfrog
55+
type, extends(integrator_multistep_object) :: integrator_leapfrog
5656
!< FOODIE integrator: provide an explicit class of leapfrog multi-step schemes, 2nd order accurate.
5757
!<
5858
!< @note The integrator must be initialized before used.

src/lib/foodie_integrator_lmm_ssp.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module foodie_integrator_lmm_ssp
2828

2929
use foodie_error_codes, only : ERROR_UNSUPPORTED_SCHEME
3030
use foodie_integrand_object, only : integrand_object
31-
use foodie_integrator_multistep_explicit_object, only : integrator_multistep_explicit_object
31+
use foodie_integrator_multistep_object, only : integrator_multistep_object
3232
use foodie_integrator_object, only : integrator_object
3333
use penf, only : I_P, R_P
3434

@@ -43,7 +43,7 @@ module foodie_integrator_lmm_ssp
4343

4444
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
4545

46-
type, extends(integrator_multistep_explicit_object) :: integrator_lmm_ssp
46+
type, extends(integrator_multistep_object) :: integrator_lmm_ssp
4747
!< FOODIE integrator: provide an explicit class of Linear Multi-step Methods (LLM) with Strong Stability Preserving property,
4848
!< from 2nd to 3rd order accurate.
4949
!<

src/lib/foodie_integrator_lmm_ssp_vss.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module foodie_integrator_lmm_ssp_vss
3939

4040
use foodie_error_codes, only : ERROR_UNSUPPORTED_SCHEME
4141
use foodie_integrand_object, only : integrand_object
42-
use foodie_integrator_multistep_explicit_object, only : integrator_multistep_explicit_object
42+
use foodie_integrator_multistep_object, only : integrator_multistep_object
4343
use foodie_integrator_object, only : integrator_object
4444
use penf, only : I_P, R_P
4545

@@ -56,7 +56,7 @@ module foodie_integrator_lmm_ssp_vss
5656

5757
logical, parameter :: has_fast_mode_=.true. !< Flag to check if integrator provides *fast mode* integrate.
5858

59-
type, extends(integrator_multistep_explicit_object) :: integrator_lmm_ssp_vss
59+
type, extends(integrator_multistep_object) :: integrator_lmm_ssp_vss
6060
!< FOODIE integrator: provide an explicit class of Linear Multi-step Methods (LLM) with Strong Stability Preserving property and
6161
!< variable stepsize (VSS), from 2nd to 3rd order accurate.
6262
!<
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
!< Define the abstract type [[integrator_multistage_explicit_object]] of FOODIE ODE integrators.
1+
!< Define the abstract type [[integrator_multistage_object]] of FOODIE ODE integrators.
22

3-
module foodie_integrator_multistage_explicit_object
4-
!< Define the abstract type [[integrator_multistage_explicit_object]] of FOODIE ODE integrators.
3+
module foodie_integrator_multistage_object
4+
!< Define the abstract type [[integrator_multistage_object]] of FOODIE ODE integrators.
55

66
use, intrinsic :: iso_fortran_env, only : stderr=>error_unit
77
use foodie_integrand_object, only : integrand_object
@@ -10,9 +10,9 @@ module foodie_integrator_multistage_explicit_object
1010

1111
implicit none
1212
private
13-
public :: integrator_multistage_explicit_object
13+
public :: integrator_multistage_object
1414

15-
type, extends(integrator_object), abstract :: integrator_multistage_explicit_object
15+
type, extends(integrator_object), abstract :: integrator_multistage_object
1616
!< Abstract type of FOODIE ODE integrators of the multistage family.
1717
integer(I_P) :: registers !< Number of registers used for stages.
1818
integer(I_P) :: stages !< Number of stages.
@@ -29,63 +29,63 @@ module foodie_integrator_multistage_explicit_object
2929
procedure, pass(self) :: steps_number !< Return number of steps used.
3030
! public methods
3131
procedure, pass(self) :: allocate_integrand_members !< Allocate integrand members.
32-
procedure, pass(lhs) :: assign_multistage !< Assign members of [[integrator_multistage_explicit_object]] and parents.
32+
procedure, pass(lhs) :: assign_multistage !< Assign members of [[integrator_multistage_object]] and parents.
3333
procedure, pass(self) :: destroy_multistage !< Destroy the integrator.
34-
endtype integrator_multistage_explicit_object
34+
endtype integrator_multistage_object
3535

3636
abstract interface
37-
!< Abstract interfaces of deferred methods of [[integrator_multistage_explicit_object]].
37+
!< Abstract interfaces of deferred methods of [[integrator_multistage_object]].
3838
subroutine integrate_interface(self, U, Dt, t, new_Dt)
3939
!< Integrate integrand field.
40-
import :: integrand_object, integrator_multistage_explicit_object, R_P
41-
class(integrator_multistage_explicit_object), intent(inout) :: self !< Integrator.
42-
class(integrand_object), intent(inout) :: U !< Integrand.
43-
real(R_P), intent(in) :: Dt !< Time step.
44-
real(R_P), intent(in) :: t !< Time.
45-
real(R_P), intent(out), optional :: new_Dt !< New adapted time step.
40+
import :: integrand_object, integrator_multistage_object, R_P
41+
class(integrator_multistage_object), intent(inout) :: self !< Integrator.
42+
class(integrand_object), intent(inout) :: U !< Integrand.
43+
real(R_P), intent(in) :: Dt !< Time step.
44+
real(R_P), intent(in) :: t !< Time.
45+
real(R_P), intent(out), optional :: new_Dt !< New adapted time step.
4646
endsubroutine integrate_interface
4747

4848
subroutine integrate_fast_interface(self, U, Dt, t, new_Dt)
4949
!< Integrate integrand field, fast mode.
50-
import :: integrand_object, integrator_multistage_explicit_object, R_P
51-
class(integrator_multistage_explicit_object), intent(inout) :: self !< Integrator.
52-
class(integrand_object), intent(inout) :: U !< Field to be integrated.
53-
real(R_P), intent(in) :: Dt !< Time step.
54-
real(R_P), intent(in) :: t !< Time.
55-
real(R_P), intent(out), optional :: new_Dt !< New adapted time step.
50+
import :: integrand_object, integrator_multistage_object, R_P
51+
class(integrator_multistage_object), intent(inout) :: self !< Integrator.
52+
class(integrand_object), intent(inout) :: U !< Field to be integrated.
53+
real(R_P), intent(in) :: Dt !< Time step.
54+
real(R_P), intent(in) :: t !< Time.
55+
real(R_P), intent(out), optional :: new_Dt !< New adapted time step.
5656
endsubroutine integrate_fast_interface
5757
endinterface
5858

5959
contains
6060
! deferred methods
6161
elemental function is_multistage(self)
6262
!< Return .true. for multistage integrator.
63-
class(integrator_multistage_explicit_object), intent(in) :: self !< Integrator.
64-
logical :: is_multistage !< Inquire result.
63+
class(integrator_multistage_object), intent(in) :: self !< Integrator.
64+
logical :: is_multistage !< Inquire result.
6565

6666
is_multistage = .true.
6767
endfunction is_multistage
6868

6969
elemental function is_multistep(self)
7070
!< Return .true. for multistage integrator.
71-
class(integrator_multistage_explicit_object), intent(in) :: self !< Integrator.
72-
logical :: is_multistep !< Inquire result.
71+
class(integrator_multistage_object), intent(in) :: self !< Integrator.
72+
logical :: is_multistep !< Inquire result.
7373

7474
is_multistep = .false.
7575
endfunction is_multistep
7676

7777
elemental function stages_number(self)
7878
!< Return number of stages used.
79-
class(integrator_multistage_explicit_object), intent(in) :: self !< Integrator.
80-
integer(I_P) :: stages_number !< Number of stages used.
79+
class(integrator_multistage_object), intent(in) :: self !< Integrator.
80+
integer(I_P) :: stages_number !< Number of stages used.
8181

8282
stages_number = self%stages
8383
endfunction stages_number
8484

8585
elemental function steps_number(self)
8686
!< Return number of steps used.
87-
class(integrator_multistage_explicit_object), intent(in) :: self !< Integrator.
88-
integer(I_P) :: steps_number !< Number of steps used.
87+
class(integrator_multistage_object), intent(in) :: self !< Integrator.
88+
integer(I_P) :: steps_number !< Number of steps used.
8989

9090
steps_number = 0
9191
endfunction steps_number
@@ -95,9 +95,9 @@ pure subroutine allocate_integrand_members(self, U)
9595
!< Allocate members of interpolator being of [[integrand_object]] class.
9696
!<
9797
!< @note It is assumed that the integrator has been properly initialized before calling this method.
98-
class(integrator_multistage_explicit_object), intent(inout) :: self !< Integrator.
99-
class(integrand_object), intent(in) :: U !< Integrand.
100-
integer(I_P) :: s !< Counter.
98+
class(integrator_multistage_object), intent(inout) :: self !< Integrator.
99+
class(integrand_object), intent(in) :: U !< Integrand.
100+
integer(I_P) :: s !< Counter.
101101

102102
if (self%is_multistage() .and. self%registers > 0) then
103103
if (allocated(self%stage)) deallocate(self%stage)
@@ -114,14 +114,14 @@ pure subroutine allocate_integrand_members(self, U)
114114
endsubroutine allocate_integrand_members
115115

116116
pure subroutine assign_multistage(lhs, rhs)
117-
!< Assign members of [[integrator_multistage_explicit_object]] and parents.
118-
class(integrator_multistage_explicit_object), intent(inout) :: lhs !< Left hand side.
119-
class(integrator_object), intent(in) :: rhs !< Right hand side.
120-
integer(I_P) :: s !< Counter.
117+
!< Assign members of [[integrator_multistage_object]] and parents.
118+
class(integrator_multistage_object), intent(inout) :: lhs !< Left hand side.
119+
class(integrator_object), intent(in) :: rhs !< Right hand side.
120+
integer(I_P) :: s !< Counter.
121121

122122
call lhs%assign_abstract(rhs=rhs)
123123
select type(rhs)
124-
class is (integrator_multistage_explicit_object)
124+
class is (integrator_multistage_object)
125125
lhs%registers = rhs%registers
126126
lhs%stages = rhs%stages
127127
if (allocated(lhs%stage)) deallocate(lhs%stage)
@@ -141,12 +141,12 @@ pure subroutine assign_multistage(lhs, rhs)
141141

142142
elemental subroutine destroy_multistage(self)
143143
!< Destroy the integrator.
144-
class(integrator_multistage_explicit_object), intent(inout) :: self !< Integrator.
144+
class(integrator_multistage_object), intent(inout) :: self !< Integrator.
145145

146146
call self%destroy_abstract
147147
self%registers = 0
148148
self%stages = 0
149149
if (allocated(self%stage)) deallocate(self%stage)
150150
if (allocated(self%buffer)) deallocate(self%buffer)
151151
endsubroutine destroy_multistage
152-
endmodule foodie_integrator_multistage_explicit_object
152+
endmodule foodie_integrator_multistage_object

0 commit comments

Comments
 (0)