17 #define __FUNCT__ "TransferVecToPETSc" 36 std::vector<int> index(sim[sim_idx].solver.ndims,0);
45 VecRestoreArray(Y,&Yarr);
47 PetscFunctionReturn(0);
58 PetscErrorCode ierr = 0;
63 double val[bs][bs*nbands];
64 for (
int n=0; n<nbands; n++) {
65 colind[n] = M->
ncol[nbands*i+n];
66 for (
int p=0; p<bs; p++) {
67 for (
int q = 0; q<bs; q++) {
68 val[p][n*bs+q] = M->
data[i*nbands*bs2+n*bs2+p*bs+q];
72 MatSetValuesBlocked(A,1,&M->
nrow[i],M->
nbands,&colind[0],&val[0][0],INSERT_VALUES);
75 MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
76 MatAssemblyEnd (A,MAT_FINAL_ASSEMBLY);
Structure defining a simulation.
int TransferMatToPETSc(void *J, Mat A, void *ctxt)
Data structure and some function declarations for banded block matrices.
Some basic definitions and macros.
Structure for defining a banded block matrix.
INLINE int ArrayCopynD(int, const double *, double *, int *, int, int, int *, int)
Structure containing the variables for time-integration with PETSc.
int TransferVecToPETSc(const double *const u, Vec Y, void *ctxt, const int sim_idx, const int offset)
Contains macros and function definitions for common array operations.
Contains structure that defines the interface for time integration with PETSc (https://petsc.org/release/)