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; PetscBool is_bjac; PetscFunctionBeginUser; PetscCall(PetscInitialize(&argc, &argv, NULL,help)); /* Create a mesh */ PetscCall(DMCreate(PETSC_COMM_WORLD, &dm)); PetscCall(DMSetType(dm, DMPLEX)); PetscCall(DMSetFromOptions(dm)); PetscCall(DMViewFromOptions(dm, NULL, "-dm_view")); PetscCall(DMGetDimension(dm, &dim)); i = dim; PetscCall(PetscOptionsGetIntArray(NULL, NULL, "-dm_plex_box_faces", faces, &i, NULL)); PetscCall(PetscOptionsGetInt(NULL, NULL, "-np", &Np, NULL)); PetscCall(DMGetBoundingBox(dm, lo, hi)); for (i=0;i