Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
iMOABF.F90
Go to the documentation of this file.
1 ! iMOAB Interface for Fortran 90/2003/2008 compatible compilers
2 
3 #include "moab/MOABConfig.h"
4 
5 module imoab
6 
7  use iso_c_binding
8  implicit none
9 
10 ! Interface to all the API routines
11  interface
12 
13  integer(c_int) function imoab_initialize() bind(C, name='iMOAB_InitializeFortran')
14  ! Directly forward the call
15  use, intrinsic :: iso_c_binding, only: c_int
16  end function imoab_initialize
17 
18  integer(c_int) function imoab_finalize() bind(C, name='iMOAB_Finalize')
19  ! Directly forward the call
20  use, intrinsic :: iso_c_binding, only: c_int
21  end function imoab_finalize
22 
23 #ifdef MOAB_HAVE_MPI
24  integer(c_int) function imoab_registerapplication(app_name, fcomm, compid, pid) &
25  bind(c, name='iMOAB_RegisterApplicationFortran')
26 #else
27  integer(c_int) function imoab_registerapplication(app_name, compid, pid) &
28  bind(c, name='iMOAB_RegisterApplicationFortran')
29 #endif
30  ! Interface blocks don't know about their context,
31  ! so we need to use iso_c_binding inside all interface functions again
32  use, intrinsic :: iso_c_binding, only: c_int, c_char, c_ptr
33  character(kind=c_char), intent(in) :: app_name(*)
34 #ifdef MOAB_HAVE_MPI
35  integer, intent(in) :: fcomm
36 #endif
37  integer(c_int), intent(in) :: compid
38  integer(c_int), intent(out) :: pid
39  end function imoab_registerapplication
40 
41  integer(c_int) function imoab_deregisterapplication(pid) bind(C, name='iMOAB_DeregisterApplicationFortran')
42  use, intrinsic :: iso_c_binding, only: c_int
43  integer(c_int), intent(in) :: pid
44  end function imoab_deregisterapplication
45 
46  integer(c_int) function imoab_readheaderinfo(filename, num_global_vertices, num_global_elements, &
47  num_dimension, num_parts) bind(C, name='iMOAB_ReadHeaderInfo')
48  use, intrinsic :: iso_c_binding, only: c_int, c_char
49  character(kind=c_char), intent(in) :: filename(*)
50  integer(c_int), intent(out) :: num_global_vertices
51  integer(c_int), intent(out) :: num_global_elements
52  integer(c_int), intent(out) :: num_dimension
53  integer(c_int), intent(out) :: num_parts
54  end function imoab_readheaderinfo
55 
56  integer(c_int) function imoab_loadmesh(pid, filename, read_options, num_ghost_layers) bind(C, name='iMOAB_LoadMesh')
57  use, intrinsic :: iso_c_binding, only: c_int, c_char
58  integer(c_int), intent(in) :: pid
59  character(kind=c_char), intent(in) :: filename(*)
60  character(kind=c_char), intent(in) :: read_options(*)
61  integer(c_int), intent(in) :: num_ghost_layers
62  end function imoab_loadmesh
63 
64  integer(c_int) function imoab_createvertices(pid, coords_len, dim, coordinates) bind(C, name='iMOAB_CreateVertices')
65  use, intrinsic :: iso_c_binding, only: c_int, c_double
66  integer(c_int), intent(in) :: pid
67  integer(c_int), intent(in) :: coords_len
68  integer(c_int), intent(in) :: dim
69  real(c_double), intent(in) :: coordinates(*)
70  end function imoab_createvertices
71 
72  integer(c_int) function imoab_createelements(pid, num_elem, type, num_nodes_per_element, &
73  connectivity, block_ID) bind(C, name='iMOAB_CreateElements')
74  use, intrinsic :: iso_c_binding, only: c_int
75  integer(c_int), intent(in) :: pid
76  integer(c_int), intent(in) :: num_elem
77  integer(c_int), intent(in) :: type
78  integer(c_int), intent(in) :: num_nodes_per_element
79  integer(c_int), intent(in) :: connectivity(*)
80  integer(c_int), intent(in) :: block_id
81  end function imoab_createelements
82 
83  integer(c_int) function imoab_resolvesharedentities(pid, num_verts, marker) bind(C, name='iMOAB_ResolveSharedEntities')
84  use, intrinsic :: iso_c_binding, only: c_int
85  integer(c_int), intent(in) :: pid
86  integer(c_int), intent(in) :: num_verts
87  integer(c_int), intent(in) :: marker(*)
88  end function imoab_resolvesharedentities
89 
90  integer(c_int) function imoab_determineghostentities(pid, ghost_dim, num_ghost_layers, bridge_dim) &
91  bind(c, name='iMOAB_DetermineGhostEntities')
92  use, intrinsic :: iso_c_binding, only: c_int
93  integer(c_int), intent(in) :: pid
94  integer(c_int), intent(in) :: ghost_dim
95  integer(c_int), intent(in) :: num_ghost_layers
96  integer(c_int), intent(in) :: bridge_dim
97  end function imoab_determineghostentities
98 
99  integer(c_int) function imoab_writemesh(pid, filename, write_options) bind(C, name='iMOAB_WriteMesh')
100  use, intrinsic :: iso_c_binding, only: c_int, c_char
101  integer(c_int), intent(in) :: pid
102  character(kind=c_char), intent(in) :: filename(*)
103  character(kind=c_char), intent(in) :: write_options(*)
104  end function imoab_writemesh
105 
106  integer(c_int) function imoab_updatemeshinfo(pid) bind(C, name='iMOAB_UpdateMeshInfo')
107  use, intrinsic :: iso_c_binding, only: c_int
108  integer(c_int), intent(in) :: pid
109  end function imoab_updatemeshinfo
110 
111  integer(c_int) function imoab_getmeshinfo(pid, num_visible_vertices, num_visible_elements, &
112  num_visible_blocks, num_visible_surfaceBC, &
113  num_visible_vertexBC) bind(C, name='iMOAB_GetMeshInfo')
114  use, intrinsic :: iso_c_binding, only: c_int
115  integer(c_int), intent(in) :: pid
116  integer(c_int), intent(out) :: num_visible_vertices(3)
117  integer(c_int), intent(out) :: num_visible_elements(3)
118  integer(c_int), intent(out) :: num_visible_blocks(3)
119  integer(c_int), intent(out) :: num_visible_surfacebc(3)
120  integer(c_int), intent(out) :: num_visible_vertexbc(3)
121  end function imoab_getmeshinfo
122 
123  integer(c_int) function imoab_getvertexid(pid, vertices_length, global_vertex_ID) bind(C, name='iMOAB_GetVertexID')
124  use, intrinsic :: iso_c_binding, only: c_int
125  integer(c_int), intent(in) :: pid
126  integer(c_int), intent(in) :: vertices_length
127  integer(c_int), intent(out) :: global_vertex_id(*)
128  end function imoab_getvertexid
129 
130  integer(c_int) function imoab_getvertexownership(pid, vertices_length, visible_global_rank_ID) &
131  bind(c, name='iMOAB_GetVertexOwnership')
132  use, intrinsic :: iso_c_binding, only: c_int
133  integer(c_int), intent(in) :: pid
134  integer(c_int), intent(in) :: vertices_length
135  integer(c_int), intent(out) :: visible_global_rank_id(*)
136  end function imoab_getvertexownership
137 
138  integer(c_int) function imoab_getvisibleverticescoordinates(pid, coords_length, coordinates) &
139  bind(c, name='iMOAB_GetVisibleVerticesCoordinates')
140  use, intrinsic :: iso_c_binding, only: c_int, c_double
141  integer(c_int), intent(in) :: pid
142  integer(c_int), intent(in) :: coords_length
143  real(c_double), intent(out) :: coordinates(*)
144  end function imoab_getvisibleverticescoordinates
145 
146  integer(c_int) function imoab_getblockid(pid, block_length, global_block_IDs) bind(C, name='iMOAB_GetBlockID')
147  use, intrinsic :: iso_c_binding, only: c_int
148  integer(c_int), intent(in) :: pid
149  integer(c_int), intent(in) :: block_length
150  integer(c_int), intent(out) :: global_block_ids(*)
151  end function imoab_getblockid
152 
153  integer(c_int) function imoab_getblockinfo(pid, global_block_ID, vertices_per_element, &
154  num_elements_in_block) bind(C, name='iMOAB_GetBlockInfo')
155  use, intrinsic :: iso_c_binding, only: c_int
156  integer(c_int), intent(in) :: pid
157  integer(c_int), intent(in) :: global_block_id
158  integer(c_int), intent(out) :: vertices_per_element
159  integer(c_int), intent(out) :: num_elements_in_block
160  end function imoab_getblockinfo
161 
162  integer(c_int) function imoab_getvisibleelementsinfo(pid, num_visible_elements, element_global_IDs, &
163  ranks, block_IDs) bind(C, name='iMOAB_GetVisibleElementsInfo')
164  use, intrinsic :: iso_c_binding, only: c_int
165  integer(c_int), intent(in) :: pid
166  integer(c_int), intent(out) :: num_visible_elements
167  integer(c_int), intent(out) :: element_global_ids(*)
168  integer(c_int), intent(out) :: ranks(*)
169  integer(c_int), intent(out) :: block_ids(*)
170  end function imoab_getvisibleelementsinfo
171 
172  integer(c_int) function imoab_getblockelementconnectivities(pid, global_block_ID, connectivity_length, &
173  element_connectivity) &
174  bind(c, name='iMOAB_GetBlockElementConnectivities')
175  use, intrinsic :: iso_c_binding, only: c_int
176  integer(c_int), intent(in) :: pid
177  integer(c_int), intent(in) :: global_block_id
178  integer(c_int), intent(in) :: connectivity_length
179  integer(c_int), intent(out) :: element_connectivity(*)
180  end function imoab_getblockelementconnectivities
181 
182  integer(c_int) function imoab_getelementconnectivity(pid, elem_index, connectivity_length, &
183  element_connectivity) bind(C, name='iMOAB_GetElementConnectivity')
184  use, intrinsic :: iso_c_binding, only: c_int
185  integer(c_int), intent(in) :: pid
186  integer(c_int), intent(in) :: elem_index
187  integer(c_int), intent(in) :: connectivity_length
188  integer(c_int), intent(out) :: element_connectivity(*)
189  end function imoab_getelementconnectivity
190 
191  integer(c_int) function imoab_getelementownership(pid, global_block_ID, num_elements_in_block, &
192  element_ownership) bind(C, name='iMOAB_GetElementOwnership')
193  use, intrinsic :: iso_c_binding, only: c_int
194  integer(c_int), intent(in) :: pid
195  integer(c_int), intent(in) :: global_block_id
196  integer(c_int), intent(out) :: num_elements_in_block
197  integer(c_int), intent(out) :: element_ownership(*)
198  end function imoab_getelementownership
199 
200  integer(c_int) function imoab_getelementid(pid, global_block_ID, num_elements_in_block, &
201  global_element_ID, local_element_ID) bind(C, name='iMOAB_GetElementID')
202  use, intrinsic :: iso_c_binding, only: c_int
203  integer(c_int), intent(in) :: pid
204  integer(c_int), intent(in) :: global_block_id
205  integer(c_int), intent(in) :: num_elements_in_block
206  integer(c_int), intent(in) :: global_element_id
207  integer(c_int), intent(out) :: local_element_id
208  end function imoab_getelementid
209 
210  integer(c_int) function imoab_getpointertosurfacebc(pid, surface_BC_length, local_element_ID, &
211  reference_surface_ID, boundary_condition_value) &
212  bind(c, name='iMOAB_GetPointerToSurfaceBC')
213  use, intrinsic :: iso_c_binding, only: c_int
214  integer(c_int), intent(in) :: pid
215  integer(c_int), intent(in) :: surface_bc_length
216  integer(c_int), intent(in) :: local_element_id
217  integer(c_int), intent(in) :: reference_surface_id
218  integer(c_int), intent(out) :: boundary_condition_value
219  end function imoab_getpointertosurfacebc
220 
221  integer(c_int) function imoab_getpointertovertexbc(pid, vertex_BC_length, local_vertex_ID, &
222  boundary_condition_value) bind(C, name='iMOAB_GetPointerToVertexBC')
223  use, intrinsic :: iso_c_binding, only: c_int
224  integer(c_int), intent(in) :: pid
225  integer(c_int), intent(in) :: vertex_bc_length
226  integer(c_int), intent(in) :: local_vertex_id
227  integer(c_int), intent(out) :: boundary_condition_value
228  end function imoab_getpointertovertexbc
229 
230  integer(c_int) function imoab_definetagstorage(pid, tag_storage_name, tag_type, components_per_entity, &
231  tag_index) bind(C, name='iMOAB_DefineTagStorage')
232  use, intrinsic :: iso_c_binding, only: c_int, c_char
233  integer(c_int), intent(in) :: pid
234  character(kind=c_char), intent(in) :: tag_storage_name(*)
235  integer(c_int), intent(in) :: tag_type
236  integer(c_int), intent(in) :: components_per_entity
237  integer(c_int), intent(in) :: tag_index
238  end function imoab_definetagstorage
239 
240  integer(c_int) function imoab_setinttagstorage(pid, tag_storage_name, num_tag_storage_length, entity_type, &
241  tag_storage_data) bind(C, name='iMOAB_SetIntTagStorage')
242  use, intrinsic :: iso_c_binding, only: c_int, c_char
243  integer(c_int), intent(in) :: pid
244  character(kind=c_char), intent(in) :: tag_storage_name(*)
245  integer(c_int), intent(in) :: num_tag_storage_length
246  integer(c_int), intent(in) :: entity_type
247  integer(c_int), intent(in) :: tag_storage_data(*)
248  end function imoab_setinttagstorage
249 
250  integer(c_int) function imoab_getinttagstorage(pid, tag_storage_name, num_tag_storage_length, entity_type, &
251  tag_storage_data) bind(C, name='iMOAB_GetIntTagStorage')
252  use, intrinsic :: iso_c_binding, only: c_int, c_char
253  integer(c_int), intent(in) :: pid
254  character(kind=c_char), intent(in) :: tag_storage_name(*)
255  integer(c_int), intent(in) :: num_tag_storage_length
256  integer(c_int), intent(in) :: entity_type
257  integer(c_int), intent(out) :: tag_storage_data(*)
258  end function imoab_getinttagstorage
259 
260  integer(c_int) function imoab_setdoubletagstorage(pid, tag_storage_name, num_tag_storage_length, entity_type, &
261  tag_storage_data) bind(C, name='iMOAB_SetDoubleTagStorage')
262  use, intrinsic :: iso_c_binding, only: c_int, c_char, c_double
263  integer(c_int), intent(in) :: pid
264  character(kind=c_char), intent(in) :: tag_storage_name(*)
265  integer(c_int), intent(in) :: num_tag_storage_length
266  integer(c_int), intent(in) :: entity_type
267  real(c_double), intent(in) :: tag_storage_data(*)
268  end function imoab_setdoubletagstorage
269 
270  integer(c_int) function imoab_setdoubletagstoragewithgid(pid, tag_storage_name, num_tag_storage_length, entity_type, &
271  tag_storage_data, globalIds) bind(C, name='iMOAB_SetDoubleTagStorageWithGid')
272  use, intrinsic :: iso_c_binding, only: c_int, c_char, c_double
273  integer(c_int), intent(in) :: pid
274  character(kind=c_char), intent(in) :: tag_storage_name(*)
275  integer(c_int), intent(in) :: num_tag_storage_length
276  integer(c_int), intent(in) :: entity_type
277  real(c_double), intent(in) :: tag_storage_data(*)
278  integer(c_int), intent(in) :: globalids(*)
279  end function imoab_setdoubletagstoragewithgid
280 
281 
282  integer(c_int) function imoab_getdoubletagstorage(pid, tag_storage_name, num_tag_storage_length, entity_type, &
283  tag_storage_data) bind(C, name='iMOAB_GetDoubleTagStorage')
284  use, intrinsic :: iso_c_binding, only: c_int, c_char, c_double
285  integer(c_int), intent(in) :: pid
286  character(kind=c_char), intent(in) :: tag_storage_name(*)
287  integer(c_int), intent(in) :: num_tag_storage_length
288  integer(c_int), intent(in) :: entity_type
289  real(c_double), intent(out) :: tag_storage_data(*)
290  end function imoab_getdoubletagstorage
291 
292  integer(c_int) function imoab_synchronizetags(pid, num_tag, tag_indices, entity_type) bind(C, name='iMOAB_SynchronizeTags')
293  use, intrinsic :: iso_c_binding, only: c_int
294  integer(c_int), intent(in) :: pid
295  integer(c_int), intent(in) :: num_tag
296  integer(c_int), intent(in) :: tag_indices(*)
297  integer(c_int), intent(in) :: entity_type(*)
298  end function imoab_synchronizetags
299 
300  integer(c_int) function imoab_reducetagsmax(pid, tag_index, entity_type) bind(C, name='iMOAB_ReduceTagsMax')
301  use, intrinsic :: iso_c_binding, only: c_int
302  integer(c_int), intent(in) :: pid
303  integer(c_int), intent(in) :: tag_index
304  integer(c_int), intent(in) :: entity_type
305  end function imoab_reducetagsmax
306 
307  integer(c_int) function imoab_getneighborelements(pid, local_index, num_adjacent_elements, adjacent_element_IDs) &
308  bind(c, name='iMOAB_GetNeighborElements')
309  use, intrinsic :: iso_c_binding, only: c_int
310  integer(c_int), intent(in) :: pid
311  integer(c_int), intent(in) :: local_index
312  integer(c_int), intent(out) :: num_adjacent_elements
313  integer(c_int), intent(out) :: adjacent_element_ids
314  end function imoab_getneighborelements
315 
316  integer(c_int) function imoab_getneighborvertices(pid, local_index, num_adjacent_vertices, adjacent_vertex_IDs) &
317  bind(c, name='iMOAB_GetNeighborVertices')
318  use, intrinsic :: iso_c_binding, only: c_int
319  integer(c_int), intent(in) :: pid
320  integer(c_int), intent(in) :: local_index
321  integer(c_int), intent(out) :: num_adjacent_vertices
322  integer(c_int), intent(out) :: adjacent_vertex_ids
323  end function imoab_getneighborvertices
324 
325  integer(c_int) function imoab_setglobalinfo(pid, num_global_verts, num_global_elems) bind(C, name='iMOAB_SetGlobalInfo')
326  use, intrinsic :: iso_c_binding, only: c_int
327  integer(c_int), intent(in) :: pid
328  integer(c_int), intent(in) :: num_global_verts
329  integer(c_int), intent(in) :: num_global_elems
330  end function imoab_setglobalinfo
331 
332  integer(c_int) function imoab_getglobalinfo(pid, num_global_verts, num_global_elems) bind(C, name='iMOAB_GetGlobalInfo')
333  use, intrinsic :: iso_c_binding, only: c_int
334  integer(c_int), intent(in) :: pid
335  integer(c_int), intent(out) :: num_global_verts
336  integer(c_int), intent(out) :: num_global_elems
337  end function imoab_getglobalinfo
338 
339  integer(c_int) function imoab_writelocalmesh(pid, prefix) bind(C, name='iMOAB_WriteLocalMesh')
340  use, intrinsic :: iso_c_binding, only : c_int, c_char
341  integer(c_int), intent(in) :: pid
342  character(kind=c_char), intent(in) :: prefix(*)
343  end function imoab_writelocalmesh
344 
345 #ifdef MOAB_HAVE_MPI
346 
347  integer(c_int) function imoab_sendmesh(pid, joint_comm, receivingGroup, rcompid, method) bind(C, name='iMOAB_SendMesh')
348  use, intrinsic :: iso_c_binding, only: c_int, c_ptr
349  integer(c_int), intent(in) :: pid
350  integer, intent(in) :: joint_comm ! MPI_Comm
351  integer, intent(in) :: receivinggroup ! MPI_Group
352  integer(c_int), intent(in) :: rcompid
353  integer(c_int), intent(in) :: method
354  end function imoab_sendmesh
355 
356  integer(c_int) function imoab_receivemesh(pid, joint_comm, sendingGroup, scompid) bind(C, name='iMOAB_ReceiveMesh')
357  use, intrinsic :: iso_c_binding, only: c_int, c_ptr
358  integer(c_int), intent(in) :: pid
359  integer, intent(in) :: joint_comm ! MPI_Comm
360  integer, intent(in) :: sendinggroup ! MPI_Group
361  integer(c_int), intent(in) :: scompid
362  end function imoab_receivemesh
363 
364  integer(c_int) function imoab_freesenderbuffers(pid, context_id) bind(C, name='iMOAB_FreeSenderBuffers')
365  use, intrinsic :: iso_c_binding, only: c_int
366  integer(c_int), intent(in) :: pid
367  integer(c_int), intent(in) :: context_id
368  end function imoab_freesenderbuffers
369 
370  integer(c_int) function imoab_sendelementtag(pid, tag_storage_name, joint_comm, context_id) &
371  bind(c, name='iMOAB_SendElementTag')
372  use, intrinsic :: iso_c_binding, only: c_int, c_char, c_ptr
373  integer(c_int), intent(in) :: pid
374  character(kind=c_char), intent(in) :: tag_storage_name(*)
375  integer, intent(in) :: joint_comm ! MPI_Comm
376  integer(c_int), intent(in) :: context_id
377  end function imoab_sendelementtag
378 
379  integer(c_int) function imoab_receiveelementtag(pid, tag_storage_name, joint_comm, context_id) &
380  bind(c, name='iMOAB_ReceiveElementTag')
381  use, intrinsic :: iso_c_binding, only: c_int, c_char, c_ptr
382  integer(c_int), intent(in) :: pid
383  character(kind=c_char), intent(in) :: tag_storage_name(*)
384  integer, intent(in) :: joint_comm ! MPI_Comm
385  integer(c_int), intent(in) :: context_id
386  end function imoab_receiveelementtag
387 
388  integer(c_int) function imoab_computecommgraph(pid1, pid2, joint_comm, group1, group2, type1, type2, &
389  comp1, comp2) bind(C, name='iMOAB_ComputeCommGraph')
390  use, intrinsic :: iso_c_binding, only: c_int, c_ptr
391  integer(c_int), intent(in) :: pid1
392  integer(c_int), intent(in) :: pid2
393  integer, intent(in) :: joint_comm ! MPI_Comm
394  integer, intent(in) :: group1 ! MPI_Group
395  integer, intent(in) :: group2 ! MPI_Group
396  integer(c_int), intent(in) :: type1
397  integer(c_int), intent(in) :: type2
398  integer(c_int), intent(in) :: comp1
399  integer(c_int), intent(in) :: comp2
400  end function imoab_computecommgraph
401 
402  integer(c_int) function imoab_coveragegraph(joint_comm, pid_source, pid_migration, pid_intx, source_id, &
403  migration_id, context_id) bind(C, name='iMOAB_CoverageGraph')
404  use, intrinsic :: iso_c_binding, only: c_int, c_ptr
405  integer, intent(in) :: joint_comm ! MPI_Comm
406  integer(c_int), intent(in) :: pid_source
407  integer(c_int), intent(in) :: pid_migration
408  integer(c_int), intent(in) :: pid_intx
409  integer(c_int), intent(in) :: source_id
410  integer(c_int), intent(in) :: migration_id
411  integer(c_int), intent(in) :: context_id
412  end function imoab_coveragegraph
413 
414  integer(c_int) function imoab_dumpcommgraph(pid, context_id, is_sender, prefix) bind(C, name='iMOAB_DumpCommGraph')
415  use, intrinsic :: iso_c_binding, only: c_int, c_char
416  integer(c_int), intent(in) :: pid
417  integer(c_int), intent(in) :: context_id
418  integer(c_int), intent(in) :: is_sender
419  character(kind=c_char), intent(in) :: prefix(*)
420  end function imoab_dumpcommgraph
421 
422  integer(c_int) function imoab_mergevertices(pid) bind(C, name='iMOAB_MergeVertices')
423  use, intrinsic :: iso_c_binding, only: c_int
424  integer(c_int), intent(in) :: pid
425  end function imoab_mergevertices
426 
427  integer(c_int) function imoab_migratemapmesh( pid1, pid2, pid3, jointcomm, groupA, groupB, type, comp1, comp2, &
428  direction) bind(C, name='iMOAB_MigrateMapMesh')
429  use, intrinsic :: iso_c_binding, only : c_int
430  integer(c_int), intent(in) :: pid1
431  integer(c_int), intent(in) :: pid2
432  integer(c_int), intent(in) :: pid3
433  integer, intent(in) :: jointcomm ! MPI_Comm
434  integer, intent(in) :: groupa ! MPI_Group
435  integer, intent(in) :: groupb ! MPI_Group
436  integer(c_int), intent(in) :: type
437  integer(c_int), intent(in) :: comp1
438  integer(c_int), intent(in) :: comp2
439  integer(c_int), intent(in) :: direction
440  end function imoab_migratemapmesh
441 
442  integer(c_int) function imoab_setghostlayers(pid, num_layers) bind(C, name='iMOAB_SetGhostLayers')
443  use, intrinsic :: iso_c_binding, only: c_int
444  integer(c_int), intent(in) :: pid
445  integer(c_int), intent(in) :: num_layers
446  end function imoab_setghostlayers
447 
448 ! closing endif: MOAB_HAVE_MPI
449 #endif
450 
451 #ifdef MOAB_HAVE_TEMPESTREMAP
452 
453  integer(c_int) function imoab_computemeshintersectiononsphere(pid_source, pid_target, pid_intersection) &
454  bind(c, name='iMOAB_ComputeMeshIntersectionOnSphere')
455  use, intrinsic :: iso_c_binding, only: c_int, c_double
456  integer(c_int), intent(in) :: pid_source
457  integer(c_int), intent(in) :: pid_target
458  integer(c_int), intent(in) :: pid_intersection
459  end function imoab_computemeshintersectiononsphere
460 
461  integer(c_int) function imoab_computepointdofintersection(pid_source, pid_target, pid_intersection) &
462  bind(c, name='iMOAB_ComputePointDoFIntersection')
463  use, intrinsic :: iso_c_binding, only: c_int
464  integer(c_int), intent(in) :: pid_source
465  integer(c_int), intent(in) :: pid_target
466  integer(c_int), intent(in) :: pid_intersection
467  end function imoab_computepointdofintersection
468 
469 #ifdef MOAB_HAVE_NETCDF
470 
471  integer(c_int) function imoab_loadmappingweightsfromfile(pid_intersection, pid_cpl, column_or_row, mtype, &
472  solution_weights_identifier, remap_weights_filename) &
473  bind(c, name='iMOAB_LoadMappingWeightsFromFile')
474  use, intrinsic :: iso_c_binding, only : c_int, c_char
475  integer(c_int), intent(in) :: pid_intersection
476  integer(c_int), intent(in) :: pid_cpl
477  integer(c_int), intent(in) :: column_or_row
478  integer(c_int), intent(in) :: mtype
479  character(kind=c_char), intent(in) :: solution_weights_identifier(*)
480  character(kind=c_char), intent(in) :: remap_weights_filename(*)
481  end function imoab_loadmappingweightsfromfile
482 
483  integer(c_int) function imoab_writemappingweightstofile(pid_intersection, solution_weights_identifier, &
484  remap_weights_filename) bind(C, name='iMOAB_WriteMappingWeightsToFile')
485  use, intrinsic :: iso_c_binding, only: c_int, c_char
486  integer(c_int), intent(in) :: pid_intersection
487  character(kind=c_char), intent(in) :: solution_weights_identifier(*)
488  character(kind=c_char), intent(in) :: remap_weights_filename(*)
489  end function imoab_writemappingweightstofile
490 
491 ! closing endif: MOAB_HAVE_NETCDF
492 #endif
493 
494  integer(c_int) function imoab_computescalarprojectionweights(pid_intersection, solution_weights_identifier, &
495  disc_method_source, disc_order_source, &
496  disc_method_target, disc_order_target, &
497  fv_methods, fNoBubble, fMonotoneTypeID, fVolumetric, &
498  fInverseDistanceMap, fNoConservation, fValidate, &
499  source_solution_tag_dof_name, target_solution_tag_dof_name) &
500  bind(c, name='iMOAB_ComputeScalarProjectionWeights')
501  use, intrinsic :: iso_c_binding, only: c_int, c_char
502  integer(c_int), intent(in) :: pid_intersection
503  character(kind=c_char), intent(in) :: solution_weights_identifier(*)
504  character(kind=c_char), intent(in) :: disc_method_source(*)
505  integer(c_int), intent(in) :: disc_order_source
506  character(kind=c_char), intent(in) :: disc_method_target(*)
507  character(kind=c_char), intent(in) :: fv_methods(*)
508  integer(c_int), intent(in) :: disc_order_target
509  integer(c_int), intent(in) :: fnobubble
510  integer(c_int), intent(in) :: fmonotonetypeid
511  integer(c_int), intent(in) :: fvolumetric
512  integer(c_int), intent(in) :: finversedistancemap
513  integer(c_int), intent(in) :: fnoconservation
514  integer(c_int), intent(in) :: fvalidate
515  character(kind=c_char), intent(in) :: source_solution_tag_dof_name(*)
516  character(kind=c_char), intent(in) :: target_solution_tag_dof_name(*)
517  end function imoab_computescalarprojectionweights
518 
519  integer(c_int) function imoab_applyscalarprojectionweights(pid_intersection, filter_type, solution_weights_identifier, &
520  source_solution_tag_name, target_solution_tag_name) &
521  bind(c, name='iMOAB_ApplyScalarProjectionWeights')
522  use, intrinsic :: iso_c_binding, only: c_int, c_char
523  integer(c_int), intent(in) :: pid_intersection
524  integer(c_int), intent(in) :: filter_type
525  character(kind=c_char), intent(in) :: solution_weights_identifier(*)
526  character(kind=c_char), intent(in) :: source_solution_tag_name(*)
527  character(kind=c_char), intent(in) :: target_solution_tag_name(*)
528  end function imoab_applyscalarprojectionweights
529 
530 ! closing endif: MOAB_HAVE_TEMPESTREMAP
531 #endif
532 
533 #ifdef MOAB_HAVE_MPI
534 
535 ! Add some helper MPI converter functions
536 
537  ! Convert a C-based MPI-Comm handle to fortran
538  integer function imoab_mpi_comm_c2f(c_handle) bind(C, name="MOAB_MPI_Comm_c2f")
539  use, intrinsic :: iso_c_binding, only: c_ptr
540  type(c_ptr), value :: c_handle
541  end function
542 
543  ! Convert a Fortran-based MPI-integer handle to MPI-Comm pointer
544  type(c_ptr) function imoab_mpi_comm_f2c(f_handle) bind(C, name="MOAB_MPI_Comm_f2c")
545  use, intrinsic :: iso_c_binding, only: c_ptr
546  integer, intent(in) :: f_handle
547  end function
548 
549  ! Convert a C-based MPI-Group handle to fortran
550  integer function imoab_mpi_group_c2f(c_handle) bind(C, name="MOAB_MPI_Group_c2f")
551  use, intrinsic :: iso_c_binding, only: c_ptr
552  type(c_ptr), value :: c_handle
553  end function
554 
555  ! Convert a Fortran-based MPI-integer handle to MPI-Group pointer
556  type(c_ptr) function imoab_mpi_group_f2c(f_handle) bind(C, name="MOAB_MPI_Group_f2c")
557  use, intrinsic :: iso_c_binding, only: c_ptr
558  integer, intent(in) :: f_handle
559  end function
560 
561 #endif
562 
563  end interface
564 
565 end module imoab