| 1 | /*BHEADER**********************************************************************
|
|---|
| 2 | * Copyright (c) 2008, Lawrence Livermore National Security, LLC.
|
|---|
| 3 | * Produced at the Lawrence Livermore National Laboratory.
|
|---|
| 4 | * This file is part of HYPRE. See file COPYRIGHT for details.
|
|---|
| 5 | *
|
|---|
| 6 | * HYPRE is free software; you can redistribute it and/or modify it under the
|
|---|
| 7 | * terms of the GNU Lesser General Public License (as published by the Free
|
|---|
| 8 | * Software Foundation) version 2.1 dated February 1999.
|
|---|
| 9 | *
|
|---|
| 10 | * $Revision: 2.4 $
|
|---|
| 11 | ***********************************************************************EHEADER*/
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | #include "headers.h"
|
|---|
| 15 |
|
|---|
| 16 | /*---------------------------------------------------------------------------
|
|---|
| 17 | * Auxilary routines for the long range interpolation methods.
|
|---|
| 18 | * Implemented: "standard", "extended", "multipass", "FF"
|
|---|
| 19 | *--------------------------------------------------------------------------*/
|
|---|
| 20 | /* AHB 11/06: Modification of the above original - takes two
|
|---|
| 21 | communication packages and inserts nodes to position expected for
|
|---|
| 22 | OUT_marker
|
|---|
| 23 |
|
|---|
| 24 | offd nodes from comm_pkg take up first chunk of CF_marker_offd, offd
|
|---|
| 25 | nodes from extend_comm_pkg take up the second chunk 0f CF_marker_offd. */
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | int alt_insert_new_nodes(hypre_ParCSRCommPkg *comm_pkg,
|
|---|
| 30 | hypre_ParCSRCommPkg *extend_comm_pkg,
|
|---|
| 31 | int *IN_marker,
|
|---|
| 32 | int full_off_procNodes,
|
|---|
| 33 | int *OUT_marker)
|
|---|
| 34 | {
|
|---|
| 35 | hypre_ParCSRCommHandle *comm_handle;
|
|---|
| 36 |
|
|---|
| 37 | int i, j, start, index, shift;
|
|---|
| 38 |
|
|---|
| 39 | int num_sends, num_recvs;
|
|---|
| 40 |
|
|---|
| 41 | int *recv_vec_starts;
|
|---|
| 42 |
|
|---|
| 43 | int e_num_sends;
|
|---|
| 44 |
|
|---|
| 45 | int *int_buf_data;
|
|---|
| 46 | int *e_out_marker;
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg);
|
|---|
| 50 | num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg);
|
|---|
| 51 | recv_vec_starts = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg);
|
|---|
| 52 |
|
|---|
| 53 | e_num_sends = hypre_ParCSRCommPkgNumSends(extend_comm_pkg);
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | index = hypre_max(hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends),
|
|---|
| 57 | hypre_ParCSRCommPkgSendMapStart(extend_comm_pkg, e_num_sends));
|
|---|
| 58 |
|
|---|
| 59 | int_buf_data = hypre_CTAlloc(int, index);
|
|---|
| 60 |
|
|---|
| 61 | /* orig commpkg data*/
|
|---|
| 62 | index = 0;
|
|---|
| 63 |
|
|---|
| 64 | for (i = 0; i < num_sends; i++)
|
|---|
| 65 | {
|
|---|
| 66 | start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i);
|
|---|
| 67 | for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1);
|
|---|
| 68 | j++)
|
|---|
| 69 | int_buf_data[index++]
|
|---|
| 70 | = IN_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)];
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | comm_handle = hypre_ParCSRCommHandleCreate( 11, comm_pkg, int_buf_data,
|
|---|
| 74 | OUT_marker);
|
|---|
| 75 |
|
|---|
| 76 | hypre_ParCSRCommHandleDestroy(comm_handle);
|
|---|
| 77 | comm_handle = NULL;
|
|---|
| 78 |
|
|---|
| 79 | /* now do the extend commpkg */
|
|---|
| 80 |
|
|---|
| 81 | /* first we need to shift our position in the OUT_marker */
|
|---|
| 82 | shift = recv_vec_starts[num_recvs];
|
|---|
| 83 | e_out_marker = OUT_marker + shift;
|
|---|
| 84 |
|
|---|
| 85 | index = 0;
|
|---|
| 86 |
|
|---|
| 87 | for (i = 0; i < e_num_sends; i++)
|
|---|
| 88 | {
|
|---|
| 89 | start = hypre_ParCSRCommPkgSendMapStart(extend_comm_pkg, i);
|
|---|
| 90 | for (j = start; j < hypre_ParCSRCommPkgSendMapStart(extend_comm_pkg, i+1);
|
|---|
| 91 | j++)
|
|---|
| 92 | int_buf_data[index++]
|
|---|
| 93 | = IN_marker[hypre_ParCSRCommPkgSendMapElmt(extend_comm_pkg,j)];
|
|---|
| 94 | }
|
|---|
| 95 |
|
|---|
| 96 | comm_handle = hypre_ParCSRCommHandleCreate( 11, extend_comm_pkg, int_buf_data,
|
|---|
| 97 | e_out_marker);
|
|---|
| 98 |
|
|---|
| 99 | hypre_ParCSRCommHandleDestroy(comm_handle);
|
|---|
| 100 | comm_handle = NULL;
|
|---|
| 101 |
|
|---|
| 102 | hypre_TFree(int_buf_data);
|
|---|
| 103 |
|
|---|
| 104 | return hypre_error_flag;
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 | int big_insert_new_nodes(hypre_ParCSRCommPkg *comm_pkg,
|
|---|
| 109 | hypre_ParCSRCommPkg *extend_comm_pkg,
|
|---|
| 110 | int *IN_marker,
|
|---|
| 111 | int full_off_procNodes,
|
|---|
| 112 | HYPRE_BigInt offset,
|
|---|
| 113 | HYPRE_BigInt *OUT_marker)
|
|---|
| 114 | {
|
|---|
| 115 | hypre_ParCSRCommHandle *comm_handle;
|
|---|
| 116 |
|
|---|
| 117 | int i, j, start, index, shift;
|
|---|
| 118 |
|
|---|
| 119 | int num_sends, num_recvs;
|
|---|
| 120 |
|
|---|
| 121 | int *recv_vec_starts;
|
|---|
| 122 |
|
|---|
| 123 | int e_num_sends;
|
|---|
| 124 |
|
|---|
| 125 | HYPRE_BigInt *big_buf_data;
|
|---|
| 126 | HYPRE_BigInt *e_out_marker;
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 | num_sends = hypre_ParCSRCommPkgNumSends(comm_pkg);
|
|---|
| 130 | num_recvs = hypre_ParCSRCommPkgNumRecvs(comm_pkg);
|
|---|
| 131 | recv_vec_starts = hypre_ParCSRCommPkgRecvVecStarts(comm_pkg);
|
|---|
| 132 |
|
|---|
| 133 | e_num_sends = hypre_ParCSRCommPkgNumSends(extend_comm_pkg);
|
|---|
| 134 |
|
|---|
| 135 |
|
|---|
| 136 | index = hypre_max(hypre_ParCSRCommPkgSendMapStart(comm_pkg, num_sends),
|
|---|
| 137 | hypre_ParCSRCommPkgSendMapStart(extend_comm_pkg, e_num_sends));
|
|---|
| 138 |
|
|---|
| 139 | big_buf_data = hypre_CTAlloc(HYPRE_BigInt, index);
|
|---|
| 140 |
|
|---|
| 141 | /* orig commpkg data*/
|
|---|
| 142 | index = 0;
|
|---|
| 143 |
|
|---|
| 144 | for (i = 0; i < num_sends; i++)
|
|---|
| 145 | {
|
|---|
| 146 | start = hypre_ParCSRCommPkgSendMapStart(comm_pkg, i);
|
|---|
| 147 | for (j = start; j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1);
|
|---|
| 148 | j++)
|
|---|
| 149 | big_buf_data[index++] = offset
|
|---|
| 150 | + (HYPRE_BigInt) IN_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)];
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | comm_handle = hypre_ParCSRCommHandleCreate( 21, comm_pkg, big_buf_data,
|
|---|
| 154 | OUT_marker);
|
|---|
| 155 |
|
|---|
| 156 | hypre_ParCSRCommHandleDestroy(comm_handle);
|
|---|
| 157 | comm_handle = NULL;
|
|---|
| 158 |
|
|---|
| 159 | /* now do the extend commpkg */
|
|---|
| 160 |
|
|---|
| 161 | /* first we need to shift our position in the OUT_marker */
|
|---|
| 162 | shift = recv_vec_starts[num_recvs];
|
|---|
| 163 | e_out_marker = OUT_marker + shift;
|
|---|
| 164 |
|
|---|
| 165 | index = 0;
|
|---|
| 166 |
|
|---|
| 167 | for (i = 0; i < e_num_sends; i++)
|
|---|
| 168 | {
|
|---|
| 169 | start = hypre_ParCSRCommPkgSendMapStart(extend_comm_pkg, i);
|
|---|
| 170 | for (j = start; j < hypre_ParCSRCommPkgSendMapStart(extend_comm_pkg, i+1);
|
|---|
| 171 | j++)
|
|---|
| 172 | big_buf_data[index++] = offset
|
|---|
| 173 | + (HYPRE_BigInt) IN_marker[hypre_ParCSRCommPkgSendMapElmt(extend_comm_pkg,j)];
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | comm_handle = hypre_ParCSRCommHandleCreate( 21, extend_comm_pkg, big_buf_data,
|
|---|
| 177 | e_out_marker);
|
|---|
| 178 |
|
|---|
| 179 | hypre_ParCSRCommHandleDestroy(comm_handle);
|
|---|
| 180 | comm_handle = NULL;
|
|---|
| 181 |
|
|---|
| 182 | hypre_TFree(big_buf_data);
|
|---|
| 183 |
|
|---|
| 184 | return hypre_error_flag;
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 | /* AHB 11/06 : alternate to the extend function below - creates a
|
|---|
| 190 | * second comm pkg based on found - this makes it easier to use the
|
|---|
| 191 | * global partition*/
|
|---|
| 192 | int
|
|---|
| 193 | hypre_ParCSRFindExtendCommPkg(hypre_ParCSRMatrix *A, int newoff, HYPRE_BigInt *found,
|
|---|
| 194 | hypre_ParCSRCommPkg **extend_comm_pkg)
|
|---|
| 195 |
|
|---|
| 196 | {
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 | int num_sends;
|
|---|
| 200 | int *send_procs;
|
|---|
| 201 | int *send_map_starts;
|
|---|
| 202 | int *send_map_elmts;
|
|---|
| 203 |
|
|---|
| 204 | int num_recvs;
|
|---|
| 205 | int *recv_procs;
|
|---|
| 206 | int *recv_vec_starts;
|
|---|
| 207 |
|
|---|
| 208 | hypre_ParCSRCommPkg *new_comm_pkg;
|
|---|
| 209 |
|
|---|
| 210 | MPI_Comm comm = hypre_ParCSRMatrixComm(A);
|
|---|
| 211 |
|
|---|
| 212 | HYPRE_BigInt first_col_diag = hypre_ParCSRMatrixFirstColDiag(A);
|
|---|
| 213 | /* use found instead of col_map_offd in A, and newoff instead
|
|---|
| 214 | of num_cols_offd*/
|
|---|
| 215 |
|
|---|
| 216 | #if HYPRE_NO_GLOBAL_PARTITION
|
|---|
| 217 |
|
|---|
| 218 | HYPRE_BigInt row_start=0, row_end=0, col_start = 0, col_end = 0;
|
|---|
| 219 | HYPRE_BigInt global_num_cols;
|
|---|
| 220 | hypre_IJAssumedPart *apart;
|
|---|
| 221 |
|
|---|
| 222 | hypre_ParCSRMatrixGetLocalRange( A,
|
|---|
| 223 | &row_start, &row_end ,
|
|---|
| 224 | &col_start, &col_end );
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 | global_num_cols = hypre_ParCSRMatrixGlobalNumCols(A);
|
|---|
| 228 |
|
|---|
| 229 | /* Create the assumed partition */
|
|---|
| 230 | if (hypre_ParCSRMatrixAssumedPartition(A) == NULL)
|
|---|
| 231 | {
|
|---|
| 232 | hypre_ParCSRMatrixCreateAssumedPartition(A);
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | apart = hypre_ParCSRMatrixAssumedPartition(A);
|
|---|
| 236 |
|
|---|
| 237 | hypre_NewCommPkgCreate_core( comm, found, first_col_diag,
|
|---|
| 238 | col_start, col_end,
|
|---|
| 239 | newoff, global_num_cols,
|
|---|
| 240 | &num_recvs, &recv_procs, &recv_vec_starts,
|
|---|
| 241 | &num_sends, &send_procs, &send_map_starts,
|
|---|
| 242 | &send_map_elmts, apart);
|
|---|
| 243 |
|
|---|
| 244 | #else
|
|---|
| 245 | HYPRE_BigInt *col_starts = hypre_ParCSRMatrixColStarts(A);
|
|---|
| 246 | int num_cols_diag = hypre_CSRMatrixNumCols(hypre_ParCSRMatrixDiag(A));
|
|---|
| 247 |
|
|---|
| 248 | hypre_MatvecCommPkgCreate_core
|
|---|
| 249 | (
|
|---|
| 250 | comm, found, first_col_diag, col_starts,
|
|---|
| 251 | num_cols_diag, newoff,
|
|---|
| 252 | first_col_diag, found,
|
|---|
| 253 | 1,
|
|---|
| 254 | &num_recvs, &recv_procs, &recv_vec_starts,
|
|---|
| 255 | &num_sends, &send_procs, &send_map_starts,
|
|---|
| 256 | &send_map_elmts
|
|---|
| 257 | );
|
|---|
| 258 |
|
|---|
| 259 | #endif
|
|---|
| 260 |
|
|---|
| 261 | new_comm_pkg = hypre_CTAlloc(hypre_ParCSRCommPkg, 1);
|
|---|
| 262 |
|
|---|
| 263 | hypre_ParCSRCommPkgComm(new_comm_pkg) = comm;
|
|---|
| 264 |
|
|---|
| 265 | hypre_ParCSRCommPkgNumRecvs(new_comm_pkg) = num_recvs;
|
|---|
| 266 | hypre_ParCSRCommPkgRecvProcs(new_comm_pkg) = recv_procs;
|
|---|
| 267 | hypre_ParCSRCommPkgRecvVecStarts(new_comm_pkg) = recv_vec_starts;
|
|---|
| 268 | hypre_ParCSRCommPkgNumSends(new_comm_pkg) = num_sends;
|
|---|
| 269 | hypre_ParCSRCommPkgSendProcs(new_comm_pkg) = send_procs;
|
|---|
| 270 | hypre_ParCSRCommPkgSendMapStarts(new_comm_pkg) = send_map_starts;
|
|---|
| 271 | hypre_ParCSRCommPkgSendMapElmts(new_comm_pkg) = send_map_elmts;
|
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 | *extend_comm_pkg = new_comm_pkg;
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 | return hypre_error_flag;
|
|---|
| 279 |
|
|---|
| 280 | }
|
|---|
| 281 |
|
|---|
| 282 | /* Find nodes that are offd and are not contained in original offd
|
|---|
| 283 | * (neighbors of neighbors) */
|
|---|
| 284 | int new_offd_nodes(HYPRE_BigInt **found, int num_cols_A_offd, int *A_ext_i,
|
|---|
| 285 | HYPRE_BigInt *big_A_ext_j, int **A_ext_j_ptr,
|
|---|
| 286 | int num_cols_S_offd, HYPRE_BigInt *col_map_offd, HYPRE_BigInt col_1,
|
|---|
| 287 | HYPRE_BigInt col_n, int *Sop_i, HYPRE_BigInt *big_Sop_j,
|
|---|
| 288 | int **Sop_j_ptr,
|
|---|
| 289 | int *CF_marker, hypre_ParCSRCommPkg *comm_pkg)
|
|---|
| 290 | {
|
|---|
| 291 | int i, ii, j, ifound, kk;
|
|---|
| 292 | int got_loc, loc_col;
|
|---|
| 293 |
|
|---|
| 294 | int min;
|
|---|
| 295 |
|
|---|
| 296 | int size_offP;
|
|---|
| 297 |
|
|---|
| 298 | HYPRE_BigInt *tmp_found, big_ifound;
|
|---|
| 299 | HYPRE_BigInt big_i1, big_k1;
|
|---|
| 300 | int *CF_marker_offd = NULL;
|
|---|
| 301 | int *int_buf_data;
|
|---|
| 302 | int *loc;
|
|---|
| 303 | int *A_ext_j;
|
|---|
| 304 | int *Sop_j;
|
|---|
| 305 | int newoff = 0;
|
|---|
| 306 | hypre_ParCSRCommHandle *comm_handle;
|
|---|
| 307 |
|
|---|
| 308 | CF_marker_offd = hypre_CTAlloc(int, num_cols_A_offd);
|
|---|
| 309 | int_buf_data = hypre_CTAlloc(int,
|
|---|
| 310 | hypre_ParCSRCommPkgSendMapStart(comm_pkg,
|
|---|
| 311 | hypre_ParCSRCommPkgNumSends(comm_pkg)));
|
|---|
| 312 | ii = 0;
|
|---|
| 313 | for (i=0; i < hypre_ParCSRCommPkgNumSends(comm_pkg); i++)
|
|---|
| 314 | {
|
|---|
| 315 | for (j=hypre_ParCSRCommPkgSendMapStart(comm_pkg,i);
|
|---|
| 316 | j < hypre_ParCSRCommPkgSendMapStart(comm_pkg, i+1); j++)
|
|---|
| 317 | int_buf_data[ii++]
|
|---|
| 318 | = CF_marker[hypre_ParCSRCommPkgSendMapElmt(comm_pkg,j)];
|
|---|
| 319 | }
|
|---|
| 320 | comm_handle = hypre_ParCSRCommHandleCreate(11, comm_pkg,int_buf_data,
|
|---|
| 321 | CF_marker_offd);
|
|---|
| 322 | hypre_ParCSRCommHandleDestroy(comm_handle);
|
|---|
| 323 | hypre_TFree(int_buf_data);
|
|---|
| 324 |
|
|---|
| 325 | size_offP = A_ext_i[num_cols_A_offd];
|
|---|
| 326 | tmp_found = hypre_CTAlloc(HYPRE_BigInt, size_offP);
|
|---|
| 327 | A_ext_j = hypre_CTAlloc(int, size_offP);
|
|---|
| 328 | loc = hypre_CTAlloc(int, size_offP);
|
|---|
| 329 |
|
|---|
| 330 | /* Find nodes that will be added to the off diag list */
|
|---|
| 331 | for (i = 0; i < num_cols_A_offd; i++)
|
|---|
| 332 | {
|
|---|
| 333 | if (CF_marker_offd[i] < 0)
|
|---|
| 334 | {
|
|---|
| 335 | for (j = A_ext_i[i]; j < A_ext_i[i+1]; j++)
|
|---|
| 336 | {
|
|---|
| 337 | big_i1 = big_A_ext_j[j];
|
|---|
| 338 | if(big_i1 < col_1 || big_i1 >= col_n)
|
|---|
| 339 | {
|
|---|
| 340 | ifound = hypre_BigBinarySearch(col_map_offd,big_i1,num_cols_A_offd);
|
|---|
| 341 | if(ifound == -1)
|
|---|
| 342 | {
|
|---|
| 343 | tmp_found[newoff]=big_i1;
|
|---|
| 344 | loc[newoff++] = j;
|
|---|
| 345 | }
|
|---|
| 346 | else
|
|---|
| 347 | {
|
|---|
| 348 | A_ext_j[j] = -ifound-1;
|
|---|
| 349 | }
|
|---|
| 350 | }
|
|---|
| 351 | else
|
|---|
| 352 | A_ext_j[j] = (int)(big_i1 - col_1);
|
|---|
| 353 | }
|
|---|
| 354 | }
|
|---|
| 355 | }
|
|---|
| 356 | /* Put found in monotone increasing order */
|
|---|
| 357 | if (newoff > 0)
|
|---|
| 358 | {
|
|---|
| 359 | hypre_BigQsort0(tmp_found,0,newoff-1);
|
|---|
| 360 | big_ifound = tmp_found[0];
|
|---|
| 361 | min = 1;
|
|---|
| 362 | for (i=1; i < newoff; i++)
|
|---|
| 363 | {
|
|---|
| 364 | if (tmp_found[i] > big_ifound)
|
|---|
| 365 | {
|
|---|
| 366 | big_ifound = tmp_found[i];
|
|---|
| 367 | tmp_found[min++] = big_ifound;
|
|---|
| 368 | }
|
|---|
| 369 | }
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | for (i=0; i < newoff; i++)
|
|---|
| 373 | {
|
|---|
| 374 | kk = hypre_BigBinarySearch(tmp_found,big_A_ext_j[loc[i]],min);
|
|---|
| 375 | A_ext_j[loc[i]] = -kk - num_cols_A_offd - 1;
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | if (newoff > 0) newoff = min;
|
|---|
| 379 | hypre_TFree(big_A_ext_j);
|
|---|
| 380 | hypre_TFree(loc);
|
|---|
| 381 |
|
|---|
| 382 | /* Set column indices for Sop and A_ext such that offd nodes are
|
|---|
| 383 | * negatively indexed */
|
|---|
| 384 |
|
|---|
| 385 | Sop_j = hypre_CTAlloc(int,Sop_i[num_cols_S_offd]);
|
|---|
| 386 |
|
|---|
| 387 | if (newoff < num_cols_A_offd)
|
|---|
| 388 | {
|
|---|
| 389 | for(i = 0; i < num_cols_S_offd; i++)
|
|---|
| 390 | {
|
|---|
| 391 | if (CF_marker_offd[i] < 0)
|
|---|
| 392 | {
|
|---|
| 393 | for(kk = Sop_i[i]; kk < Sop_i[i+1]; kk++)
|
|---|
| 394 | {
|
|---|
| 395 | big_k1 = big_Sop_j[kk];
|
|---|
| 396 | if(big_k1 < col_1 || big_k1 >= col_n)
|
|---|
| 397 | {
|
|---|
| 398 | got_loc = hypre_BigBinarySearch(tmp_found,big_k1,newoff);
|
|---|
| 399 | if(got_loc > -1)
|
|---|
| 400 | loc_col = got_loc + num_cols_A_offd;
|
|---|
| 401 | else
|
|---|
| 402 | loc_col = hypre_BigBinarySearch(col_map_offd,big_k1,
|
|---|
| 403 | num_cols_A_offd);
|
|---|
| 404 | if(loc_col < 0)
|
|---|
| 405 | {
|
|---|
| 406 | printf("Could not find node: STOP\n");
|
|---|
| 407 | return(-1);
|
|---|
| 408 | }
|
|---|
| 409 | Sop_j[kk] = -loc_col - 1;
|
|---|
| 410 | }
|
|---|
| 411 | else
|
|---|
| 412 | Sop_j[kk] = (int)(big_k1-col_1);
|
|---|
| 413 | }
|
|---|
| 414 | }
|
|---|
| 415 | }
|
|---|
| 416 | }
|
|---|
| 417 | else
|
|---|
| 418 | {
|
|---|
| 419 | for(i = 0; i < num_cols_S_offd; i++)
|
|---|
| 420 | {
|
|---|
| 421 | if (CF_marker_offd[i] < 0)
|
|---|
| 422 | {
|
|---|
| 423 | for(kk = Sop_i[i]; kk < Sop_i[i+1]; kk++)
|
|---|
| 424 | {
|
|---|
| 425 | big_k1 = big_Sop_j[kk];
|
|---|
| 426 | if(big_k1 < col_1 || big_k1 >= col_n)
|
|---|
| 427 | {
|
|---|
| 428 | loc_col = hypre_BigBinarySearch(col_map_offd,big_k1,
|
|---|
| 429 | num_cols_A_offd);
|
|---|
| 430 | if(loc_col == -1)
|
|---|
| 431 | loc_col = hypre_BigBinarySearch(tmp_found,big_k1,newoff) +
|
|---|
| 432 | num_cols_A_offd;
|
|---|
| 433 | if(loc_col < 0)
|
|---|
| 434 | {
|
|---|
| 435 | printf("Could not find node: STOP\n");
|
|---|
| 436 | return(-1);
|
|---|
| 437 | }
|
|---|
| 438 | Sop_j[kk] = -loc_col - 1;
|
|---|
| 439 | }
|
|---|
| 440 | else
|
|---|
| 441 | Sop_j[kk] = (int)(big_k1-col_1);
|
|---|
| 442 | }
|
|---|
| 443 | }
|
|---|
| 444 | }
|
|---|
| 445 | }
|
|---|
| 446 |
|
|---|
| 447 | hypre_TFree(big_Sop_j);
|
|---|
| 448 | hypre_TFree(CF_marker_offd);
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 | *found = tmp_found;
|
|---|
| 452 | *A_ext_j_ptr = A_ext_j;
|
|---|
| 453 | *Sop_j_ptr = Sop_j;
|
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 | return newoff;
|
|---|
| 457 | }
|
|---|