source: CIVL/examples/mpi-omp/AMG2013/sstruct_mv/sstruct_copy.c@ 397ae5f

main test-branch
Last change on this file since 397ae5f 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 * SStruct copy routine
18 *
19 *****************************************************************************/
20
21#include "headers.h"
22
23/*--------------------------------------------------------------------------
24 * hypre_SStructPCopy
25 *--------------------------------------------------------------------------*/
26
27int
28hypre_SStructPCopy( hypre_SStructPVector *px,
29 hypre_SStructPVector *py )
30{
31 int ierr = 0;
32 int nvars = hypre_SStructPVectorNVars(px);
33 int var;
34
35 for (var = 0; var < nvars; var++)
36 {
37 hypre_StructCopy(hypre_SStructPVectorSVector(px, var),
38 hypre_SStructPVectorSVector(py, var));
39 }
40
41 return ierr;
42}
43
44/*--------------------------------------------------------------------------
45 * hypre_SStructPartialPCopy: Copy the components on only a subset of the
46 * pgrid. For each box of an sgrid, an array of subboxes are copied.
47 *--------------------------------------------------------------------------*/
48
49int
50hypre_SStructPartialPCopy( hypre_SStructPVector *px,
51 hypre_SStructPVector *py,
52 hypre_BoxArrayArray **array_boxes )
53{
54 int ierr = 0;
55 int nvars = hypre_SStructPVectorNVars(px);
56 hypre_BoxArrayArray *boxes;
57 int var;
58
59 for (var = 0; var < nvars; var++)
60 {
61 boxes= array_boxes[var];
62 hypre_StructPartialCopy(hypre_SStructPVectorSVector(px, var),
63 hypre_SStructPVectorSVector(py, var),
64 boxes);
65 }
66
67 return ierr;
68}
69
70/*--------------------------------------------------------------------------
71 * hypre_SStructCopy
72 *--------------------------------------------------------------------------*/
73
74int
75hypre_SStructCopy( hypre_SStructVector *x,
76 hypre_SStructVector *y )
77{
78 int ierr = 0;
79
80 int nparts = hypre_SStructVectorNParts(x);
81 int part;
82
83 int x_object_type= hypre_SStructVectorObjectType(x);
84 int y_object_type= hypre_SStructVectorObjectType(y);
85
86 if (x_object_type != y_object_type)
87 {
88 printf("vector object types different- cannot perform SStructCopy\n");
89 return ierr;
90 }
91
92
93 if (x_object_type == HYPRE_SSTRUCT)
94 {
95 for (part = 0; part < nparts; part++)
96 {
97 hypre_SStructPCopy(hypre_SStructVectorPVector(x, part),
98 hypre_SStructVectorPVector(y, part));
99 }
100 }
101
102 else if (x_object_type == HYPRE_PARCSR)
103 {
104 hypre_ParVector *x_par;
105 hypre_ParVector *y_par;
106
107 hypre_SStructVectorConvert(x, &x_par);
108 hypre_SStructVectorConvert(y, &y_par);
109
110 hypre_ParVectorCopy(x_par, y_par);
111 }
112
113 return ierr;
114}
Note: See TracBrowser for help on using the repository browser.