index_grid2vector: Convert node grid positions to indices

View source: R/flownet_finitedifferences.R

index_grid2vectorR Documentation

Convert node grid positions to indices

Description

Function takes a vectors of x and y node indices and returns the index (numbered row-wise)

Usage

index_grid2vector(ix, iy, nx, ny, i0 = 0, real_only = FALSE, ...)

Arguments

ix, iy

arrays with index of position in x and y directions

nx

number of real nodes in x and y directions

ny

number of real nodes in x and y directions

i0

node index offset

real_only

if 'TRUE', only real nodes are numbered and ghost nodes are ignored in numbering

...

additional arguments to pass

Value

array with node index for each node

Examples

#define grid
nx <- 4
ny <- 3

#including ghost nodes
i <- seq(nodes_total(nx, ny))
ixy <- index_vector2grid(i, nx, ny)
index_grid2vector(ixy$ix, ixy$iy, nx, ny)

#excluding ghost nodes
i <- seq(nodes_total(nx, ny, real_only = TRUE))
ixy <- index_vector2grid(i, nx, ny, real_only = TRUE)
index_grid2vector(ixy$ix, ixy$iy, nx, ny, real_only = TRUE)

GJMeijer/soilmech documentation built on May 22, 2022, 10:39 a.m.