vector_dist_operators_extensions.hpp 1.3 KB
Newer Older
Pietro Incardona's avatar
Pietro Incardona committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * vector_dist_operators_extensions.hpp
 *
 *  Created on: Jul 18, 2016
 *      Author: i-bird
 */

#ifndef OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATORS_EXTENSIONS_HPP_
#define OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATORS_EXTENSIONS_HPP_


/*! \Create an expression from a Point
 *
 * \tpatam prp property
 * \param v
 *
 */
template <unsigned int dim, typename T> inline vector_dist_expression<16384,Point<dim,T> > getVExpr(Point<dim,T> & v)
{
	vector_dist_expression<(unsigned int)16384,Point<dim,T>> exp_v(v);

	return exp_v;
}


26
/*! \brief This class represent a constant parameter in a vector expression
Pietro Incardona's avatar
Pietro Incardona committed
27
 *
28
 * \tparam point type of point
Pietro Incardona's avatar
Pietro Incardona committed
29 30 31 32 33
 *
 */
template<typename point>
class vector_dist_expression<16384,point>
{
34
	//! constant point stored
Pietro Incardona's avatar
Pietro Incardona committed
35 36 37 38
	point p;

public:

39
	//! vector expression from a constant point
Pietro Incardona's avatar
Pietro Incardona committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53
	vector_dist_expression(point p)
	:p(p)
	{}

	/*! \brief This function must be called before value
	 *
	 * it initialize the expression if needed
	 *
	 */
	inline void init() const
	{}

	/*! \brief Evaluate the expression
	 *
54 55 56
	 * \param k where to evaluate the expression (ignored)
	 *
	 * \return the point stored
Pietro Incardona's avatar
Pietro Incardona committed
57 58 59 60 61 62 63 64 65 66
	 *
	 */
	inline point value(const vect_dist_key_dx & k) const
	{
		return p;
	}
};


#endif /* OPENFPM_NUMERICS_SRC_OPERATORS_VECTOR_VECTOR_DIST_OPERATORS_EXTENSIONS_HPP_ */