15 #define __FUNCT__ "PetscComputePreconMatImpl" 66 int nsims = context->
nsims;
73 for (
int ns = 0; ns < nsims; ns++) {
81 HyPar* solver( &(sim[ns].solver) );
84 int ndims = solver->
ndims,
85 nvars = solver->
nvars,
90 *points = context->
points[ns],
91 index[ndims],indexL[ndims],indexR[ndims],
92 rows[nvars],cols[nvars];
94 double *u = solver->
u,
96 dxinv, values[nvars*nvars];
103 for (
int n = 0; n < npoints; n++) {
104 int *this_point = points + n*(ndims+1);
105 int p = this_point[ndims];
108 double iblank = solver->
iblank[p];
112 for (
int dir = 0; dir < ndims; dir++) {
130 for (
int v=0; v<nvars; v++) { rows[v] = nvars*pg + v; cols[v] = nvars*pg + v; }
133 MatSetValues(Pmat,nvars,rows,nvars,cols,values,ADD_VALUES);
137 for (
int v=0; v<nvars; v++) { rows[v] = nvars*pg + v; cols[v] = nvars*pgL + v; }
140 MatSetValues(Pmat,nvars,rows,nvars,cols,values,ADD_VALUES);
145 for (
int v=0; v<nvars; v++) { rows[v] = nvars*pg + v; cols[v] = nvars*pgR + v; }
148 MatSetValues(Pmat,nvars,rows,nvars,cols,values,ADD_VALUES);
155 for (
int dir = 0; dir < ndims; dir++) {
173 for (
int v=0; v<nvars; v++) { rows[v] = nvars*pg + v; cols[v] = nvars*pg + v; }
176 MatSetValues(Pmat,nvars,rows,nvars,cols,values,ADD_VALUES);
180 for (
int v=0; v<nvars; v++) { rows[v] = nvars*pg + v; cols[v] = nvars*pgL + v; }
183 MatSetValues(Pmat,nvars,rows,nvars,cols,values,ADD_VALUES);
188 for (
int v=0; v<nvars; v++) { rows[v] = nvars*pg + v; cols[v] = nvars*pgR + v; }
191 MatSetValues(Pmat,nvars,rows,nvars,cols,values,ADD_VALUES);
198 MatAssemblyBegin(Pmat,MAT_FINAL_ASSEMBLY);
199 MatAssemblyEnd (Pmat,MAT_FINAL_ASSEMBLY);
201 MatShift(Pmat,context->
shift);
202 PetscFunctionReturn(0);
std::vector< int * > points
Structure defining a simulation.
C++ declarations for MPI-related functions.
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
int(* ApplyBoundaryConditions)(void *, void *, double *, double *, double)
int(* KFunction)(double *, double *, void *, int, int)
Structure containing all solver-specific variables and functions.
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int PetscComputePreconMatImpl(Mat Pmat, Vec Y, void *ctxt)
Structure containing the variables for time-integration with PETSc.
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
int(* JFunction)(double *, double *, void *, int, int, int)
Structure of MPI-related variables.
#define _ArrayScale1D_(x, a, size)
std::vector< double * > globalDOF
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
int TransferVecFromPETSc(double *const, const Vec, void *, const int, const int)