OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
IndexedBareField.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
28#include "Utility/IpplInfo.h"
29#include "Utility/PAssert.h"
30
32
33#include <vector>
34#include <iostream>
35
36//----------------------------------------------------------------------
37
38//MWERKS: moved this member template into class definition, in
39//MWERKS: IndexedBareField.h
40// template<class T, unsigned D1>
41// template<unsigned int D2>
42// bool
43// IndexedBareFieldIterator<T,D1>::plugBase(const NDIndex<D2>& i)
44
46
47
48template< class T, unsigned Dim, unsigned Brackets >
49void
51{
52
53
54 // make sure we have the right number of brackets
55 PInsist(Dim == Brackets,
56 "Field not fully indexed in IndexedBareField::write!!");
57 NDIndex<Dim> testIndex;
58 for (unsigned d=0; d<Dim; d++)
59 testIndex[d] = Indexes[d];
60
61 // make a BareField which will store the subset
62 FieldLayout<Dim> subfl(testIndex);
63 BareField<T,Dim> subset(subfl);
64
65 // assign values to this subfield
66 // my_indexed_assign(subset, A, testIndex);
67 assign(subset[testIndex], A[testIndex]);
68
69 // finally, print out the subfield
70 out << subset;
71}
72
73
75
76template<class T, unsigned Dim, unsigned Brackets>
77void
79{
80
81
82 A.getsingle(Indexes, r);
83}
84
86// Return a single value.
87template<class T, unsigned Dim, unsigned Brackets>
88T
90{
91 T r;
92
93
94 getsingle(r);
95 return r;
96}
97
98/***************************************************************************
99 * $RCSfile: IndexedBareField.cpp,v $ $Author: adelmann $
100 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:26 $
101 * IPPL_VERSION_ID: $Id: IndexedBareField.cpp,v 1.1.1.1 2003/01/23 07:40:26 adelmann Exp $
102 ***************************************************************************/
const unsigned Dim
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
#define PInsist(c, m)
Definition: PAssert.h:120
void write(std::ostream &)