Click here to Skip to main content
15,892,746 members
Articles / Programming Languages / CUDA

odeint v2 - Solving ordinary differential equations in C++

Rate me:
Please Sign up or sign in to vote.
4.64/5 (18 votes)
19 Oct 2011CPOL19 min read 129.9K   2.8K   34  
odeint v2 - Solving ordinary differential equations in C++
/*
 * prepare_stepper_testing.hpp
 *
 *  Created on: Jan 19, 2011
 *      Author: karsten
 */

#ifndef PREPARE_STEPPER_TESTING_HPP_
#define PREPARE_STEPPER_TESTING_HPP_

#include <tr1/array>
#include <vector>

#include <boost/mpl/vector.hpp>

namespace mpl = boost::mpl;


struct constant_system_standard
{
	template< class State , class Deriv , class Time >
	void operator()( const State &x , Deriv &dxdt , const Time &t ) const
	{
		dxdt[0] = 1.0;
	}
};

struct constant_system_vector_space
{
	template< class State , class Deriv , class Time >
	void operator()( const State &x , class Deriv &dxdt , const Time &t  ) const
	{
		dxdt.m_x = 1.0;
	}
};

struct constant_system_fusion
{
	template< class State , class Deriv , class Time >
	void operator()( const State &x , class Deriv &dxdt , const Time &t ) const
	{
		fusion::at_c< 0 >( dxdt ) = fusion::at_c< 0 >( x ) / Time( 1.0 );
	}
};



typedef mpl::vector
<
	mpl::vector< float , std::tr1::array< float , 1 > , std::tr1::array< float , 1 > , constant_system_standard , stepper_type > ,
    mpl::vector< float , std::tr1::array< float , 1 > , std::vector< float > , constant_system_standard , stepper_type >
> types_and_systems_matrix;


struct check_stepper
{
	template< class Vector >
	void operator()( Vector )
	{
		typedef typename mpl::at_c< Vector , 0 >::type value_type;
		typedef typename mpl::at_c< Vector , 1 >::type deriv_type;
		typedef typename mpl::at_c< Vector , 2 >::type state_type;
		typedef typename mpl::at_c< Vector , 3 >::type system_type;
	}
};


#endif /* PREPARE_STEPPER_TESTING_HPP_ */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions