~vcs-imports/escript-finley/trunk

« back to all changes in this revision

Viewing changes to dudley/src/Util.h

  • Committer: jfenwick
  • Date: 2010-10-11 01:48:14 UTC
  • Revision ID: svn-v4:77569008-7704-0410-b7a0-a92fef0b09fd:trunk:3259
Merging dudley and scons updates from branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*******************************************************
 
3
*
 
4
* Copyright (c) 2003-2010 by University of Queensland
 
5
* Earth Systems Science Computational Center (ESSCC)
 
6
* http://www.uq.edu.au/esscc
 
7
*
 
8
* Primary Business: Queensland, Australia
 
9
* Licensed under the Open Software License version 3.0
 
10
* http://www.opensource.org/licenses/osl-3.0.php
 
11
*
 
12
*******************************************************/
 
13
 
 
14
/**************************************************************/
 
15
 
 
16
/*   Some utility routines: */
 
17
 
 
18
/**************************************************************/
 
19
 
 
20
#ifndef INC_DUDLEY_UTIL
 
21
#define INC_DUDLEY_UTIL
 
22
 
 
23
#include "Dudley.h"
 
24
 
 
25
/**************************************************************/
 
26
 
 
27
void Dudley_Util_Gather_double(dim_t len, index_t * index, dim_t numData, double *in, double *out);
 
28
void Dudley_Util_Gather_int(dim_t len, index_t * index, dim_t numData, index_t * in, index_t * out);
 
29
void Dudley_Util_AddScatter(dim_t len, index_t * index, dim_t numData, double *in, double *out, index_t bound);
 
30
void Dudley_Util_SmallMatMult(dim_t A1, dim_t A2, double *A, dim_t B2, const double *B, const double *C);
 
31
void Dudley_Util_SmallMatSetMult(dim_t len, dim_t A1, dim_t A2, double *A, dim_t B2, const double *B, const double *C);
 
32
void Dudley_Util_SmallMatSetMult1(dim_t len, dim_t A1, dim_t A2, double *A, dim_t B2, const double *B, const double *C);
 
33
void Dudley_Util_InvertSmallMat(dim_t len, dim_t dim, double *A, double *invA, double *det);
 
34
void Dudley_Util_DetOfSmallMat(dim_t len, dim_t dim, double *A, double *det);
 
35
void Dudley_NormalVector(dim_t len, dim_t dim, dim_t dim1, double *A, double *Normal);
 
36
void Dudley_LengthOfNormalVector(dim_t len, dim_t dim, dim_t dim1, double *A, double *length);
 
37
void Dudley_Util_InvertMap(dim_t, index_t *, dim_t, index_t *);
 
38
index_t Dudley_Util_getMaxInt(dim_t dim, dim_t N, index_t * values);
 
39
index_t Dudley_Util_getMinInt(dim_t dim, dim_t N, index_t * values);
 
40
index_t Dudley_Util_getFlaggedMaxInt(dim_t dim, dim_t N, index_t * values, index_t ignore);
 
41
index_t Dudley_Util_getFlaggedMinInt(dim_t dim, dim_t N, index_t * values, index_t ignore);
 
42
dim_t Dudley_Util_packMask(dim_t N, bool_t * mask, index_t * index);
 
43
bool_t Dudley_Util_isAny(dim_t N, index_t * array, index_t value);
 
44
index_t Dudley_Util_cumsum(dim_t, index_t *);
 
45
bool_t Dudley_Util_anyNonZeroDouble(dim_t N, double *values);
 
46
void Dudley_Util_setValuesInUse(const index_t * values, const dim_t numValues, dim_t * numValuesInUse,
 
47
                                index_t ** valuesInUse, Esys_MPIInfo * mpiinfo);
 
48
 
 
49
#ifdef ESYS_MPI
 
50
void Dudley_printDoubleArray(FILE * fid, dim_t n, double *array, char *name);
 
51
void Dudley_printIntArray(FILE * fid, dim_t n, int *array, char *name);
 
52
void Dudley_printMaskArray(FILE * fid, dim_t n, int *array, char *name);
 
53
#endif
 
54
 
 
55
/* Dudley_Util_orderValueAndIndex is used to sort items by a value */
 
56
/* index points to the location of the original item array. */
 
57
/* it can be used to reorder the array */
 
58
struct Dudley_Util_ValueAndIndex {
 
59
    index_t index;
 
60
    index_t value;
 
61
};
 
62
typedef struct Dudley_Util_ValueAndIndex Dudley_Util_ValueAndIndex;
 
63
 
 
64
void Dudley_Util_sortValueAndIndex(dim_t n, Dudley_Util_ValueAndIndex * array);
 
65
int Dudley_Util_ValueAndIndex_compar(const void *, const void *);
 
66
 
 
67
#endif                          /* #ifndef INC_UTIL_UTIL */