//generic snapshot function. To be called with function pointer for each type of snapshot void snapshot(Grid *g, float *field, int slice, int orientation, Snapshot snap) { int i, j; //did we initialize the snapshots? if (!isInitialized()) { return; } //do we need to get a snapshot? if (!strideConditionsMet(g)) { return; } switch (orientation) { case XY: // XY plane snap.header(g, XY, slice); for (i = 0; i < g->sizeX; i++) { for (j = 0; j < g->sizeY; j++) { snap.body(g, field, i, j, slice, j); } snap.rowDelim(i); } break; case XZ: // XZ plane snap.header(g, XZ, slice); for (i = 0; i < g->sizeX; i++) { for (j = 0; j < g->sizeZ; j++) { snap.body(g, field, i, slice, j, j); } snap.rowDelim(i); } break; case YZ: // YZ plane snap.header(g, YZ, slice); for (i = 0; i < g->sizeY; i++) { for (j = 0; j < g->sizeZ; j++) { snap.body(g, field, slice, i, j, j); } snap.rowDelim(i); } break; } snap.footer(); return; }