<div dir="ltr">I get all the coordinates with this method:<div><br></div><div>static PetscErrorCode crd_func(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt Nf_dummy, PetscScalar *u, void *actx)<br>{<br>  int i;<br>  PetscFunctionBeginUser;<br>  for (i = 0; i < dim; ++i) u[i] = x[i];<br>  PetscFunctionReturn(0);<br>}<br></div><div><br></div><div>  PetscErrorCode (*initu[1])(PetscInt, PetscReal, const PetscReal [], PetscInt, PetscScalar [], void *);<br></div><div>  /* project coordinates to vertices */<br>  ierr = DMCreateGlobalVector(crddm, &crd_vec);CHKERRV(ierr);<br>  initu[0] = crd_func;<br>  ierr = DMProjectFunction(crddm, 0.0, initu, NULL, INSERT_ALL_VALUES, crd_vec);CHKERRV(ierr);<br>  ierr = VecViewFromOptions(crd_vec, NULL, "-coord_view");CHKERRV(ierr);<br>  /* iterate over mesh data and get indices */<br>  ierr = VecGetArrayRead(crd_vec,&xx);CHKERRV(ierr);<br>  ierr = VecGetLocalSize(rho,&N);CHKERRV(ierr);<br>  /* access grid data here */<br>  for (p=0;p<N;p++) { <br>    for (i=0;i<dim;i++) ..... = xx[p*dim+i];<br>    PetscPrintf(PETSC_COMM_SELF,"xx = (%g, %g)\n", xx[p*dim+0], xx[p*dim+1]); <br>  }<br>  ierr = VecRestoreArrayRead(crd_vec,&xx);CHKERRV(ierr);<br>  ierr = VecDestroy(&crd_vec);CHKERRV(ierr);<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jul 25, 2020 at 4:10 AM Swarnava Ghosh <<a href="mailto:swarnava89@gmail.com">swarnava89@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear Petsc users,<div><br></div><div>I had a trivial question about DMPlex. Suppose I have a 3D mesh of tetrahedrons. I want to find out the 3D coordinates of the vertices of a particular cell. What would be the function to do this?</div><div><br></div><div>Thank you,</div><div>SG</div></div>
</blockquote></div>