Skip to content

Commit

Permalink
merge interpolation branch
Browse files Browse the repository at this point in the history
  • Loading branch information
szaghi committed Apr 7, 2017
2 parents 9cb4943 + 497dd85 commit 05b307f
Show file tree
Hide file tree
Showing 37 changed files with 5,487 additions and 806 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
*.dat
*.png

# gdb history
.gdb_history

# special directories
doc/html/
exe/
Expand All @@ -37,3 +40,4 @@ references/
shared/
static/
wiki/
venv/
4 changes: 2 additions & 2 deletions fobos
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ help = Perform coverage analysis
rule_1 = FoBiS.py clean -mode tests-gnu
rule_2 = FoBiS.py build -mode tests-gnu -coverage
rule_3 = ./scripts/run_tests.sh
rule_4 = rm -f exe/obj/penf* exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/vecfor*
rule_4 = rm -f exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/foreseer* exe/obj/penf* exe/obj/pyplot* exe/obj/vecfor*
rule_5 = gcov -o exe/obj/ src/lib/wenoof*
rule_6 = rm -f *.gcov

Expand All @@ -245,7 +245,7 @@ help = Perform coverage analysis and saving reports in markdown
rule_1 = FoBiS.py clean -mode tests-gnu
rule_2 = FoBiS.py build -mode tests-gnu -coverage
rule_3 = ./scripts/run_tests.sh
rule_4 = rm -f exe/obj/penf* exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/vecfor*
rule_4 = rm -f exe/obj/face* exe/obj/flap* exe/obj/flow* exe/obj/foodie* exe/obj/foreseer* exe/obj/penf* exe/obj/pyplot* exe/obj/vecfor*
rule_5 = gcov -o exe/obj/ src/lib/wenoof*
rule_6 = FoBiS.py rule -gcov_analyzer wiki/ Coverage-Analysis
rule_7 = rm -f *.gcov
6 changes: 4 additions & 2 deletions src/lib/abstract_objects/wenoof_alpha_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ module wenoof_alpha_object

type, extends(base_object), abstract :: alpha_object
!< Abstract alpha (non linear weights) object.
real(RPP), allocatable :: values(:,:) !< Alpha coefficients [1:2,0:S-1].
real(RPP), allocatable :: values_sum(:) !< Sum of alpha coefficients [1:2].
real(RPP), allocatable :: values_rank_1(:) !< Alpha values [0:S-1].
real(RPP) :: values_sum_rank_1 !< Sum of alpha coefficients.
real(RPP), allocatable :: values_rank_2(:,:) !< Alpha values [1:2,0:S-1].
real(RPP), allocatable :: values_sum_rank_2(:) !< Sum of alpha coefficients [1:2].
contains
! public deferred methods
procedure(compute_interface), pass(self), deferred :: compute !< Compute alpha.
Expand Down
21 changes: 1 addition & 20 deletions src/lib/abstract_objects/wenoof_base_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ module wenoof_base_object
type, abstract :: base_object_constructor
!< Abstract base object constructor.
integer(I_P) :: S=0_I_P !< Stencils dimension.
logical :: face_left=.true. !< Activate left-face interpolation computation.
logical :: face_right=.true. !< Activate right-face interpolation computation.
real(RPP) :: eps=EPS_DEF !< Small epsilon to avoid division by zero.
contains
procedure, pass(self) :: create => create_base_object_constructor
Expand All @@ -32,9 +30,6 @@ module wenoof_base_object
!<
!< Define a minimal, base, object that is used as ancestor of all objects, e.g. smoothness indicator, optimal weights, etc...
integer(I_P) :: S=0_I_P !< Stencils dimension.
integer(I_P) :: f1=1_I_P !< Lower bound of faces index.
integer(I_P) :: f2=2_I_P !< Upper bound of faces index.
integer(I_P) :: ff=0_I_P !< Offset (step) of faces index.
real(RPP) :: eps=EPS_DEF !< Small epsilon to avoid division by zero.
contains
! public deferred methods
Expand Down Expand Up @@ -75,17 +70,13 @@ elemental subroutine destroy_interface(self)
! base object constructor

! public methods
subroutine create_base_object_constructor(self, S, face_left, face_right, eps)
subroutine create_base_object_constructor(self, S, eps)
!< Create alpha constructor.
class(base_object_constructor), intent(inout) :: self !< Constructor.
integer(I_P), intent(in) :: S !< Stencils dimension.
logical, intent(in), optional :: face_left !< Activate left-face interpolations.
logical, intent(in), optional :: face_right !< Activate right-face interpolations.
real(RPP), intent(in), optional :: eps !< Small epsilon to avoid division by zero.

self%S = S
if (present(face_left)) self%face_left = face_left
if (present(face_right)) self%face_right = face_right
if (present(eps)) self%eps = eps
endsubroutine create_base_object_constructor

Expand All @@ -101,13 +92,6 @@ subroutine create_(self, constructor)
select type(constructor)
class is(base_object_constructor)
self%S = constructor%S
if (constructor%face_left.and.constructor%face_right) then
self%f1 = 1_I_P; self%f2 = 2_I_P; self%ff = 0_I_P
elseif (constructor%face_left) then
self%f1 = 1_I_P; self%f2 = 1_I_P; self%ff = 0_I_P
elseif (constructor%face_right) then
self%f1 = 2_I_P; self%f2 = 2_I_P; self%ff = -1_I_P
endif
self%eps = constructor%eps
endselect
endsubroutine create_
Expand All @@ -117,9 +101,6 @@ elemental subroutine destroy_(self)
class(base_object), intent(inout) :: self !< Object.

self%S = 0_I_P
self%f1 = 1_I_P
self%f2 = 2_I_P
self%ff = 0_I_P
self%eps = EPS_DEF
endsubroutine destroy_
endmodule wenoof_base_object
21 changes: 16 additions & 5 deletions src/lib/abstract_objects/wenoof_beta_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,31 @@ module wenoof_beta_object

type, extends(base_object), abstract :: beta_object
!< Abstract Beta coefficients (smoothness indicators of stencil interpolations) object.
real(RPP), allocatable :: values(:,:) !< Beta values [1:2,0:S-1].
real(RPP), allocatable :: values_rank_1(:) !< Beta values [0:S-1].
real(RPP), allocatable :: values_rank_2(:,:) !< Beta values [1:2,0:S-1].
contains
! public deferred methods
procedure(compute_interface), pass(self), deferred :: compute !< Compute beta.
! public methods
generic :: compute => compute_with_stencil_of_rank_1, compute_with_stencil_of_rank_2
! deferred public methods
procedure(compute_with_stencil_of_rank_1_interface), pass(self), deferred :: compute_with_stencil_of_rank_1!< Compute beta.
procedure(compute_with_stencil_of_rank_2_interface), pass(self), deferred :: compute_with_stencil_of_rank_2!< Compute beta.
endtype beta_object

abstract interface
!< Abstract interfaces of [[beta_object]].
pure subroutine compute_interface(self, stencil)
pure subroutine compute_with_stencil_of_rank_1_interface(self, stencil)
!< Compute beta.
import :: beta_object, RPP
class(beta_object), intent(inout) :: self !< Beta.
real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S].
endsubroutine compute_with_stencil_of_rank_1_interface

pure subroutine compute_with_stencil_of_rank_2_interface(self, stencil)
!< Compute beta.
import :: beta_object, RPP
class(beta_object), intent(inout) :: self !< Beta.
real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S].
endsubroutine compute_interface
endsubroutine compute_with_stencil_of_rank_2_interface
endinterface

endmodule wenoof_beta_object
23 changes: 18 additions & 5 deletions src/lib/abstract_objects/wenoof_interpolations_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,37 @@ module wenoof_interpolations_object

type, extends(base_object_constructor), abstract :: interpolations_object_constructor
!< Abstract interpolations object constructor.
real(RPP), allocatable :: stencil(:) !< Stencil used for interpolation, [1-S:S-1].
real(RPP) :: x_target !< Coordinate of the interpolation point.
endtype interpolations_object_constructor

type, extends(base_object), abstract :: interpolations_object
!< Abstract interpolations object.
real(RPP), allocatable :: values(:,:) !< Stencil interpolations values [1:2,0:S-1].
real(RPP), allocatable :: values_rank_1(:) !< Stencil interpolations values [0:S-1].
real(RPP), allocatable :: values_rank_2(:,:) !< Stencil interpolations values [1:2,0:S-1].
contains
! public deferred methods
procedure(compute_interface), pass(self), deferred :: compute !< Compute beta.
! public methods
generic :: compute => compute_with_stencil_of_rank_1, compute_with_stencil_of_rank_2
! deferred public methods
procedure(compute_with_stencil_of_rank_1_interface), pass(self), deferred :: compute_with_stencil_of_rank_1!< Compute interp.
procedure(compute_with_stencil_of_rank_2_interface), pass(self), deferred :: compute_with_stencil_of_rank_2!< Compute interp.
endtype interpolations_object

abstract interface
!< Abstract interfaces of [[interpolations_object]].
pure subroutine compute_interface(self, stencil)
pure subroutine compute_with_stencil_of_rank_1_interface(self, stencil)
!< Compute interpolations.
import :: interpolations_object, RPP
class(interpolations_object), intent(inout) :: self !< Interpolations.
real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S].
endsubroutine compute_with_stencil_of_rank_1_interface

pure subroutine compute_with_stencil_of_rank_2_interface(self, stencil)
!< Compute interpolations.
import :: interpolations_object, RPP
class(interpolations_object), intent(inout) :: self !< Interpolations.
real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S].
endsubroutine compute_interface
endsubroutine compute_with_stencil_of_rank_2_interface
endinterface

endmodule wenoof_interpolations_object
41 changes: 33 additions & 8 deletions src/lib/abstract_objects/wenoof_interpolator_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,57 @@ module wenoof_interpolator_object
class(interpolations_object), allocatable :: interpolations !< Stencil interpolations.
class(weights_object), allocatable :: weights !< Weights of interpolations.
contains
! public deferred methods
procedure(interpolate_debug_interface), pass(self), deferred :: interpolate_debug !< Interpolate values, debug mode.
procedure(interpolate_standard_interface), pass(self), deferred :: interpolate_standard !< Interpolate values, standard mode.
! public methods
generic :: interpolate => interpolate_standard, interpolate_debug !< Interpolate values.
generic :: interpolate => interpolate_with_stencil_of_rank_1_debug, interpolate_with_stencil_of_rank_2_debug, &
interpolate_with_stencil_of_rank_1_standard, interpolate_with_stencil_of_rank_2_standard
! public deferred methods
procedure(interpolate_with_stencil_of_rank_1_debug_interface), pass(self), &
deferred :: interpolate_with_stencil_of_rank_1_debug
procedure(interpolate_with_stencil_of_rank_2_debug_interface), pass(self), &
deferred :: interpolate_with_stencil_of_rank_2_debug
procedure(interpolate_with_stencil_of_rank_1_standard_interface), pass(self), &
deferred :: interpolate_with_stencil_of_rank_1_standard
procedure(interpolate_with_stencil_of_rank_2_standard_interface), pass(self), &
deferred :: interpolate_with_stencil_of_rank_2_standard
endtype interpolator_object

abstract interface
!< Abstract interfaces of [[interpolator_object]].
pure subroutine interpolate_debug_interface(self, stencil, interpolation, si, weights)
pure subroutine interpolate_with_stencil_of_rank_1_debug_interface(self, stencil, interpolation, si, weights)
!< Interpolate values (providing also debug values).
import :: interpolator_object, RPP
class(interpolator_object), intent(inout) :: self !< Interpolator.
real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1-S:-1+S].
real(RPP), intent(out) :: interpolation !< Result of the interpolation.
real(RPP), intent(out) :: si(0:) !< Computed values of smoothness indicators [0:S-1].
real(RPP), intent(out) :: weights(0:) !< Weights of the stencils, [0:S-1].
endsubroutine interpolate_with_stencil_of_rank_1_debug_interface

pure subroutine interpolate_with_stencil_of_rank_2_debug_interface(self, stencil, interpolation, si, weights)
!< Interpolate values (providing also debug values).
import :: interpolator_object, RPP
class(interpolator_object), intent(inout) :: self !< Interpolator.
real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S].
real(RPP), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2].
real(RPP), intent(out) :: si(1:, 0:) !< Computed values of smoothness indicators [1:2, 0:S-1].
real(RPP), intent(out) :: weights(1:, 0:) !< Weights of the stencils, [1:2, 0:S-1].
endsubroutine interpolate_debug_interface
endsubroutine interpolate_with_stencil_of_rank_2_debug_interface

pure subroutine interpolate_with_stencil_of_rank_1_standard_interface(self, stencil, interpolation)
!< Interpolate values (without providing debug values).
import :: interpolator_object, RPP
class(interpolator_object), intent(inout) :: self !< Interpolator.
real(RPP), intent(in) :: stencil(1 - self%S:) !< Stencil of the interpolation [1-S:-1+S].
real(RPP), intent(out) :: interpolation !< Result of the interpolation.
endsubroutine interpolate_with_stencil_of_rank_1_standard_interface

pure subroutine interpolate_standard_interface(self, stencil, interpolation)
pure subroutine interpolate_with_stencil_of_rank_2_standard_interface(self, stencil, interpolation)
!< Interpolate values (without providing debug values).
import :: interpolator_object, RPP
class(interpolator_object), intent(inout) :: self !< Interpolator.
real(RPP), intent(in) :: stencil(1:, 1 - self%S:) !< Stencil of the interpolation [1:2, 1-S:-1+S].
real(RPP), intent(out) :: interpolation(1:) !< Result of the interpolation, [1:2].
endsubroutine interpolate_standard_interface
endsubroutine interpolate_with_stencil_of_rank_2_standard_interface
endinterface

endmodule wenoof_interpolator_object
30 changes: 22 additions & 8 deletions src/lib/abstract_objects/wenoof_kappa_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module wenoof_kappa_object
!< Abstract Kappa (optimal, linear weights of stencil interpolations) object.

#ifdef r16p
use penf, only: RPP=>R16P
use penf, only: I_P, RPP=>R16P
#else
use penf, only: RPP=>R8P
use penf, only: I_P, RPP=>R8P
#endif
use wenoof_base_object

Expand All @@ -16,23 +16,37 @@ module wenoof_kappa_object

type, extends(base_object_constructor), abstract :: kappa_object_constructor
!< Abstract kappa object constructor.
real(RPP), allocatable :: stencil(:) !< Stencil used for interpolation, [1-S:S-1].
real(RPP) :: x_target !< Coordinate of the interpolation point.
endtype kappa_object_constructor

type, extends(base_object), abstract :: kappa_object
!< Kappa (optimal, linear weights of stencil interpolations) object.
real(RPP), allocatable :: values(:,:) !< Kappa coefficients values [1:2,0:S-1].
real(RPP), allocatable :: values_rank_1(:) !< Kappa coefficients values [0:S-1].
real(RPP), allocatable :: values_rank_2(:,:) !< Kappa coefficients values [1:2,0:S-1].
contains
! public deferred methods
procedure(compute_interface), pass(self), deferred :: compute !< Compute kappa.
! public methods
generic :: compute => compute_kappa_rec, compute_kappa_int
! deferred public methods
procedure(compute_kappa_rec_interface), pass(self), deferred :: compute_kappa_rec!< Compute interp.
procedure(compute_kappa_int_interface), pass(self), deferred :: compute_kappa_int!< Compute interp.
endtype kappa_object

abstract interface
!< Abstract interfaces of [[kappa_object]].
pure subroutine compute_interface(self)
pure subroutine compute_kappa_rec_interface(self)
!< Compute kappa.
import :: kappa_object
class(kappa_object), intent(inout) :: self !< Kappa.
endsubroutine compute_interface
class(kappa_object), intent(inout) :: self !< Kappa.
endsubroutine compute_kappa_rec_interface

pure subroutine compute_kappa_int_interface(self, stencil, x_target)
!< Compute kappa.
import :: kappa_object, I_P, RPP
class(kappa_object), intent(inout) :: self !< Kappa.
real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for interpolation, [1-S:S-1].
real(RPP), intent(in) :: x_target !< Coordinate of the interpolation point.
endsubroutine compute_kappa_int_interface
endinterface

endmodule wenoof_kappa_object
38 changes: 29 additions & 9 deletions src/lib/abstract_objects/wenoof_weights_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,48 @@ module wenoof_weights_object

type, extends(base_object), abstract :: weights_object
!< Weights of stencil interpolations object.
real(RPP), allocatable :: values(:,:) !< Weights values of stencil interpolations [1:2,0:S-1].
real(RPP), allocatable :: values_rank_1(:) !< Weights values of stencil interpolations [0:S-1].
real(RPP), allocatable :: values_rank_2(:,:) !< Weights values of stencil interpolations [1:2,0:S-1].
contains
! public methods
generic :: compute => compute_with_stencil_of_rank_1, compute_with_stencil_of_rank_2
generic :: smoothness_indicators => smoothness_indicators_of_rank_1, smoothness_indicators_of_rank_2
! deferred public methods
procedure(compute_interface), pass(self), deferred :: compute !< Compute weights.
procedure(smoothness_indicators_interface), pass(self), deferred :: smoothness_indicators !< Return smoothness indicators.
procedure(compute_with_stencil_of_rank_1_interface), pass(self), deferred :: compute_with_stencil_of_rank_1 !< Compute beta.
procedure(compute_with_stencil_of_rank_2_interface), pass(self), deferred :: compute_with_stencil_of_rank_2 !< Compute beta.
procedure(smoothness_indicators_of_rank_1_interface), pass(self), deferred :: smoothness_indicators_of_rank_1 !< Return IS.
procedure(smoothness_indicators_of_rank_2_interface), pass(self), deferred :: smoothness_indicators_of_rank_2 !< Return IS.
endtype weights_object

abstract interface
!< Abstract interfaces of [[weights_object]].
pure subroutine compute_interface(self, stencil)
pure subroutine compute_with_stencil_of_rank_1_interface(self, stencil)
!< Compute beta.
import :: weights_object, RPP
class(weights_object), intent(inout) :: self !< Weights.
real(RPP), intent(in) :: stencil(1-self%S:) !< Stencil used for the interpolation, [1-S:-1+S].
endsubroutine compute_with_stencil_of_rank_1_interface

pure subroutine compute_with_stencil_of_rank_2_interface(self, stencil)
!< Compute beta.
import :: weights_object, RPP
class(weights_object), intent(inout) :: self !< Weights.
real(RPP), intent(in) :: stencil(1:,1-self%S:) !< Stencil used for the interpolation, [1:2, 1-S:-1+S].
endsubroutine compute_interface
endsubroutine compute_with_stencil_of_rank_2_interface

pure subroutine smoothness_indicators_of_rank_1_interface(self, si)
!< Return smoothness indicators.
import :: weights_object, RPP
class(weights_object), intent(in) :: self !< Weights.
real(RPP), intent(out) :: si(:) !< Smoothness indicators.
endsubroutine smoothness_indicators_of_rank_1_interface

pure function smoothness_indicators_interface(self) result(si)
pure subroutine smoothness_indicators_of_rank_2_interface(self, si)
!< Return smoothness indicators.
import :: weights_object, RPP
class(weights_object), intent(in) :: self !< Weights.
real(RPP), allocatable :: si(:,:) !< Smoothness indicators.
endfunction smoothness_indicators_interface
class(weights_object), intent(in) :: self !< Weights.
real(RPP), intent(out) :: si(:,:) !< Smoothness indicators.
endsubroutine smoothness_indicators_of_rank_2_interface
endinterface

endmodule wenoof_weights_object
Loading

0 comments on commit 05b307f

Please sign in to comment.