source: CIVL/examples/mpi-omp/AMG2013/struct_mv/struct_scale.c@ 7d77e64

main test-branch
Last change on this file since 7d77e64 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.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 * Structured scale routine
17 *
18 *****************************************************************************/
19
20#include "headers.h"
21
22/*--------------------------------------------------------------------------
23 * hypre_StructScale
24 *--------------------------------------------------------------------------*/
25
26int
27hypre_StructScale( double alpha,
28 hypre_StructVector *y )
29{
30 int ierr = 0;
31
32 hypre_Box *y_data_box;
33
34 int yi;
35 double *yp;
36
37 hypre_BoxArray *boxes;
38 hypre_Box *box;
39 hypre_Index loop_size;
40 hypre_IndexRef start;
41 hypre_Index unit_stride;
42
43 int i;
44 int loopi, loopj, loopk;
45
46 hypre_SetIndex(unit_stride, 1, 1, 1);
47
48 boxes = hypre_StructGridBoxes(hypre_StructVectorGrid(y));
49 hypre_ForBoxI(i, boxes)
50 {
51 box = hypre_BoxArrayBox(boxes, i);
52 start = hypre_BoxIMin(box);
53
54 y_data_box = hypre_BoxArrayBox(hypre_StructVectorDataSpace(y), i);
55 yp = hypre_StructVectorBoxData(y, i);
56
57 hypre_BoxGetSize(box, loop_size);
58
59 hypre_BoxLoop1Begin(loop_size,
60 y_data_box, start, unit_stride, yi);
61
62 hypre_BoxLoop1For(loopi, loopj, loopk, yi)
63 {
64 yp[yi] *= alpha;
65 }
66 hypre_BoxLoop1End(yi);
67 }
68
69 return ierr;
70}
Note: See TracBrowser for help on using the repository browser.