/* This file is part of the OpenLB library
*
* Copyright (C) 2014-2016 Cyril Masquelier, Mathias J. Krause, Benjamin Förster
* E-mail contact: info@openlb.net
* The most recent release of OpenLB can be downloaded at
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef INDICATOR_BASE_F_2D_H
#define INDICATOR_BASE_F_2D_H
#include
#include "core/vector.h"
#include "functors/genericF.h"
namespace olb {
/** IndicatorF1D is an application from \f$ \Omega \subset R^3 \to {0,1} \f$.
* \param _myMin holds minimal(component wise) vector of the domain \f$ \Omega \f$.
* \param _myMax holds maximal(component wise) vector of the domain \f$ \Omega \f$.
*/
template
class IndicatorF1D : public GenericF {
protected:
IndicatorF1D();
Vector _myMin;
Vector _myMax;
public:
virtual Vector& getMin();
virtual Vector& getMax();
IndicatorF1D& operator+(IndicatorF1D& rhs);
IndicatorF1D& operator-(IndicatorF1D& rhs);
IndicatorF1D& operator*(IndicatorF1D& rhs);
};
/** IndicatorF2D is an application from \f$ \Omega \subset R^3 \to {0,1} \f$.
* \param _myMin holds minimal(component wise) vector of the domain \f$ \Omega \f$.
* \param _myMax holds maximal(component wise) vector of the domain \f$ \Omega \f$.
*/
template
class IndicatorF2D : public GenericF {
protected:
IndicatorF2D();
Vector _myMin;
Vector _myMax;
public:
using GenericF::operator();
virtual Vector& getMin();
virtual Vector& getMax();
/// returns false or true and pos. distance if there was one found for an given origin and direction
/**
* (mind that the default computation is done by a numerical approximation which searches .. [TODO])
*/
virtual bool distance(S& distance, const Vector& origin, const Vector& direction, int iC=-1);
/// returns true and the normal if there was one found for an given origin and direction
/**
* (mind that the default computation is done by a numerical approximation which searches .. [TODO])
*/
virtual bool normal(Vector& normal, const Vector& origin, const Vector& direction, int iC=-1);
/// Returns true if `point` is inside a cube with corners `_myMin` and `_myMax`
bool isInsideBox(Vector point);
/// Indicator specific function operator overload
/**
* \return Domain indicator i.e. `true` iff the input lies within the described domain.
**/
virtual bool operator() (const S input[]);
};
/////////////////////////////////////IdentityF//////////////////////////////////
template
class IndicatorIdentity2D : public IndicatorF2D {
public:
std::shared_ptr> _f;
IndicatorIdentity2D(std::shared_ptr> f);
bool operator() (bool output[1], const S input[2]) override;
};
}
#endif