| 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 |
|
|---|
| 15 |
|
|---|
| 16 | /******************************************************************************
|
|---|
| 17 | *
|
|---|
| 18 | * Member functions for hypre_AuxParVector class.
|
|---|
| 19 | *
|
|---|
| 20 | *****************************************************************************/
|
|---|
| 21 |
|
|---|
| 22 | #include "IJ_mv.h"
|
|---|
| 23 | #include "aux_par_vector.h"
|
|---|
| 24 |
|
|---|
| 25 | /*--------------------------------------------------------------------------
|
|---|
| 26 | * hypre_AuxParVectorCreate
|
|---|
| 27 | *--------------------------------------------------------------------------*/
|
|---|
| 28 |
|
|---|
| 29 | int
|
|---|
| 30 | hypre_AuxParVectorCreate( hypre_AuxParVector **aux_vector)
|
|---|
| 31 | {
|
|---|
| 32 | hypre_AuxParVector *vector;
|
|---|
| 33 |
|
|---|
| 34 | vector = hypre_CTAlloc(hypre_AuxParVector, 1);
|
|---|
| 35 |
|
|---|
| 36 | /* set defaults */
|
|---|
| 37 | hypre_AuxParVectorMaxOffProcElmts(vector) = 0;
|
|---|
| 38 | hypre_AuxParVectorCurrentNumElmts(vector) = 0;
|
|---|
| 39 | /* stash for setting or adding off processor values */
|
|---|
| 40 | hypre_AuxParVectorOffProcI(vector) = NULL;
|
|---|
| 41 | hypre_AuxParVectorOffProcData(vector) = NULL;
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 | *aux_vector = vector;
|
|---|
| 45 | return 0;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | /*--------------------------------------------------------------------------
|
|---|
| 49 | * hypre_AuxParVectorDestroy
|
|---|
| 50 | *--------------------------------------------------------------------------*/
|
|---|
| 51 |
|
|---|
| 52 | int
|
|---|
| 53 | hypre_AuxParVectorDestroy( hypre_AuxParVector *vector )
|
|---|
| 54 | {
|
|---|
| 55 | int ierr=0;
|
|---|
| 56 |
|
|---|
| 57 | if (vector)
|
|---|
| 58 | {
|
|---|
| 59 | if (hypre_AuxParVectorOffProcI(vector))
|
|---|
| 60 | hypre_TFree(hypre_AuxParVectorOffProcI(vector));
|
|---|
| 61 | if (hypre_AuxParVectorOffProcData(vector))
|
|---|
| 62 | hypre_TFree(hypre_AuxParVectorOffProcData(vector));
|
|---|
| 63 | hypre_TFree(vector);
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | return ierr;
|
|---|
| 67 | }
|
|---|
| 68 |
|
|---|
| 69 | /*--------------------------------------------------------------------------
|
|---|
| 70 | * hypre_AuxParVectorInitialize
|
|---|
| 71 | *--------------------------------------------------------------------------*/
|
|---|
| 72 |
|
|---|
| 73 | int
|
|---|
| 74 | hypre_AuxParVectorInitialize( hypre_AuxParVector *vector )
|
|---|
| 75 | {
|
|---|
| 76 | int max_off_proc_elmts = hypre_AuxParVectorMaxOffProcElmts(vector);
|
|---|
| 77 |
|
|---|
| 78 | /* allocate stash for setting or adding off processor values */
|
|---|
| 79 | if (max_off_proc_elmts > 0)
|
|---|
| 80 | {
|
|---|
| 81 | hypre_AuxParVectorOffProcI(vector) = hypre_CTAlloc(HYPRE_BigInt,
|
|---|
| 82 | max_off_proc_elmts);
|
|---|
| 83 | hypre_AuxParVectorOffProcData(vector) = hypre_CTAlloc(double,
|
|---|
| 84 | max_off_proc_elmts);
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | return 0;
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | /*--------------------------------------------------------------------------
|
|---|
| 91 | * hypre_AuxParVectorSetMaxOffProcElmts
|
|---|
| 92 | *--------------------------------------------------------------------------*/
|
|---|
| 93 |
|
|---|
| 94 | int
|
|---|
| 95 | hypre_AuxParVectorSetMaxOffPRocElmts( hypre_AuxParVector *vector,
|
|---|
| 96 | int max_off_proc_elmts )
|
|---|
| 97 | {
|
|---|
| 98 | int ierr = 0;
|
|---|
| 99 | hypre_AuxParVectorMaxOffProcElmts(vector) = max_off_proc_elmts;
|
|---|
| 100 | return ierr;
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|