<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Apr 28, 2018 at 2:08 AM, Danyang Su <span dir="ltr"><<a href="mailto:danyang.su@gmail.com" target="_blank">danyang.su@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
I use DMPlex and need to get coordinates back after distribution. However, I always get segmentation violation in getting coords values in the following codes if using multiple processors. If only one processor is used, it works fine.<br>
<br>
For each processors, the off value starts from 0 which looks good. I also tried 0-based index, which gives the same error. Would any one help to check what is wrong here?<br>
<br>
idof 1 off 0<br>
idof 2 off 0<br>
idof 1 off 2<br>
idof 2 off 2<br>
idof 1 off 4<br>
idof 2 off 4<br>
idof 1 off 6<br>
idof 2 off 6<br>
idof 1 off 8<br>
idof 2 off 8<br>
<br>
<br>
DM :: distributedMesh, cda<br>
Vec :: gc<br>
PetscScalar, pointer :: coords(:)<br>
PetscSection :: cs<br>
<br>
...<br>
<br>
call DMGetCoordinatesLocal(dmda_flo<wbr>w%da,gc,ierr)<br>
CHKERRQ(ierr)<br>
<br>
call DMGetCoordinateDM(dmda_flow%da<wbr>,cda,ierr)<br>
CHKERRQ(ierr)<br>
<br>
call DMGetDefaultSection(cda,cs,ier<wbr>r)<br>
CHKERRQ(ierr)<br>
<br>
call PetscSectionGetChart(cs,istart<wbr>,iend,ierr)<br>
CHKERRQ(ierr)<br>
<br>
!c get coordinates array<br>
call DMDAVecGetArrayF90(cda,gc,coor<wbr>ds,ierr)<br></blockquote><div><br></div><div>You cannot call DMDA function if you have a DMPlex. You jsut call VecGetArrayF90()</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
CHKERRQ(ierr)<br>
<br>
do ipoint = istart, iend-1<br>
<br>
call PetscSectionGetDof(cs,ipoint,d<wbr>of,ierr)<br>
CHKERRQ(ierr)<br>
<br>
call PetscSectionGetOffset(cs,ipoin<wbr>t,off,ierr)<br>
CHKERRQ(ierr)<br>
<br>
inode = ipoint-istart+1<br>
<br>
if (cell_coords == coords_xyz) then<br>
nodes(inode)%x = coords(off+1)<br>
nodes(inode)%y = coords(off+2)<br>
nodes(inode)%z = coords(off+3)<br>
else if (cell_coords == coords_xy) then<br>
nodes(inode)%x = coords(off+1)<br>
nodes(inode)%y = coords(off+2)<br>
nodes(inode)%z = 0.0d0<br>
else if (cell_coords == coords_yz) then<br>
nodes(inode)%x = 0.0d0<br>
nodes(inode)%y = coords(off+1)<br>
nodes(inode)%z = coords(off+2)<br>
else if (cell_coords ==coords_xz) then<br>
nodes(inode)%x = coords(off+1)<br>
nodes(inode)%y = 0.0d0<br>
nodes(inode)%z = coords(off+2)<br>
end if<br>
end do<br>
<br>
call DMDAVecRestoreArrayF90(cda,gc,<wbr>coords,ierr)<br>
CHKERRQ(ierr)<br>
<br>
Thanks,<br>
<br>
Danyang<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.caam.rice.edu/~mk51/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div>
</div></div>