Question on the ordering for a 3D Distributed Array Vector with 3 degrees of freedom

Barry Smith bsmith at
Sat Feb 16 11:39:13 CST 2008

    In Fortran array indexing it is v(dof,mx,my,mz)


On Feb 15, 2008, at 5:23 PM, Randall Mackie wrote:

> I am using a 3D distributed array with 3 degrees of freedom, where  
> each
> degree of freedom refers to, for example, the model value in the x,  
> y, and
> z directions (the model properties are diagonally anisotropic).
> If I scatter the DA vector to a natural vector on the zero processor,
> and then use VecGetArray to access it:
> 	Call VecGetArray(vseq,xx_v,xx_i,ierr)
> 	do i=1,3*mx*my*mz
> 	  v=xx_a(i)
> 	end do
> 	call VecRestoreArray(vseq,xx_v,xx_i,ierr)
> Is the natural ordering with the vector v then v(mx,my,mz,dof)?
> So then if I want to get the model values in the x direction and write
> them to a file, then it would be the first mx*my*mz values, and so  
> forth?
> Randy

More information about the petsc-users mailing list