source: CIVL/examples/mpi-omp/AMG2013/IJ_mv/aux_par_vector.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.0 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 *
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
29int
30hypre_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
52int
53hypre_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
73int
74hypre_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
94int
95hypre_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
Note: See TracBrowser for help on using the repository browser.