ESYS13
Revision_
|
00001 00002 /******************************************************* 00003 * 00004 * Copyright (c) 2003-2012 by University of Queensland 00005 * Earth Systems Science Computational Center (ESSCC) 00006 * http://www.uq.edu.au/esscc 00007 * 00008 * Primary Business: Queensland, Australia 00009 * Licensed under the Open Software License version 3.0 00010 * http://www.opensource.org/licenses/osl-3.0.php 00011 * 00012 *******************************************************/ 00013 00014 00015 /**************************************************************/ 00016 00017 /* Some utility routines: */ 00018 00019 /**************************************************************/ 00020 00021 #ifndef INC_FINLEY_UTIL 00022 #define INC_FINLEY_UTIL 00023 00024 #include "Finley.h" 00025 #include "esysUtils/Esys_MPI.h" 00026 00027 /**************************************************************/ 00028 00029 void Finley_Util_Gather_double(dim_t len,index_t* index,dim_t numData,double* in,double * out); 00030 void Finley_Util_Gather_int(dim_t len,index_t* index,dim_t numData,index_t* in,index_t * out); 00031 void Finley_Util_AddScatter(const dim_t len, const index_t* index, const dim_t numData, const double* in,double * out, const index_t upperBound); 00032 void Finley_Util_SmallMatMult(dim_t A1,dim_t A2, double* A, dim_t B2, double*B, double* C); 00033 void Finley_Util_SmallMatSetMult(dim_t len,dim_t A1,dim_t A2, double* A, dim_t B2, double*B, double* C); 00034 void Finley_Util_SmallMatSetMult1(dim_t len,dim_t A1,dim_t A2, double* A, dim_t B2, double*B, double* C); 00035 void Finley_Util_InvertSmallMat(dim_t len,dim_t dim,double* A,double *invA, double* det); 00036 void Finley_Util_DetOfSmallMat(dim_t len,dim_t dim,double* A,double* det); 00037 void Finley_NormalVector(dim_t len, dim_t dim, dim_t dim1, double* A,double* Normal); 00038 void Finley_LengthOfNormalVector(dim_t len, dim_t dim, dim_t dim1, double* A,double* length); 00039 void Finley_Util_InvertMap(dim_t, index_t*,dim_t, index_t*); 00040 index_t Finley_Util_getMaxInt(dim_t dim,dim_t N,index_t* values); 00041 index_t Finley_Util_getMinInt(dim_t dim,dim_t N,index_t* values); 00042 index_t Finley_Util_getFlaggedMaxInt(dim_t dim,dim_t N,index_t* values,index_t ignore); 00043 index_t Finley_Util_getFlaggedMinInt(dim_t dim,dim_t N,index_t* values,index_t ignore); 00044 dim_t Finley_Util_packMask(dim_t N,bool_t* mask,index_t* index); 00045 bool_t Finley_Util_isAny(dim_t N,index_t* array,index_t value); 00046 index_t Finley_Util_cumsum(dim_t,index_t*); 00047 bool_t Finley_Util_anyNonZeroDouble(dim_t N,double* values); 00048 void Finley_Util_setValuesInUse(const index_t *values, const dim_t numValues, dim_t *numValuesInUse, index_t **valuesInUse, Esys_MPIInfo* mpiinfo); 00049 00050 #ifdef ESYS_MPI 00051 void Finley_printDoubleArray( FILE *fid, dim_t n, double *array, char *name ); 00052 void Finley_printIntArray( FILE *fid, dim_t n, int *array, char *name ); 00053 void Finley_printMaskArray( FILE *fid, dim_t n, int *array, char *name ); 00054 #endif 00055 00056 00057 00058 00059 /* Finley_Util_orderValueAndIndex is used to sort items by a value */ 00060 /* index points to the location of the original item array. */ 00061 /* it can be used to reorder the array */ 00062 struct Finley_Util_ValueAndIndex { 00063 index_t index; 00064 index_t value; 00065 }; 00066 typedef struct Finley_Util_ValueAndIndex Finley_Util_ValueAndIndex; 00067 00068 void Finley_Util_sortValueAndIndex(dim_t n,Finley_Util_ValueAndIndex* array); 00069 int Finley_Util_ValueAndIndex_compar(const void *, const void *); 00070 00071 #endif /* #ifndef INC_FINLEY_UTIL */ 00072