Commit 6794c24b authored by incardon's avatar incardon

Fixing change name in VCluster

parent 6abb6a87
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
LINKLIBS = $(OPENMP_LDFLAGS) $(LIBHILBERT_LIB) $(PETSC_LIB) $(SUITESPARSE_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(METIS_LIB) $(PARMETIS_LIB) $(DEFAULT_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_IOSTREAMS_LIB) $(HDF5_LDFLAGS) $(HDF5_LIBS) $(LIBQUADMATH) $(OPENMP_LDFLAGS) $(LIBIFCORE) LINKLIBS = $(OPENMP_LDFLAGS) $(LIBHILBERT_LIB) $(PETSC_LIB) $(SUITESPARSE_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(METIS_LIB) $(PARMETIS_LIB) $(DEFAULT_LIB) $(PTHREAD_LIBS) $(OPT_LIBS) $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB) $(BOOST_IOSTREAMS_LIB) $(HDF5_LDFLAGS) $(HDF5_LIBS) $(LIBQUADMATH) $(OPENMP_LDFLAGS) $(LIBIFCORE)
noinst_PROGRAMS = numerics noinst_PROGRAMS = numerics
numerics_SOURCES = main.cpp ../../openfpm_vcluster/src/VCluster.cpp ../../openfpm_devices/src/memory/HeapMemory.cpp ../../openfpm_devices/src/memory/PtrMemory.cpp ../../openfpm_devices/src/Memleak_check.cpp numerics_SOURCES = main.cpp ../../openfpm_vcluster/src/VCluster/VCluster.cpp ../../openfpm_devices/src/memory/HeapMemory.cpp ../../openfpm_devices/src/memory/PtrMemory.cpp ../../openfpm_devices/src/Memleak_check.cpp
numerics_CXXFLAGS = $(OPENMP_CFLAGS) $(LIBHILBERT_INCLUDE) $(AM_CXXFLAGS) $(HDF5_CPPFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) $(SUITESPARSE_INCLUDE) $(METIS_INCLUDE) $(PARMETIS_INCLUDE) $(EIGEN_INCLUDE) $(PETSC_INCLUDE) -Wno-deprecated-declarations -Wno-unused-local-typedefs numerics_CXXFLAGS = $(OPENMP_CFLAGS) $(LIBHILBERT_INCLUDE) $(AM_CXXFLAGS) $(HDF5_CPPFLAGS) $(INCLUDES_PATH) $(BOOST_CPPFLAGS) $(SUITESPARSE_INCLUDE) $(METIS_INCLUDE) $(PARMETIS_INCLUDE) $(EIGEN_INCLUDE) $(PETSC_INCLUDE) -Wno-deprecated-declarations -Wno-unused-local-typedefs
numerics_CFLAGS = $(CUDA_CFLAGS) numerics_CFLAGS = $(CUDA_CFLAGS)
numerics_LDADD = $(LINKLIBS) -lparmetis -lmetis numerics_LDADD = $(LINKLIBS) -lparmetis -lmetis
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "Vector/map_vector.hpp" #include "Vector/map_vector.hpp"
#include <boost/mpl/int.hpp> #include <boost/mpl/int.hpp>
#include "VCluster.hpp" #include "VCluster/VCluster.hpp"
#define EIGEN_TRIPLET 1 #define EIGEN_TRIPLET 1
......
...@@ -199,15 +199,27 @@ struct apply_kernel_is_number_or_expression_gen ...@@ -199,15 +199,27 @@ struct apply_kernel_is_number_or_expression_gen
template <typename exp1,typename vector_type> template <typename exp1,typename vector_type>
class vector_dist_expression_op<exp1,vector_type,VECT_APPLYKER_IN> class vector_dist_expression_op<exp1,vector_type,VECT_APPLYKER_IN>
{ {
//! Type of neighborhood
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<0>>::type NN; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<0>>::type NN;
//! Type of kernel
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<1>>::type Kernel; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<1>>::type Kernel;
// Type of the vector containing the particles
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<2>>::type vector_orig; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<2>>::type vector_orig;
//! expression
const exp1 o1; const exp1 o1;
//! neighborhood list
NN & cl; NN & cl;
//! kernel
Kernel & ker; Kernel & ker;
//! Vector of particles
const vector_orig & vd; const vector_orig & vd;
//! Return type of the expression
typedef typename apply_kernel_rtype<decltype(o1.value(vect_dist_key_dx(0)))>::rtype rtype; typedef typename apply_kernel_rtype<decltype(o1.value(vect_dist_key_dx(0)))>::rtype rtype;
public: public:
...@@ -246,14 +258,25 @@ public: ...@@ -246,14 +258,25 @@ public:
template <typename exp1,typename vector_type> template <typename exp1,typename vector_type>
class vector_dist_expression_op<exp1,vector_type,VECT_APPLYKER_IN_SIM> class vector_dist_expression_op<exp1,vector_type,VECT_APPLYKER_IN_SIM>
{ {
//! Type of neighborhood list
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<0>>::type NN; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<0>>::type NN;
//! Type of the kernel
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<1>>::type Kernel; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<1>>::type Kernel;
//! Type that store the particles
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<2>>::type vector_orig; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<2>>::type vector_orig;
//! Neighborhood list
NN & cl; NN & cl;
//! kernel
Kernel & ker; Kernel & ker;
//! vector of particles
const vector_orig & vd; const vector_orig & vd;
//! return type of the expression
typedef typename apply_kernel_rtype<decltype(std::declval<Kernel>().value(Point<vector_orig::dims,typename vector_orig::stype>(0.0), Point<vector_orig::dims,typename vector_orig::stype>(0.0) ) )>::rtype rtype; typedef typename apply_kernel_rtype<decltype(std::declval<Kernel>().value(Point<vector_orig::dims,typename vector_orig::stype>(0.0), Point<vector_orig::dims,typename vector_orig::stype>(0.0) ) )>::rtype rtype;
...@@ -268,6 +291,13 @@ public: ...@@ -268,6 +291,13 @@ public:
{ {
} }
/*! \brief Constructor
*
* \param cl neighborhood-list
* \param ker kernel to apply
* \param vd particle set to which apply the kernel
*
*/
vector_dist_expression_op(NN & cl, Kernel & ker, const vector_orig & vd) vector_dist_expression_op(NN & cl, Kernel & ker, const vector_orig & vd)
:cl(cl),ker(ker),vd(vd) :cl(cl),ker(ker),vd(vd)
{} {}
...@@ -293,15 +323,28 @@ public: ...@@ -293,15 +323,28 @@ public:
template <typename exp1,typename vector_type> template <typename exp1,typename vector_type>
class vector_dist_expression_op<exp1,vector_type,VECT_APPLYKER_IN_GEN> class vector_dist_expression_op<exp1,vector_type,VECT_APPLYKER_IN_GEN>
{ {
//! Type of nearest neighborhood
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<0>>::type NN; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<0>>::type NN;
//! Type of kernel
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<1>>::type Kernel; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<1>>::type Kernel;
//! Type of vector
typedef typename boost::mpl::at<vector_type,boost::mpl::int_<2>>::type vector_orig; typedef typename boost::mpl::at<vector_type,boost::mpl::int_<2>>::type vector_orig;
//! expression 1
const exp1 o1; const exp1 o1;
//! nearest neighborhood
NN & cl; NN & cl;
//! kernel
Kernel & ker; Kernel & ker;
//! Vector containing the particles
const vector_orig & vd; const vector_orig & vd;
//! Return type of the kernel
typedef typename apply_kernel_rtype<decltype(o1.value(vect_dist_key_dx(0)))>::rtype rtype; typedef typename apply_kernel_rtype<decltype(o1.value(vect_dist_key_dx(0)))>::rtype rtype;
public: public:
...@@ -316,6 +359,14 @@ public: ...@@ -316,6 +359,14 @@ public:
o1.init(); o1.init();
} }
/*! \brief Constructor from expression
*
* \param o1 first expression
* \param NN neighborhood
* \param kernel
* \param vd vector with particles
*
*/
vector_dist_expression_op(const exp1 & o1, NN & cl, Kernel & ker, const vector_orig & vd) vector_dist_expression_op(const exp1 & o1, NN & cl, Kernel & ker, const vector_orig & vd)
:o1(o1),cl(cl),ker(ker),vd(vd) :o1(o1),cl(cl),ker(ker),vd(vd)
{} {}
......
...@@ -208,24 +208,34 @@ CREATE_VDIST_ARG2_FUNC(pmul,pmul,VECT_PMUL) ...@@ -208,24 +208,34 @@ CREATE_VDIST_ARG2_FUNC(pmul,pmul,VECT_PMUL)
////////// Special function reduce ///////////////////////// ////////// Special function reduce /////////////////////////
/*! \brief expression that encapsulate a vector reduction expression
*
* \tparam exp1 expression 1
* \tparam vector_type type of vector on which the expression is acting
*
*/
template <typename exp1, typename vector_type> template <typename exp1, typename vector_type>
class vector_dist_expression_op<exp1,vector_type,VECT_SUM_REDUCE> class vector_dist_expression_op<exp1,vector_type,VECT_SUM_REDUCE>
{ {
//! expression 1
const exp1 o1; const exp1 o1;
//! return type comming from the expression
typedef typename apply_kernel_rtype<decltype(o1.value(vect_dist_key_dx(0)))>::rtype rtype; typedef typename apply_kernel_rtype<decltype(o1.value(vect_dist_key_dx(0)))>::rtype rtype;
// calculated value //! r_type without reference
mutable typename std::remove_reference<rtype>::type val; mutable typename std::remove_reference<rtype>::type val;
const vector_type & vd; const vector_type & vd;
public: public:
//! constructor from an epxression exp1 and a vector vd
vector_dist_expression_op(const exp1 & o1, const vector_type & vd) vector_dist_expression_op(const exp1 & o1, const vector_type & vd)
:o1(o1), vd(vd) :o1(o1), vd(vd)
{} {}
//! initialize the expression
inline void init() const inline void init() const
{ {
o1.init(); o1.init();
...@@ -244,19 +254,21 @@ public: ...@@ -244,19 +254,21 @@ public:
} }
} }
//! Get the value of the expression
inline typename std::remove_reference<rtype>::type get() inline typename std::remove_reference<rtype>::type get()
{ {
init(); init();
return value(vect_dist_key_dx(0)); return value(vect_dist_key_dx(0));
} }
//! Get the value of the expression
template<typename r_type= typename std::remove_reference<rtype>::type > inline r_type value(const vect_dist_key_dx & key) const template<typename r_type= typename std::remove_reference<rtype>::type > inline r_type value(const vect_dist_key_dx & key) const
{ {
return val; return val;
} }
}; };
//! Reduce function (it generate an expression)
template<typename exp1, typename exp2_, unsigned int op1, typename vector_type> template<typename exp1, typename exp2_, unsigned int op1, typename vector_type>
inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2_,op1>,vector_type,VECT_SUM_REDUCE> inline vector_dist_expression_op<vector_dist_expression_op<exp1,exp2_,op1>,vector_type,VECT_SUM_REDUCE>
rsum(const vector_dist_expression_op<exp1,exp2_,op1> & va, const vector_type & vd) rsum(const vector_dist_expression_op<exp1,exp2_,op1> & va, const vector_type & vd)
...@@ -266,6 +278,7 @@ rsum(const vector_dist_expression_op<exp1,exp2_,op1> & va, const vector_type & v ...@@ -266,6 +278,7 @@ rsum(const vector_dist_expression_op<exp1,exp2_,op1> & va, const vector_type & v
return exp_sum; return exp_sum;
} }
//! Reduce function (It generate an expression)
template<unsigned int prp1, typename v1, typename vector_type> template<unsigned int prp1, typename v1, typename vector_type>
inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_type,VECT_SUM_REDUCE> inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_type,VECT_SUM_REDUCE>
rsum(const vector_dist_expression<prp1,v1> & va, const vector_type & vd) rsum(const vector_dist_expression<prp1,v1> & va, const vector_type & vd)
......
...@@ -652,12 +652,16 @@ typedef vector_dist<3,float,aggregate<float,float,float,VectorS<3,float>,VectorS ...@@ -652,12 +652,16 @@ typedef vector_dist<3,float,aggregate<float,float,float,VectorS<3,float>,VectorS
//! Exponential kernel //! Exponential kernel
struct exp_kernel struct exp_kernel
{ {
//! variance of the exponential kernel
float var; float var;
//! Exponential kernel giving variance
exp_kernel(float var) exp_kernel(float var)
:var(var) :var(var)
{} {}
//! Calculate the value of the exponential kernel given two points p and q
// pA is the property on p pB is the property on B
inline float value(const Point<3,float> & p, const Point<3,float> & q,float pA,float pB) inline float value(const Point<3,float> & p, const Point<3,float> & q,float pA,float pB)
{ {
float dist = norm(p-q); float dist = norm(p-q);
...@@ -665,6 +669,8 @@ struct exp_kernel ...@@ -665,6 +669,8 @@ struct exp_kernel
return (pA + pB) * exp(dist * dist / var); return (pA + pB) * exp(dist * dist / var);
} }
//! Calculate the value of the exponential kernel given two points p and q
// pA is the value of the property on pA and pB is the value of the property on pB
inline Point<3,float> value(const Point<3,float> & p, const Point<3,float> & q,const Point<3,float> & pA, const Point<3,float> & pB) inline Point<3,float> value(const Point<3,float> & p, const Point<3,float> & q,const Point<3,float> & pA, const Point<3,float> & pB)
{ {
float dist = norm(p-q); float dist = norm(p-q);
...@@ -672,6 +678,9 @@ struct exp_kernel ...@@ -672,6 +678,9 @@ struct exp_kernel
return (pA + pB) * exp(dist * dist / var); return (pA + pB) * exp(dist * dist / var);
} }
//! Calculate the value of the exponential kernel given two points p and q
// pA is the value of the property on pA and pB is the value of the property on pB
// vd1 is the set of particles
inline float value(size_t p, size_t q, float pA, float pB, const vector_type & vd1) inline float value(size_t p, size_t q, float pA, float pB, const vector_type & vd1)
{ {
Point<3,float> pp = vd1.getPos(p); Point<3,float> pp = vd1.getPos(p);
...@@ -682,6 +691,9 @@ struct exp_kernel ...@@ -682,6 +691,9 @@ struct exp_kernel
return (pA + pB) * exp(dist * dist / var); return (pA + pB) * exp(dist * dist / var);
} }
//! Calculate the value of the exponential kernel given two points p and q
// pA is the value of the property on pA and pB is the value of the property on pB
// vd1 is the set of particles
inline Point<3,float> value(size_t p, size_t q, const Point<3,float> & pA, const Point<3,float> & pB , const vector_type & vd1) inline Point<3,float> value(size_t p, size_t q, const Point<3,float> & pA, const Point<3,float> & pB , const vector_type & vd1)
{ {
Point<3,float> pp = vd1.getPos(p); Point<3,float> pp = vd1.getPos(p);
...@@ -692,6 +704,7 @@ struct exp_kernel ...@@ -692,6 +704,7 @@ struct exp_kernel
return (pA + pB) * exp(dist * dist / var); return (pA + pB) * exp(dist * dist / var);
} }
//! Calculate the value of the exponential kernel given two points p and q
inline Point<2,float> value(const Point<3,float> & p, const Point<3,float> & q) inline Point<2,float> value(const Point<3,float> & p, const Point<3,float> & q)
{ {
float dist = norm(p-q); float dist = norm(p-q);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#ifndef UNIT_TEST_INIT_CLEANUP_HPP_ #ifndef UNIT_TEST_INIT_CLEANUP_HPP_
#define UNIT_TEST_INIT_CLEANUP_HPP_ #define UNIT_TEST_INIT_CLEANUP_HPP_
#include "VCluster.hpp" #include "VCluster/VCluster.hpp"
struct ut_start { struct ut_start {
ut_start() { ut_start() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment