| 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 scale routine
|
|---|
| 18 | *
|
|---|
| 19 | *****************************************************************************/
|
|---|
| 20 |
|
|---|
| 21 | #include "headers.h"
|
|---|
| 22 |
|
|---|
| 23 | /*--------------------------------------------------------------------------
|
|---|
| 24 | * hypre_SStructPScale
|
|---|
| 25 | *--------------------------------------------------------------------------*/
|
|---|
| 26 |
|
|---|
| 27 | int
|
|---|
| 28 | hypre_SStructPScale( double alpha,
|
|---|
| 29 | hypre_SStructPVector *py )
|
|---|
| 30 | {
|
|---|
| 31 | int ierr = 0;
|
|---|
| 32 | int nvars = hypre_SStructPVectorNVars(py);
|
|---|
| 33 | int var;
|
|---|
| 34 |
|
|---|
| 35 | for (var = 0; var < nvars; var++)
|
|---|
| 36 | {
|
|---|
| 37 | hypre_StructScale(alpha, hypre_SStructPVectorSVector(py, var));
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | return ierr;
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | /*--------------------------------------------------------------------------
|
|---|
| 44 | * hypre_SStructScale
|
|---|
| 45 | *--------------------------------------------------------------------------*/
|
|---|
| 46 |
|
|---|
| 47 | int
|
|---|
| 48 | hypre_SStructScale( double alpha,
|
|---|
| 49 | hypre_SStructVector *y )
|
|---|
| 50 | {
|
|---|
| 51 | int ierr = 0;
|
|---|
| 52 | int nparts = hypre_SStructVectorNParts(y);
|
|---|
| 53 | int part;
|
|---|
| 54 | int y_object_type= hypre_SStructVectorObjectType(y);
|
|---|
| 55 |
|
|---|
| 56 | if (y_object_type == HYPRE_SSTRUCT)
|
|---|
| 57 | {
|
|---|
| 58 | for (part = 0; part < nparts; part++)
|
|---|
| 59 | {
|
|---|
| 60 | hypre_SStructPScale(alpha, hypre_SStructVectorPVector(y, part));
|
|---|
| 61 | }
|
|---|
| 62 | }
|
|---|
| 63 |
|
|---|
| 64 | else if (y_object_type == HYPRE_PARCSR)
|
|---|
| 65 | {
|
|---|
| 66 | hypre_ParVector *y_par;
|
|---|
| 67 |
|
|---|
| 68 | hypre_SStructVectorConvert(y, &y_par);
|
|---|
| 69 | hypre_ParVectorScale(alpha, y_par);
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | return ierr;
|
|---|
| 73 | }
|
|---|