blitzdg
an open-source project aiming to implement parallel discontinuous Galerkin (dg) solvers for common partial differential equations systems using blitz++ for array and tensor manipulations and MPI for distributed parallelism.
orexpression.h
1 
2 // Copyright Joakim Karlsson & Kim Gräsman 2010-2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef IGLOO_OREXPRESSION_H
8 #define IGLOO_OREXPRESSION_H
9 
10 #include "./expression_fwd.h"
11 
12 namespace snowhouse {
13 
14  template< typename LeftExpression, typename RightExpression >
15  struct OrExpression : Expression< OrExpression<LeftExpression, RightExpression> >
16  {
17  OrExpression(const LeftExpression& left, const RightExpression& right)
18  : m_left(left)
19  , m_right(right)
20  {
21  }
22 
23  template< typename ActualType >
24  bool operator()(const ActualType& actual) const
25  {
26  return (m_left(actual) || m_right(actual));
27  }
28 
29  LeftExpression m_left;
30  RightExpression m_right;
31  };
32 
33  template< typename LeftExpression, typename RightExpression >
34  struct Stringizer< OrExpression<LeftExpression, RightExpression> >
35  {
36  static std::string ToString(const OrExpression<LeftExpression, RightExpression>& expression)
37  {
38  std::ostringstream builder;
39  builder << snowhouse::Stringize(expression.m_left) << " or " << snowhouse::Stringize(expression.m_right);
40 
41  return builder.str();
42  }
43  };
44 }
45 
46 #endif
Definition: assert.h:13
Definition: orexpression.h:15
Definition: stringize.h:71
Definition: expression.h:17