|
| 1 | +!################################################################################################### |
| 2 | +! This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) # |
| 3 | +! Copyright (C) 2022 University of Illinois Urbana-Champaign # |
| 4 | +! Authors: https://github.com/open-atmos/PyPartMC/graphs/contributors # |
| 5 | +!################################################################################################### |
| 6 | + |
| 7 | +module PyPartMC_aero_dist |
| 8 | + use iso_c_binding |
| 9 | + use pmc_aero_dist |
| 10 | + implicit none |
| 11 | + |
| 12 | + contains |
| 13 | + |
| 14 | + subroutine f_aero_dist_ctor(ptr_c) bind(C) |
| 15 | + type(aero_dist_t), pointer :: ptr_f => null() |
| 16 | + type(c_ptr), intent(out) :: ptr_c |
| 17 | + |
| 18 | + allocate(ptr_f) |
| 19 | + |
| 20 | + ptr_c = c_loc(ptr_f) |
| 21 | + end subroutine |
| 22 | + |
| 23 | + subroutine f_aero_dist_dtor(ptr_c) bind(C) |
| 24 | + type(aero_dist_t), pointer :: ptr_f => null() |
| 25 | + type(c_ptr), intent(in) :: ptr_c |
| 26 | + |
| 27 | + call c_f_pointer(ptr_c, ptr_f) |
| 28 | + |
| 29 | + deallocate(ptr_f) |
| 30 | + end subroutine |
| 31 | + |
| 32 | + subroutine f_aero_dist_from_json(ptr_c, aero_data_ptr_c) bind(C) |
| 33 | + type(aero_dist_t), pointer :: aero_dist => null() |
| 34 | + type(aero_data_t), pointer :: aero_data_ptr_f => null() |
| 35 | + type(c_ptr), intent(inout) :: ptr_c, aero_data_ptr_c |
| 36 | + type(spec_file_t) :: file |
| 37 | + |
| 38 | + call c_f_pointer(ptr_c, aero_dist) |
| 39 | + call c_f_pointer(aero_data_ptr_c, aero_data_ptr_f) |
| 40 | + |
| 41 | + call spec_file_read_aero_dist(file, aero_data_ptr_f, aero_dist) |
| 42 | + end subroutine |
| 43 | +end module |
0 commit comments