https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 36dc528c6d1608e2aa3de0eff35c0453d8e12a44 authored by Wenqing Wang on 28 July 2021, 10:40:49 UTC
[ProcessLib/Python] Moved a double defined class to a new file.
Tip revision: 36dc528
ODESolverTypes.h
/**
 * \file
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#pragma once

#include <functional>
#include <Eigen/Core>

namespace MathLib
{
namespace ODE
{
//! \addtogroup ExternalODESolverInterface
//! @{

/*! This type can be used like an \f$N \times M\f$ Eigen::Matrix, but it
 *  does not manage the storage for its entries on its own.
 *
 * \tparam N number of rows
 * \tparam M number of columns
 *
 * \see https://eigen.tuxfamily.org/dox/classEigen_1_1Map.html
 */
template <int N, int M>
using MappedMatrix = Eigen::Map<Eigen::Matrix<double, N, M, Eigen::ColMajor>>;

//! Behaves like a \c const Eigen::Matrix. \see MappedMatrix
template <int N, int M>
using MappedConstMatrix =
    Eigen::Map<const Eigen::Matrix<double, N, M, Eigen::ColMajor>>;

//! \see MappedMatrix
template <int N>
using MappedVector = MappedMatrix<N, 1>;

//! \see MappedConstMatrix
template <int N>
using MappedConstVector = MappedConstMatrix<N, 1>;

/*! A function computing \c ydot as a function of \c t and \c y.
 *
 *  The function returns true or false indecating whether it succeeded.
 *
 * \tparam N the number of equations in the ODE system.
 */
template <unsigned N>
using Function = std::function<bool(
    const double t, MappedConstVector<N> const& y, MappedVector<N>& ydot)>;

/*! A function computing \f$\mathtt{jac} := \partial \dot y/\partial y\f$.
 *
 * The function returns true or false indecating whether it succeeded.
 *
 * \tparam N the number of equations in the ODE system.
 */
template <unsigned N>
using JacobianFunction = std::function<bool(const double t,
                                            MappedConstVector<N> const& y,
                                            MappedConstVector<N> const& ydot,
                                            MappedMatrix<N, N>& jac)>;

//! @}

}  // namespace ODE
}  // namespace MathLib
back to top