OPAL (Object Oriented Parallel Accelerator Library)
2022.1
OPAL
src
ippl
src
Field
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
27
#include "
Field/IndexedBareField.h
"
28
#include "
Utility/IpplInfo.h
"
29
#include "
Utility/PAssert.h
"
30
31
#include "
FieldLayout/FieldLayout.h
"
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
48
template
<
class
T,
unsigned
Dim,
unsigned
Brackets >
49
void
50
IndexedBareField<T,Dim,Brackets>::write
(std::ostream& out)
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
76
template
<
class
T,
unsigned
Dim,
unsigned
Brackets>
77
void
78
IndexedBareField<T,Dim,Brackets>::getsingle
(
T
& r)
79
{
80
81
82
A.getsingle(Indexes, r);
83
}
84
86
// Return a single value.
87
template
<
class
T,
unsigned
Dim,
unsigned
Brackets>
88
T
89
IndexedBareField<T,Dim,Brackets>::get
()
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
***************************************************************************/
Dim
const unsigned Dim
Definition:
P3MPoissonSolver.h:26
FieldLayout.h
assign
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
IndexedBareField.h
PAssert.h
PInsist
#define PInsist(c, m)
Definition:
PAssert.h:120
IpplInfo.h
Attrib::Legacy::Distribution::T
@ T
Definition:
Distribution.h:171
NDIndex
Definition:
NDIndex.h:74
BareField
Definition:
BareField.h:56
IndexedBareField::getsingle
void getsingle(T &)
Definition:
IndexedBareField.hpp:78
IndexedBareField::get
T get()
Definition:
IndexedBareField.hpp:89
IndexedBareField::write
void write(std::ostream &)
Definition:
IndexedBareField.hpp:50
FieldLayout
Definition:
FieldLayout.h:62
Generated on Thu Oct 20 2022 17:40:07 for OPAL (Object Oriented Parallel Accelerator Library) by
1.9.3