Memosa-FVM  0.2
MultiField.cpp
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #ifdef FVM_PARALLEL
6 #include <mpi.h>
7 #endif
8 
9 #include "MultiField.h"
10 #include "OneToOneIndexMap.h"
11 #include "MultiFieldReduction.h"
12 
13 
14 
15 #include <iostream>
16 
18  IContainer(),
19  _length(0),
20  _arrays(),
21  _arrayIndices(),
22  _arrayMap()
23 {
24  logCtor();
25 }
26 
28 {
29  logDtor();
30 }
31 
32 bool
34 {
35  return _arrayMap.find(i) != _arrayMap.end();
36 }
37 
38 const ArrayBase&
40 {
41  ArrayMap::const_iterator pos = _arrayMap.find(i);
42  if (pos != _arrayMap.end())
43  {
44  return *_arrays[pos->second];
45  }
46 
47  ostringstream e;
48  e << "MultiField::operator[] No array found";
49  throw CException(e.str());
50 }
51 
52 ArrayBase&
54 {
55  ArrayMap::const_iterator pos = _arrayMap.find(i);
56  if (pos != _arrayMap.end())
57  {
58  return *_arrays[pos->second];
59  }
60 
61  ostringstream e;
62  e << "MultiField::operator[] No array found";
63  throw CException(e.str());
64 }
65 
66 shared_ptr<ArrayBase>
68 {
69  ArrayMap::const_iterator pos = _arrayMap.find(i);
70  if (pos != _arrayMap.end())
71  {
72  return _arrays[pos->second];
73  }
74 
75  ostringstream e;
76  e << "MultiField::operator[] No array found";
77  throw CException(e.str());
78 }
79 
80 shared_ptr<IContainer>
82 {
83  shared_ptr<MultiField> c(new MultiField());
84  for(int i=0; i<_length; i++)
85  {
86  const ArrayBase& myArray = *_arrays[i];
87  shared_ptr<IContainer> aCloneI(myArray.newClone());
88  shared_ptr<ArrayBase> aClone(dynamic_pointer_cast<ArrayBase>(aCloneI));
89  if (aClone)
90  c->addArray(_arrayIndices[i],aClone);
91  else
92  {
93  throw CException("array clone failed");
94  }
95  }
96  return c;
97 }
98 
99 
100 shared_ptr<IContainer>
102 {
103  shared_ptr<MultiField> c(new MultiField());
104  for(int i=0; i<_length; i++)
105  {
106  const ArrayBase& myArray = *_arrays[i];
107  shared_ptr<ArrayBase> aCopy(dynamic_pointer_cast<ArrayBase>(myArray.newCopy()));
108  c->addArray(_arrayIndices[i],aCopy);
109  }
110  return c;
111 }
112 
113 
114 void
116 {
117  for(int i=0; i<_length; i++)
118  _arrays[i]->zero();
119 
120  foreach(GhostArrayMap::value_type& pos, _ghostArrays)
121  {
122  pos.second->zero();
123  }
124 }
125 
126 void
128 {
129  const MultiField& ofield = dynamic_cast<const MultiField&>(oc);
130  foreach(ArrayMap::value_type& pos, _arrayMap)
131  {
132  ArrayBase& myArray = operator[](pos.second);
133  const ArrayBase& oArray = ofield[pos.first];
134  myArray.copyFrom(oArray);
135  }
136 }
137 
138 MultiField&
140 {
141  for(int i=0; i<_length; i++)
142  {
143  ArrayBase& myArray = *_arrays[i];
144  const ArrayBase& oArray = ofield[_arrayIndices[i]];
145  myArray += oArray;
146  }
147  return *this;
148 }
149 
150 MultiField&
152 {
153  for(int i=0; i<_length; i++)
154  {
155  ArrayBase& myArray = *_arrays[i];
156  const ArrayBase& oArray = ofield[_arrayIndices[i]];
157  myArray -= oArray;
158  }
159  return *this;
160 }
161 
162 MultiField&
164 {
165  for(int i=0; i<_length; i++)
166  {
167  ArrayBase& myArray = *_arrays[i];
168  const ArrayBase& alpha = alphaMF[*_arrayIndices[i].first];
169  const ArrayBase& x = xMF[_arrayIndices[i]];
170 
171  myArray.saxpy(alpha,x);
172  }
173  return *this;
174 }
175 
176 MultiField&
178 {
179  for(int i=0; i<_length; i++)
180  {
181  ArrayBase& myArray = *_arrays[i];
182  const ArrayBase& alpha = alphaMF[*_arrayIndices[i].first];
183  const ArrayBase& x = xMF[_arrayIndices[i]];
184 
185  myArray.msaxpy(alpha,x);
186  }
187  return *this;
188 }
189 
190 
191 MultiField&
193 {
194  for(int i=0; i<_length; i++)
195  {
196  ArrayBase& myArray = *_arrays[i];
197  const ArrayBase& alpha = alphaMF[*_arrayIndices[i].first];
198  myArray /= alpha;
199  }
200  return *this;
201 }
202 
203 MultiField&
205 {
206  for(int i=0; i<_length; i++)
207  {
208  ArrayBase& myArray = *_arrays[i];
209  const ArrayBase& alpha = alphaMF[*_arrayIndices[i].first];
210  myArray *= alpha;
211  }
212  return *this;
213 }
214 
215 shared_ptr<MultiFieldReduction>
217 {
218  shared_ptr<MultiField> c(new MultiField());
219  for(int i=0; i<_length; i++)
220  {
221  const StorageSite& thisSite = *(_arrayIndices[i].second);
222  const ArrayBase& myArray = *_arrays[i];
223  c->addArray(_arrayIndices[i],
224  myArray.getOneNorm(thisSite.getSelfCount()));
225  }
226  shared_ptr<MultiFieldReduction> r(c->reduceSum());
227  return r;
228 }
229 
230 shared_ptr<MultiFieldReduction>
231 MultiField::dotWith(const MultiField& ofield) const
232 {
233  shared_ptr<MultiField> dotpField(new MultiField());
234 
235  for(int i=0; i<_length; i++)
236  {
237  const StorageSite& thisSite = *(_arrayIndices[i].second);
238  const ArrayBase& myArray = *_arrays[i];
239  const ArrayBase& otherArray = ofield[_arrayIndices[i]];
240  dotpField->addArray(_arrayIndices[i],
241  myArray.dotWith(otherArray, thisSite.getSelfCount()));
242  }
243 
244  shared_ptr<MultiFieldReduction> r(dotpField->reduceSum());
245  return r;
246 }
247 
248 shared_ptr<MultiFieldReduction>
250 {
251  shared_ptr<MultiFieldReduction> sum(new MultiFieldReduction());
252 
253  for(int i=0; i<_length; i++)
254  {
255  const ArrayBase& myArray = *_arrays[i];
256  const Field& fIndex = *_arrayIndices[i].first;
257  if (sum->hasArray(fIndex))
258  (*sum)[fIndex] += myArray;
259  else
260  sum->addArray(fIndex,dynamic_pointer_cast<ArrayBase>(myArray.newCopy()));
261  }
262 
263 #ifdef FVM_PARALLEL
264  sum->sync(); //global reduction operation for residual check;
265 #endif
266  return sum;
267 }
268 
269 void
270 MultiField::addArray(const MultiField::ArrayIndex& i, shared_ptr<ArrayBase> a)
271 {
272  _arrayMap[i] = _length;
273  _arrays.push_back(a);
274  _arrayIndices.push_back(i);
275  ++_length;
276 }
277 
278 
279 void
281 {
282  int loc = _arrayMap[aIndex];
283 
284  _arrays.erase(_arrays.begin()+loc);
285  _arrayIndices.erase(_arrayIndices.begin()+loc);
286  _arrayMap.erase(aIndex);
287 
288  for(ArrayMap::iterator pos=_arrayMap.begin();
289  pos!=_arrayMap.end();
290  ++pos)
291  {
292  int currentValue = pos->second;
293  if (currentValue == loc)
294  cerr << "Error in removing array" << endl;
295  else if (currentValue > loc)
296  pos->second = currentValue-1;
297  }
298  _length = _arrays.size();
299 }
300 
301 
302 
303 shared_ptr<MultiField>
305 {
306  shared_ptr<MultiField> r(new MultiField);
307  foreach(ArrayIndex i,indices)
308  {
309  r->addArray(i,getArrayPtr(i));
310  removeArray(i);
311  }
312  return r;
313 }
314 
315 void
317 {
318  foreach(const ArrayMap::value_type& pos, other._arrayMap)
319  {
320  addArray(pos.first, other._arrays[pos.second]);
321  }
322 }
323 
324 void
326 {
327 
328  const ArrayBase& thisArray = *_arrays[_arrayMap[i]];
329  const StorageSite& thisSite = *i.second;
330 
331  const StorageSite::ScatterMap& scatterMap = thisSite.getScatterMap();
332 
333  foreach(const StorageSite::ScatterMap::value_type& mpos, scatterMap)
334  {
335  const StorageSite& oSite = *mpos.first;
336 
337  ArrayIndex oIndex(i.first,&oSite);
338 
339  // skip if the other site is not in this Multifield
340  //if (!hasArray(oIndex))
341  // continue;
342 
343  // arrays are stored with (Sender,receiver) as the key
344  EntryIndex eIndex(i,oIndex);
345  const Array<int>& fromIndices = *(mpos.second);
346  if (_ghostArrays.find(eIndex) == _ghostArrays.end()){
347  _ghostArrays[eIndex] = thisArray.newSizedClone(fromIndices.getLength());
348  }
349 
350  ArrayBase& ghostArray = *_ghostArrays[eIndex];
351  thisArray.scatter(ghostArray,fromIndices);
352  }
353 
354 }
355 
356 
357 void
359 {
360 
361  const ArrayBase& thisArray = *_arrays[_arrayMap[i]];
362  const StorageSite& thisSite = *i.second;
363  if ( thisArray.getLength() == thisSite.getCountLevel1() ){
364  const StorageSite::ScatterMap& scatterMap = thisSite.getScatterMapLevel1();
365 
366  foreach(const StorageSite::ScatterMap::value_type& mpos, scatterMap)
367  {
368  const StorageSite& oSite = *mpos.first;
369 
370  ArrayIndex oIndex(i.first,&oSite);
371  // arrays are stored with (Sender,receiver) as the key
372  EntryIndex eIndex(i,oIndex);
373  const Array<int>& fromIndices = *(mpos.second);
374  if (_ghostArraysLevel1.find(eIndex) == _ghostArraysLevel1.end()){
375  _ghostArraysLevel1[eIndex] = thisArray.newSizedClone(fromIndices.getLength());
376  }
377 
378  ArrayBase& ghostArray = *_ghostArraysLevel1[eIndex];
379  thisArray.scatter(ghostArray,fromIndices);
380  }
381  }
382 
383 }
384 
385 void
387 {
388 
389  ArrayBase& thisArray = *_arrays[_arrayMap[i]];
390  const StorageSite& thisSite = *i.second;
391 
392  const StorageSite::GatherMap& gatherMap = thisSite.getGatherMap();
393 
394  foreach(const StorageSite::GatherMap::value_type& mpos, gatherMap)
395  {
396  const StorageSite& oSite = *mpos.first;
397 
398  ArrayIndex oIndex(i.first,&oSite);
399  EntryIndex eIndex(oIndex,i);
400 
401  const Array<int>& toIndices = *(mpos.second);
402  if (_ghostArrays.find(eIndex) == _ghostArrays.end()){
403  _ghostArrays[eIndex] = thisArray.newSizedClone(toIndices.getLength());
404  }
405  }
406 
407 }
408 
409 void
411 {
412 
413  ArrayBase& thisArray = *_arrays[_arrayMap[i]];
414  const StorageSite& thisSite = *i.second;
415 
416  if ( thisArray.getLength() == thisSite.getCountLevel1() ){
417  const StorageSite::GatherMap& gatherMap = thisSite.getGatherMapLevel1();
418 
419  foreach(const StorageSite::GatherMap::value_type& mpos, gatherMap)
420  {
421  const StorageSite& oSite = *mpos.first;
422 
423  ArrayIndex oIndex(i.first,&oSite);
424  EntryIndex eIndex(oIndex,i);
425 
426  const Array<int>& toIndices = *(mpos.second);
427  if (_ghostArraysLevel1.find(eIndex) == _ghostArraysLevel1.end()){
428  _ghostArraysLevel1[eIndex] = thisArray.newSizedClone(toIndices.getLength());
429  }
430  }
431  }
432 
433 }
434 
435 void
437 {
438 
439  ArrayBase& thisArray = *_arrays[_arrayMap[i]];
440  const StorageSite& thisSite = *i.second;
441 
442  const StorageSite::GatherMap& gatherMap = thisSite.getGatherMap();
443 
444  foreach(const StorageSite::GatherMap::value_type& mpos, gatherMap)
445  {
446  const StorageSite& oSite = *mpos.first;
447  ArrayIndex oIndex(i.first,&oSite);
448 
449  const Array<int>& toIndices = *(mpos.second);
450  EntryIndex eIndex(oIndex,i);
451 
452  if (_ghostArrays.find(eIndex) != _ghostArrays.end()){
453  const ArrayBase& ghostArray = *_ghostArrays[eIndex];
454  thisArray.gather(ghostArray,toIndices);
455  }
456  }
457 
458 }
459 
460 void
462 {
463 
464  ArrayBase& thisArray = *_arrays[_arrayMap[i]];
465  const StorageSite& thisSite = *i.second;
466 
467  if ( thisArray.getLength() == thisSite.getCountLevel1() ){
468  const StorageSite::GatherMap& gatherMap = thisSite.getGatherMapLevel1();
469 
470  foreach(const StorageSite::GatherMap::value_type& mpos, gatherMap)
471  {
472  const StorageSite& oSite = *mpos.first;
473  ArrayIndex oIndex(i.first,&oSite);
474 
475  const Array<int>& toIndices = *(mpos.second);
476  EntryIndex eIndex(oIndex,i);
477 
478  if (_ghostArraysLevel1.find(eIndex) != _ghostArraysLevel1.end()){
479  const ArrayBase& ghostArray = *_ghostArraysLevel1[eIndex];
480  thisArray.gather(ghostArray,toIndices);
481  }
482  }
483  }
484 
485 }
486 
487 
488 void
490 {
491  foreach(ArrayIndex i, _arrayIndices)
492  syncScatter(i);
493 
494  foreach(ArrayIndex i, _arrayIndices)
496 
497 #ifdef FVM_PARALLEL
498  //this communication is based on assumption that MPI communication will be only done inside the same field
499  //SENDING
500  MPI::Request request_send[ get_request_size() ];
501  MPI::Request request_recv[ get_request_size() ];
502  int sendIndx = 0;
503  int recvIndx = 0;
504  foreach ( ArrayIndex i, _arrayIndices ){
505  const StorageSite& thisSite = *i.second;
506  const StorageSite::ScatterMap& scatterMap = thisSite.getScatterMap();
507  foreach(const StorageSite::ScatterMap::value_type& mpos, scatterMap){
508  const StorageSite& oSite = *mpos.first;
509  ArrayIndex oIndex(i.first,&oSite);
510  // arrays are stored with (Sender,receiver) as the key
511  EntryIndex eIndex(i,oIndex);
512  ArrayBase& sendArray = *_ghostArrays[eIndex];
513  int to_where = oSite.getGatherProcID();
514  if ( to_where != -1 ){
515  int mpi_tag = oSite.getTag();
516  request_send[sendIndx++] =
517  MPI::COMM_WORLD.Isend( sendArray.getData(), sendArray.getDataSize(), MPI::BYTE, to_where, mpi_tag );
518  }
519  }
520 
521 
522  //RECIEVING
523  const StorageSite::GatherMap& gatherMap = thisSite.getGatherMap();
524  foreach(const StorageSite::GatherMap::value_type& mpos, gatherMap){
525  const StorageSite& oSite = *mpos.first;
526  ArrayIndex oIndex(i.first,&oSite);
527  EntryIndex eIndex(oIndex,i);
528  ArrayBase& recvArray = *_ghostArrays[eIndex];
529  int from_where = oSite.getGatherProcID();
530  if ( from_where != -1 ){
531  int mpi_tag = oSite.getTag();
532  request_recv[recvIndx++] =
533  MPI::COMM_WORLD.Irecv( recvArray.getData(), recvArray.getDataSize(), MPI::BYTE, from_where, mpi_tag );
534  }
535  }
536 
537  }
538 
539  int count = get_request_size();
540  MPI::Request::Waitall( count, request_recv );
541  MPI::Request::Waitall( count, request_send );
542 
543 #endif
544 
545  foreach(ArrayIndex i, _arrayIndices)
546  syncGather(i);
547 
548  //syncLevel1
549  syncLevel1();
550 
551 }
552 
553 
554 int
556 {
557  int indx = 0;
558  foreach ( ArrayIndex i, _arrayIndices ){
559  const StorageSite& thisSite = *i.second;
560  const StorageSite::ScatterMap& scatterMap = thisSite.getScatterMap();
561  foreach(const StorageSite::ScatterMap::value_type& mpos, scatterMap){
562  const StorageSite& oSite = *mpos.first;
563  ArrayIndex oIndex(i.first,&oSite);
564  // arrays are stored with (Sender,receiver) as the key
565  if ( oSite.getGatherProcID() != -1 )
566  indx++;
567  }
568  }
569  return indx;
570 
571 }
572 
573 
574 void
576 {
577  foreach(ArrayIndex i, _arrayIndices)
579 
580  foreach(ArrayIndex i, _arrayIndices)
582 
583 #ifdef FVM_PARALLEL
584  //this communication is based on assumption that MPI communication will be only done inside the same field
585  //SENDING
586  int countScatter = get_request_size_scatter_level1();
587  int countGather = get_request_size_gather_level1();
588  MPI::Request request_send[ countScatter ];
589  MPI::Request request_recv[ countGather ];
590  int sendIndx = 0;
591  int recvIndx = 0;
592  foreach ( ArrayIndex i, _arrayIndices ){
593  const StorageSite& thisSite = *i.second;
594  const StorageSite::ScatterMap& scatterMap = thisSite.getScatterMapLevel1();
595  const ArrayBase& thisArray = *_arrays[_arrayMap[i]];
596  if ( thisArray.getLength() == thisSite.getCountLevel1() ){
597  foreach(const StorageSite::ScatterMap::value_type& mpos, scatterMap){
598  const StorageSite& oSite = *mpos.first;
599  ArrayIndex oIndex(i.first,&oSite);
600  // arrays are stored with (Sender,receiver) as the key
601  EntryIndex eIndex(i,oIndex);
602  ArrayBase& sendArray = *_ghostArraysLevel1[eIndex];
603  int to_where = oSite.getGatherProcID();
604  if ( to_where != -1 ){
605  int mpi_tag = oSite.getTag();
606  request_send[sendIndx++] =
607  MPI::COMM_WORLD.Isend( sendArray.getData(), sendArray.getDataSize(), MPI::BYTE, to_where, mpi_tag );
608  }
609  }
610 
611  //RECIEVING
612  const StorageSite::GatherMap& gatherMap = thisSite.getGatherMapLevel1();
613  foreach(const StorageSite::GatherMap::value_type& mpos, gatherMap){
614  const StorageSite& oSite = *mpos.first;
615  ArrayIndex oIndex(i.first,&oSite);
616  EntryIndex eIndex(oIndex,i);
617  ArrayBase& recvArray = *_ghostArraysLevel1[eIndex];
618  int from_where = oSite.getGatherProcID();
619  if ( from_where != -1 ){
620  int mpi_tag = oSite.getTag();
621  request_recv[recvIndx++] =
622  MPI::COMM_WORLD.Irecv( recvArray.getData(), recvArray.getDataSize(), MPI::BYTE, from_where, mpi_tag );
623  }
624  }
625 
626  }
627  }
628 
629  MPI::Request::Waitall( countGather, request_recv );
630  MPI::Request::Waitall( countScatter , request_send );
631 
632 #endif
633 
634  foreach(ArrayIndex i, _arrayIndices)
635  syncGatherLevel1(i);
636 
637 }
638 
639 
640 int
642 {
643  int indx = 0;
644  foreach ( ArrayIndex i, _arrayIndices ){
645  const StorageSite& thisSite = *i.second;
646  const StorageSite::ScatterMap& scatterMap = thisSite.getScatterMapLevel1();
647  const ArrayBase& thisArray = *_arrays[_arrayMap[i]];
648  if ( thisArray.getLength() == thisSite.getCountLevel1() ){
649  foreach(const StorageSite::ScatterMap::value_type& mpos, scatterMap){
650  const StorageSite& oSite = *mpos.first;
651  ArrayIndex oIndex(i.first,&oSite);
652  // arrays are stored with (Sender,receiver) as the key
653  if ( oSite.getGatherProcID() != -1 )
654  indx++;
655  }
656  }
657  }
658  return indx;
659 
660 }
661 
662 int
664 {
665  int indx = 0;
666  foreach ( ArrayIndex i, _arrayIndices ){
667  const StorageSite& thisSite = *i.second;
668  const StorageSite::GatherMap& gatherMap = thisSite.getGatherMapLevel1();
669  const ArrayBase& thisArray = *_arrays[_arrayMap[i]];
670  if ( thisArray.getLength() == thisSite.getCountLevel1() ){
671  foreach(const StorageSite::GatherMap::value_type& mpos, gatherMap){
672  const StorageSite& oSite = *mpos.first;
673  ArrayIndex oIndex(i.first,&oSite);
674  // arrays are stored with (Sender,receiver) as the key
675  if ( oSite.getGatherProcID() != -1 )
676  indx++;
677  }
678  }
679  }
680  return indx;
681 
682 }
virtual shared_ptr< IContainer > newCopy() const
Definition: MultiField.cpp:101
virtual int getDataSize() const =0
int get_request_size_scatter_level1()
Definition: MultiField.cpp:641
ArrayMap _arrayMap
Definition: MultiField.h:94
int getSelfCount() const
Definition: StorageSite.h:40
virtual int getLength() const =0
void createSyncGatherArraysLevel1(const ArrayIndex &i)
Definition: MultiField.cpp:410
virtual void scatter(ArrayBase &other_, const ArrayBase &indices, const int offset=0) const =0
ArrayList _arrays
Definition: MultiField.h:92
MultiField & saxpy(const MultiFieldReduction &alphaMF, const MultiField &xMF)
Definition: MultiField.cpp:163
bool hasArray(const ArrayIndex &) const
Definition: MultiField.cpp:33
Definition: Field.h:14
virtual ArrayBase & msaxpy(const ArrayBase &alphabase, const ArrayBase &xbase)=0
const GatherMap & getGatherMapLevel1() const
Definition: StorageSite.h:74
const ScatterMap & getScatterMapLevel1() const
Definition: StorageSite.h:73
void syncGather(const ArrayIndex &i)
Definition: MultiField.cpp:436
virtual shared_ptr< ArrayBase > getOneNorm(const int lengthToUse) const =0
shared_ptr< ArrayBase > getArrayPtr(const ArrayIndex &)
Definition: MultiField.cpp:67
virtual void zero()
Definition: MultiField.cpp:115
#define logCtor()
Definition: RLogInterface.h:26
virtual shared_ptr< ArrayBase > dotWith(const ArrayBase &a, const int lengthToUse) const =0
shared_ptr< MultiField > extract(const ArrayIndexList &indices)
Definition: MultiField.cpp:304
MultiField & msaxpy(const MultiFieldReduction &alphaMF, const MultiField &xMF)
Definition: MultiField.cpp:177
GhostArrayMap _ghostArrays
Definition: MultiField.h:95
void syncScatterLevel1(const ArrayIndex &i)
Definition: MultiField.cpp:358
virtual MultiField & operator-=(const MultiField &o)
Definition: MultiField.cpp:151
virtual MultiField & operator/=(const MultiFieldReduction &alpha)
Definition: MultiField.cpp:192
int getTag() const
Definition: StorageSite.h:84
shared_ptr< MultiFieldReduction > reduceSum() const
Definition: MultiField.cpp:249
void syncGatherLevel1(const ArrayIndex &i)
Definition: MultiField.cpp:461
pair< const Field *, const StorageSite * > ArrayIndex
Definition: MultiField.h:21
pair< ArrayIndex, ArrayIndex > EntryIndex
Definition: MultiField.h:25
int getGatherProcID() const
Definition: StorageSite.h:83
virtual ArrayBase & saxpy(const ArrayBase &alphabase, const ArrayBase &xbase)=0
virtual void copyFrom(const IContainer &oc)
Definition: MultiField.cpp:127
GhostArrayMap _ghostArraysLevel1
Definition: MultiField.h:96
shared_ptr< MultiFieldReduction > getOneNorm() const
Definition: MultiField.cpp:216
void removeArray(const ArrayIndex &aIndex)
Definition: MultiField.cpp:280
int get_request_size()
Definition: MultiField.cpp:555
vector< ArrayIndex > ArrayIndexList
Definition: MultiField.h:24
int _length
Definition: MultiField.h:91
#define logDtor()
Definition: RLogInterface.h:33
int getCountLevel1() const
Definition: StorageSite.h:72
const ScatterMap & getScatterMap() const
Definition: StorageSite.h:58
map< const StorageSite *, shared_ptr< Array< int > > > ScatterMap
Definition: StorageSite.h:23
ArrayIndexList _arrayIndices
Definition: MultiField.h:93
virtual shared_ptr< ArrayBase > newSizedClone(const int size) const =0
virtual MultiField & operator+=(const MultiField &o)
Definition: MultiField.cpp:139
const GatherMap & getGatherMap() const
Definition: StorageSite.h:59
void syncLevel1()
Definition: MultiField.cpp:575
void merge(const MultiField &other)
Definition: MultiField.cpp:316
virtual void * getData() const =0
virtual void gather(const ArrayBase &other_, const ArrayBase &indices, const int offset=0)=0
virtual ~MultiField()
Definition: MultiField.cpp:27
const ArrayBase & operator[](const ArrayIndex &) const
Definition: MultiField.cpp:39
int get_request_size_gather_level1()
Definition: MultiField.cpp:663
map< const StorageSite *, shared_ptr< Array< int > > > GatherMap
Definition: StorageSite.h:24
void addArray(const ArrayIndex &aIndex, shared_ptr< ArrayBase > a)
Definition: MultiField.cpp:270
void syncScatter(const ArrayIndex &i)
Definition: MultiField.cpp:325
virtual void copyFrom(const IContainer &a)=0
void createSyncGatherArrays(const ArrayIndex &i)
Definition: MultiField.cpp:386
shared_ptr< MultiFieldReduction > dotWith(const MultiField &ofield) const
Definition: MultiField.cpp:231
void sync()
Definition: MultiField.cpp:489
virtual MultiField & operator*=(const MultiFieldReduction &alpha)
Definition: MultiField.cpp:204
virtual shared_ptr< IContainer > newClone() const
Definition: MultiField.cpp:81
int getLength() const
Definition: Array.h:87
virtual shared_ptr< IContainer > newClone() const =0
virtual shared_ptr< IContainer > newCopy() const =0