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.
atmostoperator.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_ATMOSTOPERATOR_H
8 #define IGLOO_ATMOSTOPERATOR_H
9 
10 namespace snowhouse {
11 
13  {
14  AtMostOperator(unsigned int expected) : m_expected(expected) {}
15 
16  template <typename ConstraintListType, typename ActualType>
17  void Evaluate(ConstraintListType& list, ResultStack& result, OperatorStack& operators, const ActualType& actual)
18  {
19  unsigned int passed_elements = CollectionConstraintEvaluator<ConstraintListType, ActualType>::Evaluate(*this, list, result, operators, actual);
20 
21  result.push(passed_elements <= m_expected);
22  }
23 
24  unsigned int m_expected;
25  };
26 
27  template<>
29  {
30  static std::string ToString(const AtMostOperator& op)
31  {
32  std::ostringstream stm;
33  stm << "at most " << op.m_expected;
34  return stm.str();
35  }
36  };
37 }
38 
39 #endif
Definition: assert.h:13
Definition: stringize.h:71
Definition: collectionconstraintevaluator.h:17
Definition: collectionoperator.h:11
Definition: atmostoperator.h:12