static char help[] = "Example program demonstrating projection between particle and finite element spaces\n\n"; #include "petscdmplex.h" #include "petscds.h" #include "petscdmswarm.h" #include "petscksp.h" int main(int argc, char **argv) { DM dm, sw; PetscFE fe; KSP ksp; PC pc; Mat M_p, PM_p=NULL; Vec f, rho, rhs; PetscInt dim, Nc = 1, timestep = 0, i, faces[3]; PetscInt Np = 10, p, field = 0, zero = 0, bs; PetscReal time = 0.0, norm, energy_0, energy_1; PetscReal lo[3], hi[3], h[3]; PetscBool removePoints = PETSC_TRUE; PetscReal *wq, *coords; PetscDataType dtype; PetscErrorCode ierr; PetscBool is_bjac; ierr = PetscInitialize(&argc, &argv, NULL,help);if (ierr) return ierr; /* Create a mesh */ CHKERRQ(DMCreate(PETSC_COMM_WORLD, &dm)); CHKERRQ(DMSetType(dm, DMPLEX)); CHKERRQ(DMSetFromOptions(dm)); CHKERRQ(DMViewFromOptions(dm, NULL, "-dm_view")); CHKERRQ(DMGetDimension(dm, &dim)); i = dim; CHKERRQ(PetscOptionsGetIntArray(NULL, NULL, "-dm_plex_box_faces", faces, &i, NULL)); CHKERRQ(PetscOptionsGetInt(NULL, NULL, "-np", &Np, NULL)); CHKERRQ(DMGetBoundingBox(dm, lo, hi)); for (i=0;i