#include "petscdm.h" #include "petscdmlabel.h" #include "petscds.h" PetscErrorCode DMLocatePoints(DM dm, Vec v, DMPointLocationType ltype, PetscSF *cellSF)Collective on Vec v (see explanation below)
dm | - The DM | |
v | - The Vec of points | |
ltype | - The type of point location, e.g. DM_POINTLOCATION_NONE or DM_POINTLOCATION_NEAREST | |
cells | - Points to either NULL, or a PetscSF with guesses for which cells contain each point. |
v | - The Vec of points, which now contains the nearest mesh points to the given points if DM_POINTLOCATION_NEAREST is used | |
cells | - The PetscSF containing the ranks and local indices of the containing points. |
If *cellSF is NULL on input, a PetscSF will be created. If *cellSF is not NULL on input, it should point to an existing PetscSF, whose graph will be used as initial guesses.
An array that maps each point to its containing cell can be obtained with
const PetscSFNode *cells;
PetscInt nFound;
const PetscSFNode *found;
PetscSFGetGraph(cells,NULL,&nFound,&found,&cells);
Where cells[i].rank is the rank of the cell containing point found[i] (or i if found == NULL), and cells[i].index is the index of the cell in its rank's local numbering.