/usr/include/trilinos/ml_smoother.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 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | /* ******************************************************************** */
/* See the file COPYRIGHT for a complete copyright notice, contact */
/* and disclaimer. */
/* ******************************************************************** */
/* ******************************************************************** */
/* Declaration of the ML_Smoother structure */
/* ******************************************************************** */
/* Author : Charles Tong (LLNL) and Raymond Tuminaro (SNL) */
/* Date : March, 1999 */
/* ******************************************************************** */
#ifndef __MLSMOOTHER__
#define __MLSMOOTHER__
/* ******************************************************************** */
/* data structure type definition */
/* ******************************************************************** */
typedef enum {ML_GS_standard=0,ML_GS_symmetric,ML_GS_efficient_symmetric} ML_GS_SWEEP_TYPE;
/* 0 - Standard G-S or Block G-S
1 - Symmetric G-S or Block G-S
2 - Efficient Symmetric G-S or Block G-S
(i.e. pre=forward, post=backward) */
typedef struct ML_SmootherFunc_Struct ML_SmootherFunc;
typedef struct ML_Smoother_Struct ML_Smoother;
typedef struct ML_Sm_BGS_Data_Struct ML_Sm_BGS_Data;
typedef struct ML_Sm_ILUT_Data_Struct ML_Sm_ILUT_Data;
typedef struct ML_Sm_Hiptmair_Data_Struct ML_Sm_Hiptmair_Data;
typedef struct ML_Sm_BlockHiptmair_Data_Struct ML_Sm_BlockHiptmair_Data;
/* ******************************************************************** */
/* local include files */
/* ******************************************************************** */
#include "ml_common.h"
#include "ml_defs.h"
#include "ml_memory.h"
#include "ml_1level.h"
#include "ml_operator.h"
#include "ml_comminfoop.h"
#include "ml_csolve.h"
#include "ml_struct.h"
#include <math.h>
#ifdef WKC
#include <Epetra_MultiVector.h>
#endif
/* ******************************************************************** */
/* data definition for the ML_Smoother Class */
/* ******************************************************************** */
/* -------------------------------------------------------------------- */
/* These data structures define the smoother object. */
/* -------------------------------------------------------------------- */
struct ML_SmootherFunc_Struct
{
int ML_id;
int (*func_ptr)(ML_Smoother *, int, double *, int, double *);
void *data;
};
/*******************************************************************************
pre_or_post flag that the smoother toggles to determine whether it is
in pre or post smoothing phase
envelope message-passing information that is used in
ML_exchange_bdry
*******************************************************************************/
struct ML_Smoother_Struct
{
int ML_id;
struct ML_1Level_Struct *my_level;
int ntimes;
int init_guess;
double omega;
double tol;
ML_SmootherFunc *smoother;
void (*data_destroy)(void *);
double build_time, apply_time;
int times_applied;
char *label;
int pre_or_post;
ML_Comm_Envelope *envelope;
int output_level;
ML_GS_SWEEP_TYPE gs_sweep_type;
};
struct ML_Sm_BGS_Data_Struct
{
double ** blockfacts;
int ** perms;
int blocksize;
int *blocklengths;
int *blockmap;
int *blockOffset;
int Nblocks;
int optimized;
double **trid_dl;
double **trid_d;
double **trid_du;
double **trid_du2;
int **trid_ipiv;
};
struct ML_Sm_ILUT_Data_Struct
{
int Nrows;
int *mat_ia;
int *mat_ja;
double *mat_aa;
ML_CommInfoOP *getrow_comm;
int fillin;
double threshold;
};
struct DinvA_widget {
int ML_id;
int (*func_ptr)(ML_Operator *, int, double *, int, double *);
void *data;
ML_Operator *Amat;
};
#ifdef out
#if defined(SUPERLU)
#include "dsp_defs.h"
#include "util.h"
#endif
#ifdef DSUPERLU
#include "mpi.h"
#include "superlu_ddefs.h"
#endif
typedef struct ML_Sm_Schwarz_Data_Struct ML_Sm_Schwarz_Data;
struct ML_Sm_Schwarz_Data_Struct
{
int Nrows;
int **bmat_ia;
int **bmat_ja;
double **bmat_aa;
int **aux_bmat_ia;
int **aux_bmat_ja;
double **aux_bmat_aa;
ML_CommInfoOP *getrow_comm;
int nblocks;
int *blk_info;
int *blk_size;
int **blk_indices;
int **perm_r;
int **perm_c;
#if defined(SUPERLU)
SuperMatrix **slu_Amat;
SuperMatrix **slu_Lmat;
SuperMatrix **slu_Umat;
#endif
};
#endif
/*******************************************************************************
Hiptmair Smoother data structure
sm_nodal pointer to nodal smoother structure
max_eig eigenvalue calculated for damping parameter
omega damping parameter for edge and/or nodal smoother inside
Hiptmair smoother
*******************************************************************************/
struct ML_Sm_Hiptmair_Data_Struct
{
ML_Operator *Tmat;
ML_Operator *Tmat_trans;
ML_Operator *ATmat_trans;
double *TtAT_diag;
ML_Operator *TtATmat;
ML_Smoother *sm_nodal;
double max_eig;
double omega;
double output_level;
ML *ml_nodal;
ML *ml_edge;
int reduced_smoother;
int external_TtATmat; /* Set if T^TAT is generated elsewhere */
};
#define FULL_HIPTMAIR 0
/* smoothes on edges, nodes and then edges */
#define HALF_HIPTMAIR 1
/* smoothes on edges then node for pre-smoothing */
/* smoothes on nodes then edges fr post-smoothing */
/* for block hiptmair */
struct ML_Sm_BlockHiptmair_Data_Struct
{
ML_Operator *Tmat;
ML_Operator *Tmat_trans;
ML_Operator *ATmat_trans;
double *TtAT_diag;
ML_Operator *TtATmat;
ML_Smoother *sm_nodal;
double *res_edge;
double *res_edge1;
double *res_edge2;
double *rhs_nodal1;
double *rhs_nodal2;
double *x_nodal1;
double *x_nodal2;
double *edge_update1;
double *edge_update2;
double max_eig;
double omega;
double output_level;
ML *ml_nodal;
ML *ml_edge;
int reduced_smoother;
};
/* ******************************************************************** */
/* ******************************************************************** */
/* User Interface Proto-types */
/* ******************************************************************** */
/* ******************************************************************** */
#ifndef ML_CPP
#ifdef __cplusplus
extern "C" {
#endif
#endif
extern int ML_Smoother_Create(ML_Smoother **, ML_1Level *level_ptr );
extern int ML_Smoother_Init(ML_Smoother *, ML_1Level *level_ptr);
extern int ML_Smoother_Destroy(ML_Smoother **);
extern int ML_Smoother_Clean(ML_Smoother *);
extern int ML_Smoother_Set_Label( ML_Smoother *smoo, char *label);
extern int ML_Smoother_Apply(ML_Smoother *,int,double *,int,double*,int);
#ifdef WKC
/* WKC Added proto for Epetra stuff! */
extern int ML_Smoother_Apply(ML_Smoother *,int,Epetra_MultiVector &,
int,Epetra_MultiVector &,int);
#endif
extern int ML_Smoother_Set(ML_Smoother *, void *,
int (*func_ptr)(ML_Smoother*,int,double*,int,double *),
int, double, char *);
extern int ML_Smoother_Jacobi(ML_Smoother *, int, double *x, int, double *);
extern int ML_Smoother_GaussSeidel(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_SGSSequential(ML_Smoother *, int,double *, int, double *);
extern int ML_Smoother_SGS(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_BlockGS(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_NewGS(ML_Smoother *sm,int inlen,double x[],int outlen,
double rhs[]);
extern int ML_BlockScaledApply(ML_Operator *Amat, int inlen, double in[],
int outlen, double out[]);
extern int ML_Smoother_Cheby_Apply(ML_Smoother *, int, double *, int, double *);
extern int ML_Cheby(ML_Smoother *sm, int inlen, double x[], int outlen, double rhs[]);
#ifdef WKC
/* WKC -- double * are actually Epetra_MultiVectors */
/*extern int ML_Cheby_WKC(ML_Smoother *sm, int inlen, double *x, int outlen, double *rhs);*/
extern int ML_Cheby_WKC(void *sm, int inlen, double *x, int outlen, double *rhs);
#endif
extern int ML_complex_Cheby(ML_Smoother *sm, int inlen, double x[], int outlen,
double rhs[]);
extern int ML_DiagScaled_1stepKrylov(ML_Smoother *sm, int inlen, double x[],
int outlen, double rhs[]);
extern int ML_Smoother_ParaSails(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_ParaSailsSym(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_ParaSailsTrans(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_VBlockJacobi(ML_Smoother *,int,double *x,int, double *);
extern int ML_Smoother_LineJacobi(ML_Smoother *,int,double *x,int, double *);
extern int ML_Smoother_LineGS(ML_Smoother *,int,double *x,int, double *);
extern int ML_Smoother_VBlockKrylovJacobi(ML_Smoother *,int,double*,int,double*);
extern int ML_Smoother_VBlockSGS(ML_Smoother *, int, double *x, int, double *);
extern int ML_Smoother_VBlockSGSSequential(ML_Smoother*,int,double*,int,double*);
extern int ML_Smoother_OverlappedILUT(ML_Smoother *,int,double *x,int,double *);
extern int ML_Smoother_VBlockAdditiveSchwarz(ML_Smoother *,int,double*,int,double*);
extern int ML_Smoother_VBlockMultiplicativeSchwarz(ML_Smoother *,int,double*,int,double*);
extern int ML_Smoother_Hiptmair(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_BlockHiptmair(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_ApplySubdomainOverlap(ML_Smoother *sm, int inlen,
double x[],int outlen, double b[]);
#ifdef HAVE_ML_PETSC
extern int ML_Smoother_Petsc(ML_Smoother *sm, int inlen, double x[], int outlen,
double rhs[]);
#endif
extern void ML_Smoother_DestroySubdomainOverlap(void *data);
extern int ML_EyeMinusIterationOperator_Matvec(ML_Operator *Amat, int ilen,
double p[], int olen, double ap[]);
extern int ML_Smoother_ComputeOmegaViaSpectralradius(ML_Operator *Amat,
int (*smoothing_function)(ML_Smoother *, int, double *, int, double *),
void *data, double *spectral_radius, double *omega);
/* ******************************************************************** */
/* ******************************************************************** */
/* private functions */
/* ******************************************************************** */
/* ******************************************************************** */
extern int ML_Smoother_Create_Hiptmair_Data(ML_Sm_Hiptmair_Data **data);
extern int ML_Smoother_Create_BlockHiptmair_Data(ML_Sm_BlockHiptmair_Data **data);
extern int ML_Smoother_Gen_Hiptmair_Data(ML_Sm_Hiptmair_Data**,
ML_Operator*, ML_Operator*, ML_Operator*,
ML_Operator*, ML_Operator*, ML_Operator *,
int, int*, void *, void **, void *, void **);
extern int ML_Smoother_Gen_BlockHiptmair_Data(ML_Sm_BlockHiptmair_Data**,
ML_Operator*, ML_Operator*, ML_Operator*,
ML_Operator*, int, int*, void *, void **,
void *, void **);
extern int ML_Smoother_HiptmairSubsmoother_Create(ML **ml_subproblem,
ML_Operator *Amat, void *smoother,
void **args, double default_omega);
extern void ML_Smoother_Destroy_Hiptmair_Data(void *data);
extern void ML_Smoother_Destroy_BlockHiptmair_Data(void *data);
extern int ML_Smoother_Create_BGS_Data(ML_Sm_BGS_Data **data);
extern void ML_Smoother_Destroy_BGS_Data(void *data);
extern void ML_Smoother_Clean_BGS_Data(void *data);
extern int ML_Smoother_Create_ILUT_Data(ML_Sm_ILUT_Data **data);
extern void ML_Smoother_Destroy_ILUT_Data(void *data);
extern int ML_Smoother_Gen_BGSFacts(ML_Sm_BGS_Data **, ML_Operator *,int);
extern int ML_Smoother_Gen_VBGSFacts(ML_Sm_BGS_Data**,ML_Operator*,int,int*);
extern int ML_Smoother_Gen_LineSmootherFacts(ML_Sm_BGS_Data**, ML_Operator*, int, int*, int*);
extern void ML_Smoother_Destroy_Schwarz_Data(void *data);
extern void ML_Smoother_Clean_ParaSails(void *data);
extern struct MLSthing *ML_Smoother_Create_MLS(void);
extern int ML_BlockDinv(ML_Sm_BGS_Data *BGS_Data, int outlen, double out[]);
extern void ML_Smoother_Destroy_MLS(void *data);
extern void **ML_Smoother_Arglist_Create(int nargs);
extern int ML_Smoother_Arglist_Set(void **arglist, int which_arg, void *ptr);
extern void *ML_Smoother_Arglist_Get(void **arglist, int which_arg);
extern int ML_Smoother_Arglist_Delete(void ***arglist);
extern int ML_Smoother_Arglist_Nargs(void **arglist);
extern int ML_Smoother_ILUTDecomposition(ML_Sm_ILUT_Data *, ML_Operator *,
ML_Comm *, int, int *,int*,double *,int *, int *,int);
#ifdef out
extern int ML_Smoother_Create_Schwarz_Data(ML_Sm_Schwarz_Data **data);
extern int ML_Smoother_VBlockSchwarzDecomposition(ML_Sm_Schwarz_Data *,
ML_Operator *, ML_Comm *, int, int *,int*,double *,int *,
int *,int);
#endif
extern int ML_Smoother_GetOffProcRows(ML_CommInfoOP *, ML_Comm *,
ML_Operator *,int,int *,int,int *,int **,double **);
extern int ML_Smoother_GetRowLengths(ML_CommInfoOP *, ML_Comm *,
ML_Operator *, int *, int **);
extern int ML_Smoother_ComposeOverlappedMatrix(ML_Operator *, ML_Comm *,
int *, int **, int **, double **, int **, int **, int *);
extern ML *ML_Smoother_Get_Hiptmair_nodal(ML *ml, int level, int);
extern int ML_dgetrs_special(int blocksize, double *ablock, int *ipiv,
double *correc);
extern int ML_dgetrs_trans_special(int blocksize, double *ablock, int *ipiv,
double *correc);
extern int ML_permute_for_dgetrs_special(double *Z[], int Nblocks, int blocksize,
ML_Sm_BGS_Data *block_data_widget);
/* -------------------------------------------------------------------- */
/* Ray's functions */
/* -------------------------------------------------------------------- */
extern int ML_MSR_SGSextra(ML_Smoother *, int , double *, int , double *);
extern void ML_MSR_GSextra_Clean(void *data);
extern int ML_Smoother_BackGS(void *, int, double *, int, double *);
extern void ML_Smoother_Clean_OrderedSGS(void *data);
extern int ML_Smoother_Gen_Ordering(ML_Operator *Amat, int **data_ptr);
extern int ML_Smoother_OrderedSGS(ML_Smoother *sm,int inlen,double x[],int outlen,
double rhs[]);
extern int ML_Smoother_MSR_SGS(ML_Smoother *, int, double *, int, double *);
extern int ML_Smoother_MSR_SGSnodamping(ML_Smoother *,int ,double *,int , double *);
extern int ML_Smoother_MSR_GSforwardnodamping(void *sm,int inlen,double x[],
int outlen, double rhs[]);
extern int ML_Smoother_MSR_GSbackwardnodamping(void *sm,int inlen,double x[],
int outlen, double rhs[]);
extern int ML_Smoother_MSR_SGSdamping(void *,int ,double *,int , double *);
extern void ML_Smoother_Clean_MSR_GS(void *data);
extern int DinvA(ML_Operator *data, int in, double p[], int out, double ap[]);
#ifndef ML_CPP
#ifdef __cplusplus
}
#endif
#endif
#endif
|