Subsections


6.7 Non-Replicated Variable Arrays

For each non-replicated variable array defined in the Config file (see Sec:ConfigFileSyntax), various macros and constants are defined to assist the user in retrieving the information from the NONREP line as well as determining the distribution of array element variables across the meshes.

6.7.1 Per-Array Macros

For each non-replicated variable array FOO as defined by the following Config line:

NONREP unktype FOO localmax globalparam ioformat

the following will be placed into Flash.h:

6.7.2 Array Partitioning Macros

These are the macros used to calculate the subset of indices into the global variable array each mesh is responsible for:

Descriptions of arguments to the above macros:

6.7.3 Example

In this example the global array FOO has eight elements, but there are three meshes, so two of the meshes will receive three elements of the array and one will get two. How that distribution is decided is hidden from the user. The output datasets will contain variables foo1 ...foo8.

Config:  

NONREP MASS_SCALAR FOO 3 numFoo foo?

flash.par:  

meshCopyCount = 3
numFoo = 8

Fortran 90:  

#include "Flash.h"

! this shows how to iterate over the UNKs corresponding to this ! processor's subset of FOO integer :: nfooglob, nfooloc ! number of foo vars, global and local integer :: mesh, nmesh ! this mesh number, and total number of meshes integer :: fooloc, fooglob ! local and global foo indices integer :: unk
call Driver_getMype(MESH_ACROSS_COMM, mesh) call Driver_getNumProcs(MESH_ACROSS_COMM, nmesh) call RuntimeParameters_get(FOO_NONREP_RPCOUNT, nfooglob) nfooloc = NONREP_NLOCS(mesh, nmesh, nfooglob)
! iterate over the local subset for this mesh do fooloc=1, nfooloc ! get the location in UNK unk = FOO_NONREP_LOC2UNK(fooloc) ! get the global index fooglob = NONREP_LOC2GLOB(fooloc, mesh, nmesh)
! you have what you need, do your worst... end do