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);
INLINE int ArrayCopynD(int, const double *, double *, int *, int, int, int *, int)
Structure for defining a banded block matrix.
Data structure and some function declarations for banded block matrices.
int TransferMatToPETSc(void *, Mat, void *)
int TransferVecToPETSc(const double *const, Vec, void *, const int, const int)
Contains structure that defines the interface for time integration with PETSc (https://petsc.org/release/)
Structure containing the variables for time-integration with PETSc.
Structure defining a simulation.
Some basic definitions and macros.
Contains macros and function definitions for common array operations.