Memosa-FVM  0.2
MultiFieldReduction.h
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 #ifndef _MULTIFIELDREDUCTION_H_
6 #define _MULTIFIELDREDUCTION_H_
7 
8 #include "Field.h"
9 #include "ArrayBase.h"
10 
12 {
13 public:
14  typedef map<const Field*,shared_ptr<ArrayBase> > ArrayMap;
15 
17 
18  virtual ~MultiFieldReduction();
19  DEFINE_TYPENAME("MultiFieldReduction");
20 
21  ArrayBase& operator[](const Field&);
22  const ArrayBase& operator[](const Field&) const;
23 
25 
26  void addArray(const Field& aIndex, shared_ptr<ArrayBase> a);
27  bool hasArray(const Field& aIndex) const;
28 
29  shared_ptr<ArrayBase> getArrayPtr(const Field&);
30 
31  void reduceSum();
32 
33  bool operator<(const double tolerance) const;
34  shared_ptr<MultiFieldReduction> operator/(const MultiFieldReduction& o);
35  shared_ptr<MultiFieldReduction> normalize(const MultiFieldReduction& o);
36  shared_ptr<MultiFieldReduction> operator*(const MultiFieldReduction& o);
37  shared_ptr<MultiFieldReduction> operator-() const;
38 
39  void setMax(const MultiFieldReduction& o);
40  void limit(const double min, const double max);
41 
42  void print(ostream &os) const;
43  void sync();
44 
45 private:
47 };
48 
49 inline ostream& operator<<(ostream &os,
50  const MultiFieldReduction &x)
51 {
52  x.print(os);
53  return os;
54 }
55 
56 typedef shared_ptr<MultiFieldReduction> MFRPtr;
57 
58 typedef vector<shared_ptr<MultiFieldReduction> > MFReductionVector;
59 
60 #endif
DEFINE_TYPENAME("MultiFieldReduction")
void setMax(const MultiFieldReduction &o)
vector< shared_ptr< MultiFieldReduction > > MFReductionVector
ArrayBase & operator[](const Field &)
void addArray(const Field &aIndex, shared_ptr< ArrayBase > a)
Definition: Field.h:14
shared_ptr< MultiFieldReduction > operator/(const MultiFieldReduction &o)
shared_ptr< MultiFieldReduction > normalize(const MultiFieldReduction &o)
double max(double x, double y)
Definition: Octree.cpp:18
MultiFieldReduction & operator+=(const MultiFieldReduction &ofield)
shared_ptr< ArrayBase > getArrayPtr(const Field &)
bool hasArray(const Field &aIndex) const
void limit(const double min, const double max)
ostream & operator<<(ostream &os, const MultiFieldReduction &x)
void print(ostream &os) const
shared_ptr< MultiFieldReduction > operator*(const MultiFieldReduction &o)
shared_ptr< MultiFieldReduction > MFRPtr
bool operator<(const double tolerance) const
double min(double x, double y)
Definition: Octree.cpp:23
map< const Field *, shared_ptr< ArrayBase > > ArrayMap
shared_ptr< MultiFieldReduction > operator-() const