1 c TagIterate: Get a pointer to tag memory and interact directly with that
2 c
3 c This program shows how to get a pointer to tag memory and assign it to
4 c a fortran array, allowing an application to bypass the API and/or share
5 c memory with MOAB.
67 c Usage: TagIterate <mesh_filename>
89program tag_iterate
10 #include"iMesh_f.h"1112 c declarations
13 imesh_instance mesh
14 ibase_entityhandle root_set
15 ibase_entityarriterator iter
16 ibase_taghandle tagh
17 ibase_handle_t rpents, ents, rpdata
18real*8 tag_data
19pointer(rpdata, tag_data(0:*))
20pointer(rpents, ents(0:*))
21pointer(ipoffsets, ioffsets(0,*))
22integer ierr, ents_alloc, ents_size, num_regions, atend, count2324 c create the Mesh instance
25call imesh_newmesh("MOAB", mesh, ierr)
2627 c get the root set
28call imesh_getrootset(%VAL(mesh), root_set, ierr)
2930 c load the mesh
31call imesh_load(%VAL(mesh), %VAL(root_set), "125hex.vtk", "",ierr)
3233 c get the number of regions
34call imesh_getnumoftype(%VAL(mesh), %VAL(root_set),
351 %VAL(ibase_region), num_regions, ierr)
3637 c get an iterator over regions
38call imesh_initentarriter(%VAL(mesh), %VAL(root_set),
391 %VAL(ibase_region), %VAL(imesh_all_topologies),%VAL(num_regions),
401 %VAL(0), iter, ierr)
4142 c create a tag to put on the regions
43call imesh_createtagwithoptions(%VAL(mesh), "dumtag",
441"moab:TAG_STORAGE_TYPE=DENSE moab:TAG_DEFAULT_VALUE=0.0",
451 %VAL(1), %VAL(ibase_double), tagh, ierr)
4647 c iterate over tag memory
4810call imesh_tagiterate(%VAL(mesh), %VAL(tagh), %VAL(iter),
491 rpdata, count, ierr)
5051 c step the iterator over count entities
52call imesh_stepentarriter(%VAL(mesh), %VAL(iter), %VAL(count),
531 atend, ierr)
5455if (atend .eq. 0) go to 10565758call imesh_dtor(%VAL(mesh), ierr)
5960end