dune-fem  2.8-git
datacollector.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_DATACOLLECTOR_HH
2 #define DUNE_FEM_DATACOLLECTOR_HH
3 
4 //-System includes
5 #include <cassert>
6 #include <cstdlib>
7 
8 #include <vector>
9 #include <utility>
10 #include <iostream>
11 
12 //-Dune includes
13 #include <dune/common/dynvector.hh>
14 #include <dune/common/version.hh>
15 
16 //- local includes
19 
20 namespace Dune
21 {
22 
23  namespace Fem
24  {
25 
39  // external forward declerations
40  // -----------------------------
41 
42  template<class>
43  struct DiscreteFunctionTraits;
44 
45  template <class GridImp> class DofManager;
46 
47  template <class LocalOp, class ParamType> class LocalInlinePlus;
48 
49 
50  // define read or write stream
52  {
54  };
55 
56  template <class A, class B >
58  : public LocalInlinePlus< CombinedLocalDataCollect< A, B >, typename A::Traits::ParamType >
59  {
60  protected:
61  const A& a_;
62  const B& b_;
63  public:
64  CombinedLocalDataCollect( const A& a, const B& b ) : a_( a ), b_( b ) {}
65 
66  template <class Arg>
67  void apply(Arg & arg) const
68  {
69  a_.apply( arg );
70  b_.apply( arg );
71  }
72 
73  template <class Arg1, class Arg2>
74  void apply(Arg1 & arg1, Arg2 & arg2) const
75  {
76  a_.apply( arg1, arg2 );
77  b_.apply( arg1, arg2 );
78  }
79  };
80 
81  template <class ParamT>
83  {
84  public:
86  struct Traits
87  {
88  typedef ParamT ParamType;
89  };
90 
91  template <class PT>
93  {
94  typedef PT ObjectStreamType ;
95  };
96 
97  template < class T1 , class T2 >
98  struct ObjectStreamExtractor< std::pair< T1* , const T2* > >
99  {
100  typedef T1 ObjectStreamType ;
101  };
102 
104 
105  protected:
106  typedef ParamT ParamType;
107  typedef void FuncType(MyType &, ParamType & p);
108  typedef typename std::pair < MyType * , FuncType * > PairType;
109  typedef typename std::vector < PairType > ListType;
110 
111  template <class OpType>
113  {
115  static void applyWrapper(MyType & m, ParamType & p )
116  {
117  static_cast<OpType &> (m).apply(p);
118  }
119 
122  static void addToList (ListType & vec , const OpType & op )
123  {
124  PairType p( const_cast<OpType *> (&op) , applyWrapper);
125  vec.push_back(p);
126  }
127  };
128 
129  // copy list of op to this class
130  static void copyList (ListType & vec, const MyType & op )
131  {
132  const ListType & ve = op.vec_;
133  if(ve.size() > 0)
134  {
135  ListType tmp ( vec );
136  vec.resize( vec.size() + ve.size() );
137 
138  // copy list to new vector
139  for(unsigned int i=0; i<tmp.size(); i++)
140  vec[i] = tmp[i];
141  for(unsigned int i=tmp.size(); i<vec.size(); i++)
142  vec[i] = ve[i-tmp.size()];
143  }
144  }
145 
146  public:
147  LocalInterface () : vec_ (0) {}
148 
149  template <class OpType>
150  LocalInterface (const OpType & op)
151  {
153  }
154 
155  LocalInterface (const MyType & op)
156  {
157  copyList(vec_,op);
158  }
159 
160  virtual ~LocalInterface() {};
161 
163  void apply ( ParamType & p ) const
164  {
165  const size_t size = vec_.size();
166  for(size_t i=0; i<size; ++i)
167  {
168  assert( vec_[i].second );
169  assert( vec_[i].first );
170  // vec_[i].second contains the pointer to the function that makes the
171  // correct cast to the real type of vec_[i].first
172  (*vec_[i].second)( *(vec_[i].first) , p );
173  }
174  }
175 
176  template <class OpType>
177  MyType & operator + (const OpType & op)
178  {
180  return *this;
181  }
182 
183  MyType & operator + (const MyType & op)
184  {
185  copyList(vec_,op);
186  return *this;
187  }
188 
189  template <class OpType>
190  MyType & operator += (const OpType & op)
191  {
193  return *this;
194  }
195 
196  MyType & operator += (const MyType & op)
197  {
198  copyList(vec_,op);
199  return *this;
200  }
201 
202  template <class OpType>
203  void remove(const OpType & op)
204  {
205  typedef typename ListType :: iterator iterator;
206  iterator end = vec_.end();
207  for(iterator it = vec_.begin(); it != end; ++it)
208  {
209  if( &op == (*it).first )
210  {
211  vec_.erase( it );
212  return ;
213  }
214  }
215  }
216 
217  template <class OpType>
218  MyType & operator = (const OpType & op)
219  {
221  return *this;
222  }
223 
224  bool empty () const { return (vec_.size() == 0); }
225 
226  private:
227  mutable ListType vec_;
228  };
229 
230  template <class LocalOp, class ParamT>
231  class LocalInlinePlus : public LocalInterface<ParamT>
232  {
233  public:
236  struct Traits
237  {
238  typedef ParamT ParamType;
240  };
241 
242  template <class B>
244  {
245  std::cout << "operator + of LocalInlinePlus \n";
246  typedef CombinedLocalDataCollect<LocalOp,B> CombinedType;
247  CombinedType * combo = new CombinedType ( asImp() , b );
248  this->saveObjPointer( combo );
249  return *combo;
250  }
251  LocalOp & asImp() { return static_cast<LocalOp &> (*this); }
252  };
253 
260  template <class GridType, class ObjectStreamImp = DummyObjectStream >
262  {
263  public:
264  typedef ObjectStreamImp ObjectStreamType;
265 
266 
267  typedef typename GridType::template Codim<0>::Entity EntityType;
268 
270  typedef std::pair < ObjectStreamType * , const EntityType * > DataCollectorParamType;
271 
272  public:
274 
275  struct Traits
276  {
278  };
279 
281  DataCollectorInterface () : dc_ (0) {}
282 
285 
289  virtual void apply (ObjectStreamType &str, const EntityType & entity ) const
290  {
291  //std::cout << "apply on interface class \n";
292  if(dc_) (*dc_).apply(str, entity );
293  else
294  {
295  std::cerr << "WARNING: apply: did nothing! \n";
296  }
297  };
298 
299  virtual const LocalInterfaceType & getLocalInterfaceOp () const
300  {
301  if(dc_)
302  return dc_->getLocalInterfaceOp ();
303  else
304  {
305  std::cerr << "No LocalInterfaceOperator \n";
306  assert(false);
307  return *(new LocalInterfaceType());
308  }
309  };
310 
312  {
313  if(dc_)
314  return dc_->getLocalInterfaceOp ();
315  else
316  {
317  std::cerr << "No LocalInterfaceOperator \n";
318  assert(false);
319  return *(new LocalInterfaceType());
320  }
321  };
322 
324  template <class OpType>
325  MyType & operator += (const OpType & dc)
326  {
327  if(dc_)
328  {
329  //std::cout << "Operator += with OpType \n";
330  dc_ = dcConv_;
331  MyType * tmp = const_cast<OpType &> (dc).convert();
332  dc_ = &(*dc_).operator += (*tmp);
333  }
334  else
335  {
336  dc_ = const_cast<OpType *> (&dc);
337  dcConv_ = const_cast<OpType &> (dc).convert();
338  }
339  return (*this);
340  }
341 
343  virtual MyType & operator += (const MyType & dc)
344  {
345  if(dc_)
346  {
347  //std::cout << "Operator += with MyType \n";
348  dc_ = dcConv_;
349  dc_ = &(*dc_).operator += (dc);
350  }
351  else
352  {
353  dc_ = const_cast<MyType *> (&dc);
354  dcConv_ = const_cast<MyType *> (&dc);
355  }
356  return (*this);
357  }
358 
360  template <class OpType>
361  MyType & operator = (const OpType & dc)
362  {
363  //std::cout << "Store operator \n";
364  dc_ = const_cast<OpType *> (&dc);
365  dcConv_ = const_cast<OpType &> (dc).convert();
366  return (*this);
367  }
368 
370  MyType & operator = (const MyType & dc)
371  {
372  //std::cout << "No need to do this, use += \n";
373  dc_ = const_cast<MyType *> (dc.dc_);
374  dcConv_ = const_cast<MyType *> (dc.dcConv_);
375  return (*this);
376  }
377 
379  virtual void clear()
380  {
381  dc_ = 0;
382  dcConv_ = 0;
383  }
384  private:
385  MyType *dc_;
386  MyType *dcConv_;
387  };
388 
389 
391  template <class GridType>
393  {
395  public:
396 
397  typedef std::pair < int * , int * > DataCollectorParamType;
402  void apply (int , int ) const
403  {
404  std::cerr << "WARNING: apply: did nothing! \n";
405  };
406 
408  template <class OpType>
409  MyType & operator += (const OpType & dc)
410  {
411  return (*this);
412  }
413 
415  template <class OpType>
416  MyType & operator = (const OpType & dc)
417  {
418  return (*this);
419  }
420  };
421 
422 
431  template <class GridType,
432  class LocalDataCollectImp >
434  : public DataCollectorInterface< GridType, typename LocalDataCollectImp :: ObjectStreamType >
435  , public ObjPointerStorage
436  {
437  public:
438  typedef typename LocalDataCollectImp :: ObjectStreamType ObjectStreamType;
439  typedef typename GridType::template Codim<0>::Entity EntityType;
440 
441  protected:
444 
447 
448  typedef typename std::pair < ObjectStreamType * , const EntityType * > ParamType;
450 
451  friend class DataCollectorInterface<GridType, ObjectStreamType>;
453 
454  public:
456  DataCollector (GridType & grid,
457  DofManagerType & dm,
458  LocalDataCollectImp & ldc,
459  const ReadWriteType rwType,
460  int numChildren = 8)
461  : grid_(grid) , dm_ ( dm ), ldc_ (ldc)
462  , rwType_( rwType )
463  , numChildren_(numChildren)
464  {}
465 
467  virtual ~DataCollector () {}
468 
470  template <class LocalDataCollectType>
471  DataCollector<GridType,
474  {
477 
478  COType *newLDCOp = new COType ( ldc_ , const_cast<CopyType &> (op).getLocalOp() );
479  typedef DataCollector <GridType, COType> OPType;
480 
481  OPType *dcOp = new OPType ( grid_ , dm_ , *newLDCOp, rwType_ );
482 
483  // memorize this new generated object because is represents this
484  // operator and is deleted if this operator is deleted
485  saveObjPointer( dcOp , newLDCOp );
486 
487  return *dcOp;
488  }
489 
491  template <class LocalDataCollectType>
494  {
495  typedef LocalInterface<ParamType> COType;
496 
497  COType *newLDCOp = new COType ( ldc_ + op.getLocalOp() );
498  typedef DataCollector <GridType, COType> OPType;
499 
500  OPType *dcOp = new OPType ( grid_ , dm_ , *newLDCOp, rwType_ );
501 
502  // memorize this new generated object because is represents this
503  // operator and is deleted if this operator is deleted
504  saveObjPointer( dcOp , newLDCOp );
505 
506  return *dcOp;
507  }
508 
512  {
513  //std::cout << "operator += with Interface Type \n";
514  typedef LocalInterface<ParamType> COType;
515 
516  COType *newLDCOp = new COType ( ldc_ + op.getLocalInterfaceOp() );
517  typedef DataCollector<GridType, COType> OPType;
518 
519  OPType *dcOp = new OPType ( grid_ , dm_ , *newLDCOp, rwType_ );
520 
521  // memorize this new generated object because is represents this
522  // operator and is deleted if this operator is deleted
523  saveObjPointer( dcOp , newLDCOp );
524 
525  return *dcOp;
526  }
527 
529  const LocalDataCollectImp & getLocalOp () const
530  {
531  return ldc_;
532  }
533 
535  LocalDataCollectImp & getLocalOp ()
536  {
537  return ldc_;
538  }
539 
541  {
542  //std::cout << "getLocalInter \n";
543  return ldc_;
544  }
545 
547  {
548  //std::cout << "getLocalInter \n";
549  return ldc_;
550  }
551 
553  bool writeData() const { return rwType_ == DataCollectorTraits :: writeData ; }
554 
557  void apply ( ObjectStreamType & str, const EntityType & entity ) const
558  {
559  ParamType p( &str , &entity );
560  // apply local operators
561  ldc_.apply( p );
562  }
563 
565  void inlineData (ObjectStreamType & str, const EntityType & entity ) const
566  {
567  const int mxlvl = grid_.maxLevel();
568 
569  // read/write macro element
570  inlineLocal(str, entity );
571 
572  {
573  typedef typename EntityType::HierarchicIterator HierarchicIteratorType;
574  const HierarchicIteratorType endit = entity.hend( mxlvl );
575  for(HierarchicIteratorType it = entity.hbegin( mxlvl );
576  it != endit; ++it )
577  {
578  inlineLocal(str, *it);
579  }
580  }
581  }
582 
584  void xtractData (ObjectStreamType & str, const EntityType & entity ) const
585  {
586  const int mxlvl = grid_.maxLevel();
587 
588  // read/write macro element
589  xtractLocal(str, entity );
590 
591  {
592  typedef typename EntityType::HierarchicIterator HierarchicIteratorType;
593  const HierarchicIteratorType endit = entity.hend( mxlvl );
594  for(HierarchicIteratorType it = entity.hbegin( mxlvl );
595  it != endit; ++it )
596  {
597  xtractLocal(str, *it);
598  }
599  }
600  }
601 
602  private:
604  {
605  typedef LocalInterface<ParamType> COType;
606 
607  COType *newLDCOp = new COType ( ldc_ );
608  typedef DataCollector <GridType, COType> OPType;
609 
610  OPType *dcOp = new OPType ( grid_ , dm_ , *newLDCOp, rwType_ );
611 
612  // memorize this new generated object because is represents this
613  // operator and is deleted if this operator is deleted
614  saveObjPointer( dcOp , newLDCOp );
615 
616  return dcOp;
617  }
618 
619  // write data of entity
620  void inlineLocal(ObjectStreamType & str, const EntityType& entity ) const
621  {
622  assert( writeData() );
623 
624  ParamType p( &str , &entity );
625  // apply local operators
626  ldc_.apply( p );
627  }
628 
629  // read data of entity
630  void xtractLocal(ObjectStreamType & str, const EntityType& entity ) const
631  {
632  assert( ! writeData() );
633 
634  ParamType p( &str , &entity );
635  // apply local operators
636  ldc_.apply( p );
637  }
638 
640  GridType &grid_;
641 
643  DofManagerType &dm_;
644 
646  LocalDataCollectImp &ldc_;
647 
649  const ReadWriteType rwType_;
650 
651  // number of childs one element can have
652  const int numChildren_;
653  };
654 
655 
656  //***********************************************************************
657  template< class DiscreteFunctionType >
659  {
660  typedef typename DiscreteFunctionType::DiscreteFunctionSpaceType
662  typedef typename DiscreteFunctionSpaceType::GridType GridType;
663  typedef typename DiscreteFunctionSpaceType::EntityType EntityType;
664  typedef typename GridType :: template Codim< 0 > :: Entity GridEntityType;
665 
668 
669  typedef std::pair< ObjectStreamType *, const GridEntityType * > ParamType;
671  };
672 
673 
675  template< class DiscreteFunctionType,
676  class ContainsCheck >
678  : public LocalInlinePlus< LocalDataInliner< DiscreteFunctionType, ContainsCheck >,
679  typename LocalDataInlinerTraits< DiscreteFunctionType >::ParamType >
680  {
681  public:
684 
686 
687  typedef typename Traits::EntityType EntityType;
689  typedef typename Traits::ParamType ParamType;
690 
692 
694  // we cannot use ConstLocalFunction here, since DiscreteFunctionType could
695  // be the FemPy::DiscreteFunctionList which only takes dofs vectors
696  typedef Dune::DynamicVector< DofType > LocalDofVectorType;
697 
699  LocalDataInliner ( const DiscreteFunctionType & df,
700  const ContainsCheck& containsCheck )
701  : df_ (df),
702  dm_( DofManagerType::instance( df.gridPart().grid() ) ),
703  containsCheck_( containsCheck ),
704  ldv_()
705  {}
706 
709  : df_ (other.df_),
710  dm_( other.dm_ ),
712  ldv_()
713  {}
714 
716  void apply ( ParamType & p ) const
717  {
718  assert( p.first && p.second );
719  const EntityType& entity = df_.space().gridPart().convert( *p.second );
720  inlineData( *p.first, entity, *p.second );
721  }
722 
725  protected:
728  const EntityType& entity,
729  const GridEntityType& gridEntity ) const
730  {
731  if( ! containsCheck_.contains ( entity ) ) return ;
732 
733  assert( df_.space().indexSet().contains( entity ) );
734 
735  ldv_.resize( df_.space().basisFunctionSet( entity ).size() );
736  df_.getLocalDofs( entity, ldv_ );
737  for( const DofType &dof : ldv_ )
738  str.write( dof );
739  }
740 
741  protected:
742  const DiscreteFunctionType & df_;
744  const ContainsCheck containsCheck_;
746  };
747 
748 
749  template< class DiscreteFunctionType >
751  {
752  typedef typename DiscreteFunctionType::DiscreteFunctionSpaceType
754  typedef typename DiscreteFunctionSpaceType::GridType GridType;
755  typedef typename DiscreteFunctionSpaceType::EntityType EntityType;
756  typedef typename GridType :: template Codim< 0 > :: Entity GridEntityType;
757 
760 
761  typedef std::pair< ObjectStreamType *, const GridEntityType * > ParamType;
763  };
764 
765 
767  template< class DiscreteFunctionType,
768  class ContainsCheck >
770  : public LocalInlinePlus< LocalDataXtractor< DiscreteFunctionType, ContainsCheck >,
771  typename LocalDataXtractorTraits< DiscreteFunctionType >::ParamType >
772  {
773  public:
776 
778 
779  typedef typename Traits::EntityType EntityType;
781  typedef typename Traits::ParamType ParamType;
782 
784 
786  // we cannot use ConstLocalFunction here, since DiscreteFunctionType could
787  // be the FemPy::DiscreteFunctionList which only takes dofs vectors
788  typedef Dune::DynamicVector< DofType > LocalDofVectorType;
789 
791  LocalDataXtractor ( DiscreteFunctionType & df,
792  const ContainsCheck& containsCheck )
793  : df_ (df),
794  dm_( DofManagerType :: instance( df.gridPart().grid() ) ),
795  containsCheck_( containsCheck ),
796  ldv_()
797  {}
798 
801  : df_( other.df_ ),
802  dm_( other.dm_ ),
804  ldv_()
805  {}
806 
808  void apply ( ParamType & p ) const
809  {
810  assert( p.first && p.second );
811  const EntityType& entity = df_.space().gridPart().convert( *p.second );
812  xtractData( *p.first, entity, *p.second );
813  }
814 
817  protected:
820  const EntityType& entity,
821  const GridEntityType& gridEntity ) const
822  {
823  if( ! containsCheck_.contains ( entity ) ) return ;
824 
825  // make sure entity is contained in set
826  assert( df_.space().indexSet().contains( entity ) );
827 
828  ldv_.resize( df_.space().basisFunctionSet( entity ).size() );
829  for( DofType &dof : ldv_ )
830  str.read( dof );
831  df_.setLocalDofs( entity, ldv_ );
832  }
833 
834  protected:
835  DiscreteFunctionType &df_;
837  const ContainsCheck containsCheck_;
839  };
840 
843  } // namespace Fem
844 
845 } // namespace Dune
846 
847 #endif // #ifndef DUNE_FEM_DATACOLLECTOR_HH
MessageBufferIF< InlineStreamImplType > InlineStreamType
Definition: dofmanager.hh:777
MessageBufferIF< XtractStreamImplType > XtractStreamType
Definition: dofmanager.hh:776
Definition: bindguard.hh:11
const GridEntityAccess< Entity >::GridEntityType & gridEntity(const Entity &entity)
Definition: gridpart.hh:412
Traits class for a DiscreteFunction.
Definition: common/discretefunction.hh:61
Definition: objpointer.hh:42
void saveObjPointer(DiscrOpType *discrOp)
Store new generated DiscreteOperator Pointer.
Definition: objpointer.hh:58
Definition: dofmanager.hh:762
Definition: datacollector.hh:232
LocalOp & asImp()
Definition: datacollector.hh:251
CombinedLocalDataCollect< LocalOp, B > & operator+(const B &b)
Definition: datacollector.hh:243
Definition: datacollector.hh:52
ReadWriteType
Definition: datacollector.hh:53
@ readData
Definition: datacollector.hh:53
@ writeData
Definition: datacollector.hh:53
Definition: datacollector.hh:59
void apply(Arg &arg) const
Definition: datacollector.hh:67
void apply(Arg1 &arg1, Arg2 &arg2) const
Definition: datacollector.hh:74
CombinedLocalDataCollect(const A &a, const B &b)
Definition: datacollector.hh:64
const B & b_
Definition: datacollector.hh:62
const A & a_
Definition: datacollector.hh:61
Definition: datacollector.hh:83
static void copyList(ListType &vec, const MyType &op)
Definition: datacollector.hh:130
LocalInterface(const MyType &op)
Definition: datacollector.hh:155
void apply(ParamType &p) const
for all pointer to local operators call the func pointer
Definition: datacollector.hh:163
virtual ~LocalInterface()
Definition: datacollector.hh:160
LocalInterface(const OpType &op)
Definition: datacollector.hh:150
bool empty() const
Definition: datacollector.hh:224
std::pair< MyType *, FuncType * > PairType
Definition: datacollector.hh:108
LocalInterface< ParamT > MyType
Definition: datacollector.hh:85
MyType & operator=(const OpType &op)
Definition: datacollector.hh:218
std::vector< PairType > ListType
Definition: datacollector.hh:109
ObjectStreamExtractor< ParamT >::ObjectStreamType ObjectStreamType
Definition: datacollector.hh:103
LocalInterface()
Definition: datacollector.hh:147
void remove(const OpType &op)
Definition: datacollector.hh:203
MyType & operator+=(const OpType &op)
Definition: datacollector.hh:190
ParamT ParamType
Definition: datacollector.hh:106
MyType & operator+(const OpType &op)
Definition: datacollector.hh:177
void FuncType(MyType &, ParamType &p)
Definition: datacollector.hh:107
Definition: datacollector.hh:87
ParamT ParamType
Definition: datacollector.hh:88
PT ObjectStreamType
Definition: datacollector.hh:94
Definition: datacollector.hh:113
static void applyWrapper(MyType &m, ParamType &p)
applyWrapper knows the real type of Op
Definition: datacollector.hh:115
static void addToList(ListType &vec, const OpType &op)
Definition: datacollector.hh:122
Definition: datacollector.hh:237
LocalInterface< ParamType > LocalInterfaceType
Definition: datacollector.hh:239
ParamT ParamType
Definition: datacollector.hh:238
Definition: datacollector.hh:262
DataCollectorInterface< GridType, ObjectStreamImp > MyType
Definition: datacollector.hh:269
MyType & operator=(const OpType &dc)
Assignement operator.
Definition: datacollector.hh:361
std::pair< ObjectStreamType *, const EntityType * > DataCollectorParamType
Definition: datacollector.hh:270
virtual void clear()
clear object list
Definition: datacollector.hh:379
GridType::template Codim< 0 >::Entity EntityType
Definition: datacollector.hh:267
LocalInterface< DataCollectorParamType > LocalInterfaceType
Definition: datacollector.hh:273
virtual ~DataCollectorInterface()
Virtual desctructor.
Definition: datacollector.hh:284
virtual const LocalInterfaceType & getLocalInterfaceOp() const
Definition: datacollector.hh:299
ObjectStreamImp ObjectStreamType
Definition: datacollector.hh:264
virtual void apply(ObjectStreamType &str, const EntityType &entity) const
Definition: datacollector.hh:289
DataCollectorInterface()
empty constructor
Definition: datacollector.hh:281
MyType & operator+=(const OpType &dc)
Assignement operator.
Definition: datacollector.hh:325
virtual LocalInterfaceType & getLocalInterfaceOp()
Definition: datacollector.hh:311
Definition: datacollector.hh:276
LocalInterface< DataCollectorParamType > LocalInterfaceType
Definition: datacollector.hh:277
empty data collector
Definition: datacollector.hh:393
MyType & operator=(const OpType &dc)
Assignement operator.
Definition: datacollector.hh:416
void apply(int, int) const
Definition: datacollector.hh:402
std::pair< int *, int * > DataCollectorParamType
Definition: datacollector.hh:397
LocalInterface< DataCollectorParamType > LocalInterfaceType
Definition: datacollector.hh:398
MyType & operator+=(const OpType &dc)
Assignement operator.
Definition: datacollector.hh:409
The DataCollector is an example for a grid walk done while load balancing moves entities from one pro...
Definition: datacollector.hh:436
void apply(ObjectStreamType &str, const EntityType &entity) const
Definition: datacollector.hh:557
DofManager< GridType > DofManagerType
Definition: datacollector.hh:446
LocalDataCollectImp & getLocalOp()
return reference to loacl Operator
Definition: datacollector.hh:535
DataCollector(GridType &grid, DofManagerType &dm, LocalDataCollectImp &ldc, const ReadWriteType rwType, int numChildren=8)
create DiscreteOperator with a LocalOperator
Definition: datacollector.hh:456
LocalDataCollectImp ::ObjectStreamType ObjectStreamType
Definition: datacollector.hh:438
std::pair< ObjectStreamType *, const EntityType * > ParamType
Definition: datacollector.hh:448
LocalInterface< ParamType > LocalInterfaceType
Definition: datacollector.hh:449
DataCollectorTraits ::ReadWriteType ReadWriteType
Definition: datacollector.hh:443
LocalInterfaceType & getLocalInterfaceOp()
Definition: datacollector.hh:546
DataCollectorInterface< GridType, ObjectStreamType > BaseType
Definition: datacollector.hh:442
void inlineData(ObjectStreamType &str, const EntityType &entity) const
write all data of all entities blowe this Entity to the stream
Definition: datacollector.hh:565
void xtractData(ObjectStreamType &str, const EntityType &entity) const
read all data of all entities blowe this Entity from the stream
Definition: datacollector.hh:584
bool writeData() const
return true if data collector is writing data instead of reading
Definition: datacollector.hh:553
virtual ~DataCollector()
Desctructor.
Definition: datacollector.hh:467
DataCollectorInterface< GridType, ObjectStreamType > DataCollectorInterfaceType
Definition: datacollector.hh:452
const LocalDataCollectImp & getLocalOp() const
return reference to loacl Operator
Definition: datacollector.hh:529
GridType::template Codim< 0 >::Entity EntityType
Definition: datacollector.hh:439
DataCollector< GridType, CombinedLocalDataCollect< LocalDataCollectImp, LocalDataCollectType > > & operator+(const DataCollector< GridType, LocalDataCollectType > &op)
operator + (combine this operator) and return new Object
Definition: datacollector.hh:473
const LocalInterfaceType & getLocalInterfaceOp() const
Definition: datacollector.hh:540
DataCollector< GridType, LocalInterface< ParamType > > & operator+=(const DataCollector< GridType, LocalDataCollectType > &op)
oeprator += combine and return this Object
Definition: datacollector.hh:493
DataCollector< EntityType, LocalDataCollectImp > MyType
Definition: datacollector.hh:445
Definition: datacollector.hh:659
LocalInterface< ParamType > LocalInterfaceType
Definition: datacollector.hh:670
DiscreteFunctionSpaceType::GridType GridType
Definition: datacollector.hh:662
GridType ::template Codim< 0 >::Entity GridEntityType
Definition: datacollector.hh:664
DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: datacollector.hh:661
DofManager< GridType > DofManagerType
Definition: datacollector.hh:666
std::pair< ObjectStreamType *, const GridEntityType * > ParamType
Definition: datacollector.hh:669
DiscreteFunctionSpaceType::EntityType EntityType
Definition: datacollector.hh:663
DofManagerType ::InlineStreamType ObjectStreamType
Definition: datacollector.hh:667
Inline DiscreteFunction data during load balancing.
Definition: datacollector.hh:680
LocalDataInliner(const DiscreteFunctionType &df, const ContainsCheck &containsCheck)
constructor
Definition: datacollector.hh:699
Traits::GridEntityType GridEntityType
Definition: datacollector.hh:688
LocalDofVectorType ldv_
Definition: datacollector.hh:745
Dune::DynamicVector< DofType > LocalDofVectorType
Definition: datacollector.hh:696
Traits::EntityType EntityType
Definition: datacollector.hh:687
LocalInterface< ParamType > LocalInterfaceType
Definition: datacollector.hh:691
const DiscreteFunctionType & df_
Definition: datacollector.hh:742
LocalDataInliner(const LocalDataInliner &other)
copy constructor
Definition: datacollector.hh:708
DataCollectorTraits ::ReadWriteType readWriteInfo() const
Definition: datacollector.hh:724
const ContainsCheck containsCheck_
Definition: datacollector.hh:744
void apply(ParamType &p) const
store data to stream
Definition: datacollector.hh:716
DiscreteFunctionTraits< DiscreteFunctionType >::DofType DofType
Definition: datacollector.hh:693
Traits::ParamType ParamType
Definition: datacollector.hh:689
LocalDataInlinerTraits< DiscreteFunctionType > Traits
Definition: datacollector.hh:682
Traits::ObjectStreamType ObjectStreamType
Definition: datacollector.hh:683
void inlineData(ObjectStreamType &str, const EntityType &entity, const GridEntityType &gridEntity) const
store data to stream
Definition: datacollector.hh:727
Traits::DofManagerType DofManagerType
Definition: datacollector.hh:685
DofManagerType & dm_
Definition: datacollector.hh:743
Definition: datacollector.hh:751
DiscreteFunctionSpaceType::GridType GridType
Definition: datacollector.hh:754
std::pair< ObjectStreamType *, const GridEntityType * > ParamType
Definition: datacollector.hh:761
DofManager< GridType > DofManagerType
Definition: datacollector.hh:758
DiscreteFunctionType::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
Definition: datacollector.hh:753
DiscreteFunctionSpaceType::EntityType EntityType
Definition: datacollector.hh:755
DofManagerType ::XtractStreamType ObjectStreamType
Definition: datacollector.hh:759
LocalInterface< ParamType > LocalInterfaceType
Definition: datacollector.hh:762
GridType ::template Codim< 0 >::Entity GridEntityType
Definition: datacollector.hh:756
Inline DiscreteFunction data during load balancing.
Definition: datacollector.hh:772
DataCollectorTraits ::ReadWriteType readWriteInfo() const
Definition: datacollector.hh:816
DiscreteFunctionType & df_
Definition: datacollector.hh:835
const ContainsCheck containsCheck_
Definition: datacollector.hh:837
Traits::ObjectStreamType ObjectStreamType
Definition: datacollector.hh:775
LocalDataXtractorTraits< DiscreteFunctionType > Traits
Definition: datacollector.hh:774
Traits::EntityType EntityType
Definition: datacollector.hh:779
LocalDataXtractor(const LocalDataXtractor &other)
copy constructor
Definition: datacollector.hh:800
Dune::DynamicVector< DofType > LocalDofVectorType
Definition: datacollector.hh:788
LocalDofVectorType ldv_
Definition: datacollector.hh:838
LocalDataXtractor(DiscreteFunctionType &df, const ContainsCheck &containsCheck)
constructor
Definition: datacollector.hh:791
Traits::DofManagerType DofManagerType
Definition: datacollector.hh:777
DofManagerType & dm_
Definition: datacollector.hh:836
Traits::GridEntityType GridEntityType
Definition: datacollector.hh:780
void apply(ParamType &p) const
store data to stream
Definition: datacollector.hh:808
Traits::LocalInterfaceType LocalInterfaceType
Definition: datacollector.hh:783
Traits::ParamType ParamType
Definition: datacollector.hh:781
void xtractData(ObjectStreamType &str, const EntityType &entity, const GridEntityType &gridEntity) const
store data to stream
Definition: datacollector.hh:819
DiscreteFunctionTraits< DiscreteFunctionType >::DofType DofType
Definition: datacollector.hh:785