Loading [MathJax]/extensions/tex2jax.js
Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TagIterateF.F
Go to the documentation of this file.
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. 6  7 c Usage: TagIterate <mesh_filename> 8  9  program tag_iterate 10 #include "iMesh_f.h" 11  12 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 18  real*8 tag_data 19  pointer(rpdata, tag_data(0:*)) 20  pointer(rpents, ents(0:*)) 21  pointer(ipoffsets, ioffsets(0,*)) 22  integer ierr, ents_alloc, ents_size, num_regions, atend, count 23  24 c create the Mesh instance 25  call imesh_newmesh("MOAB", mesh, ierr) 26  27 c get the root set 28  call imesh_getrootset(%VAL(mesh), root_set, ierr) 29  30 c load the mesh 31  call imesh_load(%VAL(mesh), %VAL(root_set), "125hex.vtk", "",ierr) 32  33 c get the number of regions 34  call imesh_getnumoftype(%VAL(mesh), %VAL(root_set), 35  1 %VAL(ibase_region), num_regions, ierr) 36  37 c get an iterator over regions 38  call imesh_initentarriter(%VAL(mesh), %VAL(root_set), 39  1 %VAL(ibase_region), %VAL(imesh_all_topologies),%VAL(num_regions), 40  1 %VAL(0), iter, ierr) 41  42 c create a tag to put on the regions 43  call imesh_createtagwithoptions(%VAL(mesh), "dumtag", 44  1 "moab:TAG_STORAGE_TYPE=DENSE moab:TAG_DEFAULT_VALUE=0.0", 45  1 %VAL(1), %VAL(ibase_double), tagh, ierr) 46  47 c iterate over tag memory 48  10 call imesh_tagiterate(%VAL(mesh), %VAL(tagh), %VAL(iter), 49  1 rpdata, count, ierr) 50  51 c step the iterator over count entities 52  call imesh_stepentarriter(%VAL(mesh), %VAL(iter), %VAL(count), 53  1 atend, ierr) 54  55  if (atend .eq. 0) go to 10 56  57  58  call imesh_dtor(%VAL(mesh), ierr) 59  60  end