aslPositionFunction.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 ASLPOSITIONFUNCTION_H
#define ASLPOSITIONFUNCTION_H
#include <acl/aclMath/aclVectorOfElementsDef.h>
#include "utilities/aslUValue.h"
namespace acl
{
class KernelConfiguration;
}
namespace asl {
template <typename T> class AVec;
class Block;
class AbstractDataWithGhostNodes;
typedef std::shared_ptr<AbstractDataWithGhostNodes> SPAbstractDataWithGhostNodes;
class PositionFunction
{
protected:
PositionFunction();
public:
virtual ~PositionFunction();
virtual acl::VectorOfElements value(acl::VectorOfElements & pos)=0;
};
typedef std::shared_ptr<PositionFunction> SPPositionFunction;
class PFBinaryOperation: public PositionFunction
{
protected:
SPPositionFunction e1;
SPPositionFunction e2;
public:
PFBinaryOperation(SPPositionFunction a, SPPositionFunction b);
};
class PFUnaryOperation: public PositionFunction
{
protected:
SPPositionFunction e1;
public:
PFUnaryOperation(SPPositionFunction a);
};
class PFOperationPlus: public PFBinaryOperation
{
public:
PFOperationPlus(SPPositionFunction a, SPPositionFunction b);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
class PFOperationMinus: public PFBinaryOperation
{
public:
PFOperationMinus(SPPositionFunction a, SPPositionFunction b);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
class PFOperationProduct: public PFBinaryOperation
{
public:
PFOperationProduct(SPPositionFunction a, SPPositionFunction b);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
class PFOperationInversion: public PFUnaryOperation
{
public:
PFOperationInversion(SPPositionFunction a);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
class PFConstant: public PositionFunction
{
private:
acl::VectorOfElements val;
public:
PFConstant(acl::VectorOfElements v);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
class PFLinear: public PositionFunction
{
private:
acl::VectorOfElements gradient;
acl::VectorOfElements b;
public:
PFLinear(acl::VectorOfElements g, acl::VectorOfElements p0);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
class PFRotationField: public PositionFunction
{
private:
acl::VectorOfElements axis;
acl::VectorOfElements c;
public:
PFRotationField(acl::VectorOfElements rotationAxis,
acl::VectorOfElements center);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
class PFSign: public PFUnaryOperation
{
public:
PFSign(SPPositionFunction a);
virtual acl::VectorOfElements value(acl::VectorOfElements & pos);
};
SPPositionFunction generatePFLinear(const AVec<double> & g, double p0);
template <typename T>
SPPositionFunction generatePFLinear(const AVec<double> & g, UValue<T> p0);
SPPositionFunction generatePFConstant(const AVec<double> & a);
SPPositionFunction generatePFConstant(double a);
SPPositionFunction generatePFRotationField(const AVec<double> & axis,
const AVec<double> & c);
inline SPPositionFunction operator+(SPPositionFunction a, SPPositionFunction b);
inline SPPositionFunction operator-(SPPositionFunction a, SPPositionFunction b);
inline SPPositionFunction operator-(SPPositionFunction a);
inline SPPositionFunction operator*(SPPositionFunction a, SPPositionFunction b);
inline SPPositionFunction sign(SPPositionFunction a);
SPAbstractDataWithGhostNodes generateDataContainer_SP(const Block &b,
SPPositionFunction df,
unsigned int gN,
acl::TypeID t);
void initData(SPAbstractDataWithGhostNodes d,
SPPositionFunction f);
void initData(SPAbstractDataWithGhostNodes d,
SPPositionFunction f,
const acl::KernelConfiguration & k);
//---------------------------- Implementation --------------------------------
inline SPPositionFunction operator+(SPPositionFunction a, SPPositionFunction b)
{
return SPPositionFunction(new PFOperationPlus(a,b));
}
inline SPPositionFunction operator-(SPPositionFunction a, SPPositionFunction b)
{
return SPPositionFunction(new PFOperationMinus(a,b));
}
inline SPPositionFunction operator-(SPPositionFunction a)
{
return SPPositionFunction(new PFOperationInversion(a));
}
inline SPPositionFunction operator*(SPPositionFunction a, SPPositionFunction b)
{
return SPPositionFunction(new PFOperationProduct(a,b));
}
inline SPPositionFunction sign(SPPositionFunction a)
{
return SPPositionFunction(new PFSign(a));
}
}// asl
#endif // ASLPositionFunction
acl::KernelConfiguration
ACL Kernel configuration class.
Definition: aclKernelConfiguration.h:35
acl::VectorOfElements
The class represents several Element.
Definition: aclVectorOfElementsDef.h:92
asl::AVec< double >
asl::Block
Definition: aslBlocks.h:57
asl::PFBinaryOperation
Definition: aslPositionFunction.h:62
asl::PFBinaryOperation::PFBinaryOperation
PFBinaryOperation(SPPositionFunction a, SPPositionFunction b)
asl::PFBinaryOperation::e2
SPPositionFunction e2
Definition: aslPositionFunction.h:65
asl::PFBinaryOperation::e1
SPPositionFunction e1
Definition: aslPositionFunction.h:64
asl::PFConstant
Definition: aslPositionFunction.h:113
asl::PFConstant::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFConstant::PFConstant
PFConstant(acl::VectorOfElements v)
asl::PFLinear
Definition: aslPositionFunction.h:123
asl::PFLinear::PFLinear
PFLinear(acl::VectorOfElements g, acl::VectorOfElements p0)
asl::PFLinear::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFOperationInversion
Definition: aslPositionFunction.h:105
asl::PFOperationInversion::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFOperationInversion::PFOperationInversion
PFOperationInversion(SPPositionFunction a)
asl::PFOperationMinus
Definition: aslPositionFunction.h:89
asl::PFOperationMinus::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFOperationMinus::PFOperationMinus
PFOperationMinus(SPPositionFunction a, SPPositionFunction b)
asl::PFOperationPlus
Definition: aslPositionFunction.h:81
asl::PFOperationPlus::PFOperationPlus
PFOperationPlus(SPPositionFunction a, SPPositionFunction b)
asl::PFOperationPlus::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFOperationProduct
Definition: aslPositionFunction.h:97
asl::PFOperationProduct::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFOperationProduct::PFOperationProduct
PFOperationProduct(SPPositionFunction a, SPPositionFunction b)
asl::PFRotationField
creates function corresponding to a velocity field
Definition: aslPositionFunction.h:134
asl::PFRotationField::PFRotationField
PFRotationField(acl::VectorOfElements rotationAxis, acl::VectorOfElements center)
asl::PFRotationField::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFSign
Definition: aslPositionFunction.h:149
asl::PFSign::PFSign
PFSign(SPPositionFunction a)
asl::PFSign::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)
asl::PFUnaryOperation
Definition: aslPositionFunction.h:72
asl::PFUnaryOperation::e1
SPPositionFunction e1
Definition: aslPositionFunction.h:74
asl::PFUnaryOperation::PFUnaryOperation
PFUnaryOperation(SPPositionFunction a)
asl::PositionFunction
Definition: aslPositionFunction.h:49
asl::PositionFunction::PositionFunction
PositionFunction()
asl::PositionFunction::value
virtual acl::VectorOfElements value(acl::VectorOfElements &pos)=0
asl::PositionFunction::~PositionFunction
virtual ~PositionFunction()
asl::UValue
Updatable value. This class stores value and its TimeStamp.
Definition: aslUValue.h:35
asl::generateDataContainer_SP
SPDataWrapperACL generateDataContainer_SP(const Block &b, const acl::VectorOfElements &a)
asl::operator-
SPDistanceFunction operator-(SPDistanceFunction a)
asl::generatePFConstant
SPPositionFunction generatePFConstant(const AVec< double > &a)
asl::generatePFRotationField
SPPositionFunction generatePFRotationField(const AVec< double > &axis, const AVec< double > &c)
asl::generatePFLinear
SPPositionFunction generatePFLinear(const AVec< double > &g, double p0)
asl::operator*
SPPositionFunction operator*(SPPositionFunction a, SPPositionFunction b)
Definition: aslPositionFunction.h:215
asl::SPPositionFunction
std::shared_ptr< PositionFunction > SPPositionFunction
Definition: aslPositionFunction.h:58
asl::sign
SPPositionFunction sign(SPPositionFunction a)
Definition: aslPositionFunction.h:220
acl
Advanced Computational Language.
Definition: acl.h:41
acl::TypeID
TypeID
Definition: aclTypes.h:39
asl
Advanced Simulation Library.
Definition: aslDataInc.h:31
asl::SPAbstractDataWithGhostNodes
std::shared_ptr< AbstractDataWithGhostNodes > SPAbstractDataWithGhostNodes
Definition: aslGenerators.h:50
asl::operator+
const AMatr< T > operator+(const AMatr< T > &a, const AMatr< T > &b)
Definition: aslMatrices.h:252
asl::initData
void initData(SPAbstractData d, double a)