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.
notexpression.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_NOTEXPRESSION_H
8 #define IGLOO_NOTEXPRESSION_H
9 
10 #include "./expression_fwd.h"
11 
12 namespace snowhouse {
13 
14  template< typename ExpressionType >
15  struct NotExpression : Expression< NotExpression<ExpressionType> >
16  {
17  NotExpression(const ExpressionType& expression)
18  : m_expression(expression)
19  {
20  }
21 
22  template<typename ActualType>
23  bool operator()(const ActualType& actual) const
24  {
25  return !m_expression(actual);
26  }
27 
28  ExpressionType m_expression;
29  };
30 
31  template< typename ExpressionType >
32  struct Stringizer< NotExpression<ExpressionType> >
33  {
34  static std::string ToString(const NotExpression<ExpressionType>& expression)
35  {
36  std::ostringstream builder;
37  builder << "not " << snowhouse::Stringize(expression.m_expression);
38 
39  return builder.str();
40  }
41  };
42 }
43 
44 #endif
Definition: assert.h:13
Definition: notexpression.h:15
Definition: stringize.h:71
Definition: expression.h:17