Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81483703
odeint_types.hpp
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
Fri, Sep 6, 07:36
Size
3 KB
Mime Type
text/x-c++
Expires
Sun, Sep 8, 07:36 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20582415
Attached To
rSPECMICP SpecMiCP / ReactMiCP
odeint_types.hpp
View Options
/*-------------------------------------------------------
- Module : odeint
- File : odeint_types.hpp
- Author : Fabien Georget
Copyright (c) 2014, Fabien Georget <fabieng@princeton.edu>, Princeton University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Princeton University nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------*/
#ifndef SPECMICP_ODEINT_ODEINTTYPES_HPP
#define SPECMICP_ODEINT_ODEINTTYPES_HPP
//! \file odeint_types.hpp common types for odeint
#include <functional>
#include <Eigen/Dense>
namespace
specmicp
{
namespace
odeint
{
//! A scalar
using
scalar_t
=
double
;
namespace
internal
{
//! \brief implementation for the vector type (which may not be a vector for dim=1)
template
<
int
dim
>
struct
vector_trait
{
using
type
=
Eigen
::
Matrix
<
scalar_t
,
Eigen
::
Dynamic
,
1
>
;
};
//! Specialisation for dimension 1 (scalar)
template
<>
struct
vector_trait
<
1
>
{
using
type
=
scalar_t
;
};
//! Specialization for dimension 2 (fixed-size vector)
template
<>
struct
vector_trait
<
2
>
{
using
type
=
Eigen
::
Matrix
<
scalar_t
,
2
,
1
>
;
};
//! Specialization for dimension 3 (fixed-size vector)
template
<>
struct
vector_trait
<
3
>
{
using
type
=
Eigen
::
Matrix
<
scalar_t
,
3
,
1
>
;
};
}
// end namespace internal
//! The vector type
template
<
int
dim
>
using
vector_t
=
typename
internal
::
vector_trait
<
dim
>::
type
;
//! Return the maximum coefficient of the vector
template
<
int
dim
>
scalar_t
max_coeff
(
const
vector_t
<
dim
>&
vec
)
{
return
vec
.
maxCoeff
();}
template
<>
scalar_t
max_coeff
<
1
>
(
const
vector_t
<
1
>&
vec
)
{
return
vec
;}
//! Type of the function f in dy/dx=f(x,y)
template
<
int
dim
>
using
rhs_f
=
std
::
function
<
void
(
scalar_t
,
const
vector_t
<
dim
>&
,
vector_t
<
dim
>&
)
>
;
}
// end namespace odeint
}
// end namespace specmicp
#endif
// SPECMICP_ODEINT_ODEINTTYPES_HPP
Event Timeline
Log In to Comment