On 10/11/2015 8:47 PM, Matthew Knepley
wrote:
Hi,
Let me clarify this. I declare in this way:
DM da_cu_types
Vec cu_types_local,cu_types_global
PetscScalar,pointer :: cu_types_array(:,:,:)
call
DMDACreate3d(MPI_COMM_WORLD,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DMDA_STENCIL_STAR,(end_ijk_uniform(1)
- sta_ijk_uniform(1) + 1),(end_ijk_uniform(2) - sta_ijk_uniform(2) +
1),&
(end_ijk_uniform(3) - sta_ijk_uniform(3) +
1),PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,stencil_width_IIB,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,PETSC_NULL_INTEGER,da_cu_types,ierr)
call DMCreateGlobalVector(da_cu_types,cu_types_global,ierr)
call DMCreateLocalVector(da_cu_types,cu_types_local,ierr)
So when I need to change the values in DA variable cu_types, I call:
call
DMDAVecGetArrayF90(da_cu_types,cu_types_local,cu_types_array,ierr)
.... math operations, changing the values of cu_types_array, such
as:
cu_types_array = 0.d0
call
DMDAVecRestoreArrayF90(da_cu_types,cu_types_local,cu_types_array,ierr)
1st of all, does these DMDAVecGetArrayF90 and DMDAVecRestoreArrayF90
take a lot of time, especially if I call them many times.
Next qn is whether if I can call DMDAVecGetArrayF90 at the start,
and DMDAVecRestoreArrayF90 after operations similar to the one above
is finished.
Thanks.