# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)


###########################################################
# In this example, the x/y coordinates are as follows
#
#                    x >
#    ---------------------------------
#  ^ |       |       |       | (4,2) |
#  y ---------------------------------  <- part 1
#    | (1,1) |       |       |       |
#    =================================
#  ^ |       |       |       | (4,2) |
#  y ---------------------------------  <- part 0
#    | (1,1) |       |       |       |
#    ---------------------------------
#                    x >
#
###########################################################

# GridCreate: ndim nparts
GridCreate: 2 2

# GridSetExtents: part ilower(ndim) iupper(ndim)
GridSetExtents: 0 (1- 1-) (4+ 2+)
GridSetExtents: 1 (1- 1-) (4+ 2+)

# GridSetVariables: part nvars vartypes[nvars]
# NODE  = 1
GridSetVariables: 0 1 [1]
GridSetVariables: 1 1 [1]

# GridSetNeighborPart: part      ilower(ndim)      iupper(ndim) \
#                      nbor_part nbor_ilower(ndim) nbor_iupper(ndim) \
#                      index_map[ndim] index_dir[ndim]
GridSetNeighborPart: 0 (1- 3-) (4+ 3-) 1 (1- 1-) (4+ 1-) [0 1] [1 1]
GridSetNeighborPart: 1 (1- 0+) (4+ 0+) 0 (1- 2+) (4+ 2+) [0 1] [1 1]

###########################################################

# FEMStencilCreate: size
FEMStencilCreate: 4
 
# FEMStencilSetRow: row offset[ndim] var values[size]
FEMStencilSetRow: 0 [-1 -1] 0 [  1.0 -0.5 -0.5  0.0 ]
FEMStencilSetRow: 1 [ 0 -1] 0 [ -0.5  1.0  0.0 -0.5 ]
FEMStencilSetRow: 2 [-1  0] 0 [ -0.5  0.0  1.0 -0.5 ]
FEMStencilSetRow: 3 [ 0  0] 0 [  0.0 -0.5 -0.5  1.0 ]

###########################################################

# FEMMatrixAddToValues: \
#   part ilower(ndim) iupper(ndim) nrows rows[nrows] ncols cols[ncols] \
#   values[nrows*ncols]

# lower part (s, w, e, sw, se)
FEMMatrixAddToValues: 0 (1- 1-) (4+ 1-) 2 [0 1] 2 [0 1] [ 1.0 -0.5 -0.5 1.0 ]
FEMMatrixAddToValues: 0 (1- 1-) (1- 2+) 2 [0 2] 2 [0 2] [ 1.0 -0.5 -0.5 1.0 ]
FEMMatrixAddToValues: 0 (4+ 1-) (4+ 2+) 2 [1 3] 2 [1 3] [ 1.0 -0.5 -0.5 1.0 ]
FEMMatrixAddToValues: 0 (1- 1-) (1- 1-) 1 [0]   1 [0]   [ 1.0 ]
FEMMatrixAddToValues: 0 (4+ 1-) (4+ 1-) 1 [1]   1 [1]   [ 1.0 ]

# upper part (n, w, e, nw, ne)
FEMMatrixAddToValues: 1 (1- 2+) (4+ 2+) 2 [2 3] 2 [2 3] [ 1.0 -0.5 -0.5 1.0 ]
FEMMatrixAddToValues: 1 (1- 1-) (1- 2+) 2 [0 2] 2 [0 2] [ 1.0 -0.5 -0.5 1.0 ]
FEMMatrixAddToValues: 1 (4+ 1-) (4+ 2+) 2 [1 3] 2 [1 3] [ 1.0 -0.5 -0.5 1.0 ]
FEMMatrixAddToValues: 1 (1- 2+) (1- 2+) 1 [2]   1 [2]   [ 1.0 ]
FEMMatrixAddToValues: 1 (4+ 2+) (4+ 2+) 1 [3]   1 [3]   [ 1.0 ]

###########################################################

# ProcessPoolCreate: num_pools
ProcessPoolCreate: 2

# ProcessPoolSetPart: pool part
ProcessPoolSetPart: 0 0
ProcessPoolSetPart: 1 1

###########################################################

