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