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
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "IpplPaws/PawsFieldData.h"
00037
00038
00039
00040
00041
00042 template <class T, unsigned Dim, class M, class C>
00043 PawsFieldData<T,Dim,M,C>::PawsFieldData(const char* name, int io_mode,
00044 int sync_mode, int order_mode, PawsApplication& app)
00045 : PawsGeneralData<Repr,Desc>()
00046 {
00047 initialize(name, io_mode, sync_mode, order_mode, app);
00048 }
00049
00050
00051
00052
00053
00054
00055 template <class T, unsigned Dim, class M, class C>
00056 PawsFieldData<T,Dim,M,C>::PawsFieldData(const char* name, Field_t* ptr,
00057 int io_mode, int sync_mode, int order_mode,
00058 PawsApplication& app)
00059 : PawsGeneralData<Repr,Desc>()
00060 {
00061 initialize(name, ptr,
00062 io_mode, sync_mode, order_mode, app);
00063 }
00064
00065
00066
00067
00068
00069
00070 template <class T, unsigned Dim, class M, class C>
00071 void
00072 PawsFieldData<T,Dim,M,C>::initialize(const char* name, int io_mode,
00073 int sync_mode, int order_mode, PawsApplication& app)
00074 {
00075 static char* id = "PawsFieldData::initialize(DYNAMIC)";
00076 PDebug(PAWSD_ARR, ("%s entering\n", id));
00077
00078
00079
00080 PAssert(data_app == PAWS_NULL);
00081 int valid = true;
00082 if ((io_mode != PAWS_IN) && (io_mode != PAWS_OUT) &&
00083 (io_mode != PAWS_INOUT)) {
00084 PDebug(PAWSD_ERR, ("ERROR: I/O mode flag is not valid\n"));
00085 valid = false;
00086 }
00087 if ((sync_mode != PAWS_SYNC) && (sync_mode != PAWS_ASYNC) &&
00088 (sync_mode != PAWS_PSYNC)) {
00089 PDebug(PAWSD_ERR, ("ERROR: Synchronization mode flag is not valid\n"));
00090 valid = false;
00091 }
00092 if ((order_mode != PAWS_ROW) && (order_mode != PAWS_COLUMN)) {
00093 PDebug(PAWSD_ERR, ("ERROR: Order mode flag is not valid\n"));
00094 valid = false;
00095 }
00096 if (valid == false) {
00097 PInsist(false, "ERROR: Bad arguments for constructing PawsArray");
00098 }
00099
00100
00101 data_name = name;
00102 data_app = &app;
00103
00104
00105
00106 data_rep = new Repr();
00107 data_desc = new Desc(*data_rep);
00108 paws_data = new PawsData_t(*data_rep, *data_desc, name, io_mode, sync_mode,
00109 PAWS_PARALLEL, dataType(), "ARRAY( Field<T,Dim,M,C> )",
00110 "IPPL", app);
00111
00112
00113 paws_data->updateFlag(PAWS_OFF);
00114
00115
00116 app.addDomainData(this);
00117 }
00118
00119
00120
00121
00122
00123
00124 template <class T, unsigned Dim, class M, class C>
00125 void
00126 PawsFieldData<T,Dim,M,C>::initialize(const char* name, Field_t* ptr,
00127 int io_mode, int sync_mode, int order_mode,
00128 PawsApplication& app)
00129 {
00130 static char* id = "PawsFieldData::initialize(SIZE)";
00131 PDebug(PAWSD_ARR, ("%s entering\n", id));
00132
00133
00134
00135 PAssert(data_app == PAWS_NULL);
00136 int valid = true;
00137 if ((io_mode != PAWS_IN) && (io_mode != PAWS_OUT) &&
00138 (io_mode != PAWS_INOUT)) {
00139 PDebug(PAWSD_ERR, ("ERROR: I/O mode flag is not valid\n"));
00140 valid = false;
00141 }
00142 if ((sync_mode != PAWS_SYNC) && (sync_mode != PAWS_ASYNC) &&
00143 (sync_mode != PAWS_PSYNC)) {
00144 PDebug(PAWSD_ERR, ("ERROR: Synchronization mode flag is not valid\n"));
00145 valid = false;
00146 }
00147 if ((order_mode != PAWS_ROW) && (order_mode != PAWS_COLUMN)) {
00148 PDebug(PAWSD_ERR, ("ERROR: Order mode flag is not valid\n"));
00149 valid = false;
00150 }
00151 if (valid == false) {
00152 PInsist(false, "ERROR: Bad arguments for constructing PawsArray");
00153 }
00154
00155
00156 data_name = name;
00157 data_app = &app;
00158
00159
00160
00161 data_rep = new Repr(ptr->getLayout());
00162 data_desc = new Desc(*data_rep, ptr);
00163 PString size_str, desc;
00164 data_rep->sizeString(size_str);
00165 desc = "ARRAY(size=" + size_str + ")";
00166 paws_data = new PawsData_t
00167 (*data_rep, *data_desc, name, io_mode, sync_mode,
00168 PAWS_PARALLEL, dataType(), desc.c_str(), "PAWS", app);
00169
00170
00171 paws_data->updateFlag(PAWS_ON);
00172
00173
00174 app.addDomainData(this);
00175
00176 PDebug(PAWSD_ARR, ("%s exiting\n", id));
00177 }
00178
00179
00180
00181
00182
00183 template <class T, unsigned Dim, class M, class C>
00184 void
00185 PawsFieldData<T,Dim,M,C>::update(Field_t* ptr)
00186 {
00187 static char* id = "PawsFieldData::update(USERDIST)";
00188 PAssert(data_app != PAWS_NULL);
00189
00190
00191
00192
00193
00194 data_rep->update(ptr->getLayout());
00195 data_desc->update(*data_rep, ptr);
00196 paws_data->updateFlag(PAWS_ON);
00197
00198
00199 paws_data->updateLocalData();
00200
00201
00202 data_app->updateData(paws_data);
00203 PDebug(PAWSD_ARR, ("%s exiting\n", id));
00204 }
00205
00206
00207
00208
00209
00210
00211
00212 template <class T, unsigned Dim, class M, class C>
00213 void
00214 PawsFieldData<T,Dim,M,C>::resize(Field_t* ptr)
00215 {
00216 static char* id = "PawsFieldData::resize(USERDIST)";
00217 PAssert(data_app != PAWS_NULL);
00218
00219
00220
00221
00222
00223 data_rep->update(ptr->getLayout());
00224 data_desc->update(*data_rep, ptr);
00225 paws_data->updateFlag(PAWS_ON);
00226
00227
00228 paws_data->scheduleDoneOff();
00229
00230
00231 data_app->updateData(paws_data);
00232 PDebug(PAWSD_ARR, ("%s exiting\n", id));
00233 }
00234
00235
00236
00237
00238
00239 template <class T, unsigned Dim, class M, class C>
00240 T
00241 sum(const PawsFieldData<T,Dim,M,C>& data)
00242 {
00243 return data.sum();
00244 }
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259