| [2aa6644] | 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 | * hypre_IJMatrix interface
|
|---|
| 18 | *
|
|---|
| 19 | *****************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | #include "./IJ_mv.h"
|
|---|
| 22 |
|
|---|
| 23 | #include "../HYPRE.h"
|
|---|
| 24 |
|
|---|
| 25 | /*--------------------------------------------------------------------------
|
|---|
| 26 | * hypre_IJMatrixGetRowPartitioning
|
|---|
| 27 | *--------------------------------------------------------------------------*/
|
|---|
| 28 |
|
|---|
| 29 | /**
|
|---|
| 30 | Returns a pointer to the row partitioning
|
|---|
| 31 |
|
|---|
| 32 | @return integer error code
|
|---|
| 33 | @param IJMatrix [IN]
|
|---|
| 34 | The ijmatrix to be pointed to.
|
|---|
| 35 | */
|
|---|
| 36 |
|
|---|
| 37 | int
|
|---|
| 38 | hypre_IJMatrixGetRowPartitioning( HYPRE_IJMatrix matrix ,
|
|---|
| 39 | HYPRE_BigInt **row_partitioning )
|
|---|
| 40 | {
|
|---|
| 41 | hypre_IJMatrix *ijmatrix = (hypre_IJMatrix *) matrix;
|
|---|
| 42 |
|
|---|
| 43 | if (!ijmatrix)
|
|---|
| 44 | {
|
|---|
| 45 | printf("Variable ijmatrix is NULL -- hypre_IJMatrixGetRowPartitioning\n");
|
|---|
| 46 | exit(1);
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | if ( hypre_IJMatrixRowPartitioning(ijmatrix))
|
|---|
| 50 | *row_partitioning = hypre_IJMatrixRowPartitioning(ijmatrix);
|
|---|
| 51 | else
|
|---|
| 52 | return -1;
|
|---|
| 53 |
|
|---|
| 54 | return -99;
|
|---|
| 55 | }
|
|---|
| 56 | /*--------------------------------------------------------------------------
|
|---|
| 57 | * hypre_IJMatrixGetColPartitioning
|
|---|
| 58 | *--------------------------------------------------------------------------*/
|
|---|
| 59 |
|
|---|
| 60 | /**
|
|---|
| 61 | Returns a pointer to the column partitioning
|
|---|
| 62 |
|
|---|
| 63 | @return integer error code
|
|---|
| 64 | @param IJMatrix [IN]
|
|---|
| 65 | The ijmatrix to be pointed to.
|
|---|
| 66 | */
|
|---|
| 67 |
|
|---|
| 68 | int
|
|---|
| 69 | hypre_IJMatrixGetColPartitioning( HYPRE_IJMatrix matrix ,
|
|---|
| 70 | HYPRE_BigInt **col_partitioning )
|
|---|
| 71 | {
|
|---|
| 72 | hypre_IJMatrix *ijmatrix = (hypre_IJMatrix *) matrix;
|
|---|
| 73 |
|
|---|
| 74 | if (!ijmatrix)
|
|---|
| 75 | {
|
|---|
| 76 | printf("Variable ijmatrix is NULL -- hypre_IJMatrixGetColPartitioning\n");
|
|---|
| 77 | exit(1);
|
|---|
| 78 | }
|
|---|
| 79 |
|
|---|
| 80 | if ( hypre_IJMatrixColPartitioning(ijmatrix))
|
|---|
| 81 | *col_partitioning = hypre_IJMatrixColPartitioning(ijmatrix);
|
|---|
| 82 | else
|
|---|
| 83 | return -1;
|
|---|
| 84 |
|
|---|
| 85 | return -99;
|
|---|
| 86 | }
|
|---|
| 87 | /*--------------------------------------------------------------------------
|
|---|
| 88 | * hypre_IJMatrixSetObject
|
|---|
| 89 | *--------------------------------------------------------------------------*/
|
|---|
| 90 |
|
|---|
| 91 | int
|
|---|
| 92 | hypre_IJMatrixSetObject( HYPRE_IJMatrix matrix,
|
|---|
| 93 | void *object )
|
|---|
| 94 | {
|
|---|
| 95 | hypre_IJMatrix *ijmatrix = (hypre_IJMatrix *) matrix;
|
|---|
| 96 |
|
|---|
| 97 | if (hypre_IJMatrixObject(ijmatrix) != NULL)
|
|---|
| 98 | {
|
|---|
| 99 | printf("Referencing a new IJMatrix object can orphan an old -- ");
|
|---|
| 100 | printf("hypre_IJMatrixSetObject\n");
|
|---|
| 101 | exit(1);
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | hypre_IJMatrixObject(ijmatrix) = object;
|
|---|
| 105 |
|
|---|
| 106 | return 0;
|
|---|
| 107 | }
|
|---|