00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "Field/IndexedBareField.h"
00028 #include "Utility/IpplInfo.h"
00029 #include "Utility/PAssert.h"
00030 #include "Profile/Profiler.h"
00031 #include "FieldLayout/FieldLayout.h"
00032
00033 #ifdef IPPL_STDSTL
00034 #include <vector>
00035 using std::vector;
00036 #else
00037 #include <vector.h>
00038 #endif
00039
00040 #ifdef IPPL_USE_STANDARD_HEADERS
00041 #include <iostream>
00042 using namespace std;
00043 #else
00044 #include <iostream.h>
00045 #endif
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00057
00058
00059 template< class T, unsigned Dim, unsigned Brackets >
00060 void
00061 IndexedBareField<T,Dim,Brackets>::write(ostream& out)
00062 {
00063 TAU_TYPE_STRING(taustr, CT(*this) + " void (ostream )" );
00064 TAU_PROFILE("IndexedBareField::write()", taustr, TAU_FIELD | TAU_IO);
00065
00066 PInsist(Dim == Brackets,
00067 "Field not fully indexed in IndexedBareField::write!!");
00068 NDIndex<Dim> testIndex;
00069 for (unsigned d=0; d<Dim; d++)
00070 testIndex[d] = Indexes[d];
00071
00072
00073 FieldLayout<Dim> subfl(testIndex);
00074 BareField<T,Dim> subset(subfl);
00075
00076
00077
00078 assign(subset[testIndex], A[testIndex]);
00079
00080
00081 out << subset;
00082 }
00083
00084
00086
00087 template<class T, unsigned Dim, unsigned Brackets>
00088 void
00089 IndexedBareField<T,Dim,Brackets>::getsingle(T& r)
00090 {
00091 TAU_TYPE_STRING(taustr, CT(*this) + " void (" + CT(r) + " )" );
00092 TAU_PROFILE("IndexedBareField::getsingle()", taustr, TAU_FIELD);
00093 A.getsingle(Indexes, r);
00094 }
00095
00097
00098 template<class T, unsigned Dim, unsigned Brackets>
00099 T
00100 IndexedBareField<T,Dim,Brackets>::get()
00101 {
00102 T r;
00103 TAU_TYPE_STRING(taustr, CT(*this) + " " + CT(r) + " ()" );
00104 TAU_PROFILE("IndexedBareField::get()", taustr, TAU_FIELD);
00105 getsingle(r);
00106 return r;
00107 }
00108
00109
00110
00111
00112
00113