Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57116 - in sandbox/odeint/boost/numeric/odeint: . concept
From: mario.mulansky_at_[hidden]
Date: 2009-10-23 14:26:08


Author: mariomulansky
Date: 2009-10-23 14:26:08 EDT (Fri, 23 Oct 2009)
New Revision: 57116
URL: http://svn.boost.org/trac/boost/changeset/57116

Log:
added concept check for ContainerType
Added:
   sandbox/odeint/boost/numeric/odeint/concept/
   sandbox/odeint/boost/numeric/odeint/concept/concepts.hpp (contents, props changed)
Text files modified:
   sandbox/odeint/boost/numeric/odeint/euler.hpp | 11 ++++++-----
   1 files changed, 6 insertions(+), 5 deletions(-)

Added: sandbox/odeint/boost/numeric/odeint/concept/concepts.hpp
==============================================================================
--- (empty file)
+++ sandbox/odeint/boost/numeric/odeint/concept/concepts.hpp 2009-10-23 14:26:08 EDT (Fri, 23 Oct 2009)
@@ -0,0 +1,51 @@
+/* Boost odeint/euler.hpp header file
+
+ Copyright 2009 Karsten Ahnert
+ Copyright 2009 Mario Mulansky
+ Copyright 2009 Andre Bergner
+
+ This file contains the concepts used in the odeint library
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or
+ copy at http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+#ifndef BOOST_NUMERIC_ODEINT_CONCEPTS_HPP
+#define BOOST_NUMERIC_ODEINT_CONCEPTS_HPP
+
+#include <boost/concept_check.hpp>
+
+namespace boost {
+namespace numeric {
+namespace odeint {
+
+ template<class X>
+ struct StateType {
+
+ public:
+ typedef typename X::iterator iterator; // requires iterator typedef
+
+ // requires iterator being ForwardIterator
+ BOOST_CONCEPT_ASSERT((ForwardIterator<iterator>));
+
+ BOOST_CONCEPT_USAGE(StateType)
+ {
+ same_type(state.begin(), it); //requires begin() method
+ same_type(state.end(), it); // requires end() method
+ }
+
+ private:
+ X state;
+ iterator it;
+
+ template<class T>
+ void same_type( T const&, T const& );
+
+ };
+
+} // namespace odeint
+} // namespace numeric
+} // namespace boost
+
+#endif

Modified: sandbox/odeint/boost/numeric/odeint/euler.hpp
==============================================================================
--- sandbox/odeint/boost/numeric/odeint/euler.hpp (original)
+++ sandbox/odeint/boost/numeric/odeint/euler.hpp 2009-10-23 14:26:08 EDT (Fri, 23 Oct 2009)
@@ -18,6 +18,7 @@
 #define BOOST_NUMERIC_ODEINT_EULER_HPP
 
 #include <boost/concept_check.hpp>
+#include <boost/numeric/odeint/concept/concepts.hpp>
 #include <tr1/array>
 
 namespace boost {
@@ -61,12 +62,12 @@
>
     class ode_step_euler
     {
- // BOOST_CLASS_REQUIRE( ContainerType , boost , SequenceConcept );
- ContainerType dxdt;
- ResizeType resizer;
-
- typedef typename ContainerType::iterator iterator;
+ BOOST_CLASS_REQUIRE( ContainerType , boost::numeric::odeint, StateType );
+ ContainerType dxdt;
+ ResizeType resizer;
 
+ typedef typename ContainerType::iterator iterator;
+
     public:
 
         template< class DynamicalSystem , class TimeType>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk