ASL 0.1.7
Advanced Simulation Library
Loading...
Searching...
No Matches
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
28#include <math/aslVectors.h>
29#include <iostream>
30#include <fstream>
31
32
33
34using namespace std;
35
36namespace acl
37{
38 class VectorOfElementsData;
39 typedef std::shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
40
41}
42namespace 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
67
68 public:
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
99
100 public:
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
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
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
definition of class АVec<T>
OpenCl Kernel generator.
Definition aclKernel.h:49
Collects point values from the input data.
Definition aslProbe.h:54
const unsigned int getNDimensions() const
void addPoint(AVec< int > p)
void loadIndicesToACL()
vector< vector< double > > values
Definition aslProbe.h:62
acl::SPVectorOfElementsData indicesACL
Definition aslProbe.h:60
void update()
Updates data in output.
void init()
initialization of internal kernels and data
SPAbstractData data
Definition aslProbe.h:56
acl::Kernel k
Definition aslProbe.h:57
vector< double > & getComponent(unsigned int i)
Definition aslProbe.h:116
AVec< double > getValue(unsigned int pointNumber)
Definition aslProbe.h:122
std::vector< int > indices
Definition aslProbe.h:59
acl::SPVectorOfElementsData valuesACL
Definition aslProbe.h:63
void loadValuesFromACL()
Probe(SPAbstractData d)
const unsigned int getNComponents() const
Collects point values from the input data with linear interpolation
Definition aslProbe.h:86
acl::SPVectorOfElementsData valuesACL
Definition aslProbe.h:95
AVec< double > getValue(unsigned int pointNumber)
Definition aslProbe.h:138
void loadValuesFromACL()
vector< vector< double > > values
Definition aslProbe.h:94
std::vector< AVec<> > points
Definition aslProbe.h:91
SPAbstractData data
Definition aslProbe.h:88
void loadPointsToACL()
void addPoint(AVec<> p)
acl::Kernel k
Definition aslProbe.h:89
const unsigned int getNDimensions() const
void init()
initialization of internal kernels and data
const unsigned int getNComponents() const
ProbeLI(SPAbstractData d)
vector< double > & getComponent(unsigned int i)
Definition aslProbe.h:132
void update()
Updates data in output.
acl::SPVectorOfElementsData pointsACL
Definition aslProbe.h:92
SPDataWrapperACLData generateDataContainerACL_SP(const Block &b, unsigned int n=1)
generates pointer to ACL Data field with n components
Advanced Computational Language.
Definition acl.h:41
shared_ptr< VectorOfElementsData > SPVectorOfElementsData
Advanced Simulation Library.
Definition aslDataInc.h:31
shared_ptr< AbstractData > SPAbstractData
STL namespace.