From 36506fb6de31f03908cae35fa2f53773fe197816 Mon Sep 17 00:00:00 2001 From: absingh <absingh@mpi-cbg.de> Date: Wed, 15 Mar 2023 13:43:01 +0100 Subject: [PATCH] adding relevant if def --- src/OdeIntegrators/OdeIntegrators.hpp | 74 +++++++++---------- .../tests/Odeintegrators_test_gpu.cu | 2 + 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/OdeIntegrators/OdeIntegrators.hpp b/src/OdeIntegrators/OdeIntegrators.hpp index 5f4ecbc0..5296b2ac 100644 --- a/src/OdeIntegrators/OdeIntegrators.hpp +++ b/src/OdeIntegrators/OdeIntegrators.hpp @@ -31,41 +31,6 @@ namespace boost{ #ifdef __NVCC__ #include "OdeIntegrators/vector_algebra_ofp_gpu.hpp" -#endif - -namespace boost { namespace numeric { namespace odeint { - - template<typename T> - struct is_resizeable< vector_dist_expression<0,openfpm::vector<aggregate<T>> > > - { - typedef boost::true_type type; - static const bool value = type::value; - }; - - } } } - -/*! \brief A 1d Odeint and Openfpm compatible structure. - * - * Use the method this.data.get<d>() to refer to property of all the particles in the dimension d. - * - * d starts with 0. - * - */ -struct state_type_1d_ofp{ - state_type_1d_ofp(){ - } - typedef size_t size_type; - typedef int is_state_vector; - aggregate<texp_v<double>> data; - - size_t size() const - { return data.get<0>().size(); } - - void resize(size_t n) - { - data.get<0>().resize(n); - } -}; /*! \brief A 1d Odeint and Openfpm compatible structure. * * Use the method this.data.get<d>() to refer to property of all the particles in the dimension d. @@ -113,6 +78,41 @@ struct state_type_1d_ofp_gpu{ return s1_ker; } }; +#endif + +namespace boost { namespace numeric { namespace odeint { + + template<typename T> + struct is_resizeable< vector_dist_expression<0,openfpm::vector<aggregate<T>> > > + { + typedef boost::true_type type; + static const bool value = type::value; + }; + + } } } + +/*! \brief A 1d Odeint and Openfpm compatible structure. + * + * Use the method this.data.get<d>() to refer to property of all the particles in the dimension d. + * + * d starts with 0. + * + */ +struct state_type_1d_ofp{ + state_type_1d_ofp(){ + } + typedef size_t size_type; + typedef int is_state_vector; + aggregate<texp_v<double>> data; + + size_t size() const + { return data.get<0>().size(); } + + void resize(size_t n) + { + data.get<0>().resize(n); + } +}; /*! \brief A 2d Odeint and Openfpm compatible structure. * @@ -225,13 +225,13 @@ namespace boost { typedef boost::true_type type; static const bool value = type::value; }; - +#ifdef __NVCC__ template<> struct is_resizeable<state_type_1d_ofp_gpu> { typedef boost::true_type type; static const bool value = type::value; }; - +#endif template<> struct is_resizeable<state_type_2d_ofp> { typedef boost::true_type type; diff --git a/src/OdeIntegrators/tests/Odeintegrators_test_gpu.cu b/src/OdeIntegrators/tests/Odeintegrators_test_gpu.cu index bca0527b..a1b2771d 100644 --- a/src/OdeIntegrators/tests/Odeintegrators_test_gpu.cu +++ b/src/OdeIntegrators/tests/Odeintegrators_test_gpu.cu @@ -14,6 +14,7 @@ #include "Operators/Vector/vector_dist_operators.hpp" #include "OdeIntegrators/OdeIntegrators.hpp" //#include "DCPSE/DCPSE_op/DCPSE_op.hpp" +#ifdef __NVCC__ typedef state_type_1d_ofp_gpu state_type; //const double a = 2.8e-4; @@ -100,3 +101,4 @@ BOOST_AUTO_TEST_CASE(odeint_base_test_gpu) BOOST_REQUIRE(worst < 1e-6); } BOOST_AUTO_TEST_SUITE_END() +#endif \ No newline at end of file -- GitLab