OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
meta_compare< T > Struct Template Reference

This class compare general objects. More...

Detailed Description

template<typename T>
struct meta_compare< T >

This class compare general objects.

this function is a general function to compare

  • primitives
  • array of primitives
  • complex objects
  • aggregates

Usage of meta copy and compare for primitives

float f_src = 1.0;
float f_dst;
BOOST_REQUIRE_EQUAL(f_src,f_dst);
bool ret = meta_compare<float>::meta_compare_f(f_src,f_dst);
BOOST_REQUIRE_EQUAL(ret,true);
This class compare general objects.
__device__ static __host__ void meta_copy_(const T &src, T &dst)
copy and object from src to dst
Definition meta_copy.hpp:60

Usage of meta copy and compare for array of primitives

float f_src[2][3] = {{1.0,2.9,4.0},{2.3,4.4,9.0}};
float f_dst[2][3];
BOOST_REQUIRE_EQUAL(ret,true);

Usage of meta copy and compare for openfpm aggregates

boost::fusion::at_c<0>(agg1.data) = 1.0;
boost::fusion::at_c<1>(agg1.data) = 2.0;
boost::fusion::at_c<2>(agg1.data)[0] = 3.0;
boost::fusion::at_c<2>(agg1.data)[1] = 4.0;
boost::fusion::at_c<2>(agg1.data)[2] = 5.0;
meta_copy<aggregate<float,int,float[3]>>::meta_copy_(agg1,agg2);
bool ret = meta_compare<aggregate<float,int,float[3]>>::meta_compare_f(agg1,agg2);
BOOST_REQUIRE_EQUAL(ret,true);
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
type data
the data
This class copy general objects.
Definition meta_copy.hpp:53

Usage of meta copy and compare for complex object

std::string s_src("Test string");
std::string s_dst;
BOOST_REQUIRE_EQUAL(s_src,s_dst);
BOOST_REQUIRE_EQUAL(ret,true);

Usage of meta copy and compare for complex aggregates object

aggregate<std::string,std::vector<float>,std::map<size_t,std::string>,std::string[3]> a_src;
// fill the complex aggregates
a_src.template get<0>() = std::string("Test string");
a_src.template get<1>().push_back(5.0);
a_src.template get<1>().push_back(15.0);
a_src.template get<1>().push_back(45.0);
a_src.template get<1>().push_back(7.0);
a_src.template get<2>()[0] = std::string("Test string 2");
a_src.template get<2>()[10] = std::string("Test string 3");
a_src.template get<2>()[9] = std::string("Test string 4");
a_src.template get<2>()[1] = std::string("Test string 5");
a_src.template get<3>()[0] = std::string("Last string 9");
a_src.template get<3>()[1] = std::string("Last string 10");
a_src.template get<3>()[2] = std::string("Last string 11");
aggregate<std::string,std::vector<float>,std::map<size_t,std::string>,std::string[3]> a_dst;
meta_copy<aggregate<std::string,std::vector<float>,std::map<size_t,std::string>,std::string[3]>>::meta_copy_(a_src,a_dst);
bool ret = meta_compare<aggregate<std::string,std::vector<float>,std::map<size_t,std::string>,std::string[3]>>::meta_compare_f(a_src,a_dst);
BOOST_REQUIRE_EQUAL(ret,true);

Usage of meta copy and compare for Point_test

typedef Point_test<float> p;
// fill p_src
p_src.template get<p::x>() = 1;
p_src.template get<p::y>() = 567;
p_src.template get<p::z>() = 341;
p_src.template get<p::s>() = 5670;
p_src.template get<p::v>()[0] = 921;
p_src.template get<p::v>()[1] = 5675;
p_src.template get<p::v>()[2] = 117;
p_src.template get<p::t>()[0][0] = 1921;
p_src.template get<p::t>()[0][1] = 25675;
p_src.template get<p::t>()[0][2] = 3117;
p_src.template get<p::t>()[1][0] = 4921;
p_src.template get<p::t>()[1][1] = 55675;
p_src.template get<p::t>()[1][2] = 6117;
p_src.template get<p::t>()[2][0] = 7921;
p_src.template get<p::t>()[2][1] = 85675;
p_src.template get<p::t>()[2][2] = 9117;
meta_copy<Point_test<float>>::meta_copy_(p_src,p_dst);
bool ret = meta_compare<Point_test<float>>::meta_compare_f(p_src,p_dst);
BOOST_REQUIRE_EQUAL(ret,true);
Test structure used for several test.

Definition at line 37 of file meta_compare.hpp.

#include <meta_compare.hpp>

Static Public Member Functions

static bool meta_compare_f (const T &src, const T &dst)
 

Member Function Documentation

◆ meta_compare_f()

template<typename T >
static bool meta_compare< T >::meta_compare_f ( const T &  src,
const T &  dst 
)
inlinestatic

Definition at line 39 of file meta_compare.hpp.


The documentation for this struct was generated from the following files: