source: XIOS/trunk/src/filter/binary_arithmetic_filter.hpp @ 1704

Last change on this file since 1704 was 1704, checked in by yushan, 5 years ago

Introducing the new graph functionality. Attribute build_workflow_graph=.TRUE. is used in the field definition section in the xml file to enable the workflow graph of the field and other fields referecing to it. A more detailed document will be available soon on the graph fuctionality.

File size: 4.0 KB
Line 
1#ifndef __XIOS_CBinaryArithmeticFilter__
2#define __XIOS_CBinaryArithmeticFilter__
3
4#include "filter.hpp"
5#include <string>
6#include "operator_expr.hpp"
7#include <unordered_map>
8#include <tuple>
9
10namespace xios
11{
12  /*!
13   * A generic binary arithmetic filter wrapping any type of binary scalar-field operator.
14   */
15  class CScalarFieldArithmeticFilter : public CFilter, public IFilterEngine
16  {
17    public:
18      /*!
19       * Constructs an binary scalar-field arithmetic filter wrapping the specified operator.
20       *
21       * \param gc the associated garbage collector
22       * \param op the string identifing the binary scalar-field operator
23       * \param value the scalar value
24       */
25      CScalarFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value);
26      StdString virtual GetName(void);
27
28
29    protected:
30      COperatorExpr::functionScalarField op; //!< The binary scalar-field operator attached to the binary arithmeric filter
31      double value; //!< The scalar value associated with the binary arithmeric filter
32
33      /*!
34       * Applies the binary scalar-field operator to the input data and returns the result.
35       *
36       * \param data a vector of packets corresponding to each slot (one in this case)
37       * \return the result of the binary operation
38       */
39      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
40      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data);
41     
42
43  }; // class CScalarFieldArithmeticFilter
44
45  /*!
46   * A generic binary arithmetic filter wrapping any type of binary scalar-field operator.
47   */
48  class CFieldScalarArithmeticFilter : public CFilter, public IFilterEngine
49  {
50    public:
51      /*!
52       * Constructs an binary field-scalar arithmetic filter wrapping the specified operator.
53       *
54       * \param gc the associated garbage collector
55       * \param op the string identifing the binary field-scalar operator
56       * \param value the scalar value
57       */
58      CFieldScalarArithmeticFilter(CGarbageCollector& gc, const std::string& op, double value);
59      StdString virtual GetName(void);
60
61
62    protected:
63      COperatorExpr::functionFieldScalar op; //!< The binary field-scalar operator attached to the binary arithmeric filter
64      double value; //!< The scalar value associated with the binary arithmeric filter
65
66      /*!
67       * Applies the binary field-scalar operator to the input data and returns the result.
68       *
69       * \param data a vector of packets corresponding to each slot (one in this case)
70       * \return the result of the binary operation
71       */
72      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
73      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data);
74  }; // class CFieldScalarArithmeticFilter
75
76  /*!
77   * A generic binary arithmetic filter wrapping any type of binary scalar-field operator.
78   */
79  class CFieldFieldArithmeticFilter : public CFilter, public IFilterEngine
80  {
81    public:
82      /*!
83       * Constructs an binary field-field arithmetic filter wrapping the specified operator.
84       *
85       * \param gc the associated garbage collector
86       * \param op the string identifing the binary field-field operator
87       */
88      CFieldFieldArithmeticFilter(CGarbageCollector& gc, const std::string& op);
89      StdString virtual GetName(void);
90
91
92    protected:
93      COperatorExpr::functionFieldField op; //!< The binary field-field operator attached to the binary arithmeric filter
94
95      /*!
96       * Applies the binary field-field operator to the input data and returns the result.
97       *
98       * \param data a vector of packets corresponding to each slot (one in this case)
99       * \return the result of the binary operation
100       */
101      CDataPacketPtr virtual apply(std::vector<CDataPacketPtr> data);
102      std::tuple<int, int, int> virtual buildGraph(std::vector<CDataPacketPtr> data);
103  }; // class CFieldFieldArithmeticFilter
104} // namespace xios
105
106#endif //__XIOS_CBinaryArithmeticFilter__
Note: See TracBrowser for help on using the repository browser.