/* * Advanced Simulation Library * * Copyright 2015 Avtech Scientific * * * This file is part of Advanced Simulation Library (ASL). * * ASL is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, version 3 of the License. * * ASL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with ASL. If not, see . * */ #ifndef ACLREDUCTIONALGGENERATUR_H #define ACLREDUCTIONALGGENERATUR_H #include "aclVectorOfElementsDef.h" #include #include namespace acl { class Kernel; enum ReductionOperatorType {ROT_SUM, ROT_PRODUCT, ROT_MINIMUM, ROT_MAXIMUM}; /// The class generates code corresponding to a reduction operation of elements /** \ingroup ComplexDataTypes */ template class ReductionAlgGenerator { private: VectorOfElements ve; unsigned int nGroups; unsigned int nLocal; public: asl::UValue> res; private: std::vector> groupRes; VectorOfElementsData groupResACL; shared_ptr kernel; public: ReductionAlgGenerator(VectorOfElements v); void compute(); void generateAlg(Kernel & k); void generateAlg(); }; template std::shared_ptr> generateSumAlg(VectorOfElements v); template std::shared_ptr> generateMinAlg(VectorOfElements v); template std::shared_ptr> generateMaxAlg(VectorOfElements v); template std::shared_ptr> generateProductAlg(VectorOfElements v); } //namespace acl #endif // ACLREDUCTIONALGGENERATUR_H