/usr/include/trilinos/ml_utils.h is in libtrilinos-ml-dev 12.10.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | /* ******************************************************************** */
/* See the file COPYRIGHT for a complete copyright notice, contact */
/* person and disclaimer. */
/* ******************************************************************** */
/* ******************************************************************** */
/* Miscellaneous functions for efficient searching and sorting */
/* ******************************************************************** */
/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */
/* Date : September, 1998 */
/* ******************************************************************** */
#ifndef __MLUTILH__
#define __MLUTILH__
#ifndef __cplusplus
#if defined(ICL) || defined(_MSC_VER)
#include <time.h>
#else
#include <sys/time.h>
#endif
#endif
#ifndef ICL
#ifndef _WIN32
#include <unistd.h>
#endif
#endif
/*#include "ml_struct.h"*/
#include "ml_config.h"
#include "ml_common.h"
#include "ml_defs.h"
#include "ml_comm.h"
#include "ml_operator.h"
#define ML_dabs(x) (((x) > 0.) ? x : (-(x)))
#define ML_abs(x) (((x) > 0) ? x : (-(x)))
#define ML_min(a,b) (((a) <= (b)) ? (a) : (b))
#define ML_max(x,y) (((x) > (y)) ? (x) : (y))
#define ML_avoid_unused_param(x) ML_use_param(x,0)
/* A fast integer hash function written by Bob Jenkins. */
#define ml_hash_function(a) \
{ \
a = (a+0x7ed55d16) + (a<<12); \
a = (a^0xc761c23c) ^ (a>>19); \
a = (a+0x165667b1) + (a<<5); \
a = (a+0xd3a2646c) ^ (a<<9); \
a = (a+0xfd7046c5) + (a<<3); \
a = (a^0xb55a4f09) ^ (a>>16); \
}
#define ML_UseInlinedHashFunction
#ifdef ML_UseInlinedHashFunction
/* work around for compiling on qt (ax_create_stdint_h.m4 didn't work) */
#ifdef _MSC_VER
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#else
typedef unsigned int uint32_t;
#endif
extern uint32_t ml_unew_val;
/* Important: If you want to use ML_fast_hash, the table size must be 2^k for a
positive integer k. */
#define ML_fast_hash(new_val, hash_table, hlm1, used, hash_index) \
{ \
ml_unew_val = new_val; \
ml_hash_function(ml_unew_val); \
*hash_index = ((int) ml_unew_val) & hlm1; \
while ( hash_table[*hash_index] != new_val) { \
if (hash_table[*hash_index] == -1) { (*used)++; break;} \
(*hash_index)++; \
*hash_index = (*hash_index) & hlm1; \
} \
}
#define ML_hash_it(new_val,hash_table,hash_length,used, hash_index) \
{ \
*hash_index = new_val<<1; \
if (*hash_index < 0) *hash_index = new_val; \
*hash_index = (*hash_index) % hash_length; \
while ( hash_table[*hash_index] != new_val) { \
if (hash_table[*hash_index] == -1) { (*used)++; break;} \
(*hash_index)++; \
*hash_index = (*hash_index) % hash_length; \
} \
}
#endif /*ifdef ML_UseInlinedHashFunction */
/* JJH FIXME
#ifdef __GNUC__
#define ML_Enter() \
if(ML_DebugLocation()) { if( NEVADA::comm.rank() ==
NEVADA::comm.IO_processor()) printf("+++ Entering: %s\n",__PRETTY_FUNCTION__);}
#define ML_Leave() \
if(ML_DebugLocation()) { if( NEVADA::comm.rank() ==
NEVADA::comm.IO_processor()) printf("--- Leaving: %s\n",__PRETTY_FUNCTION__);}
#else
#define MLEnter()
#define MLLeave()
#endif
*/
/*
#define MLEnter() \
if(Debug_Location()){ if( NEVADA::comm.rank() == NEVADA::comm.IO_processor())
std::cout << "+++
Entering: " << __FILE__ << ":" << __LINE__ << std::endl;}
#define MLLeave() \
if(Debug_Location()){ if( NEVADA::comm.rank() == NEVADA::comm.IO_processor())
std::cout << "--- Leaving:
" << __FILE__ << ":" << __LINE__ << std::endl;}
*/
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
/* The following is included in the siesta SUN4 environment to solve */
/* the random number generation problem */
/* -------------------------------------------------------------------- */
#if defined(SUN4) || defined(SUN5)
#ifndef ML_CPP
#ifdef __cplusplus
extern "C" {
#endif
#endif
double drand48();
void srand48(long seedval);
#ifndef ML_CPP
#ifdef __cplusplus
}
#endif
#endif
#endif
#define million 0.1e7
#ifndef ML_CPP
#ifdef __cplusplus
extern "C" {
#endif
#endif
void pr_error(const char *fmt, ... );
double GetClock(void);
void StartTimer(double* t0);
void StopTimer(double* t0, double* delta);
void ReportTimer(double t0, const char *msgString, ML_Comm *comm);
int ML_crude_search( int, int, int * );
int ML_sorted_search( int, int, int * );
int ML_fastsorted_search( int, int, int * , int);
int ML_sorted_search2( int, int, int *, int, int ** );
int ML_search_insert_sort( int, int *, int *, int * );
int ML_split_dsort(double list[], int N, int *, int);
int ML_selection_dsort(double list[], int N, int *, int);
int ML_sort( int, int * );
void ML_dsort2(double *, int N, int *);
int ML_Check_Context( void * );
int ML_randomize( int , int * );
int ML_random_init(void);
int ML_get_random_seed();
void ML_set_random_seed(int seed);
void ML_random_vec(double u[], int N, ML_Comm *comm);
double ML_srandom1(int *seed);
void ML_serial_start(ML_Comm *comm);
void ML_serial_end(ML_Comm *comm);
int ML_Coord2RBM(int Nnodes, double x[], double y[], double z[], double rbm[], int Ndof, int NscalarDof);
void ML_az_dsort2(double dlist[], int N, int list2[]);
/* these are functions used by Ray in his RAP thing */
void ML_az_sort(int list[], int N, int list2[], double list3[]);
void ML_az_dsort(double list[], int N);
void ML_gsum_scalar_int(int vals[], int vals2[], ML_Comm *comm);
void ML_gsum_vec_int(int *vals[], int *vals2[], int, ML_Comm *comm);
void ML_rm_duplicates(int array[], int *N);
void ML_splitup_big_msg(int, char *, char *, unsigned int, int *,
int *, int *, int *, int , int *, ML_Comm *);
double ML_gdot(int N, double r[], double z[], ML_Comm *comm);
double ML_gsum_double(double val, ML_Comm *comm);
void ML_gsum_vec_double(double *vals[], double *vals2[], int, ML_Comm *comm);
double ML_gmax_double(double val, ML_Comm *comm);
int ML_gmax_int(int val, ML_Comm *comm);
int ML_find_index(int key, int list[], int length);
void ML_use_param(void *data, int junk);
void ML_BreakForDebugger(ML_Comm *comm);
void ML_Pause(ML_Comm *comm);
void ML_print_line (const char *charstr, int ntimes);
/*MS*/
int ML_gsum_int(int val, ML_Comm *comm);
int ML_gmin_int(int val, ML_Comm *comm);
double ML_gmin_double(double val, ML_Comm *comm);
/*ms*/
extern int ML_Operator_Print_UsingGlobalOrdering( ML_Operator *matrix,
const char label[],
int *, int *);
extern int ML_build_global_numbering( ML_Operator *Amat,
int **pglobal_numbering,
const char *rowsOrCols );
int ML_Operator_Lump(ML_Operator *A, ML_Operator **B);
double ML_Global_Standard_Deviation(double sample, int n,
int activeflag, ML_Comm *comm);
int ML_SetupCoordinates(ML *ml_ptr, int level, int NumPDEEqns,
double *in_x_coord, double *in_y_coord,
double *in_z_coord);
int ML_hash_init(int hash_list[], int hash_length, int *hash_used);
#ifndef ML_UseInlinedHashFunction
void ML_hash_it(int value, int table[], int tableLength,int *spaceUsed,
int *hashKey);
void ML_fast_hash(int value, int table[], int tableLengthMinusOne,
int *spaceUsed, int *hashKey);
#endif
void ML_print_align(int int2match, char *space, int pad);
int ML_estimate_avg_nz_per_row(ML_Operator * matrix, double * avg_nz);
#ifndef ML_CPP
#ifdef __cplusplus
}
#endif
#endif
#endif
|