Debian Codegraph @

src/read.f90

raw
1 module read_test
2 use readdata, only:select_data_format
3 use getdata, only:get_data, get_labels
4 use initialise, only:defaults_set_initial
5 use iso_c_binding, only:c_float, c_int, c_bool, c_char, c_double
6 use asciiutils, only:fstring
7 use filenames, only:rootname, tagline, nfiles
8 use particle_data, only:dat, maxpart, maxcol, maxstep, npartoftype
9 use settings_data, only:ncolumns, ivegotdata
10 use libutils, only:ctypes_to_fstring
11
12 implicit none
13
14 public
15
16 contains
17
18 subroutine read_data_wrap(filename,fileformat,&
19 sph_dat,npart,ncol,ierr)
20 character(len=*), intent(in) :: filename, fileformat
21 integer, intent(inout) :: ncol, npart
22 real(8), intent(out) :: sph_dat(:,:)
23 integer, intent(out) :: ierr
24
25 integer :: i,j
26
27 print*, tagline
28
29 ierr = 0
30
31 call defaults_set_initial
32
33 nfiles = 1
34 rootname(1) = filename
35
36 print*, "format is ", fileformat
37
38 call select_data_format(fileformat,ierr)
39
40 if (ierr == 0) then
41 call get_data(1,.true.,.true.,1)
42 if (ivegotdata .and. maxpart>0) then
43 npart = min(sum(npartoftype(:,1)), size(sph_dat(:,1)) )
44 ncol = min(ncolumns, size(sph_dat(1,:)))
45 print*, "npart and ncol in fortran are", npart, ncol
46 if (ncol > 0) then
47 do i=1,ncol
48 do j=1,npart
49 print*, "trying to write to sph_dat"
50 print*, "sph_dat(i,j) is", sph_dat(i,j)
51 print*, "dat(i,j,1) is", dat(i,j,1)
52 sph_dat(i,j) = dat(i,j,1)
53 print*,""
54 end do
55 end do
56 ! print*, "attempting to write to sph_dat"
57 ! print*, "dat(1:1,1:1,1)", dat(1:1,1:1,1)
58 ! print*, "sph_dat(1:1,1:1)", sph_dat(1:1,1:1)
59 ! sph_dat(1:npart,1:ncol) = dat(1:npart,1:ncol,1)
60 endif
61 endif
62 else
63 print*, "Error in selecting the data format"
64 endif
65
66 end subroutine read_data_wrap
67
68 end module read_test