xref: /phasta/svLS/svLS_STRUCT_c.h (revision 712d3df0b59ebebaaeaea358162c8d2c043c6e08)
1*1e99f302SBen Matthews /*
2*1e99f302SBen Matthews  *--------------------------------------------------------------------
3*1e99f302SBen Matthews  *  This software is Copyright (c) 2012-2015 The Regents of the
4*1e99f302SBen Matthews  *  University of California. All Rights Reserved.
5*1e99f302SBen Matthews  *
6*1e99f302SBen Matthews  *  Permission to copy and modify this software and its documentation
7*1e99f302SBen Matthews  *  for educational, research and non-profit purposes, without fee,
8*1e99f302SBen Matthews  *  and without a written agreement is hereby granted, provided that
9*1e99f302SBen Matthews  *  the above copyright notice, this paragraph and the following three
10*1e99f302SBen Matthews  *  paragraphs appear in all copies.
11*1e99f302SBen Matthews  *
12*1e99f302SBen Matthews  *  Permission to make commercial use of this software may be obtained
13*1e99f302SBen Matthews  *  by contacting:
14*1e99f302SBen Matthews  *
15*1e99f302SBen Matthews  *  Technology Transfer Office
16*1e99f302SBen Matthews  *  9500 Gilman Drive, Mail Code 0910
17*1e99f302SBen Matthews  *  University of California
18*1e99f302SBen Matthews  *  La Jolla, CA 92093-0910
19*1e99f302SBen Matthews  *  (858) 534-5815
20*1e99f302SBen Matthews  *  invent@ucsd.edu
21*1e99f302SBen Matthews  *
22*1e99f302SBen Matthews  *  This software program and documentation are copyrighted by The
23*1e99f302SBen Matthews  *  Regents of the University of California. The software program and
24*1e99f302SBen Matthews  *  documentation are supplied "as is", without any accompanying
25*1e99f302SBen Matthews  *  services from The Regents. The Regents does not warrant that the
26*1e99f302SBen Matthews  *  operation of the program will be uninterrupted or error-free. The
27*1e99f302SBen Matthews  *  end-user understands that the program was developed for research
28*1e99f302SBen Matthews  *  purposes and is advised not to rely exclusively on the program for
29*1e99f302SBen Matthews  *  any reason.
30*1e99f302SBen Matthews  *
31*1e99f302SBen Matthews  *  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
32*1e99f302SBen Matthews  *  PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
33*1e99f302SBen Matthews  *  DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS
34*1e99f302SBen Matthews  *  SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
35*1e99f302SBen Matthews  *  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36*1e99f302SBen Matthews  *  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
37*1e99f302SBen Matthews  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38*1e99f302SBen Matthews  *  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
39*1e99f302SBen Matthews  *  SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE
40*1e99f302SBen Matthews  *  UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE
41*1e99f302SBen Matthews  *  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
42*1e99f302SBen Matthews  *--------------------------------------------------------------------
43*1e99f302SBen Matthews  */
44*1e99f302SBen Matthews 
45*1e99f302SBen Matthews //     Some defenitions
46*1e99f302SBen Matthews #define LS_TYPE_CG 1
47*1e99f302SBen Matthews #define LS_TYPE_GMRES 2
48*1e99f302SBen Matthews #define LS_TYPE_NS 3
49*1e99f302SBen Matthews #define BC_TYPE_Dir 0
50*1e99f302SBen Matthews #define BC_TYPE_Neu 1
51*1e99f302SBen Matthews #define BCOP_TYPE_ADD 0
52*1e99f302SBen Matthews #define BCOP_TYPE_PRE 1
53*1e99f302SBen Matthews 
54*1e99f302SBen Matthews //     Communication structure
55*1e99f302SBen Matthews typedef struct {
56*1e99f302SBen Matthews    int foC;// = false;              // Free of created          (USE)
57*1e99f302SBen Matthews    int masF;                        // If this the master       (USE)
58*1e99f302SBen Matthews    int master;                      // Master ID                (USE)
59*1e99f302SBen Matthews    int task;                        // ID of this proc.         (USE)
60*1e99f302SBen Matthews    int tF;                          // Task in FORTRAN indexing (USE)
61*1e99f302SBen Matthews    int nTasks;                      // Total number of tasks    (USE)
62*1e99f302SBen Matthews    MPI_Aint comm;                   // MPI communicator         (IN)
63*1e99f302SBen Matthews } svLS_commuType;
64*1e99f302SBen Matthews /*
65*1e99f302SBen Matthews //     LHS matrix related data
66*1e99f302SBen Matthews typedef struct {
67*1e99f302SBen Matthews    int foC;// = false;        // Free or created                (USE)
68*1e99f302SBen Matthews    int coupledFlag;        // Neu: P/Q coupling              (USE)
69*1e99f302SBen Matthews    int sharedFlag;// = false; // Neu: shared between proces     (USE)
70*1e99f302SBen Matthews    int incFlag;                  // Included in the computations   (IN)
71*1e99f302SBen Matthews    int nNo;// = 0;            // Number of nodes                (IN)
72*1e99f302SBen Matthews    int dof;                // Degrees of freedom for val     (IN)
73*1e99f302SBen Matthews    int bGrp;// = BC_TYPE_Dir; // Dir/Neu                        (IN)
74*1e99f302SBen Matthews    int reserved;                 // Only for data alignment
75*1e99f302SBen Matthews    int *glob;              // Global node number             (IN)
76*1e99f302SBen Matthews    double nS;              // ||Sai||**2D0                   (USE)
77*1e99f302SBen Matthews    double res;// = 0D0;       // Neu: P = res*Q                 (IN)
78*1e99f302SBen Matthews    double **val;           // nodal Sai for Neu              (IN)
79*1e99f302SBen Matthews    double **valM;          // Neu W*Sai                      (TMP)
80*1e99f302SBen Matthews } svLS_faceType;
81*1e99f302SBen Matthews 
82*1e99f302SBen Matthews typedef struct {
83*1e99f302SBen Matthews    int ptr;       // Pointer to start of data for commu (only 2 proc shared points)
84*1e99f302SBen Matthews    int n;         // Number of data to be commu  (only 2 proc shared points)
85*1e99f302SBen Matthews    int tag;       // Commu tag
86*1e99f302SBen Matthews    int req;       // Commu req
87*1e99f302SBen Matthews    int nBl;       // Number of blocks for commu  (for 3 < proc shared points)
88*1e99f302SBen Matthews    int reserved;  // Only for data alignment
89*1e99f302SBen Matthews    int *blPtr;    // Pointer to beggining of each block (for 3 < proc shared points)
90*1e99f302SBen Matthews    int *blN;      // Length of each block (for 3 < proc shared points)
91*1e99f302SBen Matthews } svLS_cSType;
92*1e99f302SBen Matthews 
93*1e99f302SBen Matthews typedef struct {
94*1e99f302SBen Matthews    int foC;// = false;        // Free or created                (USE)
95*1e99f302SBen Matthews    int gnNo;// = 0;           // Global number of nodes      (IN)
96*1e99f302SBen Matthews    int nNo;// = 0;            // Number of nodes             (IN)
97*1e99f302SBen Matthews    int nnz;// = 0;            // Number of non-zero in lhs   (IN)
98*1e99f302SBen Matthews    int nFaces;// = 0;         // Number of faces             (IN)
99*1e99f302SBen Matthews    int mynNo;              // nNo of this proc            (USE)
100*1e99f302SBen Matthews    int *colPtr;            // Column pointer              (USE)
101*1e99f302SBen Matthews    int **rowPtr;           // Row pointer                 (USE)
102*1e99f302SBen Matthews    int *diagPt;            // Diagonal pointer            (USE)
103*1e99f302SBen Matthews    int *map;               // Mapping of nodes            (USE)
104*1e99f302SBen Matthews    svLS_commuType commu;
105*1e99f302SBen Matthews    svLS_cSType *cS;
106*1e99f302SBen Matthews    svLS_faceType *face;
107*1e99f302SBen Matthews } svLS_lhsType;
108*1e99f302SBen Matthews */
109*1e99f302SBen Matthews //     LS related structures
110*1e99f302SBen Matthews typedef struct {
111*1e99f302SBen Matthews    int suc;       // Successful solving          (OUT)
112*1e99f302SBen Matthews    int mItr;      // Maximum iteration           (IN)
113*1e99f302SBen Matthews    int sD;        // Space dimension             (IN)
114*1e99f302SBen Matthews    int itr;       // Number of iteration         (OUT)
115*1e99f302SBen Matthews    int cM;        // Number of Ax multiply       (OUT)
116*1e99f302SBen Matthews    int cN;        // Number of |x| norms         (OUT)
117*1e99f302SBen Matthews    int cD;        // Number of <x.y> dot products(OUT)
118*1e99f302SBen Matthews    int reserve;   // Only for data alignment     (-)
119*1e99f302SBen Matthews    double absTol; // Absolute tolerance          (IN)
120*1e99f302SBen Matthews    double relTol; // Relative tolerance          (IN)
121*1e99f302SBen Matthews    double iNorm;  // Initial norm of residual    (OUT)
122*1e99f302SBen Matthews    double fNorm;  // Final norm of residual      (OUT)
123*1e99f302SBen Matthews    double dB;     // Res. rduction in last itr.  (OUT)
124*1e99f302SBen Matthews    double callD;  // Calling duration            (OUT)
125*1e99f302SBen Matthews } svLS_subLsType;
126*1e99f302SBen Matthews 
127*1e99f302SBen Matthews typedef struct {
128*1e99f302SBen Matthews    int foC;// = false;   // Free of created             (USE)
129*1e99f302SBen Matthews    int LS_type;            // Which one of LS             (IN)
130*1e99f302SBen Matthews    int Resm;               // Contribution of mom. res.   (OUT)
131*1e99f302SBen Matthews    int Resc;               // Contribution of cont. res.  (OUT)
132*1e99f302SBen Matthews    svLS_subLsType GM;
133*1e99f302SBen Matthews    svLS_subLsType CG;
134*1e99f302SBen Matthews    svLS_subLsType RI;
135*1e99f302SBen Matthews } svLS_lsType;
136