@@ -82,8 +82,8 @@ module foodie
8282
8383implicit none
8484private
85- public :: foodie_integrator
8685public :: foodie_integrator_class_names
86+ public :: foodie_integrator_factory
8787public :: foodie_integrator_schemes
8888public :: integrand_object
8989public :: integrator_object
@@ -105,32 +105,64 @@ module foodie
105105public :: is_scheme_available
106106
107107contains
108- function foodie_integrator (scheme , stages , tolerance , nu , alpha ) result(integrator)
109- ! < Return a concrete instance of [[integrator_object]] given a scheme selection.
110- ! <
111- ! < This is the FOODIE integrators factory.
112- ! <
113- ! < @note If an error occurs the error status of [[integrator_object]] is updated.
114- character (* ), intent (in ) :: scheme ! < Selected integrator given.
115- integer (I_P), intent (in ), optional :: stages ! < Stages of multi-stage methods.
116- real (R_P), intent (in ), optional :: tolerance ! < Tolerance on the local truncation error.
117- real (R_P), intent (in ), optional :: nu ! < Williams-Robert-Asselin filter coefficient.
118- real (R_P), intent (in ), optional :: alpha ! < Robert-Asselin filter coefficient.
119- class(integrator_object), allocatable :: integrator ! < The FOODIE integrator.
108+ pure function foodie_integrator_class_names () result(names)
109+ ! < Return the list of available intergrator class of schemes names.
110+ character (len= 99 ), allocatable :: names(:) ! < Available integrator class names.
120111 type (integrator_adams_bashforth) :: int_adams_bashforth ! < Integrator Adams Bashforth.
121112 type (integrator_adams_bashforth_moulton) :: int_adams_bashforth_moulton ! < Integrator Adams Bashforth Moulton.
122113 type (integrator_adams_moulton) :: int_adams_moulton ! < Integrator Adams Moulton.
123114 type (integrator_back_df) :: int_back_df ! < Integrator back differentiation formula.
124115 type (integrator_euler_explicit) :: int_euler_explicit ! < Integrator euler explicit.
125116 type (integrator_leapfrog) :: int_leapfrog ! < Integrator leapfrog.
126- type (integrator_lmm_ssp) :: int_lmm_ssp ! < Integrator LMM SSP.
127- type (integrator_lmm_ssp_vss) :: int_lmm_ssp_vss ! < Integrator LMM SSP VSS.
117+ type (integrator_lmm_ssp) :: int_lmm_ssp ! < Integrator lmm SSP.
118+ type (integrator_lmm_ssp_vss) :: int_lmm_ssp_vss ! < Integrator lmm SSP VSS.
128119 type (integrator_ms_runge_kutta_ssp) :: int_ms_runge_kutta_ssp ! < Integrator multistep Runge Kutta ssp.
129- type (integrator_runge_kutta_emd) :: int_runge_kutta_emd ! < Integrator Runge Kutta_embdedded .
120+ type (integrator_runge_kutta_emd) :: int_runge_kutta_emd ! < Integrator Runge Kutta embdedded .
130121 type (integrator_runge_kutta_ls) :: int_runge_kutta_ls ! < Integrator Runge Kutta low storage.
131122 type (integrator_runge_kutta_lssp) :: int_runge_kutta_lssp ! < Integrator linear Runge Kutta SSP.
132123 type (integrator_runge_kutta_ssp) :: int_runge_kutta_ssp ! < Integrator Runge Kutta SSP.
133124
125+ names = [ int_adams_bashforth % class_name()]
126+ names = [names, int_adams_bashforth_moulton % class_name()]
127+ names = [names, int_adams_moulton % class_name()]
128+ names = [names, int_back_df % class_name()]
129+ names = [names, int_euler_explicit % class_name()]
130+ names = [names, int_leapfrog % class_name()]
131+ names = [names, int_lmm_ssp % class_name()]
132+ names = [names, int_lmm_ssp_vss % class_name()]
133+ names = [names, int_ms_runge_kutta_ssp % class_name()]
134+ names = [names, int_runge_kutta_emd % class_name()]
135+ names = [names, int_runge_kutta_ls % class_name()]
136+ names = [names, int_runge_kutta_lssp % class_name()]
137+ names = [names, int_runge_kutta_ssp % class_name()]
138+ end function foodie_integrator_class_names
139+
140+ subroutine foodie_integrator_factory (scheme , integrator , stages , tolerance , nu , alpha )
141+ ! < Return a concrete instance of [[integrator_object]] given a scheme selection.
142+ ! <
143+ ! < This is the FOODIE integrators factory.
144+ ! <
145+ ! < @note If an error occurs the error status of [[integrator_object]] is updated.
146+ character (* ), intent (in ) :: scheme ! < Selected integrator given.
147+ class(integrator_object), allocatable , intent (out ) :: integrator ! < The FOODIE integrator.
148+ integer (I_P), optional , intent (in ) :: stages ! < Stages of multi-stage methods.
149+ real (R_P), optional , intent (in ) :: tolerance ! < Tolerance on the local truncation error.
150+ real (R_P), optional , intent (in ) :: nu ! < Williams-Robert-Asselin filter coefficient.
151+ real (R_P), optional , intent (in ) :: alpha ! < Robert-Asselin filter coefficient.
152+ type (integrator_adams_bashforth) :: int_adams_bashforth ! < Integrator Adams Bashforth.
153+ type (integrator_adams_bashforth_moulton) :: int_adams_bashforth_moulton ! < Integrator Adams Bashforth Moulton.
154+ type (integrator_adams_moulton) :: int_adams_moulton ! < Integrator Adams Moulton.
155+ type (integrator_back_df) :: int_back_df ! < Integrator back differentiation formula.
156+ type (integrator_euler_explicit) :: int_euler_explicit ! < Integrator euler explicit.
157+ type (integrator_leapfrog) :: int_leapfrog ! < Integrator leapfrog.
158+ type (integrator_lmm_ssp) :: int_lmm_ssp ! < Integrator LMM SSP.
159+ type (integrator_lmm_ssp_vss) :: int_lmm_ssp_vss ! < Integrator LMM SSP VSS.
160+ type (integrator_ms_runge_kutta_ssp) :: int_ms_runge_kutta_ssp ! < Integrator multistep Runge Kutta ssp.
161+ type (integrator_runge_kutta_emd) :: int_runge_kutta_emd ! < Integrator Runge Kutta_embdedded.
162+ type (integrator_runge_kutta_ls) :: int_runge_kutta_ls ! < Integrator Runge Kutta low storage.
163+ type (integrator_runge_kutta_lssp) :: int_runge_kutta_lssp ! < Integrator linear Runge Kutta SSP.
164+ type (integrator_runge_kutta_ssp) :: int_runge_kutta_ssp ! < Integrator Runge Kutta SSP.
165+
134166 if (index (trim (adjustl (scheme)), trim (int_adams_bashforth_moulton% class_name())) > 0 ) then
135167 allocate (integrator_adams_bashforth_moulton :: integrator)
136168 select type (integrator)
@@ -209,39 +241,7 @@ function foodie_integrator(scheme, stages, tolerance, nu, alpha) result(integrat
209241 write (stderr, ' (A)' )' error: "' // trim (adjustl (scheme))// ' " scheme is unknown!'
210242 stop
211243 endif
212- endfunction foodie_integrator
213-
214- pure function foodie_integrator_class_names () result(names)
215- ! < Return the list of available intergrator class of schemes names.
216- character (len= 99 ), allocatable :: names(:) ! < Available integrator class names.
217- type (integrator_adams_bashforth) :: int_adams_bashforth ! < Integrator Adams Bashforth.
218- type (integrator_adams_bashforth_moulton) :: int_adams_bashforth_moulton ! < Integrator Adams Bashforth Moulton.
219- type (integrator_adams_moulton) :: int_adams_moulton ! < Integrator Adams Moulton.
220- type (integrator_back_df) :: int_back_df ! < Integrator back differentiation formula.
221- type (integrator_euler_explicit) :: int_euler_explicit ! < Integrator euler explicit.
222- type (integrator_leapfrog) :: int_leapfrog ! < Integrator leapfrog.
223- type (integrator_lmm_ssp) :: int_lmm_ssp ! < Integrator lmm SSP.
224- type (integrator_lmm_ssp_vss) :: int_lmm_ssp_vss ! < Integrator lmm SSP VSS.
225- type (integrator_ms_runge_kutta_ssp) :: int_ms_runge_kutta_ssp ! < Integrator multistep Runge Kutta ssp.
226- type (integrator_runge_kutta_emd) :: int_runge_kutta_emd ! < Integrator Runge Kutta embdedded.
227- type (integrator_runge_kutta_ls) :: int_runge_kutta_ls ! < Integrator Runge Kutta low storage.
228- type (integrator_runge_kutta_lssp) :: int_runge_kutta_lssp ! < Integrator linear Runge Kutta SSP.
229- type (integrator_runge_kutta_ssp) :: int_runge_kutta_ssp ! < Integrator Runge Kutta SSP.
230-
231- names = [ int_adams_bashforth % class_name()]
232- names = [names, int_adams_bashforth_moulton % class_name()]
233- names = [names, int_adams_moulton % class_name()]
234- names = [names, int_back_df % class_name()]
235- names = [names, int_euler_explicit % class_name()]
236- names = [names, int_leapfrog % class_name()]
237- names = [names, int_lmm_ssp % class_name()]
238- names = [names, int_lmm_ssp_vss % class_name()]
239- names = [names, int_ms_runge_kutta_ssp % class_name()]
240- names = [names, int_runge_kutta_emd % class_name()]
241- names = [names, int_runge_kutta_ls % class_name()]
242- names = [names, int_runge_kutta_lssp % class_name()]
243- names = [names, int_runge_kutta_ssp % class_name()]
244- end function foodie_integrator_class_names
244+ endsubroutine foodie_integrator_factory
245245
246246 pure function foodie_integrator_schemes (class_name ) result(schemes)
247247 ! < Return the list of all available intergrator schemes, or only the schemes belonging to the given class name.
0 commit comments