Actual source code: meshzoltan.c

petsc-3.4.5 2014-06-29
  1: #include <petscdmmesh.hh>

  3: extern "C" {
  4: #if defined(PETSC_HAVE_ZOLTAN)
  5: // Inputs
  6: int nvtxs_Zoltan;      // The number of vertices
  7: int nhedges_Zoltan;    // The number of hyperedges
  8: int *eptr_Zoltan;      // The offsets of each hyperedge
  9: int *eind_Zoltan;      // The vertices in each hyperedge, indexed by eptr

 11: int getNumVertices_Zoltan(void *data, int *ierr)
 12: {
 13:   *0;
 14:   return nvtxs_Zoltan;
 15: };

 17: void getLocalElements_Zoltan(void *data, int num_gid_entries, int num_lid_entries, ZOLTAN_ID_PTR global_ids, ZOLTAN_ID_PTR local_ids, int wgt_dim, float *obj_wgts, int *ierr)
 18: {
 19:   if ((wgt_dim != 0) || (num_gid_entries != 1) || (num_lid_entries != 1)) {
 20:     *1;
 21:     return;
 22:   }
 23:   *0;
 24:   for (int v = 0; v < nvtxs_Zoltan; ++v) {
 25:     global_ids[v]= v;
 26:     local_ids[v] = v;
 27:   }
 28:   return;
 29: };

 31: void getHgSizes_Zoltan(void *data, int *num_lists, int *num_pins, int *format, int *ierr)
 32: {
 33:   *0;
 34:   *num_lists = nhedges_Zoltan;
 35:   *num_pins  = eptr_Zoltan[nhedges_Zoltan];
 36:   *format    = ZOLTAN_COMPRESSED_EDGE;
 37: };

 39: void getHg_Zoltan(void *data, int num_gid_entries, int num_row_or_col, int num_pins, int format, ZOLTAN_ID_PTR vtxedge_GID, int *vtxedge_ptr, ZOLTAN_ID_PTR pin_GID, int *ierr)
 40: {
 41:   if ((num_gid_entries != 1) || (num_row_or_col != nhedges_Zoltan) || (num_pins != eptr_Zoltan[nhedges_Zoltan]) || (format != ZOLTAN_COMPRESSED_EDGE)) {
 42:     *1;
 43:     return;
 44:   }
 45:   *0;
 46:   for (int e = 0; e < num_row_or_col; ++e) vtxedge_GID[e] = e;
 47:   for (int e = 0; e < num_row_or_col; ++e) vtxedge_ptr[e] = eptr_Zoltan[e];
 48:   for (int p = 0; p < num_pins; ++p) pin_GID[p] = eind_Zoltan[p];
 49: };
 50: #endif
 51: }