196 # include "iMeshP_f.h"
199 # include "iMesh_f.h"
204 TYPE(C_PTR) :: vertsPtr, entsPtr
205 integer numv, nume, nvpe, vgids(0:*), iconn(0:*), ierr, tp
208 imeshp_partitionhandle imeshp
213 integer comm_sz, comm_rank, numa, numo, iv, ie
214 TYPE(C_PTR) :: statsPtr
215 integer,
allocatable,
target :: stats(:)
218 ibase_entityhandle,
pointer :: verts(:), ents(:)
219 ibase_entityhandle,
allocatable :: conn(:)
220 ibase_entitysethandle root_set
221 ibase_entitysethandle file_set
223 ibase_handle_t mpi_comm_c
224 TYPE(C_PTR) :: partsPtr
225 imeshp_parthandle,
pointer :: parts(:)
226 imeshp_parthandle part
227 integer partsa, partso
228 character (len=10) filename
231 if (imesh .eq. 0)
then
232 call imesh_newmesh(
"MOAB", imesh, ierr)
236 if (imeshp .eq. 0)
then
237 call imeshp_getcommunicator(%VAL(imesh), mpi_comm_world, mpi_comm_c, ierr)
239 call imeshp_createpartitionall(%VAL(imesh), %VAL(mpi_comm_c), imeshp, ierr)
241 call imeshp_createpart(%VAL(imesh), %VAL(imeshp), part, ierr)
245 call imeshp_getlocalparts(%VAL(imesh), %VAL(imeshp), partsptr, partsa, partso, ierr)
247 call c_f_pointer(partsptr, parts, [partso])
250 call mpi_comm_rank(comm, comm_rank, ierr)
252 call mpi_comm_size(comm, comm_sz, ierr)
257 call imesh_createvtxarr(%VAL(imesh), %VAL(numv), %VAL(ibase_interleaved), posn, %VAL(3*numv), &
258 vertsptr, numa, numo, ierr)
262 allocate (conn(0:nvpe*nume-1))
263 call c_f_pointer(vertsptr, verts, [numv])
264 do i = 0, nvpe*nume-1
265 conn(i) = verts(1+iconn(i))
269 allocate(stats(0:nume-1))
270 statsptr = c_loc(stats(0))
271 call imesh_createentarr(%VAL(imesh), %VAL(tp), conn, %VAL(nvpe*nume), &
272 entsptr, numa, numo, statsptr, numa, numo, ierr)
279 call c_f_pointer(entsptr, ents, [numo])
280 call imesh_addentarrtoset(%VAL(imesh), ents, %VAL(numo), %VAL(part), ierr)
283 call imesh_gettaghandle(%VAL(imesh),
"GLOBAL_ID", tagh, ierr, %VAL(9))
284 if (ibase_success .ne. ierr)
then
286 call imesh_createtag(%VAL(imesh),
"GLOBAL_ID", %VAL(ibase_integer), tagh, ierr)
289 call imesh_setintarrdata(%VAL(imesh), verts, %VAL(numv), %VAL(tagh), vgids, %VAL(numv), ierr)
292 call imeshp_syncmeshall(%VAL(imesh), %VAL(imeshp), ierr)
295 call imeshp_createghostentsall(%VAL(imesh), %VAL(imeshp), %VAL(2), %VAL(1), %VAL(1), %VAL(0), ierr)
298 call imesh_freememory(%VAL(imesh), vertsptr);
299 call imesh_freememory(%VAL(imesh), entsptr);