ESScript  Revision_
dudley/src/Util.h
Go to the documentation of this file.
1 
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15 
16 /************************************************************************************/
17 
18 /* Some utility routines: */
19 
20 /************************************************************************************/
21 
22 #ifndef INC_DUDLEY_UTIL
23 #define INC_DUDLEY_UTIL
24 
25 #include "Dudley.h"
26 
27 /************************************************************************************/
28 
29 void Dudley_Util_Gather_double(dim_t len, index_t * index, dim_t numData, double *in, double *out);
30 void Dudley_Util_Gather_int(dim_t len, index_t * index, dim_t numData, index_t * in, index_t * out);
31 void Dudley_Util_AddScatter(const dim_t len, const index_t * index, const dim_t numData, const double *in, double *out, const index_t upperBound);
32 void Dudley_Util_SmallMatMult(dim_t A1, dim_t A2, double *A, dim_t B2, const double *B, const double *C);
33 void Dudley_Util_SmallMatSetMult(dim_t len, dim_t A1, dim_t A2, double *A, dim_t B2, const double *B, const double *C);
34 void Dudley_Util_SmallMatSetMult1(dim_t len, dim_t A1, dim_t A2, double *A, dim_t B2, const double *B, const double *C);
35 void Dudley_Util_InvertSmallMat(dim_t len, dim_t dim, double *A, double *invA, double *det);
36 void Dudley_Util_DetOfSmallMat(dim_t len, dim_t dim, double *A, double *det);
37 void Dudley_NormalVector(dim_t len, dim_t dim, dim_t dim1, double *A, double *Normal);
38 void Dudley_LengthOfNormalVector(dim_t len, dim_t dim, dim_t dim1, double *A, double *length);
45 bool Dudley_Util_isAny(dim_t N, index_t * array, index_t value);
47 bool Dudley_Util_anyNonZeroDouble(dim_t N, double *values);
48 void Dudley_Util_setValuesInUse(const index_t * values, const dim_t numValues, dim_t * numValuesInUse,
49  index_t ** valuesInUse, Esys_MPIInfo * mpiinfo);
50 
51 #ifdef ESYS_MPI
52 void Dudley_printDoubleArray(FILE * fid, dim_t n, double *array, char *name);
53 void Dudley_printIntArray(FILE * fid, dim_t n, int *array, char *name);
54 void Dudley_printMaskArray(FILE * fid, dim_t n, int *array, char *name);
55 #endif
56 
57 /* Dudley_Util_orderValueAndIndex is used to sort items by a value */
58 /* index points to the location of the original item array. */
59 /* it can be used to reorder the array */
63 };
65 
67 int Dudley_Util_ValueAndIndex_compar(const void *, const void *);
68 
69 #endif /* #ifndef INC_UTIL_UTIL */