This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen -> ? -> ODEint

Tags: None
(comma "," separated)
norbert_niemand
Registered Member
Posts
1
Karma
0

Eigen -> ? -> ODEint

Mon Oct 15, 2012 1:16 pm
Hey,

i have a working Program which is working with the eigen library (doing statical FEM calculations). At the moment i'm trying to solve the dynamic FEM solution, which results in solving a ODE. A very powerful library to solve the problem should be ODEint (http://headmyshoulder.github.com/odeint-v2/).

Here is my problem, ODEint only works with:
Boost.uBLAS
Thrust
Boost.Range
Boost.Fusion
Intel Math Kernel Library
VecXL

(Source: http://headmyshoulder.github.com/odeint ... rview.html)

Now, that i'm not a specialist in C++ programming, what would be the easiest way to get a fast solution to my problem? Has anyone got an idea? I'd be very happy :)
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Eigen -> ? -> ODEint

Tue Oct 16, 2012 6:24 pm
what's your precise question? Why cannot you simply use ODEint ?
blamalex
Registered Member
Posts
1
Karma
0

Re: Eigen -> ? -> ODEint

Tue Oct 16, 2012 8:02 pm
Hey,

lost my login-data. Obviously no chance to reset password....

That's what I want wo know. Will there be any problems when I want to use ODEint with MatrixXd and VectorXd types? Maybe someone has tried this and could give mi an example implementation.

As an alternatve: Are there any ODE-Solvers which will work for sure with MatrixXd / VectorXd?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Eigen -> ? -> ODEint

Tue Oct 16, 2012 8:25 pm
you can still copy the data to ublas types, or see if ublas support similar to Eigen::Map.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Eigen -> ? -> ODEint

Fri Oct 19, 2012 1:23 am
Passwords can be reset. If you are using a KDE Identity account, this can be done on the Identity site (https://identity.kde.org/) otherwise the forum software itself should allow you to reset your password. If it doesn't, and you are using a non-Identity connected forum account, please email forum-admin@kde.org and we can sort your issue out.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
karstenahnert
Registered Member
Posts
3
Karma
0

Re: Eigen -> ? -> ODEint

Wed Oct 31, 2012 10:52 pm
If Eigen support expression templates for the basic operators +-*/ you can use odeint with the Eigen Types. Maybe you need to the resize, same_size and is_resizable functionality, as explained in the docs. We will add an example of how to use Eigen with odeint to the odeint docs very soon. We also will provide the adapters for the resizing mechanism.
medic123
Registered Member
Posts
25
Karma
0
OS

Re: Eigen -> ? -> ODEint

Mon Nov 12, 2012 2:29 pm
Hi,

I use Eigen with odeInt in order to solve a big system of coupled ODEs represented by sparse matrices. So that Eigen does all the heavy linear algebra computation to find the changes and odeint does the stepping. As statetypes I use std::vector<double> and map them with Eigens MappedVector. Looks like this:

Code: Select all
void BattPackage::Cell::operator() (const StateType &C , StateType &dCdt , const double /* t */ )
{
   const double *PtState = &C[0];
   double *PtChange = &dCdt[0];
   MappedVectorConst States(PtState,C.size());
   MappedVector Changes(PtChange,dCdt.size());

      Changes = (SimulationData::DiffusionFactor*m_DiffusionMatrix + SimulationData::GassingFactor*m_GasMatrix + SimulationData::PressureFactor*m_PressureMatrix +        SimulationData::BuoyancyFactor*m_BuoyancyMatrix) * States  +  SimulationData::SourceFactor*m_SulfatIonSourceVector;   
   for (int i = 0; i < Changes.size(); ++i)
   {
      Changes(i) /= m_AllVolumeElements[i]->getEffectiveVolume(); //NumberChanges -> ConcentrationChanges
   }
}


So States and Changes are std::vectors which work perfectly with odeint and can be mapped/wrapped by Eigen and all ehe other matrices and vectors in the calculation are Eigen-types. Notice that I overloaded the ()-operator like it is suggested in the odeint tutorial.

greeting, medic


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]