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
FindConnectF.F
Go to the documentation of this file.
1 c FindConnect: Interacting with iMesh 2 c 3 c This program shows how to get more information about a mesh, by 4 c getting connectivity two different ways (as connectivity and as 5 c adjacent 0-dimensional entities). 6  7 c Usage: FindConnect 8  9  program findconnect 10 #include "iMesh_f.h" 11  12 c declarations 13  imesh_instance mesh 14  ibase_entityhandle ents 15  ibase_handle_t rpverts, rpallverts, ipoffsets 16  pointer(rpents, ents(0:*)) 17  pointer(rpverts, verts(0:*)) 18  pointer(rpallverts, allverts(0:*)) 19  pointer(ipoffsets, ioffsets(0,*)) 20  integer ierr, ents_alloc, ents_size 21  integer iverts_alloc, iverts_size 22  integer allverts_alloc, allverts_size 23  integer offsets_alloc, offsets_size 24  25 c create the Mesh instance 26  call imesh_newmesh("MOAB", mesh, ierr) 27  28 c load the mesh 29  call imesh_load(%VAL(mesh), %VAL(0), "125hex.vtk", "", ierr) 30  31 c get all 3d elements 32  ents_alloc = 0 33  call imesh_getentities(%VAL(mesh), %VAL(0), %VAL(ibase_region), 34  1 %VAL(imesh_all_topologies), rpents, ents_alloc, ents_size, 35  1 ierr) 36  37  ivert_uses = 0 38  39 c iterate through them; 40  do i = 0, ents_size-1 41 c get connectivity 42  iverts_alloc = 0 43  call imesh_getentadj(%VAL(mesh), %VAL(ents(i)), 44  1 %VAL(ibase_vertex), rpverts, iverts_alloc, iverts_size, 45  1 ierr) 46 c sum number of vertex uses 47  48  vert_uses = vert_uses + iverts_size 49  50  call free(rpverts) 51  end do 52  53 c now get adjacencies in one big block 54  allverts_alloc = 0 55  offsets_alloc = 0 56  call imesh_getentarradj(%VAL(mesh), %VAL(rpents), 57  1 %VAL(ents_size), %VAL(ibase_vertex), rpallverts, 58  1 allverts_alloc, allverts_size, ipoffsets, offsets_alloc, 59  1 offsets_size, ierr) 60  61  call free(rpallverts); 62  call free(ipoffsets); 63  call free(rpents); 64  65 c compare results of two calling methods 66  if (allverts_size .ne. vert_uses) then 67  write(*,'("Sizes didn''t agree!")') 68  else 69  write(*,'("Sizes did agree!")') 70  endif 71  72  call imesh_dtor(%VAL(mesh), ierr) 73  74  end