source: CIVL/examples/mpi-omp/AMG2013/seq_mv/HYPRE_csr_matrix.c

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 3.2 KB
Line 
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_CSRMatrix interface
18 *
19 *****************************************************************************/
20
21#include "headers.h"
22
23/*--------------------------------------------------------------------------
24 * HYPRE_CSRMatrixCreate
25 *--------------------------------------------------------------------------*/
26
27HYPRE_CSRMatrix
28HYPRE_CSRMatrixCreate( int num_rows,
29 int num_cols,
30 int *row_sizes )
31{
32 hypre_CSRMatrix *matrix;
33 int *matrix_i;
34 int i;
35
36 matrix_i = hypre_CTAlloc(int, num_rows + 1);
37 matrix_i[0] = 0;
38 for (i = 0; i < num_rows; i++)
39 {
40 matrix_i[i+1] = matrix_i[i] + row_sizes[i];
41 }
42
43 matrix = hypre_CSRMatrixCreate(num_rows, num_cols, matrix_i[num_rows]);
44 hypre_CSRMatrixI(matrix) = matrix_i;
45
46 return ( (HYPRE_CSRMatrix) matrix );
47}
48
49/*--------------------------------------------------------------------------
50 * HYPRE_CSRMatrixDestroy
51 *--------------------------------------------------------------------------*/
52
53int
54HYPRE_CSRMatrixDestroy( HYPRE_CSRMatrix matrix )
55{
56 return( hypre_CSRMatrixDestroy( (hypre_CSRMatrix *) matrix ) );
57}
58
59/*--------------------------------------------------------------------------
60 * HYPRE_CSRMatrixInitialize
61 *--------------------------------------------------------------------------*/
62
63int
64HYPRE_CSRMatrixInitialize( HYPRE_CSRMatrix matrix )
65{
66 return ( hypre_CSRMatrixInitialize( (hypre_CSRMatrix *) matrix ) );
67}
68
69/*--------------------------------------------------------------------------
70 * HYPRE_CSRMatrixRead
71 *--------------------------------------------------------------------------*/
72
73HYPRE_CSRMatrix
74HYPRE_CSRMatrixRead( char *file_name )
75{
76 return ( (HYPRE_CSRMatrix) hypre_CSRMatrixRead( file_name ) );
77}
78
79/*--------------------------------------------------------------------------
80 * HYPRE_CSRMatrixPrint
81 *--------------------------------------------------------------------------*/
82
83void
84HYPRE_CSRMatrixPrint( HYPRE_CSRMatrix matrix,
85 char *file_name )
86{
87 hypre_CSRMatrixPrint( (hypre_CSRMatrix *) matrix,
88 file_name );
89}
90
91/*--------------------------------------------------------------------------
92 * HYPRE_CSRMatrixGetNumRows
93 *--------------------------------------------------------------------------*/
94
95int
96HYPRE_CSRMatrixGetNumRows( HYPRE_CSRMatrix matrix, int *num_rows )
97{
98 hypre_CSRMatrix *csr_matrix = (hypre_CSRMatrix *) matrix;
99
100 *num_rows = hypre_CSRMatrixNumRows( csr_matrix );
101
102 return 0;
103}
104
105
Note: See TracBrowser for help on using the repository browser.