Added compute_sequence_graph(), which also returns the upwind graph.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-02-17 09:29:56 +01:00
parent 42413c6a35
commit b5eb8543aa
2 changed files with 47 additions and 0 deletions

View File

@ -117,6 +117,31 @@ compute_reorder_sequence(int nc, int nf, int *cellfaces, int *faceptr, int *face
free(work);
}
static void
compute_reorder_sequence_graph(int nc, int nf, int *cellfaces, int *faceptr, int *face2cell,
const double *flux, int *sequence, int *components, int *ncomponents,
int *ia, int *ja)
{
int *work;
int sz = nf;
if (nf < 3*nc)
{
sz = 3*nc;
}
work = (int*) malloc( sz * sizeof *work);
make_upwind_graph(nc, cellfaces, faceptr, face2cell,
flux, ia, ja, work);
tarjan (nc, ia, ja, sequence, components, ncomponents, work);
free(work);
}
void compute_sequence(const struct UnstructuredGrid *grid, const double *flux,
int *sequence,
int *components, int *ncomponents)
@ -133,6 +158,24 @@ void compute_sequence(const struct UnstructuredGrid *grid, const double *flux,
ncomponents);
}
void compute_sequence_graph(const struct UnstructuredGrid *grid, const double *flux,
int *sequence,
int *components, int *ncomponents,
int *ia, int *ja)
{
compute_reorder_sequence_graph(grid->number_of_cells,
grid->number_of_faces,
grid->cell_faces,
grid->cell_facepos,
grid->face_cells,
flux,
sequence,
components,
ncomponents,
ia, ja);
}
/* Local Variables: */
/* c-basic-offset:4 */

View File

@ -7,9 +7,13 @@ extern "C" {
#endif
struct UnstructuredGrid;
void compute_sequence(const struct UnstructuredGrid *grid, const double *flux,
int *sequence, int *components, int *ncomponents);
void compute_sequence_graph(const struct UnstructuredGrid *grid, const double *flux,
int *sequence, int *components, int *ncomponents,
int *ia, int *ja);
#ifdef __cplusplus