wenoof_alpha_coefficients.F90 Source File

Abstract alpha coefficients object.

This File Depends On

sourcefile~~wenoof_alpha_coefficients.f90~~EfferentGraph sourcefile~wenoof_alpha_coefficients.f90 wenoof_alpha_coefficients.F90 sourcefile~penf.f90 penf.F90 sourcefile~penf.f90->sourcefile~wenoof_alpha_coefficients.f90 sourcefile~wenoof_base_object.f90 wenoof_base_object.f90 sourcefile~wenoof_base_object.f90->sourcefile~wenoof_alpha_coefficients.f90 sourcefile~penf_b_size.f90 penf_b_size.F90 sourcefile~penf_b_size.f90->sourcefile~penf.f90 sourcefile~penf_stringify.f90 penf_stringify.F90 sourcefile~penf_b_size.f90->sourcefile~penf_stringify.f90 sourcefile~penf_global_parameters_variables.f90 penf_global_parameters_variables.F90 sourcefile~penf_global_parameters_variables.f90->sourcefile~penf.f90 sourcefile~penf_global_parameters_variables.f90->sourcefile~penf_b_size.f90 sourcefile~penf_global_parameters_variables.f90->sourcefile~penf_stringify.f90 sourcefile~penf_stringify.f90->sourcefile~penf.f90
Help

Files Dependent On This One

sourcefile~~wenoof_alpha_coefficients.f90~~AfferentGraph sourcefile~wenoof_alpha_coefficients.f90 wenoof_alpha_coefficients.F90 sourcefile~wenoof_alpha_coefficients_z.f90 wenoof_alpha_coefficients_z.f90 sourcefile~wenoof_alpha_coefficients.f90->sourcefile~wenoof_alpha_coefficients_z.f90 sourcefile~wenoof_interpolator_js.f90 wenoof_interpolator_js.f90 sourcefile~wenoof_alpha_coefficients.f90->sourcefile~wenoof_interpolator_js.f90 sourcefile~wenoof_interpolator.f90 wenoof_interpolator.F90 sourcefile~wenoof_alpha_coefficients.f90->sourcefile~wenoof_interpolator.f90 sourcefile~wenoof_objects_factory.f90 wenoof_objects_factory.f90 sourcefile~wenoof_alpha_coefficients.f90->sourcefile~wenoof_objects_factory.f90 sourcefile~wenoof_alpha_coefficients_m.f90 wenoof_alpha_coefficients_m.f90 sourcefile~wenoof_alpha_coefficients.f90->sourcefile~wenoof_alpha_coefficients_m.f90 sourcefile~wenoof.f90 wenoof.f90 sourcefile~wenoof_alpha_coefficients.f90->sourcefile~wenoof.f90 sourcefile~wenoof_alpha_coefficients_js.f90 wenoof_alpha_coefficients_js.f90 sourcefile~wenoof_alpha_coefficients.f90->sourcefile~wenoof_alpha_coefficients_js.f90 sourcefile~wenoof_alpha_coefficients_z.f90->sourcefile~wenoof_interpolator_js.f90 sourcefile~wenoof_alpha_coefficients_z.f90->sourcefile~wenoof_objects_factory.f90 sourcefile~wenoof_alpha_coefficients_z.f90->sourcefile~wenoof_alpha_coefficients_m.f90 sourcefile~wenoof_alpha_coefficients_z.f90->sourcefile~wenoof.f90 sourcefile~wenoof_interpolator_js.f90->sourcefile~wenoof.f90 sourcefile~wenoof_interpolator.f90->sourcefile~wenoof_interpolator_js.f90 sourcefile~wenoof_interpolator.f90->sourcefile~wenoof.f90 sourcefile~wenoof_objects_factory.f90->sourcefile~wenoof_interpolator.f90 sourcefile~wenoof_alpha_coefficients_m.f90->sourcefile~wenoof_interpolator_js.f90 sourcefile~wenoof_alpha_coefficients_m.f90->sourcefile~wenoof_objects_factory.f90 sourcefile~wenoof_alpha_coefficients_m.f90->sourcefile~wenoof.f90 sourcefile~sin_reconstruction.f90 sin_reconstruction.f90 sourcefile~wenoof.f90->sourcefile~sin_reconstruction.f90 sourcefile~wenoof_alpha_coefficients_js.f90->sourcefile~wenoof_interpolator_js.f90 sourcefile~wenoof_alpha_coefficients_js.f90->sourcefile~wenoof_objects_factory.f90 sourcefile~wenoof_alpha_coefficients_js.f90->sourcefile~wenoof_alpha_coefficients_m.f90 sourcefile~wenoof_alpha_coefficients_js.f90->sourcefile~wenoof.f90
Help


Source Code

!< Abstract alpha coefficients object.
module wenoof_alpha_coefficients
!< Abstract alpha coefficients object.

use penf, only : I_P, R_P
use wenoof_base_object

implicit none
private
public :: alpha_coefficients
public :: alpha_coefficients_constructor

type, extends(base_object_constructor) :: alpha_coefficients_constructor
  !< Abstract alpha coefficients object constructor.
  integer(I_P) :: S = 0 !< Stencils dimension.
endtype alpha_coefficients_constructor

type, extends(base_object) :: alpha_coefficients
  !< Abstract alpha coefficients object.
  !<
  !< @note Do not implement any real alpha coefficient, but provide the interface for the different alpha coefficient implemented.
  real(R_P), allocatable :: alpha_coef(:,:) !< Alpha coefficients [1:2,0:S-1]
  real(R_P), allocatable :: alpha_tot(:)    !< Sum of alpha coefficients
  contains
    ! deferred public methods
    procedure, pass(self) :: compute     !< Compute alpha coefficients.
    procedure, nopass     :: description !< Return alpha coefficients string-description.
    ! public methods
    procedure, pass(self) :: create  !< Create alpha coefficients.
    procedure, pass(self) :: destroy !< Destroy alpha coefficients.
endtype alpha_coefficients

contains
  ! deferred public methods
  pure subroutine compute(self, S, weight_opt, IS, eps, f1, f2)
  !< Compute alpha coefficients.
  class(alpha_coefficients), intent(inout) :: self                   !< Alpha coefficients.
  integer(I_P),              intent(in)    :: S                      !< Number of stencils used.
  real(R_P),                 intent(in)    :: weight_opt(1:2, 0:S-1) !< Optimal weight of the stencil.
  real(R_P),                 intent(in)    :: IS(1:2, 0:S-1)         !< Smoothness indicators of the stencils.
  real(R_P),                 intent(in)    :: eps                    !< Parameter for avoiding divided by zero.
  integer(I_P),              intent(in)    :: f1, f2                 !< Faces to be computed.

#ifndef DEBUG
  ! error stop in pure procedure is a F2015 feature not yet supported in debug mode
  error stop 'alpha_coefficients%compute to be implemented by your concrete alpha coefficients object'
#endif
  endsubroutine compute

  pure function description() result(string)
  !< Return alpha coefficients string-description.
  character(len=:), allocatable  :: string !< String-description.

#ifndef DEBUG
  ! error stop in pure procedure is a F2015 feature not yet supported in debug mode
  error stop 'alpha_coefficients%description to be implemented by your concrete alpha coefficients object'
#endif
  endfunction description

  ! public methods
  pure subroutine create(self, constructor)
  !< Create alpha coefficients.
  class(alpha_coefficients),      intent(inout) :: self        !< Alpha coefficients.
  class(base_object_constructor), intent(in)    :: constructor !< Alpha coefficients constructor.

  call self%destroy
  select type(constructor)
  class is(alpha_coefficients_constructor)
    allocate(self%alpha_coef(1:2, 0:constructor%S - 1))
  class default
    ! @TODO add error handling
  endselect
  allocate(self%alpha_tot(1:2))
  self%alpha_coef = 0._R_P
  self%alpha_tot = 0._R_P
  endsubroutine create

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

  if (allocated(self%alpha_coef)) deallocate(self%alpha_coef)
  if (allocated(self%alpha_tot)) deallocate(self%alpha_tot)
  endsubroutine destroy
endmodule wenoof_alpha_coefficients