OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
GuardCellSizes.hpp
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  * This program was prepared by PSI.
7  * All rights in the program are reserved by PSI.
8  * Neither PSI nor the author(s)
9  * makes any warranty, express or implied, or assumes any liability or
10  * responsibility for the use of this software
11  *
12  * Visit www.amas.web.psi for more details
13  *
14  ***************************************************************************/
15 
16 // -*- C++ -*-
17 /***************************************************************************
18  *
19  * The IPPL Framework
20  *
21  *
22  * Visit http://people.web.psi.ch/adelmann/ for more details
23  *
24  ***************************************************************************/
25 
26 // include files
27 #include "Field/GuardCellSizes.h"
28 
29 
30 template<unsigned Dim>
32 {
33 
34 
35  for (unsigned d=0; d<Dim; ++d)
36  Left[d] = Right[d] = s;
37 }
38 
39 template<unsigned Dim>
41 {
42 
43 
44  for (unsigned d=0; d<Dim; ++d)
45  Left[d] = Right[d] = s[d];
46 }
47 
48 template<unsigned Dim>
49 GuardCellSizes<Dim>::GuardCellSizes(unsigned l, unsigned r)
50 {
51 
52 
53  for (unsigned d=0; d<Dim; ++d) {
54  Left[d] = l;
55  Right[d] = r;
56  }
57 }
58 
59 template<unsigned Dim>
60 GuardCellSizes<Dim>::GuardCellSizes(unsigned *l, unsigned *r)
61 {
62 
63 
64  for (unsigned d=0; d<Dim; ++d) {
65  Left[d] = l[d];
66  Right[d] = r[d];
67  }
68 }
69 
70 template<unsigned Dim>
72 {
73 
74 
75  for (unsigned d=0; d<Dim; ++d)
76  Left[d] = s;
77 }
78 
79 template<unsigned Dim>
81 {
82 
83 
84  for (unsigned d=0; d<Dim; ++d)
85  Left[d] = s[d];
86 }
87 
88 template<unsigned Dim>
89 void GuardCellSizes<Dim>::set_Left(unsigned d, unsigned *s)
90 {
91 
92 
93  Left[d] = s[d];
94 }
95 
96 template<unsigned Dim>
98 {
99 
100 
101  for (unsigned d=0; d<Dim; ++d)
102  Right[d] = s;
103 }
104 
105 template<unsigned Dim>
107 {
108 
109 
110  for (unsigned d=0; d<Dim; ++d)
111  Right[d] = s[d];
112 }
113 
114 template<unsigned Dim>
115 void GuardCellSizes<Dim>::set_Right(unsigned d, unsigned *s)
116 {
117 
118 
119  Right[d] = s[d];
120 }
121 
123 
124 template<unsigned Dim>
125 std::ostream&
126 operator<<(std::ostream& out, const GuardCellSizes<Dim>& gc)
127 {
128 
129 
130  for (unsigned d=0; d<Dim; ++d)
131  out << "[" << gc.left(d) << "," << gc.right(d) << "]";
132  return out;
133 }
134 
135 /***************************************************************************
136  * $RCSfile: GuardCellSizes.cpp,v $ $Author: adelmann $
137  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
138  * IPPL_VERSION_ID: $Id: GuardCellSizes.cpp,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
139  ***************************************************************************/
void set_Right(unsigned s)
void set_Left(unsigned s)
const unsigned Dim