ViennaCL - The Vienna Computing Library
1.5.2
|
00001 #ifndef VIENNACL_DEVICE_SPECIFIC_TREE_PARSING_FILTER_HPP 00002 #define VIENNACL_DEVICE_SPECIFIC_TREE_PARSING_FILTER_HPP 00003 00004 /* ========================================================================= 00005 Copyright (c) 2010-2013, Institute for Microelectronics, 00006 Institute for Analysis and Scientific Computing, 00007 TU Wien. 00008 Portions of this software are copyright by UChicago Argonne, LLC. 00009 00010 ----------------- 00011 ViennaCL - The Vienna Computing Library 00012 ----------------- 00013 00014 Project Head: Karl Rupp rupp@iue.tuwien.ac.at 00015 00016 (A list of authors and contributors can be found in the PDF manual) 00017 00018 License: MIT (X11), see file LICENSE in the base directory 00019 ============================================================================= */ 00020 00021 #include "viennacl/device_specific/forwards.h" 00022 #include "viennacl/device_specific/tree_parsing/traverse.hpp" 00023 00024 namespace viennacl{ 00025 00026 namespace device_specific{ 00027 00028 namespace tree_parsing{ 00029 00030 class filter : public traversal_functor{ 00031 public: 00032 typedef bool (*pred_t)(scheduler::statement_node const & node); 00033 00034 filter(pred_t pred, std::vector<scheduler::statement_node const *> & out) : pred_(pred), out_(out){ } 00035 00036 void operator()(scheduler::statement const & statement, unsigned int root_idx, node_type) const 00037 { 00038 scheduler::statement_node const * root_node = &statement.array()[root_idx]; 00039 if(pred_(*root_node)) 00040 out_.push_back(root_node); 00041 } 00042 private: 00043 pred_t pred_; 00044 std::vector<scheduler::statement_node const *> & out_; 00045 }; 00046 00047 00048 } 00049 } 00050 } 00051 #endif