OPAL (Object Oriented Parallel Accelerator Library)
2024.1
OPAL
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
***************************************************************************/
PAssert.h
FieldLayout
Definition:
BareField.h:46
IndexedBareField::getsingle
void getsingle(T &)
Definition:
IndexedBareField.hpp:78
assign
void assign(const BareField< T, Dim > &a, RHS b, OP op, ExprTag< true >)
IndexedBareField::write
void write(std::ostream &)
Definition:
IndexedBareField.hpp:50
NDIndex
Definition:
FieldDataSource.h:40
IndexedBareField::get
T get()
Definition:
IndexedBareField.hpp:89
Attrib::Legacy::Distribution::T
Definition:
Distribution.h:171
BareField::getsingle
void getsingle(const NDIndex< Dim > &, T &) const
Definition:
BareField.hpp:1201
Dim
const unsigned Dim
Definition:
P3MPoissonSolver.h:26
PInsist
#define PInsist(c, m)
Definition:
PAssert.h:120
IndexedBareField.h
BareField
Definition:
FFT.h:26
IpplInfo.h
FieldLayout.h
Generated on Tue Jul 2 2024 15:05:13 for OPAL (Object Oriented Parallel Accelerator Library) by
1.8.5