Actual source code: meshzoltan.c
petsc-3.3-p7 2013-05-11
1: #include <petscdmmesh.hh>
3: extern "C" {
4: #ifdef 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: *0;
13: return nvtxs_Zoltan;
14: };
16: 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) {
17: if ((wgt_dim != 0) || (num_gid_entries != 1) || (num_lid_entries != 1)) {
18: *1;
19: return;
20: }
21: *0;
22: for(int v = 0; v < nvtxs_Zoltan; ++v) {
23: global_ids[v]= v;
24: local_ids[v] = v;
25: }
26: return;
27: };
29: void getHgSizes_Zoltan(void *data, int *num_lists, int *num_pins, int *format, int *ierr) {
30: *0;
31: *num_lists = nhedges_Zoltan;
32: *num_pins = eptr_Zoltan[nhedges_Zoltan];
33: *format = ZOLTAN_COMPRESSED_EDGE;
34: };
36: 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) {
37: if ((num_gid_entries != 1) || (num_row_or_col != nhedges_Zoltan) || (num_pins != eptr_Zoltan[nhedges_Zoltan]) || (format != ZOLTAN_COMPRESSED_EDGE)) {
38: *1;
39: return;
40: }
41: *0;
42: for(int e = 0; e < num_row_or_col; ++e) {
43: vtxedge_GID[e] = e;
44: }
45: for(int e = 0; e < num_row_or_col; ++e) {
46: vtxedge_ptr[e] = eptr_Zoltan[e];
47: }
48: for(int p = 0; p < num_pins; ++p) {
49: pin_GID[p] = eind_Zoltan[p];
50: }
51: };
52: #endif
53: }