ASL  0.1.7
Advanced Simulation Library
aslProbe.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 ASLPROBE_H
25 #define ASLPROBE_H
26 
27 #include <acl/Kernels/aclKernel.h>
28 #include <math/aslVectors.h>
29 #include <iostream>
30 #include <fstream>
31 
32 
33 
34 using namespace std;
35 
36 namespace acl
37 {
38  class VectorOfElementsData;
39  typedef std::shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
40 
41 }
42 namespace asl
43 {
44 
45  class AbstractData;
46  typedef std::shared_ptr<AbstractData> SPAbstractData;
47 
49 
51 
53  class Probe
54  {
55  protected:
58 
59  std::vector<int> indices;
61 
62  vector<vector<double>> values;
64 
65  void loadIndicesToACL();
66  void loadValuesFromACL();
67 
68  public:
70  void addPoint(AVec<int> p);
72  void init();
74  void update();
75  const unsigned int getNComponents() const;
76  const unsigned int getNDimensions() const;
77  inline vector<double> & getComponent(unsigned int i);
78  inline AVec<double> getValue(unsigned int pointNumber);
79  };
80 
82 
84 
85  class ProbeLI
86  {
87  protected:
90 
91  std::vector<AVec<>> points;
93 
94  vector<vector<double>> values;
96 
97  void loadPointsToACL();
98  void loadValuesFromACL();
99 
100  public:
102  void addPoint(AVec<> p);
104  void init();
106  void update();
107  const unsigned int getNComponents() const;
108  const unsigned int getNDimensions() const;
109  inline vector<double> & getComponent(unsigned int i);
110  inline AVec<double> getValue(unsigned int pointNumber);
111  };
112 
113 
114  // -------------------------- Implementation ------------------------------
115 
116  inline vector<double> & Probe::getComponent(unsigned int i)
117  {
118  return values[i];
119  }
120 
121 
122  inline AVec<double> Probe::getValue(unsigned int pointNumber)
123  {
124  unsigned int nC(getNComponents());
125  AVec<double> value(nC);
126  for (unsigned int i(0); i < nC; ++i)
127  value[i] = values[i][pointNumber];
128 
129  return value;
130  }
131 
132  inline vector<double> & ProbeLI::getComponent(unsigned int i)
133  {
134  return values[i];
135  }
136 
137 
138  inline AVec<double> ProbeLI::getValue(unsigned int pointNumber)
139  {
140  unsigned int nC(getNComponents());
141  AVec<double> value(nC);
142  for (unsigned int i(0); i < nC; ++i)
143  value[i] = values[i][pointNumber];
144 
145  return value;
146  }
147 
148 }
149 
150 #endif
151 
acl::Kernel k
Definition: aslProbe.h:89
Advanced Simulation Library.
Definition: aslDataInc.h:30
Advanced Computational Language.
Definition: acl.h:40
acl::SPVectorOfElementsData valuesACL
Definition: aslProbe.h:95
vector< vector< double > > values
Definition: aslProbe.h:94
SPAbstractData data
Definition: aslProbe.h:56
OpenCl Kernel generator.
Definition: aclKernel.h:48
std::vector< AVec<> > points
Definition: aslProbe.h:91
shared_ptr< VectorOfElementsData > SPVectorOfElementsData
vector< vector< double > > values
Definition: aslProbe.h:62
acl::SPVectorOfElementsData indicesACL
Definition: aslProbe.h:60
shared_ptr< AbstractData > SPAbstractData
Collects point values from the input data with linear interpolation.
Definition: aslProbe.h:85
acl::Kernel k
Definition: aslProbe.h:57
SPAbstractData data
Definition: aslProbe.h:88
definition of class АVec<T>
acl::SPVectorOfElementsData pointsACL
Definition: aslProbe.h:92
Collects point values from the input data.
Definition: aslProbe.h:53
acl::SPVectorOfElementsData valuesACL
Definition: aslProbe.h:63
std::vector< int > indices
Definition: aslProbe.h:59