forked from idies/turblib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDEMO_getCutoutf.f90
92 lines (74 loc) · 3 KB
/
DEMO_getCutoutf.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
! Copyright 2011 Johns Hopkins University
!
! Licensed under the Apache License, Version 2.0 (the "License");
! you may not use this file except in compliance with the License.
! You may obtain a copy of the License at
!
! http://www.apache.org/licenses/LICENSE-2.0
!
! Unless required by applicable law or agreed to in writing, software
! distributed under the License is distributed on an "AS IS" BASIS,
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
! See the License for the specific language governing permissions and
! limitations under the License.
program TurbTest
use, intrinsic :: iso_c_binding, only: c_ptr, c_int, c_float, c_f_pointer
implicit none
integer, parameter :: RP=4
character(*), parameter :: authtoken = 'edu.jhu.pha.turbulence.testing-201406' // CHAR(0)
character(1) :: field
integer, parameter :: time_step=1, x_start=1, y_start=10, z_start=1, x_end=2, y_end=11, z_end=2
integer, parameter :: x_step=1, y_step=1, z_step=1, filter_width=1
integer :: size, i
real(RP), allocatable :: result(:)
! Declare the return type of the turblib functions as integer.
! This is required for custom error handling (see the README).
integer :: getcutout
! return code
integer :: rc
! Formatting rules
character(*), parameter :: rawformat1='(i4,1(a,f10.6))'
!
! Intialize the gSOAP runtime.
! This is required before any WebService routines are called.
!
CALL soapinit()
! Enable exit on error. See README for details.
CALL turblibSetExitOnError(1)
print *, ".........getAnyCutoutWeb........."
print *, "......isotropic1024coarse u......";
field='u'
if (field=='u') then
size = (x_end-x_start+1) * (y_end-y_start+1) * (z_end-z_start+1)*3;
else if (field=='p') then
size = (x_end-x_start+1) * (y_end-y_start+1) * (z_end-z_start+1);
end if
allocate(result(size))
print *, field=='u', size
rc = getcutout (authtoken, "isotropic1024coarse", field, time_step, x_start, y_start, z_start, &
x_end, y_end, z_end, x_step, y_step, z_step, filter_width, result)
do i = 1, size
write(*,rawformat1) i, ': ', result(i)
end do
deallocate(result)
print *, ".........transition_bl p.........";
field='p'
if (field=='u') then
size = (x_end-x_start+1) * (y_end-y_start+1) * (z_end-z_start+1)*3;
else if (field=='p') then
size = (x_end-x_start+1) * (y_end-y_start+1) * (z_end-z_start+1);
end if
allocate(result(size))
print *, field=='p', size
rc = getcutout (authtoken, "transition_bl", field, time_step, x_start, y_start, z_start, &
x_end, y_end, z_end, x_step, y_step, z_step, filter_width, result)
do i = 1, size
write(*,rawformat1) i, ': ', result(i)
end do
deallocate(result)
!
! Destroy the gSOAP runtime.
! No more WebService routines may be called.
!
CALL soapdestroy()
end program TurbTest