From 58e6289578fe60c3ddb95ffb10124f910f920976 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <i-bird@localhost.localdomain> Date: Sun, 26 Jun 2016 21:45:50 +0200 Subject: [PATCH] Support for vector operations --- CHANGELOG.md | 15 +- openfpm_data | 2 +- openfpm_io | 2 +- openfpm_numerics | 2 +- src/Vector/vector_dist.hpp | 30 +- src/Vector/vector_dist_key.hpp | 2 +- src/Vector/vector_dist_operators.hpp | 748 ------------------ .../vector_dist_operators_unit_tests.hpp | 709 ----------------- src/main.cpp | 1 - 9 files changed, 35 insertions(+), 1476 deletions(-) delete mode 100644 src/Vector/vector_dist_operators.hpp delete mode 100644 src/Vector/vector_dist_operators_unit_tests.hpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 610fba5d9..7432543a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,17 @@ # Change Log All notable changes to this project will be documented in this file. -## [0.5.0] - mid July 2016 +## [0.5.0 - Gingold] - End July 2016 ### Added -- map_list map communicate particles across processors mooving the information of all the particle map_list give the possibility to give a list of property to move from one to another processor -- Numeric: Finite Differences discretization with matrix contruction and parallel solvers +- map communicate particles across processors mooving the information of all the particle map_list give the possibility to give a list of property to move from one to another processor +- Numeric: Finite Differences discretization with matrix contruction and parallel solvers (See example ... ) +- vector_dist now support complex object like Point VectorS Box ... , with no limitation + and more generic object like std::vector ... (WARNING TEMPORARY LIMITATION: Communication is not supported property must be excluded from communication using map_list and ghost_get) +- vector_dist support expressions (See example ...) +- No limit to ghost extension (they can be arbitrary extended) +- Multi-phase CellList +- Hilber curve data and computation reordering for cache firndliness ### Fixed @@ -94,5 +100,6 @@ All notable changes to this project will be documented in this file. ## [0.6.0] - Beginning of september ### Added -- Parallel IO, new formats, imroved writers +- Parallel IO, new formats, improved writers +- Algebraic Multigrid solver diff --git a/openfpm_data b/openfpm_data index 32c0433fe..9d44c008f 160000 --- a/openfpm_data +++ b/openfpm_data @@ -1 +1 @@ -Subproject commit 32c0433fe9cf7c125ef2ad019b80955e8f8a73c5 +Subproject commit 9d44c008f04e855666b1ea15d02e681f2bfcf2e9 diff --git a/openfpm_io b/openfpm_io index 088fa4a38..ca2becb04 160000 --- a/openfpm_io +++ b/openfpm_io @@ -1 +1 @@ -Subproject commit 088fa4a38c15f09f48cc78165f56d327d1a399bb +Subproject commit ca2becb045ef96fcf6287f8ef5da2314248bcb66 diff --git a/openfpm_numerics b/openfpm_numerics index 29d4f6074..6274ea12f 160000 --- a/openfpm_numerics +++ b/openfpm_numerics @@ -1 +1 @@ -Subproject commit 29d4f60747846e9f526ac03557904ec8ab93d413 +Subproject commit 6274ea12ff26d87573f361a2b1b801cb1883e38c diff --git a/src/Vector/vector_dist.hpp b/src/Vector/vector_dist.hpp index 0ad857964..a02b273ec 100644 --- a/src/Vector/vector_dist.hpp +++ b/src/Vector/vector_dist.hpp @@ -27,7 +27,6 @@ #include "Vector/vector_dist_ofb.hpp" #include "Decomposition/CartDecomposition.hpp" #include "data_type/aggregate.hpp" -#include "vector_dist_operators.hpp" #define V_SUB_UNIT_FACTOR 64 @@ -776,6 +775,12 @@ private: public: + //! space type + typedef St stype; + + //! dimensions of space + static const unsigned int dims = dim; + /*! \brief Constructor * * \param np number of elements @@ -869,6 +874,20 @@ public: return v_pos.template get<0>(vec_key.getKey()); } + /*! \brief Get the position of an element + * + * see the vector_dist iterator usage to get an element key + * + * \param vec_key element + * + * \return the position of the element in space + * + */ + inline auto getPos(vect_dist_key_dx vec_key) const -> decltype(v_pos.template get<0>(vec_key.getKey())) + { + return v_pos.template get<0>(vec_key.getKey()); + } + /*! \brief Get the property of an element * * see the vector_dist iterator usage to get an element key @@ -1627,15 +1646,6 @@ public: #endif return v_cl; } - - //////////////////////////// Vector expression implementation //////////////////////// - - template <unsigned int prp> inline vector_dist_expression<prp,vector_dist<dim,St,prop,Decomposition,Memory> > getV() - { - vector_dist_expression<prp,vector_dist<dim,St,prop,Decomposition,Memory> > exp_v(*this); - - return exp_v; - } }; diff --git a/src/Vector/vector_dist_key.hpp b/src/Vector/vector_dist_key.hpp index 80f77580f..fb99c0e1b 100644 --- a/src/Vector/vector_dist_key.hpp +++ b/src/Vector/vector_dist_key.hpp @@ -39,7 +39,7 @@ public: * \return the local key * */ - inline size_t getKey() + inline size_t getKey() const { return key; } diff --git a/src/Vector/vector_dist_operators.hpp b/src/Vector/vector_dist_operators.hpp deleted file mode 100644 index 660779247..000000000 --- a/src/Vector/vector_dist_operators.hpp +++ /dev/null @@ -1,748 +0,0 @@ -/* - * vector_dist_operators.hpp - * - * Created on: Jun 11, 2016 - * Author: i-bird - */ - -#ifndef SRC_VECTOR_VECTOR_DIST_OPERATORS_HPP_ -#define SRC_VECTOR_VECTOR_DIST_OPERATORS_HPP_ - -/*! \brief has_init check if a type has defined a - * method called init - * - * - * return true if T::init() is a valid expression (function pointers) - * and produce a defined type - * - */ - -template<typename ObjType, typename Sfinae = void> -struct has_init: std::false_type {}; - -template<typename ObjType> -struct has_init<ObjType, typename Void<typename ObjType::has_init>::type> : std::true_type -{}; - -/*! \brief Call the init function if needed - * - * \param r_exp expression - * - */ -template <typename T, bool has_init = has_init<T>::value > -struct call_init_if_needed -{ - static inline void call(T & r_exp) - { - r_exp.init(); - } -}; - -template <typename T> -struct call_init_if_needed<T,false> -{ - static inline void call(T & r_exp) - { - } -}; - - -#define SUM 1 -#define SUB 2 -#define MUL 3 -#define DIV 4 - -/*! \brief Unknown operation specialization - * - * \tparam exp1 expression1 - * \tparam exp2 expression2 - * - */ -template <typename exp1, typename exp2, unsigned int op> -class vector_dist_expression_op -{ - -}; - -/*! \brief Sum operation - * - * \tparam exp1 expression1 - * \tparam exp2 expression2 - * - */ -template <typename exp1, typename exp2> -class vector_dist_expression_op<exp1,exp2,SUM> -{ - const exp1 o1; - const exp2 o2; - -public: - - inline vector_dist_expression_op(const exp1 & o1, const exp2 & o2) - :o1(o1),o2(o2) - {} - - /*! \brief Evaluate the expression - * - * \param key where to evaluate the expression - * - */ - template<typename r_type=typename std::remove_reference<decltype(o1.value(vect_dist_key_dx(0)) + o2.value(vect_dist_key_dx(0)))>::type > inline r_type value(const vect_dist_key_dx & key) const - { - return o1.value(key) + o2.value(key); - } -}; - -/*! \brief Subtraction operation - * - * \tparam exp1 expression1 - * \tparam exp2 expression2 - * - */ -template <typename exp1, typename exp2> -class vector_dist_expression_op<exp1,exp2,SUB> -{ - const exp1 o1; - const exp2 o2; - -public: - - inline vector_dist_expression_op(const exp1 & o1, const exp2 & o2) - :o1(o1),o2(o2) - {} - - /*! \brief Evaluate the expression - * - * \param key where to evaluate the expression - * - */ - template<typename r_type=typename std::remove_reference<decltype(o1.value(vect_dist_key_dx(0)) - o2.value(vect_dist_key_dx(0)))>::type > inline r_type value(const vect_dist_key_dx & key) const - { - return o1.value(key) - o2.value(key); - } - -}; - -/*! \brief Multiplication operation - * - * \tparam exp1 expression1 - * \tparam exp2 expression2 - * - */ -template <typename exp1, typename exp2> -class vector_dist_expression_op<exp1,exp2,MUL> -{ - const exp1 o1; - const exp2 o2; - -public: - - vector_dist_expression_op(const exp1 & o1, const exp2 & o2) - :o1(o1),o2(o2) - {} - - /*! \brief Evaluate the expression - * - * \param key where to evaluate the expression - * - */ - template<typename r_type=typename std::remove_reference<decltype(o1.value(vect_dist_key_dx(0)) * o2.value(vect_dist_key_dx(0)))>::type > inline r_type value(const vect_dist_key_dx & key) const - { - return o1.value(key) * o2.value(key); - } - -}; - -/*! \brief Division operation - * - * \tparam exp1 expression1 - * \tparam exp2 expression2 - * - */ -template <typename exp1, typename exp2> -class vector_dist_expression_op<exp1,exp2,DIV> -{ - const exp1 o1; - const exp2 o2; - -public: - - vector_dist_expression_op(const exp1 & o1, const exp2 & o2) - :o1(o1),o2(o2) - {} - - /*! \brief Evaluate the expression - * - * \param key where to evaluate the expression - * - */ - template<typename r_type=typename std::remove_reference<decltype(o1.value(vect_dist_key_dx(0)) / o2.value(vect_dist_key_dx(0)))>::type > inline r_type value(const vect_dist_key_dx & key) const - { - return o1.value(key) / o2.value(key); - } - -}; - -/*! \brief Main class that encapsulate a vector properties - * - * \tparam prp property involved - * \tparam vector involved - * - */ -template<unsigned int prp, typename vector> -class vector_dist_expression -{ - vector & v; - -public: - - vector_dist_expression(vector & v) - :v(v) - {} - - /*! \brief Evaluate the expression - * - * \param key where to evaluate the expression - * - */ - inline auto value(const vect_dist_key_dx & k) const -> decltype(v.template getProp<prp>(k)) - { - return v.template getProp<prp>(k); - } - - /*! \brief Fill the vector property with the evaluated expression - * - * \param v_exp expression to evaluate - * - */ - template<typename exp1, typename exp2, unsigned int op> vector & operator=(const vector_dist_expression_op<exp1,exp2,op> & v_exp) - { - auto it = v.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - auto exp = v_exp.value(key); - call_init_if_needed<decltype(exp)>::call(exp); - v.template getProp<prp>(key) = v_exp.value(key); - - ++it; - } - - return v; - } - - /*! \brief Fill the vector property with the double - * - * \param d value to fill - * - */ - vector & operator=(double d) - { - auto it = v.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - v.template getProp<prp>(key) = d; - - ++it; - } - - return v; - } -}; - -/*! \brief Main class that encapsulate a double constant - * - * \param prp no meaning - * - */ -template<unsigned int prp> -class vector_dist_expression<prp,double> -{ - double d; - -public: - - inline vector_dist_expression(double & d) - :d(d) - {} - - /*! \brief Evaluate the expression - * - * It just return the velue set in the constructor - * - */ - inline double value(const vect_dist_key_dx & k) const - { - return d; - } -}; - - -/* \brief sum two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int p1, unsigned int p2, typename v1, typename v2> -inline vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression<p2,v2>,SUM> -operator+(const vector_dist_expression<p1,v1> & va, const vector_dist_expression<p2,v2> & vb) -{ - vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression<p2,v2>,SUM> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief sum two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1 , typename exp2, unsigned int op1, unsigned int prp1, typename v1> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<prp1,v1>,SUM> -operator+(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression<prp1,v1> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<prp1,v1>,SUM> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief sum two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1 , typename exp2, unsigned int op1, unsigned int prp1, typename v1> -inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression_op<exp1,exp2,op1>,SUM> -operator+(const vector_dist_expression<prp1,v1> & va, const vector_dist_expression_op<exp1,exp2,op1> & vb) -{ - vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression_op<exp1,exp2,op1>,SUM> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief sum two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1 , typename exp2, unsigned int op1, typename exp3 , typename exp4, unsigned int op2> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,SUM> -operator+(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression_op<exp3,exp4,op2> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,SUM> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief sum two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1 , typename v1> -inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<0,double>,SUM> -operator+(const vector_dist_expression<prp1,v1> & va, double d) -{ - vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<0,double>,SUM> exp_sum(va,vector_dist_expression<0,double>(d)); - - return exp_sum; -} - -/* \brief sum two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1 , typename v1> -inline vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<prp1,v1>,SUM> -operator+(double d, const vector_dist_expression<prp1,v1> & vb) -{ - vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<prp1,v1>,SUM> exp_sum(vector_dist_expression<0,double>(d),vb); - - return exp_sum; -} - -/* \brief sum two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1 , typename exp2, unsigned int op1> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<0,double>,SUM> -operator+(const vector_dist_expression_op<exp1,exp2,op1> & va, double d) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<0,double>,SUM> exp_sum(va,vector_dist_expression<0,double>(d)); - - return exp_sum; -} - - -/* \brief subtract two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int p1, unsigned int p2, typename v1, typename v2> -inline vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression<p2,v2>,SUB> -operator-(const vector_dist_expression<p1,v1> & va, const vector_dist_expression<p2,v2> & vb) -{ - vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression<p2,v2>,SUB> exp_sum(va,vb); - - return exp_sum; -} - - -/* \brief subtract two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1, typename exp2, unsigned int op1, unsigned int p2, typename v2> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<p2,v2>,SUB> -operator-(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression<p2,v2> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<p2,v2>,SUB> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief subtract two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1, typename exp2, unsigned int op1, unsigned int p2, typename v2> -inline vector_dist_expression_op<vector_dist_expression<p2,v2>,vector_dist_expression_op<exp1,exp2,op1>,SUB> -operator-(const vector_dist_expression<p2,v2> & va, const vector_dist_expression_op<exp1,exp2,op1> & vb) -{ - vector_dist_expression_op<vector_dist_expression<p2,v2>, vector_dist_expression_op<exp1,exp2,op1>,SUB> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief subtract two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1, typename exp2, unsigned int op1, typename exp3, typename exp4, unsigned int op2> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,SUB> -operator-(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression_op<exp3,exp4,op2> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,SUB> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief subtract two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1, typename v1> -inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<0,double>,SUB> -operator-(const vector_dist_expression<prp1,v1> & va, double d) -{ - vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<0,double>,SUB> exp_sum(va,vector_dist_expression<0,double>(d)); - - return exp_sum; -} - -/* \brief subtract two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1, typename v1> -inline vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<prp1,v1>,SUB> -operator-(double d, const vector_dist_expression<prp1,v1> & vb) -{ - vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<prp1,v1>,SUB> exp_sum(vector_dist_expression<0,double>(d),vb); - - return exp_sum; -} - -/* \brief Multiply two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int p2, typename v2> -inline vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<p2,v2>,MUL> -operator*(double d, const vector_dist_expression<p2,v2> & vb) -{ - vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<p2,v2>,MUL> exp_sum(vector_dist_expression<0,double>(d),vb); - - return exp_sum; -} - -/* \brief Multiply two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int p2, typename v2> -inline vector_dist_expression_op<vector_dist_expression<p2,v2>,vector_dist_expression<0,double>,MUL> -operator*(const vector_dist_expression<p2,v2> & va, double d) -{ - vector_dist_expression_op<vector_dist_expression<p2,v2>,vector_dist_expression<0,double>,MUL> exp_sum(va,vector_dist_expression<0,double>(d)); - - return exp_sum; -} - -/* \brief Multiply two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int p1, typename v1,unsigned int p2, typename v2> -inline vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression<p2,v2>,MUL> -operator*(const vector_dist_expression<p1,v1> & va, const vector_dist_expression<p2,v2> & vb) -{ - vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression<p2,v2>,MUL> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief Multiply two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int p1, typename v1, typename exp1, typename exp2, unsigned int op1> -inline vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression_op<exp1,exp2,op1>,MUL> -operator*(const vector_dist_expression<p1,v1> & va, const vector_dist_expression_op<exp1,exp2,op1> & vb) -{ - vector_dist_expression_op<vector_dist_expression<p1,v1>,vector_dist_expression_op<exp1,exp2,op1>,MUL> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief Multiply two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int p1, typename v1, typename exp1, typename exp2, unsigned int op1> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<p1,v1>,MUL> -operator*(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression<p1,v1> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<p1,v1>,MUL> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief Multiply two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1, typename exp2, unsigned int op1, typename exp3 , typename exp4, unsigned int op2> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,MUL> -operator*(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression_op<exp3,exp4,op2> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,MUL> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1, typename exp2, unsigned int op1> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<0,double>,DIV> -operator/(const vector_dist_expression_op<exp1,exp2,op1> & va, double d) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<0,double>,DIV> exp_sum(va,vector_dist_expression<0,double>(d)); - - return exp_sum; -} - - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1, typename exp2, unsigned int op1> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<0,double>,DIV> -operator/(double d, const vector_dist_expression_op<exp1,exp2,op1> & va) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<0,double>,DIV> exp_sum(vector_dist_expression<0,double>(d),va); - - return exp_sum; -} - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1, typename v1> -inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<0,double>,DIV> -operator/(const vector_dist_expression<prp1,v1> & va, double d) -{ - vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<0,double>,DIV> exp_sum(va,vector_dist_expression<0,double>(d)); - - return exp_sum; -} - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1, typename v1> -inline vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<prp1,v1>,DIV> -operator/(double d, const vector_dist_expression<prp1,v1> & va) -{ - vector_dist_expression_op<vector_dist_expression<0,double>,vector_dist_expression<prp1,v1>,DIV> exp_sum(vector_dist_expression<0,double>(d),va); - - return exp_sum; -} - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1, typename v1, unsigned int prp2, typename v2> -inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<prp2,v2>,DIV> -operator/(const vector_dist_expression<prp1,v1> & va, const vector_dist_expression<prp2,v2> & vb) -{ - vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression<prp2,v2>,DIV> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1, typename v1, typename exp1,typename exp2, unsigned int op1> -inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression_op<exp1,exp2,op1>,DIV> -operator/(const vector_dist_expression<prp1,v1> & va, const vector_dist_expression_op<exp1,exp2,op1> & vb) -{ - vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_dist_expression_op<exp1,exp2,op1>,DIV> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<unsigned int prp1, typename v1, typename exp1,typename exp2, unsigned int op1> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<prp1,v1>,DIV> -operator/(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression<prp1,v1> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression<prp1,v1>,DIV> exp_sum(va,vb); - - return exp_sum; -} - -/* \brief Divide two distributed vector expression - * - * \param va vector expression one - * \param vb vector expression two - * - * \return an object that encapsulate the expression - * - */ -template<typename exp1,typename exp2, unsigned int op1, typename exp3, typename exp4, unsigned int op2> -inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,DIV> -operator/(const vector_dist_expression_op<exp1,exp2,op1> & va, const vector_dist_expression_op<exp3,exp4,op2> & vb) -{ - vector_dist_expression_op<vector_dist_expression_op<exp1,exp2,op1>,vector_dist_expression_op<exp3,exp4,op2>,DIV> exp_sum(va,vb); - - return exp_sum; -} - -#endif /* SRC_VECTOR_VECTOR_DIST_OPERATORS_HPP_ */ diff --git a/src/Vector/vector_dist_operators_unit_tests.hpp b/src/Vector/vector_dist_operators_unit_tests.hpp deleted file mode 100644 index 856f6ed41..000000000 --- a/src/Vector/vector_dist_operators_unit_tests.hpp +++ /dev/null @@ -1,709 +0,0 @@ -/* - * vector_dist_operators_unit_tests.hpp - * - * Created on: Jun 11, 2016 - * Author: i-bird - */ - -#ifndef SRC_VECTOR_VECTOR_DIST_OPERATORS_UNIT_TESTS_HPP_ -#define SRC_VECTOR_VECTOR_DIST_OPERATORS_UNIT_TESTS_HPP_ - -constexpr int A = 0; -constexpr int B = 1; -constexpr int C = 2; - -constexpr int PA = 3; -constexpr int PB = 4; -constexpr int PC = 5; - -//////////////////// Here we define all the function to checl the operators - -template <unsigned int prp, typename vector> bool check_values(const vector & v,float a) -{ - bool ret = true; - auto it = v.getDomainIterator(); - - while (it.isNext()) - { - ret &= v.template getProp<prp>(it.get()) == a; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename vector> bool check_values_complex_expr(const vector & vd) -{ - bool ret = true; - auto it = vd.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - float base1 = vd.template getProp<B>(key) + 2.0 + vd.template getProp<B>(key) - 2.0*vd.template getProp<C>(key) / 5.0; - float base2 = vd.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sum(const vector & vd, double d) -{ - bool ret = true; - auto it = vd.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd.template getProp<B>(key) + d; - rtype base2 = vd.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sum(const vector & vd1, const vector & vd2) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<B>(key) + vd2.template getProp<C>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sum_3(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<B>(key) + vd1.template getProp<C>(key) + vd1.template getProp<B>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sum_4(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<B>(key) + vd1.template getProp<C>(key) + vd1.template getProp<B>(key) + vd1.template getProp<C>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sub(const vector & vd, double d) -{ - bool ret = true; - auto it = vd.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd.template getProp<B>(key) - d; - rtype base2 = vd.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sub(double d, const vector & vd) -{ - bool ret = true; - auto it = vd.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = d - vd.template getProp<B>(key); - rtype base2 = vd.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sub(const vector & vd1, const vector & vd2) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<C>(key) - vd2.template getProp<B>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sub_31(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<B>(key) - (vd1.template getProp<C>(key) + vd1.template getProp<B>(key)); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sub_32(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = (vd1.template getProp<C>(key) + vd1.template getProp<B>(key)) - vd1.template getProp<B>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_sub_4(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = (vd1.template getProp<C>(key) + vd1.template getProp<B>(key)) - (vd1.template getProp<C>(key) + vd1.template getProp<B>(key)); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_mul(const vector & vd, double d) -{ - bool ret = true; - auto it = vd.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd.template getProp<B>(key) * d; - rtype base2 = vd.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_mul(const vector & vd1, const vector & vd2) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<C>(key) * vd2.template getProp<B>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_mul_3(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<B>(key) * (vd1.template getProp<B>(key) + vd1.template getProp<C>(key)); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_mul_4(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = (vd1.template getProp<B>(key) + vd1.template getProp<C>(key)) * (vd1.template getProp<B>(key) + vd1.template getProp<C>(key)); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - - - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_div(const vector & vd, double d) -{ - bool ret = true; - auto it = vd.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd.template getProp<B>(key) / d; - rtype base2 = vd.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_div(double d, const vector & vd) -{ - bool ret = true; - auto it = vd.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = d / vd.template getProp<B>(key); - rtype base2 = vd.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_div(const vector & vd1, const vector & vd2) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<C>(key) / vd2.template getProp<B>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_div_31(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = vd1.template getProp<B>(key) / (vd1.template getProp<B>(key) + vd1.template getProp<C>(key)); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_div_32(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = (vd1.template getProp<C>(key) + vd1.template getProp<B>(key)) / vd1.template getProp<B>(key); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - - -template <typename rtype, typename vector, unsigned int A, unsigned int B, unsigned int C> bool check_values_div_4(const vector & vd1) -{ - bool ret = true; - auto it = vd1.getDomainIterator(); - - while (it.isNext()) - { - auto key = it.get(); - - rtype base1 = (vd1.template getProp<B>(key) + vd1.template getProp<C>(key)) / (vd1.template getProp<B>(key) + vd1.template getProp<C>(key)); - rtype base2 = vd1.template getProp<A>(key); - - ret &= base1 == base2; - - ++it; - } - - BOOST_REQUIRE_EQUAL(ret,true); - - return ret; -} - - -template <typename vector> void fill_values(const vector & v) -{ - auto it = v.getDomainIterator(); - - while (it.isNext()) - { - auto p = it.get(); - - v.template getProp<A>(p) = p.getKey()+1; - v.template getProp<B>(p) = 2.0*p.getKey()+1; - v.template getProp<C>(p) = 3.0*p.getKey()+1; - - for (size_t k = 0 ; k < 3 ; k++) - { - v.template getProp<PA>(p) = p.getKey()+1+k; - v.template getProp<PB>(p) = 2.0*p.getKey()+1+k; - v.template getProp<PC>(p) = 3.0*p.getKey()+1+k; - } - - ++it; - } -} - -float getProp0(vector_dist<3,float,aggregate<float,float,float,VectorS<3,float>,VectorS<3,float>,VectorS<3,float>>> & v, size_t p) -{ - return v.template getProp<A>(p); -} - -//////////////////////////////////////////////////////////////////////////// - -BOOST_AUTO_TEST_SUITE( vector_dist_test ) - - -BOOST_AUTO_TEST_CASE( vector_dist_operators_test ) -{ - if (create_vcluster().getProcessingUnits() > 3) - return; - - Box<3,float> box({0.0,0.0,0.0},{1.0,1.0,1.0}); - - // Boundary conditions - size_t bc[3]={PERIODIC,PERIODIC,PERIODIC}; - - // ghost - Ghost<3,float> ghost(0.05); - - // vector type - typedef vector_dist<3,float,aggregate<float,float,float,VectorS<3,float>,VectorS<3,float>,VectorS<3,float>>> vtype; - - vector_dist<3,float,aggregate<float,float,float,VectorS<3,float>,VectorS<3,float>,VectorS<3,float>>> vd(100,box,bc,ghost); - - vd.getV<A>() = 1.0; - vd.getV<B>() = 2.0f; - vd.getV<C>() = 3.0; - - check_values<A>(vd,1.0); - check_values<B>(vd,2.0); - check_values<C>(vd,3.0); - - fill_values(vd); - - vd.getV<A>() = vd.getV<B>() + 2.0 + vd.getV<B>() - 2.0*vd.getV<C>() / 5.0; - check_values_complex_expr(vd); - - // Various combination of 2 operator - - vd.getV<A>() = vd.getV<B>() + 2.0; - check_values_sum<float,vtype,A,B,C>(vd,2.0); - vd.getV<A>() = 2.0 + vd.getV<B>(); - check_values_sum<float,vtype,A,B,C>(vd,2.0); - vd.getV<A>() = vd.getV<C>() + vd.getV<B>(); - check_values_sum<float,vtype,A,B,C>(vd,vd); - - vd.getV<A>() = vd.getV<B>() - 2.0; - check_values_sub<float,vtype,A,B,C>(vd,2.0); - vd.getV<A>() = 2.0 - vd.getV<B>(); - check_values_sub<float,vtype,A,B,C>(2.0,vd); - vd.getV<A>() = vd.getV<C>() - vd.getV<B>(); - check_values_sub<float,vtype,A,B,C>(vd,vd); - - vd.getV<A>() = vd.getV<B>() * 2.0; - check_values_mul<float,vtype,A,B,C>(vd,2.0); - vd.getV<A>() = 2.0 * vd.getV<B>(); - check_values_mul<float,vtype,A,B,C>(vd,2.0); - vd.getV<A>() = vd.getV<C>() * vd.getV<B>(); - check_values_mul<float,vtype,A,B,C>(vd,vd); - - vd.getV<A>() = vd.getV<B>() / 2.0; - check_values_div<float,vtype,A,B,C>(vd,2.0); - vd.getV<A>() = 2.0 / vd.getV<B>(); - check_values_div<float,vtype,A,B,C>(2.0,vd); - vd.getV<A>() = vd.getV<C>() / vd.getV<B>(); - check_values_div<float,vtype,A,B,C>(vd,vd); - - // Variuos combination 3 operator - - vd.getV<A>() = vd.getV<B>() + (vd.getV<C>() + vd.getV<B>()); - check_values_sum_3<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) + vd.getV<B>(); - check_values_sum_3<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) + (vd.getV<C>() + vd.getV<B>()); - check_values_sum_4<float,vtype,A,B,C>(vd); - - vd.getV<A>() = vd.getV<B>() - (vd.getV<C>() + vd.getV<B>()); - check_values_sub_31<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) - vd.getV<B>(); - check_values_sub_32<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) - (vd.getV<C>() + vd.getV<B>()); - check_values_sub_4<float,vtype,A,B,C>(vd); - - vd.getV<A>() = vd.getV<B>() * (vd.getV<C>() + vd.getV<B>()); - check_values_mul_3<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) * vd.getV<B>(); - check_values_mul_3<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) * (vd.getV<C>() + vd.getV<B>()); - check_values_mul_4<float,vtype,A,B,C>(vd); - - vd.getV<A>() = vd.getV<B>() / (vd.getV<C>() + vd.getV<B>()); - check_values_div_31<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) / vd.getV<B>(); - check_values_div_32<float,vtype,A,B,C>(vd); - vd.getV<A>() = (vd.getV<C>() + vd.getV<B>()) / (vd.getV<C>() + vd.getV<B>()); - check_values_div_4<float,vtype,A,B,C>(vd); - - // We try with vectors - - // Various combination of 2 operator - - vd.getV<PA>() = vd.getV<PB>() + 2.0; - check_values_sum<VectorS<3,float>,vtype,PA,PB,PC>(vd,2.0); - vd.getV<PA>() = 2.0 + vd.getV<PB>(); - check_values_sum<VectorS<3,float>,vtype,PA,PB,PC>(vd,2.0); - vd.getV<PA>() = vd.getV<PC>() + vd.getV<PB>(); - check_values_sum<VectorS<3,float>,vtype,PA,PB,PC>(vd,vd); - - vd.getV<PA>() = vd.getV<PB>() - 2.0; - check_values_sub<VectorS<3,float>,vtype,PA,PB,PC>(vd,2.0); - vd.getV<PA>() = 2.0 - vd.getV<PB>(); - check_values_sub<VectorS<3,float>,vtype,PA,PB,PC>(2.0,vd); - vd.getV<PA>() = vd.getV<PC>() - vd.getV<PB>(); - check_values_sub<VectorS<3,float>,vtype,PA,PB,PC>(vd,vd); - - vd.getV<PA>() = vd.getV<PB>() * 2.0; - check_values_mul<VectorS<3,float>,vtype,PA,PB,PC>(vd,2.0); - vd.getV<PA>() = 2.0 * vd.getV<PB>(); - check_values_mul<VectorS<3,float>,vtype,PA,PB,PC>(vd,2.0); - vd.getV<PA>() = vd.getV<PC>() * vd.getV<PB>(); - check_values_mul<VectorS<3,float>,vtype,PA,PB,PC>(vd,vd); - - vd.getV<PA>() = vd.getV<PB>() / 2.0; - check_values_div<VectorS<3,float>,vtype,PA,PB,PC>(vd,2.0); - vd.getV<PA>() = 2.0 / vd.getV<PB>(); - check_values_div<VectorS<3,float>,vtype,PA,PB,PC>(2.0,vd); - vd.getV<PA>() = vd.getV<PC>() / vd.getV<PB>(); - check_values_div<VectorS<3,float>,vtype,PA,PB,PC>(vd,vd); - - // Variuos combination 3 operator - - vd.getV<PA>() = vd.getV<PB>() + (vd.getV<PC>() + vd.getV<PB>()); - check_values_sum_3<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) + vd.getV<PB>(); - check_values_sum_3<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) + (vd.getV<PC>() + vd.getV<PB>()); - check_values_sum_4<VectorS<3,float>,vtype,PA,PB,PC>(vd); - - vd.getV<PA>() = vd.getV<PB>() - (vd.getV<PC>() + vd.getV<PB>()); - check_values_sub_31<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) - vd.getV<PB>(); - check_values_sub_32<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) - (vd.getV<PC>() + vd.getV<PB>()); - check_values_sub_4<VectorS<3,float>,vtype,PA,PB,PC>(vd); - - vd.getV<PA>() = vd.getV<PB>() * (vd.getV<PC>() + vd.getV<PB>()); - check_values_mul_3<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) * vd.getV<PB>(); - check_values_mul_3<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) * (vd.getV<PC>() + vd.getV<PB>()); - check_values_mul_4<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<A>() = vd.getV<PB>() * (vd.getV<PC>() + vd.getV<PB>()); - check_values_mul_3<float,vtype,A,PB,PC>(vd); - vd.getV<A>() = (vd.getV<PC>() + vd.getV<PB>()) * vd.getV<PB>(); - check_values_mul_3<float,vtype,A,PB,PC>(vd); - vd.getV<A>() = (vd.getV<PC>() + vd.getV<PB>()) * (vd.getV<PC>() + vd.getV<PB>()); - check_values_mul_4<float,vtype,A,PB,PC>(vd); - - vd.getV<PA>() = vd.getV<PB>() / (vd.getV<PC>() + vd.getV<PB>()); - check_values_div_31<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) / vd.getV<PB>(); - check_values_div_32<VectorS<3,float>,vtype,PA,PB,PC>(vd); - vd.getV<PA>() = (vd.getV<PC>() + vd.getV<PB>()) / (vd.getV<PC>() + vd.getV<PB>()); - check_values_div_4<VectorS<3,float>,vtype,PA,PB,PC>(vd); - - // normalization function - - -} - -BOOST_AUTO_TEST_SUITE_END() - - - -#endif /* SRC_VECTOR_VECTOR_DIST_OPERATORS_UNIT_TESTS_HPP_ */ diff --git a/src/main.cpp b/src/main.cpp index 98435d5c9..3a554a6e4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,7 +26,6 @@ #include "dec_optimizer_unit_test.hpp" #include "Grid/grid_dist_id_unit_test.hpp" #include "Vector/vector_dist_unit_test.hpp" -#include "Vector/vector_dist_operators_unit_tests.hpp" #include "Decomposition/Distribution/Distribution_unit_tests.hpp" //#include "DLB/DLB_unit_test.hpp" #include "Graph/dist_map_graph_unit_test.hpp" -- GitLab