Constructor for a linear_interp_3d class.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(linear_interp_3d), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(:) | :: | x | ||
real(kind=wp), | intent(in), | dimension(:) | :: | y | ||
real(kind=wp), | intent(in), | dimension(:) | :: | z | ||
real(kind=wp), | intent(in), | dimension(:,:,:) | :: | f | ||
integer, | intent(out) | :: | istat |
|
pure subroutine initialize_3d(me,x,y,z,f,istat) implicit none class(linear_interp_3d),intent(inout) :: me real(wp),dimension(:),intent(in) :: x real(wp),dimension(:),intent(in) :: y real(wp),dimension(:),intent(in) :: z real(wp),dimension(:,:,:),intent(in) :: f integer,intent(out) :: istat !! `0` : no problems, !! `1` : `x` is not strictly increasing, !! `2` : `y` is not strictly increasing, !! `3` : `z` is not strictly increasing, !! `10` : `x` is not equal to size(f,1), !! `20` : `y` is not equal to size(f,2), !! `30` : `z` is not equal to size(f,3), !! `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 .and. size(y)/=size(f,2)) istat = 20 if (istat==0 .and. size(z)/=size(f,3)) istat = 30 if (istat==0) then call me%check_inputs(x=x,y=y,z=z,ierr=istat) if (istat==0) then allocate(me%f(size(x),size(y),size(z))); me%f = f allocate(me%x(size(x))); me%x = x allocate(me%y(size(y))); me%y = y allocate(me%z(size(z))); me%z = z me%initialized = .true. end if end if end subroutine initialize_3d