source: CIVL/examples/mpi-omp/AMG2013/sstruct_mv/sstruct_overlap_innerprod.c@ beab7f2

main test-branch
Last change on this file since beab7f2 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: 2.4 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 * SStruct inner product routine for overlapped grids.
18 *
19 *****************************************************************************/
20
21#include "headers.h"
22
23/*--------------------------------------------------------------------------
24 * hypre_SStructPOverlapInnerProd
25 *--------------------------------------------------------------------------*/
26
27int
28hypre_SStructPOverlapInnerProd( hypre_SStructPVector *px,
29 hypre_SStructPVector *py,
30 double *presult_ptr )
31{
32 int ierr = 0;
33 int nvars = hypre_SStructPVectorNVars(px);
34 double presult;
35 double sresult;
36 int var;
37
38 presult = 0.0;
39 for (var = 0; var < nvars; var++)
40 {
41 sresult = hypre_StructOverlapInnerProd(hypre_SStructPVectorSVector(px, var),
42 hypre_SStructPVectorSVector(py, var));
43 presult += sresult;
44 }
45
46 *presult_ptr = presult;
47
48 return ierr;
49}
50
51/*--------------------------------------------------------------------------
52 * hypre_SStructOverlapInnerProd
53 *--------------------------------------------------------------------------*/
54
55int
56hypre_SStructOverlapInnerProd( hypre_SStructVector *x,
57 hypre_SStructVector *y,
58 double *result_ptr )
59{
60 int ierr = 0;
61 int nparts = hypre_SStructVectorNParts(x);
62 double result;
63 double presult;
64 int part;
65
66 result = 0.0;
67 for (part = 0; part < nparts; part++)
68 {
69 hypre_SStructPOverlapInnerProd(hypre_SStructVectorPVector(x, part),
70 hypre_SStructVectorPVector(y, part), &presult);
71 result += presult;
72 }
73
74 *result_ptr = result;
75
76 return ierr;
77}
Note: See TracBrowser for help on using the repository browser.