Version 1.2 (June 2013)
 All Classes Namespaces Files Functions Variables Pages
Static Public Member Functions | List of all members
utils.GridOperations Class Reference

Collection of static methods to deal with spatial grids that are used in the MicroCoSm model. More...

Static Public Member Functions

static double[] vectorizeArray (double[][][] originalArray)
 Transforms a 3D array to a 1D array. More...
 
static double[] vectorizeArray (double[][] originalArray)
 Transforms a 2D array to a 1D array. More...
 
static double[][][] reshapeArray (double[] vectorized, int nI, int nJ, int nK)
 Reshape a vectorized array to 3 dimensional array. More...
 
static int gcd (int a, int b)
 Find the greatest common divisor of two integer numbers. More...
 
static boolean isConsistent (int[] a, int[] b)
 Check the consistency of two grid sizes. More...
 
static void addTo (double[] a, double[] b)
 Add every entry of array b to the corresponding entry in array a. More...
 
static void subtractFrom (double[] a, double[] b)
 Subtract every entry of matrix b from the corresponding entry in matrix a. (Perform a-b) More...
 
static double computeSum (double[] a)
 Return the sum of all elements in a double array. More...
 

Detailed Description

Collection of static methods to deal with spatial grids that are used in the MicroCoSm model.

Collection of static methods to deal with spatial grids that are used in the MicroCoSm model. Includes methods for dealing with the vectorized array data structure and for checking consistency of different cubic grids.

Author
Andreas Dotsch (andre.nosp@m.as.d.nosp@m.oetsc.nosp@m.h@he.nosp@m.lmhol.nosp@m.tz-h.nosp@m.zi.de), Helmholtz Centre for Infection Research (Germany)

Member Function Documentation

static void utils.GridOperations.addTo ( double[]  a,
double[]  b 
)
static

Add every entry of array b to the corresponding entry in array a.

Add every entry of array b to the corresponding entry in array a

Parameters
aTarget array
bArray of values being added to a
static double utils.GridOperations.computeSum ( double[]  a)
static

Return the sum of all elements in a double array.

Return the sum of all elements in a double array

Parameters
aDouble array to sum
Returns
the sum of all elements of a
static int utils.GridOperations.gcd ( int  a,
int  b 
)
static

Find the greatest common divisor of two integer numbers.

Find the greatest common divisor of two integer numbers

Parameters
aInteger one
bInteger two
Returns
the greatest common divisor (int)
Deprecated:
static boolean utils.GridOperations.isConsistent ( int[]  a,
int[]  b 
)
static

Check the consistency of two grid sizes.

Check the consistency of two grid sizes. Two grids of cubic voxels are consistent if one could be transformed to the other by dividing and then multipliying the number of voxels in each dimension by an integer number, respectively.

Parameters
aGrid sizes of first grid as an array of integers {nI,nJ,nK}
bGrid sizes of second grid as an array of integers {nI,nJ,nK}
Returns
true if grids are consistent
static double [][][] utils.GridOperations.reshapeArray ( double[]  vectorized,
int  nI,
int  nJ,
int  nK 
)
static

Reshape a vectorized array to 3 dimensional array.

Reshape a vectorized array to 3 dimensional array

Parameters
vectorizedthe vectorized array
nIArray size in I direction
nJArray size in J direction
nKArray size in K direction
Returns
the reshaped array
Deprecated:
static void utils.GridOperations.subtractFrom ( double[]  a,
double[]  b 
)
static

Subtract every entry of matrix b from the corresponding entry in matrix a. (Perform a-b)

Subtract every entry of matrix b from the corresponding entry in matrix a. (Perform a-b)

Parameters
aTarget array
bArray of values being subtracted from a
static double [] utils.GridOperations.vectorizeArray ( double  originalArray[][][])
static

Transforms a 3D array to a 1D array.

Transforms a 3D array to a 1D array

Parameters
originalArray3 dimensional array to transform
Returns
Vectorized array in one dimension
Deprecated:
static double [] utils.GridOperations.vectorizeArray ( double  originalArray[][])
static

Transforms a 2D array to a 1D array.

Transforms a 2D array to a 1D array

Parameters
originalArray2 dimensional array to transform
Returns
Vectorized array in one dimension
Deprecated:

The documentation for this class was generated from the following file: