mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-02 05:49:09 -06:00
Added compute_sequence_graph(), which also returns the upwind graph.
This commit is contained in:
parent
42413c6a35
commit
b5eb8543aa
@ -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 */
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user