World Builder  1.1.0-pre
A geodynamic initial conditions generator
wrapper_fortran.f90
Go to the documentation of this file.
1 !!
2 !! Copyright (C) 2018-2024 by the authors of the World Builder code.
3 !!
4 !! This file is part of the World Builder.
5 !!
6 !! This program is free software: you can redistribute it and/or modify
7 !! it under the terms of the GNU Lesser General Public License as published
8 !! by the Free Software Foundation, either version 2 of the License, or
9 !! (at your option) any later version.
10 !!
11 !! This program is distributed in the hope that it will be useful,
12 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
13 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 !! GNU Lesser General Public License for more details.
15 !!
16 !! You should have received a copy of the GNU Lesser General Public License
17 !! along with this program. If not, see <https://www.gnu.org/licenses/>.
18 !!
19 
21 use, INTRINSIC :: iso_c_binding!, ONLY: C_PTR
22  IMPLICIT NONE
23 
25  INTERFACE
26 
33  SUBROUTINE create_world(cworld, file_name, has_output_dir, output_dir, random_number_seed) bind(C, NAME='create_world')
34  use, INTRINSIC :: iso_c_binding, only: c_ptr, c_bool, c_char, c_long
35  IMPLICIT NONE
36  ! This argument is a pointer passed by reference.
37  TYPE(c_ptr), INTENT(OUT) :: cworld
38  character(KIND=C_CHAR,len=1), intent(in) :: file_name
39  logical(KIND=C_BOOL), intent(in) :: has_output_dir
40  character(KIND=C_CHAR,len=1), intent(in) :: output_dir
41  INTEGER(C_LONG), intent(in), value ::random_number_seed
42  END SUBROUTINE create_world
43 
46  SUBROUTINE temperature_2d(cworld, x, z, depth, temperature) bind(C, NAME='temperature_2d')
47  use, INTRINSIC :: iso_c_binding
48  IMPLICIT NONE
49  ! This argument is a pointer passed by value.
50  TYPE(c_ptr), INTENT(IN), VALUE :: cworld
51  REAL(C_DOUBLE), intent(in), value :: x
52  REAL(C_DOUBLE), intent(in), value :: z
53  REAL(C_DOUBLE), intent(in), value :: depth
54  REAL(C_DOUBLE), intent(out) :: temperature
55  END SUBROUTINE temperature_2d
56 
59  SUBROUTINE temperature_3d(cworld, x, y, z, depth, temperature) bind(C, NAME='temperature_3d')
60  use, INTRINSIC :: iso_c_binding
61  IMPLICIT NONE
62  ! This argument is a pointer passed by value.
63  TYPE(c_ptr), INTENT(IN), VALUE :: cworld
64  REAL(C_DOUBLE), intent(in), value :: x
65  REAL(C_DOUBLE), intent(in), value :: y
66  REAL(C_DOUBLE), intent(in), value :: z
67  REAL(C_DOUBLE), intent(in), value :: depth
68  REAL(C_DOUBLE), intent(out) :: temperature
69  END SUBROUTINE temperature_3d
70 
74  SUBROUTINE composition_2d(cworld, x, z, depth, composition_number, composition) bind(C, NAME='composition_2d')
75  use, INTRINSIC :: iso_c_binding
76  IMPLICIT NONE
77  ! This argument is a pointer passed by value.
78  TYPE(c_ptr), INTENT(IN), VALUE :: cworld
79  REAL(C_DOUBLE), intent(in), value :: x
80  REAL(C_DOUBLE), intent(in), value :: z
81  REAL(C_DOUBLE), intent(in), value :: depth
82  INTEGER(C_INT), intent(in), value :: composition_number
83  REAL(C_DOUBLE), intent(out) :: composition
84  END SUBROUTINE composition_2d
85 
89  SUBROUTINE composition_3d(cworld, x, y, z, depth, composition_number, composition) bind(C, NAME='composition_3d')
90  use, INTRINSIC :: iso_c_binding
91  IMPLICIT NONE
92  ! This argument is a pointer passed by value.
93  TYPE(c_ptr), INTENT(IN), VALUE :: cworld
94  REAL(C_DOUBLE), intent(in), value :: x
95  REAL(C_DOUBLE), intent(in), value :: y
96  REAL(C_DOUBLE), intent(in), value :: z
97  REAL(C_DOUBLE), intent(in), value :: depth
98  INTEGER(C_INT), intent(in), value :: composition_number
99  REAL(C_DOUBLE), intent(out) :: composition
100  END SUBROUTINE composition_3d
101 
105  SUBROUTINE release_world(cworld) bind(C, NAME='release_world')
106  use, INTRINSIC :: iso_c_binding, only: c_ptr
107  IMPLICIT NONE
108  ! This argument is a pointer passed by value.
109  TYPE(c_ptr), INTENT(IN), VALUE :: cworld
110  END SUBROUTINE release_world
111  END INTERFACE
112 
114  TYPE(c_ptr) :: cworld
115  END MODULE worldbuilder
Create an interface with the 3d composition function of the World builder. This function return the c...
This contains the interface to the world builder for fortran.
Create an interface with the 2d temperature C function of the World builder. This function return the...
Create an interface with the release world function. This is the destructor for the world builder cla...
type(c_ptr) cworld
The C pointer to the World Builder world. It is generated by the create_world function.
Create an interface with the 2d composition function of the World builder. This function return the c...
Create an interface with the 3d temperature function of the World builder. This function return the t...