Skip to content

Commit

Permalink
Merge branch 'release/0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
szaghi committed Jan 26, 2017
2 parents d5265fa + 87fed69 commit bad0507
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 46 deletions.
33 changes: 25 additions & 8 deletions src/lib/concrete_objects/wenoof_alpha_rec_m.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module wenoof_alpha_rec_m
!< 2005, vol. 207, pp. 542-567, doi:10.1016/j.jcp.2005.01.023

#ifdef r16p
use penf, only: I_P, RPP=>R16P
use penf, only: I_P, RPP=>R16P, str
#else
use penf, only: I_P, RPP=>R8P
use penf, only: I_P, RPP=>R8P, str
#endif
use wenoof_alpha_object
use wenoof_alpha_rec_js
Expand Down Expand Up @@ -52,6 +52,10 @@ subroutine create(self, constructor)

call self%destroy
call self%create_(constructor=constructor)
allocate(self%values(1:2, 0:self%S - 1))
allocate(self%values_sum(1:2))
self%values = 0._RPP
self%values_sum = 0._RPP
select type(constructor)
type is(alpha_rec_m_constructor)
if (allocated(constructor%base_type)) then
Expand Down Expand Up @@ -95,20 +99,33 @@ pure subroutine compute(self, beta, kappa)

pure function description(self) result(string)
!< Return alpha string-descripition.
class(alpha_rec_m), intent(in) :: self !< Alpha.
character(len=:), allocatable :: string !< String-description.
class(alpha_rec_m), intent(in) :: self !< Alpha.
character(len=:), allocatable :: string !< String-description.
character(len=1), parameter :: nl=new_line('a') !< New line char.

#ifndef DEBUG
! error stop in pure procedure is a F2015 feature not yet supported in debug mode
error stop 'alpha_rec_m%description to be implemented, do not use!'
#endif
string = ' Henrick alpha coefficients for reconstructor:'//nl
string = string//' - S = '//trim(str(self%S))//nl
string = string//' - f1 = '//trim(str(self%f1))//nl
string = string//' - f2 = '//trim(str(self%f2))//nl
string = string//' - ff = '//trim(str(self%ff))//nl
string = string//' - eps = '//trim(str(self%eps))//nl
associate(alpha_base=>self%alpha_base)
select type(alpha_base)
type is(alpha_rec_js)
string = string//' - base-mapped-alpha type = Jiang-Shu'
type is(alpha_rec_z)
string = string//' - base-mapped-alpha type = Bogeg'
endselect
endassociate
endfunction description

elemental subroutine destroy(self)
!< Destroy alpha.
class(alpha_rec_m), intent(inout) :: self !< Alpha.

call self%destroy_
if (allocated(self%values)) deallocate(self%values)
if (allocated(self%values_sum)) deallocate(self%values_sum)
if (allocated(self%alpha_base)) deallocate(self%alpha_base)
endsubroutine destroy
endmodule wenoof_alpha_rec_m
26 changes: 18 additions & 8 deletions src/lib/concrete_objects/wenoof_alpha_rec_z.F90
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module wenoof_alpha_rec_z
!< vol. 227, pp. 3191-3211, doi: 10.1016/j.jcp.2007.11.038.

#ifdef r16p
use penf, only: I_P, RPP=>R16P
use penf, only: I_P, RPP=>R16P, str
#else
use penf, only: I_P, RPP=>R8P
use penf, only: I_P, RPP=>R8P, str
#endif
use wenoof_alpha_object
use wenoof_base_object
Expand Down Expand Up @@ -47,6 +47,10 @@ subroutine create(self, constructor)

call self%destroy
call self%create_(constructor=constructor)
allocate(self%values(1:2, 0:self%S - 1))
allocate(self%values_sum(1:2))
self%values = 0._RPP
self%values_sum = 0._RPP
endsubroutine create

pure subroutine compute(self, beta, kappa)
Expand All @@ -68,20 +72,26 @@ pure subroutine compute(self, beta, kappa)

pure function description(self) result(string)
!< Return alpha string-descripition.
class(alpha_rec_z), intent(in) :: self !< Alpha coefficients.
character(len=:), allocatable :: string !< String-description.
class(alpha_rec_z), intent(in) :: self !< Alpha coefficients.
character(len=:), allocatable :: string !< String-description.
character(len=1), parameter :: nl=new_line('a') !< New line char.

string = ' Borges alpha coefficients for reconstructor:'//nl
string = string//' - S = '//trim(str(self%S))//nl
string = string//' - f1 = '//trim(str(self%f1))//nl
string = string//' - f2 = '//trim(str(self%f2))//nl
string = string//' - ff = '//trim(str(self%ff))//nl
string = string//' - eps = '//trim(str(self%eps))

#ifndef DEBUG
! error stop in pure procedure is a F2015 feature not yet supported in debug mode
error stop 'alpha_rec_z%description to be implemented, do not use!'
#endif
endfunction description

elemental subroutine destroy(self)
!< Destroy alpha.
class(alpha_rec_z), intent(inout) :: self !< Alpha.

call self%destroy_
if (allocated(self%values)) deallocate(self%values)
if (allocated(self%values_sum)) deallocate(self%values_sum)
endsubroutine destroy

! private non TBP
Expand Down
53 changes: 28 additions & 25 deletions src/lib/concrete_objects/wenoof_weights_js.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ module wenoof_weights_js
use wenoof_alpha_rec_m
use wenoof_alpha_rec_z
use wenoof_base_object
use wenoof_beta_factory
use wenoof_beta_object
use wenoof_beta_rec_js
use wenoof_kappa_factory
use wenoof_kappa_object
use wenoof_kappa_rec_js
use wenoof_weights_object
Expand Down Expand Up @@ -61,7 +63,9 @@ subroutine create(self, constructor)
!< Create reconstructor.
class(weights_js), intent(inout) :: self !< Weights.
class(base_object_constructor), intent(in) :: constructor !< Constructor.
type(alpha_factory) :: factory !< Objects factory.
type(alpha_factory) :: a_factory !< Alpha factory.
type(beta_factory) :: b_factory !< Beta factory.
type(kappa_factory) :: k_factory !< Kappa factory.

call self%destroy
call self%create_(constructor=constructor)
Expand All @@ -73,30 +77,29 @@ subroutine create(self, constructor)
beta_constructor=>constructor%beta_constructor, &
kappa_constructor=>constructor%kappa_constructor)

select type(alpha_constructor)
type is(alpha_rec_js_constructor)
! allocate(alpha_rec_js :: self%alpha)
! call self%alpha%create(constructor=alpha_constructor)
call factory%create(constructor=alpha_constructor, object=self%alpha)
type is(alpha_rec_m_constructor)
! @TODO implement this
error stop 'alpha_rec_m to be implemented'
type is(alpha_rec_z_constructor)
! @TODO implement this
error stop 'alpha_rec_z to be implemented'
endselect

select type(beta_constructor)
type is(beta_rec_js_constructor)
allocate(beta_rec_js :: self%beta)
call self%beta%create(constructor=beta_constructor)
endselect

select type(kappa_constructor)
type is(kappa_rec_js_constructor)
allocate(kappa_rec_js :: self%kappa)
call self%kappa%create(constructor=kappa_constructor)
endselect
call a_factory%create(constructor=alpha_constructor, object=self%alpha)
! select type(alpha_constructor)
! type is(alpha_rec_js_constructor)
! call factory%create(constructor=alpha_constructor, object=self%alpha)
! type is(alpha_rec_m_constructor)
! call factory%create(constructor=alpha_constructor, object=self%alpha)
! type is(alpha_rec_z_constructor)
! call factory%create(constructor=alpha_constructor, object=self%alpha)
! endselect

call b_factory%create(constructor=beta_constructor, object=self%beta)
! select type(beta_constructor)
! type is(beta_rec_js_constructor)
! allocate(beta_rec_js :: self%beta)
! call self%beta%create(constructor=beta_constructor)
! endselect

call k_factory%create(constructor=kappa_constructor, object=self%kappa)
! select type(kappa_constructor)
! type is(kappa_rec_js_constructor)
! allocate(kappa_rec_js :: self%kappa)
! call self%kappa%create(constructor=kappa_constructor)
! endselect
endassociate
endselect
endsubroutine create
Expand Down
14 changes: 14 additions & 0 deletions src/lib/factories/wenoof_alpha_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face
error stop 'interpolator-JS to be implemented'
case('reconstructor-JS')
allocate(alpha_rec_js_constructor :: constructor)
case('reconstructor-M-JS')
allocate(alpha_rec_m_constructor :: constructor)
select type(constructor)
type is(alpha_rec_m_constructor)
constructor%base_type = 'JS'
endselect
case('reconstructor-M-Z')
allocate(alpha_rec_m_constructor :: constructor)
select type(constructor)
type is(alpha_rec_m_constructor)
constructor%base_type = 'Z'
endselect
case('reconstructor-Z')
allocate(alpha_rec_z_constructor :: constructor)
endselect
call constructor%create(S=S, face_left=face_left, face_right=face_right, eps=eps)
endsubroutine create_constructor
Expand Down
6 changes: 6 additions & 0 deletions src/lib/factories/wenoof_beta_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face
error stop 'interpolator-JS to be implemented'
case('reconstructor-JS')
allocate(beta_rec_js_constructor :: constructor)
case('reconstructor-M-JS')
allocate(beta_rec_js_constructor :: constructor)
case('reconstructor-M-Z')
allocate(beta_rec_js_constructor :: constructor)
case('reconstructor-Z')
allocate(beta_rec_js_constructor :: constructor)
endselect
call constructor%create(S=S, face_left=face_left, face_right=face_right)
endsubroutine create_constructor
Expand Down
6 changes: 6 additions & 0 deletions src/lib/factories/wenoof_interpolations_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ subroutine create_constructor(interpolator_type, S, constructor, face_left, face
error stop 'interpolator-JS to be implemented'
case('reconstructor-JS')
allocate(interpolations_rec_js_constructor :: constructor)
case('reconstructor-M-JS')
allocate(interpolations_rec_js_constructor :: constructor)
case('reconstructor-M-Z')
allocate(interpolations_rec_js_constructor :: constructor)
case('reconstructor-Z')
allocate(interpolations_rec_js_constructor :: constructor)
endselect
call constructor%create(S=S, face_left=face_left, face_right=face_right)
endsubroutine create_constructor
Expand Down
6 changes: 6 additions & 0 deletions src/lib/factories/wenoof_interpolator_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ subroutine create_constructor(interpolator_type, S, interpolations_constructor,
error stop 'interpolator-JS to be implemented'
case('reconstructor-JS')
allocate(reconstructor_js_constructor :: constructor)
case('reconstructor-M-JS')
allocate(reconstructor_js_constructor :: constructor)
case('reconstructor-M-Z')
allocate(reconstructor_js_constructor :: constructor)
case('reconstructor-Z')
allocate(reconstructor_js_constructor :: constructor)
endselect
call constructor%create(S=S, face_left=face_left, face_right=face_right)
select type(constructor)
Expand Down
6 changes: 6 additions & 0 deletions src/lib/factories/wenoof_kappa_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ subroutine create_constructor(interpolator_type, S, constructor)
error stop 'interpolator-JS to be implemented'
case('reconstructor-JS')
allocate(kappa_rec_js_constructor :: constructor)
case('reconstructor-M-JS')
allocate(kappa_rec_js_constructor :: constructor)
case('reconstructor-M-Z')
allocate(kappa_rec_js_constructor :: constructor)
case('reconstructor-Z')
allocate(kappa_rec_js_constructor :: constructor)
endselect
call constructor%create(S=S)
endsubroutine create_constructor
Expand Down
6 changes: 6 additions & 0 deletions src/lib/factories/wenoof_weights_factory.f90
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ subroutine create_constructor(interpolator_type, S, alpha_constructor, beta_cons
error stop 'interpolator-JS to be implemented'
case('reconstructor-JS')
allocate(weights_js_constructor :: constructor)
case('reconstructor-M-JS')
allocate(weights_js_constructor :: constructor)
case('reconstructor-M-Z')
allocate(weights_js_constructor :: constructor)
case('reconstructor-Z')
allocate(weights_js_constructor :: constructor)
endselect
call constructor%create(S=S, face_left=face_left, face_right=face_right)
select type(constructor)
Expand Down
12 changes: 7 additions & 5 deletions src/tests/sin_reconstruction.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ module test_module
private
public :: test

character(99), parameter :: interpolators(1:4) = ["all ", &
"reconstructor-JS", &
"JS-Z ", &
"JS-M "] !< List of available interpolators.
character(99), parameter :: interpolators(1:5) = ["all ", &
"reconstructor-JS ", &
"reconstructor-M-JS", &
"reconstructor-M-Z ", &
"reconstructor-Z "] !< List of available interpolators.
real(RPP), parameter :: pi = 4._RPP * atan(1._RPP) !< Pi greek.

type :: solution_data
Expand Down Expand Up @@ -185,7 +186,8 @@ subroutine set_cli()
"sin_reconstruction --interpolator JS-M ", &
"sin_reconstruction --interpolator all -p -r "])
call cli%add(switch='--interpolator', switch_ab='-i', help='WENO interpolator type', required=.false., &
def='reconstructor-JS', act='store', choices='all,reconstructor-JS')
def='reconstructor-JS', act='store', &
choices='all,reconstructor-JS,reconstructor-M-JS,reconstructor-M-Z,reconstructor-Z')
call cli%add(switch='--points_number', switch_ab='-pn', nargs='+', help='Number of points used to discretize the domain', &
required=.false., act='store', def='50 100')
call cli%add(switch='--stencils', switch_ab='-s', nargs='+', help='Stencils dimensions (and number)', &
Expand Down

0 comments on commit bad0507

Please sign in to comment.