CEP3
David Ketcheson edited this page Mar 19, 2015
·
1 revision
Status | Active |
Author | Kyle Mandli <kyle.mandli@gmail.com> |
Created | Nov. 5, 2014 |
Updated | March 19, 2015 |
Discussion | Riemann #92 |
Implementation |
Sometimes Riemann solvers need more information than is currently available inside the routine without resorting to common blocks or module variables which inevitably are not thread safe.
The proposed solution to this problem is to create a void *
like interface that would let arbitrary data be passed to the Riemann solver. rp_data
would be defined in each Riemann solver module and would utilized the iso_c_binding
module to accomplish the generic data type.
An example Riemann solver module using an rp_data
type would be defined as follows:
module rp1_advection
implicit none
type rp_type
real(kind=8) :: u
end type rp_type
contains
subroutine rp1_ptwise(num_eqn, num_waves, rp_data, q_l, q_r, aux_l, aux_r, wave, s, amdq, apdq)
use iso_c_binding, only: c_ptr
implicit none
...
type(c_ptr), intent(in out) :: rp_data
...
! Local type
type(rp_type), pointer :: rp_aux
call c_f_pointer(rp_data, rp_aux)
...
end subroutine rp1_ptwise
end module rp1_advection
This will clearly break backwards compatibility as the calling sequence will drastically change.
- See also the long discussion: https://groups.google.com/forum/?hl=en#!topic/claw-dev/7G67NxwzxsE.
- This proposal depends on accepting and implementing #89 first.
- This proposal is similar to #88.