-
Notifications
You must be signed in to change notification settings - Fork 182
/
_hypre_parcsr_ls.h
4355 lines (4019 loc) · 297 KB
/
_hypre_parcsr_ls.h
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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*** DO NOT EDIT THIS FILE DIRECTLY (use 'headers' to generate) ***/
#ifndef hypre_PARCSR_LS_HEADER
#define hypre_PARCSR_LS_HEADER
#include <HYPRE_config.h>
#include "HYPRE_parcsr_ls.h"
#include "_hypre_parcsr_mv.h"
#include "krylov.h"
#include "HYPRE_lobpcg.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct { HYPRE_Int prev; HYPRE_Int next; } Link;
/******************************************************************************
* Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
* HYPRE Project Developers. See the top-level COPYRIGHT file for details.
*
* SPDX-License-Identifier: (Apache-2.0 OR MIT)
******************************************************************************/
#ifndef hypre_ParAMG_DATA_HEADER
#define hypre_ParAMG_DATA_HEADER
#define CUMNUMIT
#include "par_csr_block_matrix.h"
/*--------------------------------------------------------------------------
* hypre_ParAMGData
*--------------------------------------------------------------------------*/
typedef struct
{
/* Base solver data structure */
hypre_Solver base;
/* Memory location of matrices/vectors in AMGData */
HYPRE_MemoryLocation memory_location;
/* setup params */
HYPRE_Int max_levels;
HYPRE_Real strong_threshold;
HYPRE_Int coarsen_cut_factor;
HYPRE_Real strong_thresholdR; /* theta for build R: defines strong F neighbors */
HYPRE_Real filter_thresholdR; /* theta for filtering R */
HYPRE_Real max_row_sum;
HYPRE_Real trunc_factor;
HYPRE_Real agg_trunc_factor;
HYPRE_Real agg_P12_trunc_factor;
HYPRE_Real jacobi_trunc_threshold;
HYPRE_Real S_commpkg_switch;
HYPRE_Real CR_rate;
HYPRE_Real CR_strong_th;
HYPRE_Real A_drop_tol;
HYPRE_Int A_drop_type;
HYPRE_Int measure_type;
HYPRE_Int setup_type;
HYPRE_Int coarsen_type;
HYPRE_Int P_max_elmts;
HYPRE_Int interp_type;
HYPRE_Int sep_weight;
HYPRE_Int agg_interp_type;
HYPRE_Int agg_P_max_elmts;
HYPRE_Int agg_P12_max_elmts;
HYPRE_Int restr_par;
HYPRE_Int is_triangular;
HYPRE_Int gmres_switch;
HYPRE_Int agg_num_levels;
HYPRE_Int num_paths;
HYPRE_Int post_interp_type;
HYPRE_Int num_CR_relax_steps;
HYPRE_Int IS_type;
HYPRE_Int CR_use_CG;
HYPRE_Int cgc_its;
HYPRE_Int max_coarse_size;
HYPRE_Int min_coarse_size;
HYPRE_Int seq_threshold;
HYPRE_Int redundant;
HYPRE_Int participate;
HYPRE_Int Sabs;
/* solve params */
HYPRE_Int max_iter;
HYPRE_Int min_iter;
HYPRE_Int fcycle;
HYPRE_Int cycle_type;
HYPRE_Int *num_grid_sweeps;
HYPRE_Int *grid_relax_type;
HYPRE_Int **grid_relax_points;
HYPRE_Int relax_order;
HYPRE_Int user_coarse_relax_type;
HYPRE_Int user_relax_type;
HYPRE_Int user_num_sweeps;
HYPRE_Real user_relax_weight;
HYPRE_Real outer_wt;
HYPRE_Real *relax_weight;
HYPRE_Real *omega;
HYPRE_Int converge_type;
HYPRE_Real tol;
HYPRE_Int partial_cycle_coarsest_level;
HYPRE_Int partial_cycle_control;
/* problem data */
hypre_ParCSRMatrix *A;
HYPRE_Int num_variables;
HYPRE_Int num_functions;
HYPRE_Int nodal;
HYPRE_Int nodal_levels;
HYPRE_Int nodal_diag;
HYPRE_Int keep_same_sign;
HYPRE_Int num_points;
hypre_IntArray *dof_func;
HYPRE_Int *dof_point;
HYPRE_Int *point_dof_map;
/* data generated in the setup phase */
hypre_ParCSRMatrix **A_array;
hypre_ParVector **F_array;
hypre_ParVector **U_array;
hypre_ParCSRMatrix **P_array;
hypre_ParCSRMatrix **R_array;
hypre_IntArray **CF_marker_array;
hypre_IntArray **dof_func_array;
HYPRE_Int **dof_point_array;
HYPRE_Int **point_dof_map_array;
HYPRE_Int num_levels;
hypre_Vector **l1_norms;
/* Block data */
hypre_ParCSRBlockMatrix **A_block_array;
hypre_ParCSRBlockMatrix **P_block_array;
hypre_ParCSRBlockMatrix **R_block_array;
HYPRE_Int block_mode;
/* data for more complex smoothers */
HYPRE_Int smooth_num_levels;
HYPRE_Int smooth_type;
HYPRE_Solver *smoother;
HYPRE_Int smooth_num_sweeps;
HYPRE_Int schw_variant;
HYPRE_Int schw_overlap;
HYPRE_Int schw_domain_type;
HYPRE_Real schwarz_rlx_weight;
HYPRE_Int schwarz_use_nonsymm;
HYPRE_Int ps_sym;
HYPRE_Int ps_level;
HYPRE_Int pi_max_nz_per_row;
HYPRE_Int eu_level;
HYPRE_Int eu_bj;
HYPRE_Real ps_threshold;
HYPRE_Real ps_filter;
HYPRE_Real pi_drop_tol;
HYPRE_Real eu_sparse_A;
char *euclidfile;
/* ILU parameters */
HYPRE_Int ilu_lfil;
HYPRE_Int ilu_type;
HYPRE_Int ilu_max_row_nnz;
HYPRE_Int ilu_max_iter;
HYPRE_Real ilu_droptol;
HYPRE_Int ilu_tri_solve;
HYPRE_Int ilu_lower_jacobi_iters;
HYPRE_Int ilu_upper_jacobi_iters;
HYPRE_Int ilu_reordering_type;
HYPRE_Int ilu_iter_setup_type;
HYPRE_Int ilu_iter_setup_option;
HYPRE_Int ilu_iter_setup_max_iter;
HYPRE_Real ilu_iter_setup_tolerance;
/* FSAI parameters */
HYPRE_Int fsai_algo_type;
HYPRE_Int fsai_local_solve_type;
HYPRE_Int fsai_max_steps;
HYPRE_Int fsai_max_step_size;
HYPRE_Int fsai_max_nnz_row;
HYPRE_Int fsai_num_levels;
HYPRE_Real fsai_threshold;
HYPRE_Int fsai_eig_max_iters;
HYPRE_Real fsai_kap_tolerance;
HYPRE_Real *max_eig_est;
HYPRE_Real *min_eig_est;
HYPRE_Int cheby_eig_est;
HYPRE_Int cheby_order;
HYPRE_Int cheby_variant;
HYPRE_Int cheby_scale;
HYPRE_Real cheby_fraction;
hypre_Vector **cheby_ds;
HYPRE_Real **cheby_coefs;
HYPRE_Real cum_nnz_AP;
/* data needed for non-Galerkin option */
HYPRE_Int nongalerk_num_tol;
HYPRE_Real *nongalerk_tol;
HYPRE_Real nongalerkin_tol;
HYPRE_Real *nongal_tol_array;
/* data generated in the solve phase */
hypre_ParVector *Vtemp;
hypre_Vector *Vtemp_local;
HYPRE_Real *Vtemp_local_data;
HYPRE_Real cycle_op_count;
hypre_ParVector *Rtemp;
hypre_ParVector *Ptemp;
hypre_ParVector *Ztemp;
/* fields used by GSMG and LS interpolation */
HYPRE_Int gsmg; /* nonzero indicates use of GSMG */
HYPRE_Int num_samples; /* number of sample vectors */
/* log info */
HYPRE_Int logging;
HYPRE_Int num_iterations;
#ifdef CUMNUMIT
HYPRE_Int cum_num_iterations;
#endif
HYPRE_Real rel_resid_norm;
hypre_ParVector *residual; /* available if logging>1 */
/* output params */
HYPRE_Int print_level;
char log_file_name[256];
HYPRE_Int debug_flag;
/* whether to print the constructed coarse grids BM Oct 22, 2006 */
HYPRE_Int plot_grids;
char plot_filename[251];
/* coordinate data BM Oct 17, 2006 */
HYPRE_Int coorddim;
float *coordinates;
/* data for fitting vectors in interpolation */
HYPRE_Int num_interp_vectors;
HYPRE_Int num_levels_interp_vectors; /* not set by user */
hypre_ParVector **interp_vectors;
hypre_ParVector ***interp_vectors_array;
HYPRE_Int interp_vec_variant;
HYPRE_Int interp_vec_first_level;
HYPRE_Real interp_vectors_abs_q_trunc;
HYPRE_Int interp_vectors_q_max;
HYPRE_Int interp_refine;
HYPRE_Int smooth_interp_vectors;
HYPRE_Real *expandp_weights; /* currently not set by user */
/* enable redundant coarse grid solve */
HYPRE_Solver coarse_solver;
hypre_ParCSRMatrix *A_coarse;
hypre_ParVector *f_coarse;
hypre_ParVector *u_coarse;
MPI_Comm new_comm;
/* store matrix, vector and communication info for Gaussian elimination */
HYPRE_MemoryLocation ge_memory_location;
HYPRE_Int gs_setup;
HYPRE_Int *comm_info;
HYPRE_Int *A_piv;
HYPRE_Real *A_mat;
HYPRE_Real *A_work;
HYPRE_Real *b_vec;
HYPRE_Real *u_vec;
/* information for multiplication with Lambda - additive AMG */
HYPRE_Int additive;
HYPRE_Int mult_additive;
HYPRE_Int simple;
HYPRE_Int add_last_lvl;
HYPRE_Int add_P_max_elmts;
HYPRE_Real add_trunc_factor;
HYPRE_Int add_rlx_type;
HYPRE_Real add_rlx_wt;
hypre_ParCSRMatrix *Lambda;
hypre_ParCSRMatrix *Atilde;
hypre_ParVector *Rtilde;
hypre_ParVector *Xtilde;
HYPRE_Real *D_inv;
/* Use 2 mat-mat-muls instead of triple product*/
HYPRE_Int rap2;
HYPRE_Int keepTranspose;
HYPRE_Int modularized_matmat;
/* information for preserving indices as coarse grid points */
HYPRE_Int num_C_points;
HYPRE_Int C_points_coarse_level;
HYPRE_Int *C_points_local_marker;
HYPRE_BigInt *C_points_marker;
/* information for preserving indices as special fine grid points */
HYPRE_Int num_isolated_F_points;
HYPRE_BigInt *isolated_F_points_marker;
/* information for preserving indices as fine grid points */
HYPRE_Int num_F_points;
HYPRE_BigInt *F_points_marker;
#ifdef HYPRE_USING_DSUPERLU
/* Parameters and data for SuperLU_Dist */
HYPRE_Int dslu_threshold;
HYPRE_Solver dslu_solver;
#endif
} hypre_ParAMGData;
/*--------------------------------------------------------------------------
* Accessor functions for the hypre_AMGData structure
*--------------------------------------------------------------------------*/
/* setup params */
#define hypre_ParAMGDataMemoryLocation(amg_data) ((amg_data) -> memory_location)
#define hypre_ParAMGDataRestriction(amg_data) ((amg_data) -> restr_par)
#define hypre_ParAMGDataIsTriangular(amg_data) ((amg_data) -> is_triangular)
#define hypre_ParAMGDataGMRESSwitchR(amg_data) ((amg_data) -> gmres_switch)
#define hypre_ParAMGDataMaxLevels(amg_data) ((amg_data) -> max_levels)
#define hypre_ParAMGDataCoarsenCutFactor(amg_data) ((amg_data) -> coarsen_cut_factor)
#define hypre_ParAMGDataStrongThreshold(amg_data) ((amg_data) -> strong_threshold)
#define hypre_ParAMGDataStrongThresholdR(amg_data) ((amg_data) -> strong_thresholdR)
#define hypre_ParAMGDataFilterThresholdR(amg_data) ((amg_data) -> filter_thresholdR)
#define hypre_ParAMGDataSabs(amg_data) ((amg_data) -> Sabs)
#define hypre_ParAMGDataMaxRowSum(amg_data) ((amg_data) -> max_row_sum)
#define hypre_ParAMGDataTruncFactor(amg_data) ((amg_data) -> trunc_factor)
#define hypre_ParAMGDataAggTruncFactor(amg_data) ((amg_data) -> agg_trunc_factor)
#define hypre_ParAMGDataAggP12TruncFactor(amg_data) ((amg_data) -> agg_P12_trunc_factor)
#define hypre_ParAMGDataJacobiTruncThreshold(amg_data) ((amg_data) -> jacobi_trunc_threshold)
#define hypre_ParAMGDataSCommPkgSwitch(amg_data) ((amg_data) -> S_commpkg_switch)
#define hypre_ParAMGDataInterpType(amg_data) ((amg_data) -> interp_type)
#define hypre_ParAMGDataSepWeight(amg_data) ((amg_data) -> sep_weight)
#define hypre_ParAMGDataAggInterpType(amg_data) ((amg_data) -> agg_interp_type)
#define hypre_ParAMGDataCoarsenType(amg_data) ((amg_data) -> coarsen_type)
#define hypre_ParAMGDataMeasureType(amg_data) ((amg_data) -> measure_type)
#define hypre_ParAMGDataSetupType(amg_data) ((amg_data) -> setup_type)
#define hypre_ParAMGDataPMaxElmts(amg_data) ((amg_data) -> P_max_elmts)
#define hypre_ParAMGDataAggPMaxElmts(amg_data) ((amg_data) -> agg_P_max_elmts)
#define hypre_ParAMGDataAggP12MaxElmts(amg_data) ((amg_data) -> agg_P12_max_elmts)
#define hypre_ParAMGDataNumPaths(amg_data) ((amg_data) -> num_paths)
#define hypre_ParAMGDataAggNumLevels(amg_data) ((amg_data) -> agg_num_levels)
#define hypre_ParAMGDataPostInterpType(amg_data) ((amg_data) -> post_interp_type)
#define hypre_ParAMGDataNumCRRelaxSteps(amg_data) ((amg_data) -> num_CR_relax_steps)
#define hypre_ParAMGDataCRRate(amg_data) ((amg_data) -> CR_rate)
#define hypre_ParAMGDataCRStrongTh(amg_data) ((amg_data) -> CR_strong_th)
#define hypre_ParAMGDataADropTol(amg_data) ((amg_data) -> A_drop_tol)
#define hypre_ParAMGDataADropType(amg_data) ((amg_data) -> A_drop_type)
#define hypre_ParAMGDataISType(amg_data) ((amg_data) -> IS_type)
#define hypre_ParAMGDataCRUseCG(amg_data) ((amg_data) -> CR_use_CG)
#define hypre_ParAMGDataL1Norms(amg_data) ((amg_data) -> l1_norms)
#define hypre_ParAMGDataCGCIts(amg_data) ((amg_data) -> cgc_its)
#define hypre_ParAMGDataMaxCoarseSize(amg_data) ((amg_data) -> max_coarse_size)
#define hypre_ParAMGDataMinCoarseSize(amg_data) ((amg_data) -> min_coarse_size)
#define hypre_ParAMGDataSeqThreshold(amg_data) ((amg_data) -> seq_threshold)
/* solve params */
#define hypre_ParAMGDataMinIter(amg_data) ((amg_data)->min_iter)
#define hypre_ParAMGDataMaxIter(amg_data) ((amg_data)->max_iter)
#define hypre_ParAMGDataFCycle(amg_data) ((amg_data)->fcycle)
#define hypre_ParAMGDataCycleType(amg_data) ((amg_data)->cycle_type)
#define hypre_ParAMGDataConvergeType(amg_data) ((amg_data)->converge_type)
#define hypre_ParAMGDataTol(amg_data) ((amg_data)->tol)
#define hypre_ParAMGDataPartialCycleCoarsestLevel(amg_data) ((amg_data)->partial_cycle_coarsest_level)
#define hypre_ParAMGDataPartialCycleControl(amg_data) ((amg_data)->partial_cycle_control)
#define hypre_ParAMGDataNumGridSweeps(amg_data) ((amg_data)->num_grid_sweeps)
#define hypre_ParAMGDataUserCoarseRelaxType(amg_data) ((amg_data)->user_coarse_relax_type)
#define hypre_ParAMGDataUserRelaxType(amg_data) ((amg_data)->user_relax_type)
#define hypre_ParAMGDataUserRelaxWeight(amg_data) ((amg_data)->user_relax_weight)
#define hypre_ParAMGDataUserNumSweeps(amg_data) ((amg_data)->user_num_sweeps)
#define hypre_ParAMGDataGridRelaxType(amg_data) ((amg_data)->grid_relax_type)
#define hypre_ParAMGDataGridRelaxPoints(amg_data) ((amg_data)->grid_relax_points)
#define hypre_ParAMGDataRelaxOrder(amg_data) ((amg_data)->relax_order)
#define hypre_ParAMGDataRelaxWeight(amg_data) ((amg_data)->relax_weight)
#define hypre_ParAMGDataOmega(amg_data) ((amg_data)->omega)
#define hypre_ParAMGDataOuterWt(amg_data) ((amg_data)->outer_wt)
/* problem data parameters */
#define hypre_ParAMGDataNumVariables(amg_data) ((amg_data)->num_variables)
#define hypre_ParAMGDataNumFunctions(amg_data) ((amg_data)->num_functions)
#define hypre_ParAMGDataNodal(amg_data) ((amg_data)->nodal)
#define hypre_ParAMGDataNodalLevels(amg_data) ((amg_data)->nodal_levels)
#define hypre_ParAMGDataNodalDiag(amg_data) ((amg_data)->nodal_diag)
#define hypre_ParAMGDataKeepSameSign(amg_data) ((amg_data)->keep_same_sign)
#define hypre_ParAMGDataNumPoints(amg_data) ((amg_data)->num_points)
#define hypre_ParAMGDataDofFunc(amg_data) ((amg_data)->dof_func)
#define hypre_ParAMGDataDofPoint(amg_data) ((amg_data)->dof_point)
#define hypre_ParAMGDataPointDofMap(amg_data) ((amg_data)->point_dof_map)
/* data generated by the setup phase */
#define hypre_ParAMGDataCFMarkerArray(amg_data) ((amg_data)-> CF_marker_array)
#define hypre_ParAMGDataAArray(amg_data) ((amg_data)->A_array)
#define hypre_ParAMGDataFArray(amg_data) ((amg_data)->F_array)
#define hypre_ParAMGDataUArray(amg_data) ((amg_data)->U_array)
#define hypre_ParAMGDataPArray(amg_data) ((amg_data)->P_array)
#define hypre_ParAMGDataRArray(amg_data) ((amg_data)->R_array)
#define hypre_ParAMGDataDofFuncArray(amg_data) ((amg_data)->dof_func_array)
#define hypre_ParAMGDataDofPointArray(amg_data) ((amg_data)->dof_point_array)
#define hypre_ParAMGDataPointDofMapArray(amg_data) \
((amg_data)->point_dof_map_array)
#define hypre_ParAMGDataNumLevels(amg_data) ((amg_data)->num_levels)
#define hypre_ParAMGDataSmoothType(amg_data) ((amg_data)->smooth_type)
#define hypre_ParAMGDataSmoothNumLevels(amg_data) \
((amg_data)->smooth_num_levels)
#define hypre_ParAMGDataSmoothNumSweeps(amg_data) \
((amg_data)->smooth_num_sweeps)
#define hypre_ParAMGDataSmoother(amg_data) ((amg_data)->smoother)
#define hypre_ParAMGDataVariant(amg_data) ((amg_data)->schw_variant)
#define hypre_ParAMGDataOverlap(amg_data) ((amg_data)->schw_overlap)
#define hypre_ParAMGDataDomainType(amg_data) ((amg_data)->schw_domain_type)
#define hypre_ParAMGDataSchwarzRlxWeight(amg_data) \
((amg_data)->schwarz_rlx_weight)
#define hypre_ParAMGDataSchwarzUseNonSymm(amg_data) \
((amg_data)->schwarz_use_nonsymm)
#define hypre_ParAMGDataSym(amg_data) ((amg_data)->ps_sym)
#define hypre_ParAMGDataLevel(amg_data) ((amg_data)->ps_level)
#define hypre_ParAMGDataMaxNzPerRow(amg_data) ((amg_data)->pi_max_nz_per_row)
#define hypre_ParAMGDataThreshold(amg_data) ((amg_data)->ps_threshold)
#define hypre_ParAMGDataFilter(amg_data) ((amg_data)->ps_filter)
#define hypre_ParAMGDataDropTol(amg_data) ((amg_data)->pi_drop_tol)
#define hypre_ParAMGDataEuclidFile(amg_data) ((amg_data)->euclidfile)
#define hypre_ParAMGDataEuLevel(amg_data) ((amg_data)->eu_level)
#define hypre_ParAMGDataEuSparseA(amg_data) ((amg_data)->eu_sparse_A)
#define hypre_ParAMGDataEuBJ(amg_data) ((amg_data)->eu_bj)
#define hypre_ParAMGDataILUType(amg_data) ((amg_data)->ilu_type)
#define hypre_ParAMGDataILULevel(amg_data) ((amg_data)->ilu_lfil)
#define hypre_ParAMGDataILUMaxRowNnz(amg_data) ((amg_data)->ilu_max_row_nnz)
#define hypre_ParAMGDataILUDroptol(amg_data) ((amg_data)->ilu_droptol)
#define hypre_ParAMGDataILUTriSolve(amg_data) ((amg_data)->ilu_tri_solve)
#define hypre_ParAMGDataILULowerJacobiIters(amg_data) ((amg_data)->ilu_lower_jacobi_iters)
#define hypre_ParAMGDataILUUpperJacobiIters(amg_data) ((amg_data)->ilu_upper_jacobi_iters)
#define hypre_ParAMGDataILUMaxIter(amg_data) ((amg_data)->ilu_max_iter)
#define hypre_ParAMGDataILULocalReordering(amg_data) ((amg_data)->ilu_reordering_type)
#define hypre_ParAMGDataILUIterSetupType(amg_data) ((amg_data)->ilu_iter_setup_type)
#define hypre_ParAMGDataILUIterSetupOption(amg_data) ((amg_data)->ilu_iter_setup_option)
#define hypre_ParAMGDataILUIterSetupMaxIter(amg_data) ((amg_data)->ilu_iter_setup_max_iter)
#define hypre_ParAMGDataILUIterSetupTolerance(amg_data) ((amg_data)->ilu_iter_setup_tolerance)
#define hypre_ParAMGDataFSAIAlgoType(amg_data) ((amg_data)->fsai_algo_type)
#define hypre_ParAMGDataFSAILocalSolveType(amg_data) ((amg_data)->fsai_local_solve_type)
#define hypre_ParAMGDataFSAIMaxSteps(amg_data) ((amg_data)->fsai_max_steps)
#define hypre_ParAMGDataFSAIMaxStepSize(amg_data) ((amg_data)->fsai_max_step_size)
#define hypre_ParAMGDataFSAIMaxNnzRow(amg_data) ((amg_data)->fsai_max_nnz_row)
#define hypre_ParAMGDataFSAINumLevels(amg_data) ((amg_data)->fsai_num_levels)
#define hypre_ParAMGDataFSAIThreshold(amg_data) ((amg_data)->fsai_threshold)
#define hypre_ParAMGDataFSAIEigMaxIters(amg_data) ((amg_data)->fsai_eig_max_iters)
#define hypre_ParAMGDataFSAIKapTolerance(amg_data) ((amg_data)->fsai_kap_tolerance)
#define hypre_ParAMGDataMaxEigEst(amg_data) ((amg_data)->max_eig_est)
#define hypre_ParAMGDataMinEigEst(amg_data) ((amg_data)->min_eig_est)
#define hypre_ParAMGDataChebyOrder(amg_data) ((amg_data)->cheby_order)
#define hypre_ParAMGDataChebyFraction(amg_data) ((amg_data)->cheby_fraction)
#define hypre_ParAMGDataChebyEigEst(amg_data) ((amg_data)->cheby_eig_est)
#define hypre_ParAMGDataChebyVariant(amg_data) ((amg_data)->cheby_variant)
#define hypre_ParAMGDataChebyScale(amg_data) ((amg_data)->cheby_scale)
#define hypre_ParAMGDataChebyDS(amg_data) ((amg_data)->cheby_ds)
#define hypre_ParAMGDataChebyCoefs(amg_data) ((amg_data)->cheby_coefs)
#define hypre_ParAMGDataCumNnzAP(amg_data) ((amg_data)->cum_nnz_AP)
/* block */
#define hypre_ParAMGDataABlockArray(amg_data) ((amg_data)->A_block_array)
#define hypre_ParAMGDataPBlockArray(amg_data) ((amg_data)->P_block_array)
#define hypre_ParAMGDataRBlockArray(amg_data) ((amg_data)->R_block_array)
#define hypre_ParAMGDataBlockMode(amg_data) ((amg_data)->block_mode)
/* data generated in the solve phase */
#define hypre_ParAMGDataVtemp(amg_data) ((amg_data)->Vtemp)
#define hypre_ParAMGDataVtempLocal(amg_data) ((amg_data)->Vtemp_local)
#define hypre_ParAMGDataVtemplocalData(amg_data) ((amg_data)->Vtemp_local_data)
#define hypre_ParAMGDataCycleOpCount(amg_data) ((amg_data)->cycle_op_count)
#define hypre_ParAMGDataRtemp(amg_data) ((amg_data)->Rtemp)
#define hypre_ParAMGDataPtemp(amg_data) ((amg_data)->Ptemp)
#define hypre_ParAMGDataZtemp(amg_data) ((amg_data)->Ztemp)
/* fields used by GSMG */
#define hypre_ParAMGDataGSMG(amg_data) ((amg_data)->gsmg)
#define hypre_ParAMGDataNumSamples(amg_data) ((amg_data)->num_samples)
/* log info data */
#define hypre_ParAMGDataLogging(amg_data) ((amg_data)->logging)
#define hypre_ParAMGDataNumIterations(amg_data) ((amg_data)->num_iterations)
#ifdef CUMNUMIT
#define hypre_ParAMGDataCumNumIterations(amg_data) ((amg_data)->cum_num_iterations)
#endif
#define hypre_ParAMGDataRelativeResidualNorm(amg_data) ((amg_data)->rel_resid_norm)
#define hypre_ParAMGDataResidual(amg_data) ((amg_data)->residual)
/* output parameters */
#define hypre_ParAMGDataPrintLevel(amg_data) ((amg_data)->print_level)
#define hypre_ParAMGDataLogFileName(amg_data) ((amg_data)->log_file_name)
#define hypre_ParAMGDataDebugFlag(amg_data) ((amg_data)->debug_flag)
/* BM Oct 22, 2006 */
#define hypre_ParAMGDataPlotGrids(amg_data) ((amg_data)->plot_grids)
#define hypre_ParAMGDataPlotFileName(amg_data) ((amg_data)->plot_filename)
/* coordinates BM Oct 17, 2006 */
#define hypre_ParAMGDataCoordDim(amg_data) ((amg_data)->coorddim)
#define hypre_ParAMGDataCoordinates(amg_data) ((amg_data)->coordinates)
#define hypre_ParAMGNumInterpVectors(amg_data) ((amg_data)->num_interp_vectors)
#define hypre_ParAMGNumLevelsInterpVectors(amg_data) ((amg_data)->num_levels_interp_vectors)
#define hypre_ParAMGInterpVectors(amg_data) ((amg_data)->interp_vectors)
#define hypre_ParAMGInterpVectorsArray(amg_data) ((amg_data)->interp_vectors_array)
#define hypre_ParAMGInterpVecVariant(amg_data) ((amg_data)->interp_vec_variant)
#define hypre_ParAMGInterpVecFirstLevel(amg_data) ((amg_data)->interp_vec_first_level)
#define hypre_ParAMGInterpVecAbsQTrunc(amg_data) ((amg_data)->interp_vectors_abs_q_trunc)
#define hypre_ParAMGInterpVecQMax(amg_data) ((amg_data)->interp_vectors_q_max)
#define hypre_ParAMGInterpRefine(amg_data) ((amg_data)->interp_refine)
#define hypre_ParAMGSmoothInterpVectors(amg_data) ((amg_data)->smooth_interp_vectors)
#define hypre_ParAMGDataExpandPWeights(amg_data) ((amg_data)->expandp_weights)
#define hypre_ParAMGDataCoarseSolver(amg_data) ((amg_data)->coarse_solver)
#define hypre_ParAMGDataACoarse(amg_data) ((amg_data)->A_coarse)
#define hypre_ParAMGDataFCoarse(amg_data) ((amg_data)->f_coarse)
#define hypre_ParAMGDataUCoarse(amg_data) ((amg_data)->u_coarse)
#define hypre_ParAMGDataNewComm(amg_data) ((amg_data)->new_comm)
#define hypre_ParAMGDataRedundant(amg_data) ((amg_data)->redundant)
#define hypre_ParAMGDataParticipate(amg_data) ((amg_data)->participate)
#define hypre_ParAMGDataGSSetup(amg_data) ((amg_data)->gs_setup)
#define hypre_ParAMGDataGEMemoryLocation(amg_data) ((amg_data)->ge_memory_location)
#define hypre_ParAMGDataAMat(amg_data) ((amg_data)->A_mat)
#define hypre_ParAMGDataAWork(amg_data) ((amg_data)->A_work)
#define hypre_ParAMGDataAPiv(amg_data) ((amg_data)->A_piv)
#define hypre_ParAMGDataBVec(amg_data) ((amg_data)->b_vec)
#define hypre_ParAMGDataUVec(amg_data) ((amg_data)->u_vec)
#define hypre_ParAMGDataCommInfo(amg_data) ((amg_data)->comm_info)
/* additive AMG parameters */
#define hypre_ParAMGDataAdditive(amg_data) ((amg_data)->additive)
#define hypre_ParAMGDataMultAdditive(amg_data) ((amg_data)->mult_additive)
#define hypre_ParAMGDataSimple(amg_data) ((amg_data)->simple)
#define hypre_ParAMGDataAddLastLvl(amg_data) ((amg_data)->add_last_lvl)
#define hypre_ParAMGDataMultAddPMaxElmts(amg_data) ((amg_data)->add_P_max_elmts)
#define hypre_ParAMGDataMultAddTruncFactor(amg_data) ((amg_data)->add_trunc_factor)
#define hypre_ParAMGDataAddRelaxType(amg_data) ((amg_data)->add_rlx_type)
#define hypre_ParAMGDataAddRelaxWt(amg_data) ((amg_data)->add_rlx_wt)
#define hypre_ParAMGDataLambda(amg_data) ((amg_data)->Lambda)
#define hypre_ParAMGDataAtilde(amg_data) ((amg_data)->Atilde)
#define hypre_ParAMGDataRtilde(amg_data) ((amg_data)->Rtilde)
#define hypre_ParAMGDataXtilde(amg_data) ((amg_data)->Xtilde)
#define hypre_ParAMGDataDinv(amg_data) ((amg_data)->D_inv)
/* non-Galerkin parameters */
#define hypre_ParAMGDataNonGalerkNumTol(amg_data) ((amg_data)->nongalerk_num_tol)
#define hypre_ParAMGDataNonGalerkTol(amg_data) ((amg_data)->nongalerk_tol)
#define hypre_ParAMGDataNonGalerkinTol(amg_data) ((amg_data)->nongalerkin_tol)
#define hypre_ParAMGDataNonGalTolArray(amg_data) ((amg_data)->nongal_tol_array)
#define hypre_ParAMGDataRAP2(amg_data) ((amg_data)->rap2)
#define hypre_ParAMGDataKeepTranspose(amg_data) ((amg_data)->keepTranspose)
#define hypre_ParAMGDataModularizedMatMat(amg_data) ((amg_data)->modularized_matmat)
/*indices for the dof which will keep coarsening to the coarse level */
#define hypre_ParAMGDataNumCPoints(amg_data) ((amg_data)->num_C_points)
#define hypre_ParAMGDataCPointsLevel(amg_data) ((amg_data)->C_points_coarse_level)
#define hypre_ParAMGDataCPointsLocalMarker(amg_data) ((amg_data)->C_points_local_marker)
#define hypre_ParAMGDataCPointsMarker(amg_data) ((amg_data)->C_points_marker)
/* information for preserving indices as special fine grid points */
#define hypre_ParAMGDataNumIsolatedFPoints(amg_data) ((amg_data)->num_isolated_F_points)
#define hypre_ParAMGDataIsolatedFPointsMarker(amg_data) ((amg_data)->isolated_F_points_marker)
/* information for preserving indices as fine grid points */
#define hypre_ParAMGDataNumFPoints(amg_data) ((amg_data)->num_F_points)
#define hypre_ParAMGDataFPointsMarker(amg_data) ((amg_data)->F_points_marker)
/* Parameters and data for SuperLU_Dist */
#ifdef HYPRE_USING_DSUPERLU
#define hypre_ParAMGDataDSLUThreshold(amg_data) ((amg_data)->dslu_threshold)
#define hypre_ParAMGDataDSLUSolver(amg_data) ((amg_data)->dslu_solver)
#endif
#endif
/******************************************************************************
* Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
* HYPRE Project Developers. See the top-level COPYRIGHT file for details.
*
* SPDX-License-Identifier: (Apache-2.0 OR MIT)
******************************************************************************/
#ifndef hypre_PAR_AMGDD_COMP_GRID_HEADER
#define hypre_PAR_AMGDD_COMP_GRID_HEADER
/*--------------------------------------------------------------------------
* hypre_AMGDDCommPkg
*--------------------------------------------------------------------------*/
typedef struct
{
// Info needed for subsequent psi_c residual communication
HYPRE_Int num_levels; // levels in the amg hierarchy
HYPRE_Int *num_send_procs; // number of send procs to communicate with
HYPRE_Int *num_recv_procs; // number of recv procs to communicate with
HYPRE_Int **send_procs; // list of send procs
HYPRE_Int **recv_procs; // list of recv procs
HYPRE_Int **send_buffer_size; // size of send buffer on each level for each proc
HYPRE_Int **recv_buffer_size; // size of recv buffer on each level for each proc
HYPRE_Int ***num_send_nodes; // number of nodes to send on each composite level
HYPRE_Int ***num_recv_nodes; // number of nodes to recv on each composite level
HYPRE_Int ****send_flag; // flags which nodes to send after composite grid is built
HYPRE_Int
****recv_map; // mapping from recv buffer to appropriate local indices on each comp grid
HYPRE_Int ****recv_red_marker; // marker indicating a redundant recv
} hypre_AMGDDCommPkg;
/*--------------------------------------------------------------------------
* Accessor functions for the Comp Grid Comm Pkg structure
*--------------------------------------------------------------------------*/
#define hypre_AMGDDCommPkgNumLevels(compGridCommPkg) ((compGridCommPkg) -> num_levels)
#define hypre_AMGDDCommPkgNumSendProcs(compGridCommPkg) ((compGridCommPkg) -> num_send_procs)
#define hypre_AMGDDCommPkgNumRecvProcs(compGridCommPkg) ((compGridCommPkg) -> num_recv_procs)
#define hypre_AMGDDCommPkgSendProcs(compGridCommPkg) ((compGridCommPkg) -> send_procs)
#define hypre_AMGDDCommPkgRecvProcs(compGridCommPkg) ((compGridCommPkg) -> recv_procs)
#define hypre_AMGDDCommPkgSendBufferSize(compGridCommPkg) ((compGridCommPkg) -> send_buffer_size)
#define hypre_AMGDDCommPkgRecvBufferSize(compGridCommPkg) ((compGridCommPkg) -> recv_buffer_size)
#define hypre_AMGDDCommPkgNumSendNodes(compGridCommPkg) ((compGridCommPkg) -> num_send_nodes)
#define hypre_AMGDDCommPkgNumRecvNodes(compGridCommPkg) ((compGridCommPkg) -> num_recv_nodes)
#define hypre_AMGDDCommPkgSendFlag(compGridCommPkg) ((compGridCommPkg) -> send_flag)
#define hypre_AMGDDCommPkgRecvMap(compGridCommPkg) ((compGridCommPkg) -> recv_map)
#define hypre_AMGDDCommPkgRecvRedMarker(compGridCommPkg) ((compGridCommPkg) -> recv_red_marker)
/*--------------------------------------------------------------------------
* AMGDDCompGridMatrix (basically a coupled collection of CSR matrices)
*--------------------------------------------------------------------------*/
typedef struct
{
hypre_CSRMatrix *owned_diag; // Domain: owned domain of mat. Range: owned range of mat.
hypre_CSRMatrix *owned_offd; // Domain: nonowned domain of mat. Range: owned range of mat.
hypre_CSRMatrix
*nonowned_diag; // Domain: nonowned domain of mat. Range: nonowned range of mat.
hypre_CSRMatrix *nonowned_offd; // Domain: owned domain of mat. Range: nonowned range of mat.
hypre_CSRMatrix *real_real; // Domain: nonowned real. Range: nonowned real.
hypre_CSRMatrix *real_ghost; // Domain: nonowned ghost. Range: nonowned real.
HYPRE_Int owns_owned_matrices;
HYPRE_Int owns_offd_col_indices;
} hypre_AMGDDCompGridMatrix;
/*--------------------------------------------------------------------------
* Accessor functions for the AMGDDCompGridMatrix structure
*--------------------------------------------------------------------------*/
#define hypre_AMGDDCompGridMatrixOwnedDiag(matrix) ((matrix) -> owned_diag)
#define hypre_AMGDDCompGridMatrixOwnedOffd(matrix) ((matrix) -> owned_offd)
#define hypre_AMGDDCompGridMatrixNonOwnedDiag(matrix) ((matrix) -> nonowned_diag)
#define hypre_AMGDDCompGridMatrixNonOwnedOffd(matrix) ((matrix) -> nonowned_offd)
#define hypre_AMGDDCompGridMatrixRealReal(matrix) ((matrix) -> real_real)
#define hypre_AMGDDCompGridMatrixRealGhost(matrix) ((matrix) -> real_ghost)
#define hypre_AMGDDCompGridMatrixOwnsOwnedMatrices(matrix) ((matrix) -> owns_owned_matrices)
#define hypre_AMGDDCompGridMatrixOwnsOffdColIndices(matrix) ((matrix) -> owns_offd_col_indices)
/*--------------------------------------------------------------------------
* AMGDDCompGridVector
*--------------------------------------------------------------------------*/
typedef struct
{
hypre_Vector *owned_vector; // Original on-processor points (should be ordered)
hypre_Vector *nonowned_vector; // Off-processor points (not ordered)
HYPRE_Int num_real;
HYPRE_Int owns_owned_vector;
} hypre_AMGDDCompGridVector;
/*--------------------------------------------------------------------------
* Accessor functions for the AMGDDCompGridVector structure
*--------------------------------------------------------------------------*/
#define hypre_AMGDDCompGridVectorOwned(matrix) ((matrix) -> owned_vector)
#define hypre_AMGDDCompGridVectorNonOwned(matrix) ((matrix) -> nonowned_vector)
#define hypre_AMGDDCompGridVectorNumReal(vector) ((vector) -> num_real)
#define hypre_AMGDDCompGridVectorOwnsOwnedVector(matrix) ((matrix) -> owns_owned_vector)
/*--------------------------------------------------------------------------
* hypre_AMGDDCompGrid
*--------------------------------------------------------------------------*/
typedef struct
{
HYPRE_Int level;
HYPRE_MemoryLocation memory_location; /* memory location of matrices/vectors */
HYPRE_BigInt first_global_index;
HYPRE_BigInt last_global_index;
HYPRE_Int num_owned_nodes;
HYPRE_Int num_nonowned_nodes;
HYPRE_Int num_nonowned_real_nodes;
HYPRE_Int num_missing_col_indices;
HYPRE_Int *nonowned_global_indices;
HYPRE_Int *nonowned_coarse_indices;
HYPRE_Int *nonowned_real_marker;
HYPRE_Int *nonowned_sort;
HYPRE_Int *nonowned_invsort;
HYPRE_Int *nonowned_diag_missing_col_indices;
HYPRE_Int *owned_coarse_indices;
hypre_AMGDDCompGridMatrix *A;
hypre_AMGDDCompGridMatrix *P;
hypre_AMGDDCompGridMatrix *R;
hypre_AMGDDCompGridVector *u;
hypre_AMGDDCompGridVector *f;
hypre_AMGDDCompGridVector *t;
hypre_AMGDDCompGridVector *s;
hypre_AMGDDCompGridVector *q;
hypre_AMGDDCompGridVector *temp;
hypre_AMGDDCompGridVector *temp2;
hypre_AMGDDCompGridVector *temp3;
HYPRE_Real *l1_norms;
HYPRE_Int *cf_marker_array;
HYPRE_Int *owned_relax_ordering;
HYPRE_Int *nonowned_relax_ordering;
} hypre_AMGDDCompGrid;
/*--------------------------------------------------------------------------
* Accessor functions for the Comp Grid structure
*--------------------------------------------------------------------------*/
#define hypre_AMGDDCompGridLevel(compGrid) ((compGrid) -> level)
#define hypre_AMGDDCompGridMemoryLocation(compGrid) ((compGrid) -> memory_location)
#define hypre_AMGDDCompGridFirstGlobalIndex(compGrid) ((compGrid) -> first_global_index)
#define hypre_AMGDDCompGridLastGlobalIndex(compGrid) ((compGrid) -> last_global_index)
#define hypre_AMGDDCompGridNumOwnedNodes(compGrid) ((compGrid) -> num_owned_nodes)
#define hypre_AMGDDCompGridNumNonOwnedNodes(compGrid) ((compGrid) -> num_nonowned_nodes)
#define hypre_AMGDDCompGridNumNonOwnedRealNodes(compGrid) ((compGrid) -> num_nonowned_real_nodes)
#define hypre_AMGDDCompGridNumMissingColIndices(compGrid) ((compGrid) -> num_missing_col_indices)
#define hypre_AMGDDCompGridNonOwnedGlobalIndices(compGrid) ((compGrid) -> nonowned_global_indices)
#define hypre_AMGDDCompGridNonOwnedCoarseIndices(compGrid) ((compGrid) -> nonowned_coarse_indices)
#define hypre_AMGDDCompGridNonOwnedRealMarker(compGrid) ((compGrid) -> nonowned_real_marker)
#define hypre_AMGDDCompGridNonOwnedSort(compGrid) ((compGrid) -> nonowned_sort)
#define hypre_AMGDDCompGridNonOwnedInvSort(compGrid) ((compGrid) -> nonowned_invsort)
#define hypre_AMGDDCompGridOwnedCoarseIndices(compGrid) ((compGrid) -> owned_coarse_indices)
#define hypre_AMGDDCompGridNonOwnedDiagMissingColIndices(compGrid) ((compGrid) -> nonowned_diag_missing_col_indices)
#define hypre_AMGDDCompGridA(compGrid) ((compGrid) -> A)
#define hypre_AMGDDCompGridP(compGrid) ((compGrid) -> P)
#define hypre_AMGDDCompGridR(compGrid) ((compGrid) -> R)
#define hypre_AMGDDCompGridU(compGrid) ((compGrid) -> u)
#define hypre_AMGDDCompGridF(compGrid) ((compGrid) -> f)
#define hypre_AMGDDCompGridT(compGrid) ((compGrid) -> t)
#define hypre_AMGDDCompGridS(compGrid) ((compGrid) -> s)
#define hypre_AMGDDCompGridQ(compGrid) ((compGrid) -> q)
#define hypre_AMGDDCompGridTemp(compGrid) ((compGrid) -> temp)
#define hypre_AMGDDCompGridTemp2(compGrid) ((compGrid) -> temp2)
#define hypre_AMGDDCompGridTemp3(compGrid) ((compGrid) -> temp3)
#define hypre_AMGDDCompGridL1Norms(compGrid) ((compGrid) -> l1_norms)
#define hypre_AMGDDCompGridCFMarkerArray(compGrid) ((compGrid) -> cf_marker_array)
#define hypre_AMGDDCompGridOwnedRelaxOrdering(compGrid) ((compGrid) -> owned_relax_ordering)
#define hypre_AMGDDCompGridNonOwnedRelaxOrdering(compGrid) ((compGrid) -> nonowned_relax_ordering)
#endif
/******************************************************************************
* Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
* HYPRE Project Developers. See the top-level COPYRIGHT file for details.
*
* SPDX-License-Identifier: (Apache-2.0 OR MIT)
******************************************************************************/
#ifndef hypre_ParAMGDD_DATA_HEADER
#define hypre_ParAMGDD_DATA_HEADER
/*--------------------------------------------------------------------------
* hypre_ParAMGDDData
*--------------------------------------------------------------------------*/
typedef struct
{
/* The underlying AMG hierarchy */
hypre_ParAMGData *amg_data;
/* AMG-DD parameters and info */
HYPRE_Int start_level;
HYPRE_Int fac_num_cycles;
HYPRE_Int fac_cycle_type;
HYPRE_Int fac_relax_type;
HYPRE_Int fac_num_relax;
HYPRE_Real fac_relax_weight;
HYPRE_Int padding;
HYPRE_Int num_ghost_layers;
hypre_AMGDDCompGrid **amgdd_comp_grid;
hypre_AMGDDCommPkg *amgdd_comm_pkg;
hypre_ParVector *Ztemp;
HYPRE_Int (*amgddUserFACRelaxation)( void *amgdd_vdata, HYPRE_Int level,
HYPRE_Int cycle_param );
} hypre_ParAMGDDData;
/*--------------------------------------------------------------------------
* Accessor functions for the hypre_AMGDDData structure
*--------------------------------------------------------------------------*/
#define hypre_ParAMGDDDataAMG(amgdd_data) ((amgdd_data)->amg_data)
#define hypre_ParAMGDDDataStartLevel(amgdd_data) ((amgdd_data)->start_level)
#define hypre_ParAMGDDDataFACNumCycles(amgdd_data) ((amgdd_data)->fac_num_cycles)
#define hypre_ParAMGDDDataFACCycleType(amgdd_data) ((amgdd_data)->fac_cycle_type)
#define hypre_ParAMGDDDataFACRelaxType(amgdd_data) ((amgdd_data)->fac_relax_type)
#define hypre_ParAMGDDDataFACNumRelax(amgdd_data) ((amgdd_data)->fac_num_relax)
#define hypre_ParAMGDDDataFACRelaxWeight(amgdd_data) ((amgdd_data)->fac_relax_weight)
#define hypre_ParAMGDDDataPadding(amgdd_data) ((amgdd_data)->padding)
#define hypre_ParAMGDDDataNumGhostLayers(amgdd_data) ((amgdd_data)->num_ghost_layers)
#define hypre_ParAMGDDDataCompGrid(amgdd_data) ((amgdd_data)->amgdd_comp_grid)
#define hypre_ParAMGDDDataCommPkg(amgdd_data) ((amgdd_data)->amgdd_comm_pkg)
#define hypre_ParAMGDDDataZtemp(amg_data) ((amgdd_data)->Ztemp)
#define hypre_ParAMGDDDataUserFACRelaxation(amgdd_data) ((amgdd_data)->amgddUserFACRelaxation)
#endif
/******************************************************************************
* Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
* HYPRE Project Developers. See the top-level COPYRIGHT file for details.
*
* SPDX-License-Identifier: (Apache-2.0 OR MIT)
******************************************************************************/
#ifndef hypre_ParFSAI_DATA_HEADER
#define hypre_ParFSAI_DATA_HEADER
//#define DEBUG_FSAI
/*--------------------------------------------------------------------------
* hypre_ParFSAIData
*--------------------------------------------------------------------------*/
typedef struct hypre_ParFSAIData_struct
{
/* FSAI Setup input data */
HYPRE_Int algo_type; /* FSAI algorithm type */
HYPRE_Int local_solve_type; /* Local linear solver type */
HYPRE_Int max_steps; /* Max. iterations run per row */
HYPRE_Int max_step_size; /* Max. number of nonzeros added to a row of G per step */
HYPRE_Int max_nnz_row; /* Max. number of nonzeros per row of G */
HYPRE_Int num_levels; /* Number of levels for computing the candidate pattern */
HYPRE_Real threshold; /* Filtering threshold for the candidate pattern */
HYPRE_Real kap_tolerance; /* Min. amount of change between two steps */
/* FSAI Setup data */
HYPRE_Real density; /* Density of matrix G wrt. A */
hypre_ParCSRMatrix *Gmat; /* Matrix holding FSAI factor. M^(-1) = G'G */
hypre_ParCSRMatrix *GTmat; /* Matrix holding the transpose of the FSAI factor */
/* Solver data */
HYPRE_Int zero_guess; /* Flag indicating x0 = 0 */
HYPRE_Int eig_max_iters; /* Iters for computing max. eigenvalue of G^T*G*A */
HYPRE_Int max_iterations; /* Maximum iterations run for the solver */
HYPRE_Int num_iterations; /* Number of iterations the solver ran */
HYPRE_Real omega; /* Step size for Preconditioned Richardson Solver */
HYPRE_Real tolerance; /* Tolerance for the solver */
HYPRE_Real rel_resnorm; /* available if logging > 1 */
/* Work data */
hypre_ParVector *r_work; /* work vector used to compute the residual */
hypre_ParVector *z_work; /* work vector used for applying FSAI */
/* Log info data */
HYPRE_Int logging;
HYPRE_Int print_level;
} hypre_ParFSAIData;
/*--------------------------------------------------------------------------
* Accessor functions for the hypre_ParFSAIData structure
*--------------------------------------------------------------------------*/
/* FSAI Setup input data */
#define hypre_ParFSAIDataAlgoType(fsai_data) ((fsai_data) -> algo_type)
#define hypre_ParFSAIDataLocalSolveType(fsai_data) ((fsai_data) -> local_solve_type)
#define hypre_ParFSAIDataMaxSteps(fsai_data) ((fsai_data) -> max_steps)
#define hypre_ParFSAIDataMaxStepSize(fsai_data) ((fsai_data) -> max_step_size)
#define hypre_ParFSAIDataMaxNnzRow(fsai_data) ((fsai_data) -> max_nnz_row)
#define hypre_ParFSAIDataNumLevels(fsai_data) ((fsai_data) -> num_levels)
#define hypre_ParFSAIDataThreshold(fsai_data) ((fsai_data) -> threshold)
#define hypre_ParFSAIDataKapTolerance(fsai_data) ((fsai_data) -> kap_tolerance)
/* FSAI Setup data */
#define hypre_ParFSAIDataGmat(fsai_data) ((fsai_data) -> Gmat)
#define hypre_ParFSAIDataGTmat(fsai_data) ((fsai_data) -> GTmat)
#define hypre_ParFSAIDataDensity(fsai_data) ((fsai_data) -> density)
/* Solver problem data */
#define hypre_ParFSAIDataZeroGuess(fsai_data) ((fsai_data) -> zero_guess)
#define hypre_ParFSAIDataEigMaxIters(fsai_data) ((fsai_data) -> eig_max_iters)
#define hypre_ParFSAIDataMaxIterations(fsai_data) ((fsai_data) -> max_iterations)
#define hypre_ParFSAIDataNumIterations(fsai_data) ((fsai_data) -> num_iterations)
#define hypre_ParFSAIDataOmega(fsai_data) ((fsai_data) -> omega)
#define hypre_ParFSAIDataRelResNorm(fsai_data) ((fsai_data) -> rel_resnorm)
#define hypre_ParFSAIDataTolerance(fsai_data) ((fsai_data) -> tolerance)
/* Work data */
#define hypre_ParFSAIDataRWork(fsai_data) ((fsai_data) -> r_work)
#define hypre_ParFSAIDataZWork(fsai_data) ((fsai_data) -> z_work)
/* Log info data */
#define hypre_ParFSAIDataLogging(fsai_data) ((fsai_data) -> logging)
#define hypre_ParFSAIDataPrintLevel(fsai_data) ((fsai_data) -> print_level)
#endif
/******************************************************************************
* Copyright (c) 1998 Lawrence Livermore National Security, LLC and other
* HYPRE Project Developers. See the top-level COPYRIGHT file for details.
*
* SPDX-License-Identifier: (Apache-2.0 OR MIT)
******************************************************************************/
#ifndef hypre_AMS_DATA_HEADER
#define hypre_AMS_DATA_HEADER
/*--------------------------------------------------------------------------
* Auxiliary space Maxwell Solver data
*--------------------------------------------------------------------------*/
typedef struct
{
/* Space dimension (2 or 3) */
HYPRE_Int dim;
/* Edge element (ND1) stiffness matrix */
hypre_ParCSRMatrix *A;
/* Discrete gradient matrix (vertex-to-edge) */
hypre_ParCSRMatrix *G;
/* Coarse grid matrix on the range of G^T */
hypre_ParCSRMatrix *A_G;
/* AMG solver for A_G */
HYPRE_Solver B_G;
/* Is the mass term coefficient zero? */
HYPRE_Int beta_is_zero;
/* Nedelec nodal interpolation matrix (vertex^dim-to-edge) */
hypre_ParCSRMatrix *Pi;
/* Coarse grid matrix on the range of Pi^T */
hypre_ParCSRMatrix *A_Pi;
/* AMG solver for A_Pi */
HYPRE_Solver B_Pi;
/* Components of the Nedelec interpolation matrix (vertex-to-edge each) */
hypre_ParCSRMatrix *Pix, *Piy, *Piz;
/* Coarse grid matrices on the ranges of Pi{x,y,z}^T */
hypre_ParCSRMatrix *A_Pix, *A_Piy, *A_Piz;
/* AMG solvers for A_Pi{x,y,z} */
HYPRE_Solver B_Pix, B_Piy, B_Piz;
/* Does the solver own the Nedelec interpolations? */
HYPRE_Int owns_Pi;
/* Does the solver own the coarse grid matrices? */
HYPRE_Int owns_A_G, owns_A_Pi;
/* Coordinates of the vertices (z = 0 if dim == 2) */
hypre_ParVector *x, *y, *z;
/* Representations of the constant vectors in the Nedelec basis */
hypre_ParVector *Gx, *Gy, *Gz;
/* Nodes in the interior of the zero-conductivity region */
hypre_ParVector *interior_nodes;
/* Discrete gradient matrix for the interior nodes only */
hypre_ParCSRMatrix *G0;
/* Coarse grid matrix on the interior nodes */
hypre_ParCSRMatrix *A_G0;
/* AMG solver for A_G0 */
HYPRE_Solver B_G0;
/* How frequently to project the r.h.s. onto Ker(G0^T)? */
HYPRE_Int projection_frequency;
/* Internal counter to use with projection_frequency in PCG */
HYPRE_Int solve_counter;
/* Solver options */
HYPRE_Int maxit;
HYPRE_Real tol;
HYPRE_Int cycle_type;
HYPRE_Int print_level;
/* Smoothing options for A */
HYPRE_Int A_relax_type;
HYPRE_Int A_relax_times;
hypre_Vector *A_l1_norms;
HYPRE_Real A_relax_weight;
HYPRE_Real A_omega;
HYPRE_Real A_max_eig_est;
HYPRE_Real A_min_eig_est;