Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F75855244
mtest.cpp~
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Aug 4, 17:16
Size
742 B
Mime Type
text/x-c++
Expires
Tue, Aug 6, 17:16 (2 d)
Engine
blob
Format
Raw Data
Handle
19619383
Attached To
R9411 tisue modeling
mtest.cpp~
View Options
#include <iostream>
#include <boost/range/algorithm.hpp>
#include <boost/numeric/odeint.hpp>
using namespace std;
using namespace boost::numeric::odeint;
typedef double state_type;
typedef runge_kutta_cash_karp54< state_type > error_stepper_type;
class Myode{
public:
void operator()(const state_type& x, state_type& dxdt, const double t){dxdt=-1-x;}
static bool done(const state_type &x){return x<=0.0;}
};
int main(int argc, char* argv[]){
Myode ode;
state_type x=10.0;
auto stepper = make_controlled< error_stepper_type >( 1.0e-10 , 1.0e-6 );
auto iter= boost::find_if(make_adaptive_range(stepper,ode,x, 0.0 , 20.0 , 0.01 ),
Myode::done);
cout<<"integration stopped at"<<x<<endl;
return 1;
}
Event Timeline
Log In to Comment