MarmotAutomaticDifferentiation.h
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------
2  * _
3  * _ __ ___ __ _ _ __ _ __ ___ ___ | |_
4  * | '_ ` _ \ / _` | '__| '_ ` _ \ / _ \| __|
5  * | | | | | | (_| | | | | | | | | (_) | |_
6  * |_| |_| |_|\__,_|_| |_| |_| |_|\___/ \__|
7  *
8  * Unit of Strength of Materials and Structural Analysis
9  * University of Innsbruck,
10  * 2020 - today
11  *
12  * festigkeitslehre@uibk.ac.at
13  *
14  * Alexander Dummer alexander.dummer@uibk.ac.at
15  *
16  * This file is part of the MAteRialMOdellingToolbox (marmot).
17  *
18  * This library is free software; you can redistribute it and/or
19  * modify it under the terms of the GNU Lesser General Public
20  * License as published by the Free Software Foundation; either
21  * version 2.1 of the License, or (at your option) any later version.
22  *
23  * The full text of the license can be found in the file LICENSE.md at
24  * the top level directory of marmot.
25  * ---------------------------------------------------------------------
26  */
27 
28 #pragma once
29 #include "Marmot/MarmotTensor.h"
30 #include "autodiff/forward/dual.hpp"
31 #include "autodiff/forward/dual/eigen.hpp"
32 #include <autodiff/forward/dual/dual.hpp>
33 #include <functional>
34 
35 namespace Marmot {
36 
37  namespace AutomaticDifferentiation {
38 
39  using namespace autodiff;
40  using namespace Eigen;
41 
42  dual2nd shiftTo2ndOrderDual( const dual& x );
43 
44  using scalar_to_scalar_function_type = std::function< dual( const dual& ) >;
45  double df_dx( const scalar_to_scalar_function_type& f, const double& x );
46 
47  using scalar_to_scalar_function_type_2nd = std::function< dual2nd( const dual2nd& ) >;
48  dual df_dx( const scalar_to_scalar_function_type_2nd& f, const dual& x );
49 
50  using vector_to_vector_function_type = std::function< VectorXdual( const VectorXdual& X ) >;
51  MatrixXd forwardMode( const vector_to_vector_function_type& F, const VectorXd& X );
52 
53  using vector_to_vector_function_type_dual = std::function< VectorXdual( const VectorXdual& X ) >;
54  std::pair< VectorXd, MatrixXd > jacobian( const vector_to_vector_function_type_dual& F, const VectorXd& X );
55 
56  } // namespace AutomaticDifferentiation
57 
58 } // namespace Marmot
Marmot::AutomaticDifferentiation::forwardMode
MatrixXd forwardMode(const vector_to_vector_function_type &F, const VectorXd &X)
Definition: MarmotAutomaticDifferentiation.cpp:44
Marmot::AutomaticDifferentiation::vector_to_vector_function_type_dual
std::function< VectorXdual(const VectorXdual &X) > vector_to_vector_function_type_dual
Definition: MarmotAutomaticDifferentiation.h:53
Marmot::AutomaticDifferentiation::scalar_to_scalar_function_type
std::function< dual(const dual &) > scalar_to_scalar_function_type
Definition: MarmotAutomaticDifferentiation.h:44
Marmot::AutomaticDifferentiation::scalar_to_scalar_function_type_2nd
std::function< dual2nd(const dual2nd &) > scalar_to_scalar_function_type_2nd
Definition: MarmotAutomaticDifferentiation.h:47
Marmot
This file includes functions needed for calculations with stress and strain tensors written in voigt ...
Definition: MarmotTesting.h:30
Marmot::AutomaticDifferentiation::shiftTo2ndOrderDual
dual2nd shiftTo2ndOrderDual(const dual &x)
Definition: MarmotAutomaticDifferentiation.cpp:12
Marmot::AutomaticDifferentiation::jacobian
std::pair< VectorXd, MatrixXd > jacobian(const vector_to_vector_function_type_dual &F, const VectorXd &X)
Definition: MarmotAutomaticDifferentiation.cpp:52
Marmot::AutomaticDifferentiation::vector_to_vector_function_type
std::function< VectorXdual(const VectorXdual &X) > vector_to_vector_function_type
Definition: MarmotAutomaticDifferentiation.h:50
Marmot::AutomaticDifferentiation::df_dx
double df_dx(const scalar_to_scalar_function_type &f, const double &x)
Definition: MarmotAutomaticDifferentiation.cpp:20
Marmot::FiniteElement::EAS::F
Eigen::MatrixXd F(const Eigen::MatrixXd &J)
MarmotTensor.h