ASL  0.1.7
Advanced Simulation Library
aclReductionAlgGenerator.h
Go to the documentation of this file.
1 /*
2  * Advanced Simulation Library <http://asl.org.il>
3  *
4  * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5  *
6  *
7  * This file is part of Advanced Simulation Library (ASL).
8  *
9  * ASL is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU Affero General Public License as
11  * published by the Free Software Foundation, version 3 of the License.
12  *
13  * ASL is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 
24 #ifndef ACLREDUCTIONALGGENERATUR_H
25 #define ACLREDUCTIONALGGENERATUR_H
26 
27 #include "aclVectorOfElementsDef.h"
28 #include <math/aslVectors.h>
29 #include <utilities/aslUValue.h>
30 
31 
32 namespace acl
33 {
34  class Kernel;
36 
38 
41  template <typename ResType, enum ReductionOperatorType Op> class ReductionAlgGenerator
42  {
43  private:
45  unsigned int nGroups;
46  unsigned int nLocal;
47  public:
49  private:
50  std::vector<std::vector<ResType>> groupRes;
51  VectorOfElementsData groupResACL;
52 
53  shared_ptr<Kernel> kernel;
54 
55  public:
57  void compute();
58  void generateAlg(Kernel & k);
59  void generateAlg();
60  };
61 
62  template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_SUM>>
64 
65  template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MINIMUM>>
67 
68  template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_MAXIMUM>>
70 
71  template <typename ResType> std::shared_ptr<ReductionAlgGenerator<ResType, ROT_PRODUCT>>
73 
74 
75 } //namespace acl
76 
77 #endif // ACLREDUCTIONALGGENERATUR_H
Advanced Computational Language.
Definition: acl.h:40
The class generates code corresponding to a reduction operation of elements.
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_PRODUCT > > generateProductAlg(VectorOfElements v)
The class represents several ElementData.
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_MINIMUM > > generateMinAlg(VectorOfElements v)
OpenCl Kernel generator.
Definition: aclKernel.h:48
asl::UValue< asl::AVec< ResType > > res
ReductionAlgGenerator(VectorOfElements v)
Updatable value. This class stores value and its TimeStamp.
Definition: aslBasicBC.h:41
The class represents several Element.
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_MAXIMUM > > generateMaxAlg(VectorOfElements v)
definition of class АVec<T>
std::shared_ptr< ReductionAlgGenerator< ResType, ROT_SUM > > generateSumAlg(VectorOfElements v)