Debian Codegraph @

src/num/aslDataResampling.h

raw
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 ASLDATARESAMPLING_H
25 #define ASLDATARESAMPLING_H
26
27 #include "aslSingleKernelNM.h"
28 #include "math/aslVectors.h"
29 //#include <CL/cl.hpp>
30 // Supply "cl.hpp" with ASL, since it is not present in OpenCL 2.0
31 // Remove the file after switching to OpenCL 2.1
32 #include "acl/cl.hpp"
33
34 namespace acl
35 {
36 class VectorOfElementsData;
37 }
38
39 namespace asl
40 {
41 class VectorTemplate;
42 template <typename V> class DataWithGhostNodes;
43 typedef DataWithGhostNodes<acl::VectorOfElementsData> DataWithGhostNodesACLData;
44 typedef std::shared_ptr<DataWithGhostNodesACLData> SPDataWithGhostNodesACLData;
45 class AbstractDataWithGhostNodes;
46 typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
47
48 /// Algorithm for generation of coarsed dataset
49 /**
50 \ingroup NumMethods
51
52 \todo make and test
53 */
54 class DataCoarser: public SingleKernelNM
55 {
56 public:
57 typedef SPDataWithGhostNodesACLData Data;
58
59 private:
60 Data dataIn;
61 Data dataOut;
62 const VectorTemplate* vectorTemplate;
63
64 virtual void init0();
65 public:
66 DataCoarser();
67 DataCoarser(Data dIn);
68 inline Data getDataOut();
69 };
70
71 typedef std::shared_ptr<DataCoarser> SPDataCoarser;
72
73 /// \ingroup DataUtilities
74 SPDataWithGhostNodesACLData coarseData(SPDataWithGhostNodesACLData d);
75
76 /// Algorithm for generation of coarsed dataset
77 /**
78 \ingroup NumMethods
79
80 \todo make and test
81 */
82 class DataClipper: public SingleKernelNM
83 {
84 public:
85 typedef SPDataWithGhostNodesACLData Data;
86
87 private:
88 Data dataIn;
89 Data dataOut;
90 AVec<int> a0;
91 AVec<int> aE;
92
93 virtual void init0();
94 public:
95 DataClipper();
96 DataClipper(Data dIn, AVec<int> a0, AVec<int> aE);
97 inline Data getDataOut();
98 };
99
100 typedef std::shared_ptr<DataClipper> SPDataClipper;
101
102 /// \ingroup DataUtilities
103 inline SPDataWithGhostNodesACLData clipData(SPDataWithGhostNodesACLData d,
104 AVec<int> a0,
105 AVec<int> aE);
106
107 //----------------------------- Implementation -----------------------
108
109 DataCoarser::Data DataCoarser::getDataOut()
110 {
111 return dataOut;
112 }
113
114 DataClipper::Data DataClipper::getDataOut()
115 {
116 return dataOut;
117 }
118
119 inline SPDataWithGhostNodesACLData coarseData(SPDataWithGhostNodesACLData d)
120 {
121 DataCoarser dc(d);
122 dc.init();
123 dc.execute();
124 return dc.getDataOut();
125
126 }
127
128 inline SPDataWithGhostNodesACLData clipData(SPDataWithGhostNodesACLData d,
129 AVec<int> a0,
130 AVec<int> aE)
131 {
132 asl::DataClipper dcl(d, a0,aE);
133 dcl.init();
134 dcl.execute();
135 return dcl.getDataOut();
136 }
137
138
139 } // asl
140 #endif // ASLDATARESAMPLING_H