aslProbe.h
Go to the documentation of this file.
/*
* Advanced Simulation Library <http://asl.org.il>
*
* Copyright 2015 Avtech Scientific <http://avtechscientific.com>
*
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
#ifndef ASLPROBE_H
#define ASLPROBE_H
#include <acl/Kernels/aclKernel.h>
#include <math/aslVectors.h>
#include <iostream>
#include <fstream>
using namespace std;
namespace acl
{
class VectorOfElementsData;
typedef std::shared_ptr<VectorOfElementsData> SPVectorOfElementsData;
}
namespace asl
{
class AbstractData;
typedef std::shared_ptr<AbstractData> SPAbstractData;
class Probe
{
protected:
SPAbstractData data;
acl::Kernel k;
std::vector<int> indices;
acl::SPVectorOfElementsData indicesACL;
vector<vector<double>> values;
acl::SPVectorOfElementsData valuesACL;
void loadIndicesToACL();
void loadValuesFromACL();
public:
Probe(SPAbstractData d);
void addPoint(AVec<int> p);
void init();
void update();
const unsigned int getNComponents() const;
const unsigned int getNDimensions() const;
inline vector<double> & getComponent(unsigned int i);
inline AVec<double> getValue(unsigned int pointNumber);
};
class ProbeLI
{
protected:
SPAbstractData data;
acl::Kernel k;
std::vector<AVec<>> points;
acl::SPVectorOfElementsData pointsACL;
vector<vector<double>> values;
acl::SPVectorOfElementsData valuesACL;
void loadPointsToACL();
void loadValuesFromACL();
public:
ProbeLI(SPAbstractData d);
void addPoint(AVec<> p);
void init();
void update();
const unsigned int getNComponents() const;
const unsigned int getNDimensions() const;
inline vector<double> & getComponent(unsigned int i);
inline AVec<double> getValue(unsigned int pointNumber);
};
// -------------------------- Implementation ------------------------------
inline vector<double> & Probe::getComponent(unsigned int i)
{
return values[i];
}
inline AVec<double> Probe::getValue(unsigned int pointNumber)
{
unsigned int nC(getNComponents());
AVec<double> value(nC);
for (unsigned int i(0); i < nC; ++i)
value[i] = values[i][pointNumber];
return value;
}
inline vector<double> & ProbeLI::getComponent(unsigned int i)
{
return values[i];
}
inline AVec<double> ProbeLI::getValue(unsigned int pointNumber)
{
unsigned int nC(getNComponents());
AVec<double> value(nC);
for (unsigned int i(0); i < nC; ++i)
value[i] = values[i][pointNumber];
return value;
}
}
#endif
acl::Kernel
OpenCl Kernel generator.
Definition: aclKernel.h:49
asl::AVec< int >
asl::Probe
Collects point values from the input data.
Definition: aslProbe.h:54
asl::Probe::indices
std::vector< int > indices
Definition: aslProbe.h:59
asl::Probe::getNDimensions
const unsigned int getNDimensions() const
asl::Probe::addPoint
void addPoint(AVec< int > p)
asl::Probe::loadIndicesToACL
void loadIndicesToACL()
asl::Probe::indicesACL
acl::SPVectorOfElementsData indicesACL
Definition: aslProbe.h:60
asl::Probe::update
void update()
Updates data in output.
asl::Probe::init
void init()
initialization of internal kernels and data
asl::Probe::data
SPAbstractData data
Definition: aslProbe.h:56
asl::Probe::k
acl::Kernel k
Definition: aslProbe.h:57
asl::Probe::valuesACL
acl::SPVectorOfElementsData valuesACL
Definition: aslProbe.h:63
asl::Probe::loadValuesFromACL
void loadValuesFromACL()
asl::Probe::Probe
Probe(SPAbstractData d)
asl::Probe::getNComponents
const unsigned int getNComponents() const
asl::Probe::values
vector< vector< double > > values
Definition: aslProbe.h:62
asl::ProbeLI
Collects point values from the input data with linear interpolation
Definition: aslProbe.h:86
asl::ProbeLI::valuesACL
acl::SPVectorOfElementsData valuesACL
Definition: aslProbe.h:95
asl::ProbeLI::values
vector< vector< double > > values
Definition: aslProbe.h:94
asl::ProbeLI::loadValuesFromACL
void loadValuesFromACL()
asl::ProbeLI::data
SPAbstractData data
Definition: aslProbe.h:88
asl::ProbeLI::points
std::vector< AVec<> > points
Definition: aslProbe.h:91
asl::ProbeLI::loadPointsToACL
void loadPointsToACL()
asl::ProbeLI::addPoint
void addPoint(AVec<> p)
asl::ProbeLI::k
acl::Kernel k
Definition: aslProbe.h:89
asl::ProbeLI::getNDimensions
const unsigned int getNDimensions() const
asl::ProbeLI::init
void init()
initialization of internal kernels and data
asl::ProbeLI::getNComponents
const unsigned int getNComponents() const
asl::ProbeLI::ProbeLI
ProbeLI(SPAbstractData d)
asl::ProbeLI::update
void update()
Updates data in output.
asl::ProbeLI::pointsACL
acl::SPVectorOfElementsData pointsACL
Definition: aslProbe.h:92
acl
Advanced Computational Language.
Definition: acl.h:41
acl::SPVectorOfElementsData
shared_ptr< VectorOfElementsData > SPVectorOfElementsData
Definition: aclVectorOfElementsDef.h:105
asl
Advanced Simulation Library.
Definition: aslDataInc.h:31
asl::SPAbstractData
shared_ptr< AbstractData > SPAbstractData
Definition: aslDataWrapper.h:65