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