funcy  1.6.0
muscle_tissue_martins.h
1 #pragma once
2 
3 #include <funcy/examples/volumetric_penalty_functions.h>
4 #include <funcy/funcy.h>
5 
12 namespace funcy
13 {
15  namespace detail
16  {
17  template < linalg::Matrix Mat, int n = linalg::dim< Mat >() >
18  auto generate_incompressible_muscle_tissue_martins( double c, double b, double d, double e,
19  const Mat& A, const Mat& F )
20  {
21  using namespace linalg;
22  auto S = strain_tensor( F );
23  auto si1 = mi1< Mat, n >( S() ) - n;
24  auto si6 = mi6< Mat, Mat, n >( S(), A ) - 1;
25 
26  auto f = c * ( exp( b * si1 ) - 1 ) + d * ( exp( e * squared( si6 ) ) - 1 );
27  return f( S );
28  }
29  } // namespace detail
31 
51  template < linalg::Matrix Mat, int offset = linalg::dim< Mat >() >
52  auto incompressible_muscle_tissue_martins( double c, double b, double d, double e, const Mat& A,
53  const Mat& F )
54  {
55  return finalize( detail::generate_incompressible_muscle_tissue_martins< Mat, offset >(
56  c, b, d, e, A, F ) );
57  }
58 
76  template < linalg::Matrix Mat, int offset = linalg::dim< Mat >() >
77  auto incompressible_muscle_tissue_martins( const Mat& A, const Mat& F )
78  {
79  return incompressible_muscle_tissue_martins< Mat, offset >( 0.387, 23.46, 0.584, 12.43, A,
80  F );
81  }
82 
103  template < class Inflation, class Compression, linalg::Matrix Mat,
104  int offset = linalg::dim< Mat >() >
105  auto compressible_muscle_tissue_martins( double c, double b, double A, double a, double d0,
106  double d1, const Mat& M, const Mat& F )
107  {
108  return finalize( detail::generate_incompressible_muscle_tissue_martins< Mat, offset >(
109  c, b, A, a, M, F ) +
110  volumetric_penalty< Inflation, Compression >( d0, d1, F ) );
111  }
112 
133  template < class Inflation, class Compression, linalg::Matrix Mat,
134  int offset = linalg::dim< Mat >() >
135  auto compressible_muscle_tissue_martins( double d0, double d1, const Mat& M, const Mat& F )
136  {
137  return compressible_muscle_tissue_martins< Inflation, Compression, Mat, offset >(
138  0.387, 23.46, 0.584, 12.43, d0, d1, M, F );
139  }
140 } // namespace funcy
concept Matrix
Matrix concept.
Definition: concepts.h:77
auto exp(const F &f)
Generate .
Definition: exp.h:117
Main namespace of the funcy library.
auto finalize(F &&f) requires(static_check
Finish function definition.
Definition: finalize.h:248
auto compressible_muscle_tissue_martins(double c, double b, double A, double a, double d0, double d1, const Mat &M, const Mat &F)
Compressible version of the model for muscle tissue of .
Definition: muscle_tissue_martins.h:105
auto strain_tensor(const Mat &A)
Generate the right Cauchy-Green strain tensor .
Definition: strain_tensor.h:123
auto squared(F &&f)
Generate squared function.
Definition: generate.h:153
auto incompressible_muscle_tissue_martins(double c, double b, double d, double e, const Mat &A, const Mat &F)
Incompressible version of the model for muscle tissue of .
Definition: muscle_tissue_martins.h:52