Mesh Oriented datABase
(version 5.4.1)
Array-based unstructured mesh datastructure
|
00001 c TagIterate: Get a pointer to tag memory and interact directly with that 00002 c 00003 c This program shows how to get a pointer to tag memory and assign it to 00004 c a fortran array, allowing an application to bypass the API and/or share 00005 c memory with MOAB. 00006 00007 c Usage: TagIterate <mesh_filename> 00008 00009 program tag_iterate 00010 #include "iMesh_f.h" 00011 00012 c declarations 00013 iMesh_Instance mesh 00014 iBase_EntityHandle root_set 00015 iBase_EntityArrIterator iter 00016 iBase_TagHandle tagh 00017 IBASE_HANDLE_T rpents, ents, rpdata 00018 real*8 tag_data 00019 pointer (rpdata, tag_data(0:*)) 00020 pointer (rpents, ents(0:*)) 00021 pointer (ipoffsets, ioffsets(0,*)) 00022 integer ierr, ents_alloc, ents_size, num_regions, atend, count 00023 00024 c create the Mesh instance 00025 call iMesh_newMesh("MOAB", mesh, ierr) 00026 00027 c get the root set 00028 call iMesh_getRootSet(%VAL(mesh), root_set, ierr) 00029 00030 c load the mesh 00031 call iMesh_load(%VAL(mesh), %VAL(root_set), "125hex.vtk", "",ierr) 00032 00033 c get the number of regions 00034 call iMesh_getNumOfType(%VAL(mesh), %VAL(root_set), 00035 1 %VAL(iBase_REGION), num_regions, ierr) 00036 00037 c get an iterator over regions 00038 call iMesh_initEntArrIter(%VAL(mesh), %VAL(root_set), 00039 1 %VAL(iBase_REGION), %VAL(iMesh_ALL_TOPOLOGIES),%VAL(num_regions), 00040 1 %VAL(0), iter, ierr) 00041 00042 c create a tag to put on the regions 00043 call iMesh_createTagWithOptions(%VAL(mesh), "dumtag", 00044 1 "moab:TAG_STORAGE_TYPE=DENSE moab:TAG_DEFAULT_VALUE=0.0", 00045 1 %VAL(1), %VAL(iBase_DOUBLE), tagh, ierr) 00046 00047 c iterate over tag memory 00048 10 call iMesh_tagIterate(%VAL(mesh), %VAL(tagh), %VAL(iter), 00049 1 rpdata, count, ierr) 00050 00051 c step the iterator over count entities 00052 call iMesh_stepEntArrIter(%VAL(mesh), %VAL(iter), %VAL(count), 00053 1 atend, ierr) 00054 00055 if (atend .eq. 0) go to 10 00056 00057 00058 call iMesh_dtor(%VAL(mesh), ierr) 00059 00060 end