Constructor for a linear_interp_1d class.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(linear_interp_1d), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(:) | :: | x | ||
real(kind=wp), | intent(in), | dimension(:) | :: | f | ||
integer, | intent(out) | :: | istat |
|
pure subroutine initialize_1d(me,x,f,istat) implicit none class(linear_interp_1d),intent(inout) :: me real(wp),dimension(:),intent(in) :: x real(wp),dimension(:),intent(in) :: f integer,intent(out) :: istat !! `0` : no problems, !! `1` : `x` is not strictly increasing, !! `10` : `x` is not equal to size(f,1), !! `100` : cannot use linear interpolation for only one point. call me%destroy() istat = 0 if (istat==0 .and. size(x)/=size(f,1)) istat = 10 if (istat==0) then call me%check_inputs(x=x,ierr=istat) if (istat==0) then allocate(me%f(size(x))); me%f = f allocate(me%x(size(x))); me%x = x me%initialized = .true. end if end if end subroutine initialize_1d