static void face_coeff_from_below_por (FttCell * cell) { FttDirection d; GfsFaceStateVector * f = GFS_STATE (cell)->f; guint neighbors = 0; for (d = 0; d < FTT_NEIGHBORS; d++) { FttCellChildren child; guint i, n; f[d].v = 0.; n = ftt_cell_children_direction (cell, d, &child); for (i = 0; i < n; i++) if (child.c[i]) f[d].v += GFS_STATE (child.c[i])->f[d].v; f[d].v /= n; /* fixme: this stuff may not be necessary anymore? The 'dumbell' test case seems to work fine without this */ FttCell * neighbor; if (f[d].v != 0. && (neighbor = ftt_cell_neighbor (cell, d)) && !GFS_CELL_IS_BOUNDARY (neighbor)) neighbors++; } if (neighbors == 1) for (d = 0; d < FTT_NEIGHBORS; d++) f[d].v = 0.; }
static void traverse_face (FttCell * cell, gpointer * datum) { FttDirection * d = datum[0]; gint max_depth = *((gint *) datum[1]); FttFaceTraverseFunc func = (FttFaceTraverseFunc) datum[2]; gpointer data = datum[3]; gboolean check = *((gboolean *) datum[4]); gboolean boundary_faces = *((gboolean *) datum[5]); FttCellFace face; face.d = *d; face.cell = cell; face.neighbor = ftt_cell_neighbor (cell, face.d); if (face.neighbor) { if (!check || (face.neighbor->flags & FTT_FLAG_TRAVERSED) == 0) { if (FTT_CELL_IS_LEAF (cell) && !FTT_CELL_IS_LEAF (face.neighbor) && (max_depth < 0 || ftt_cell_level (face.neighbor) < max_depth)) { /* coarse -> fine */ FttCellChildren children; guint i, n; face.d = FTT_OPPOSITE_DIRECTION (face.d); n = ftt_cell_children_direction (face.neighbor, face.d, &children); face.neighbor = face.cell; for (i = 0; i < n; i++) if ((face.cell = children.c[i]) && (!check || (face.cell->flags & FTT_FLAG_TRAVERSED) == 0)) (* func) (&face, data); } else (* func) (&face, data); } } else if (boundary_faces) (* func) (&face, data); }
static void obtain_face_fluxes (const FttCell * cell) { FttCellChildren child; GfsStateVector * s = GFS_STATE (cell); FttDirection d; for (d = 0; d < FTT_NEIGHBORS; d++) { FttCell * neighbor = ftt_cell_neighbor (cell, d); if (neighbor) { if (!FTT_CELL_IS_LEAF (neighbor)) { gint i, n = ftt_cell_children_direction (neighbor, FTT_OPPOSITE_DIRECTION(d), &child); s->f[d].v = 0; for (i = 0; i < n; i++) if (child.c[i]) s->f[d].v += GFS_STATE (child.c[i])->f[FTT_OPPOSITE_DIRECTION(d)].v; s->f[d].v /= n; } else if ((d % 2) > 0 && ftt_cell_level(cell) == ftt_cell_level(neighbor)) s->f[d].v = GFS_STATE (neighbor)->f[FTT_OPPOSITE_DIRECTION(d)].v; } else s->f[d].v = 0; } }