KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
geometrical_sensitivity_utility.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ \.
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Michael Andre, https://github.com/msandre
11 //
12 
13 #if !defined(KRATOS_GEOMETRICAL_SENSITIVITY_UTILITY_H_INCLUDED)
14 #define KRATOS_GEOMETRICAL_SENSITIVITY_UTILITY_H_INCLUDED
15 
16 // System includes
17 #include <memory>
18 
19 // External includes
20 
21 // Project includes
22 #include "includes/define.h"
24 
25 // Application includes
26 
27 namespace Kratos
28 {
31 
33 {
34  std::size_t NodeIndex;
35  std::size_t Direction;
36  class Sequence;
37 };
38 
40  {
41  public:
42  Sequence(std::size_t NumberOfNodes, std::size_t Dimension)
43  : mNumberOfNodes(NumberOfNodes), mDimension(Dimension)
44  {
45  }
46 
47  operator bool() const
48  {
49  return (mShapeParameter.NodeIndex < mNumberOfNodes);
50  }
51 
53  {
54  return mShapeParameter;
55  }
56 
58  {
59  return mShapeParameter;
60  }
61 
63  {
64  KRATOS_ERROR_IF_NOT(*this)
65  << "Increment is out of sequence's range.\n";
66  mShapeParameter.Direction = (mShapeParameter.Direction + 1) % mDimension;
67  if (mShapeParameter.Direction == 0)
68  ++mShapeParameter.NodeIndex;
69  return *this;
70  }
71 
72  private:
73  const std::size_t mNumberOfNodes;
74  const std::size_t mDimension;
75  ShapeParameter mShapeParameter = {0, 0};
76  };
77 
78 class KRATOS_API(KRATOS_CORE) GeometricalSensitivityUtility
79 {
80 public:
83 
85 
87 
89 
91 
93 
94  typedef unsigned IndexType;
95 
96  typedef boost::numeric::ublas::indirect_array<DenseVector<std::size_t>> IndirectArrayType;
97 
98  typedef boost::numeric::ublas::matrix_indirect<const MatrixType, IndirectArrayType> SubMatrixType;
99 
100  template <class T>
101  using matrix_row = boost::numeric::ublas::matrix_row<T>;
102 
106 
108 
112 
113  void CalculateSensitivity(ShapeParameter Deriv, double& rDetJ_Deriv, ShapeFunctionsGradientType& rDN_DX_Deriv) const;
114 
116 
117 private:
120 
121  const JacobianType& mrJ;
122  const ShapeFunctionsLocalGradientType& mrDN_De;
123  MatrixType mCofactorJ;
124  double mDetJ;
125 
129 
130  void Initialize();
131 
132  double CalculateDeterminantOfJacobianSensitivity(ShapeParameter Deriv) const;
133 
134  MatrixType CalculateCofactorOfJacobianSensitivity(ShapeParameter Deriv) const;
135 
137 };
138 
140 
141 } /* namespace Kratos.*/
142 
143 #endif /* KRATOS_GEOMETRICAL_SENSITIVITY_UTILITY_H_INCLUDED defined */
Definition: geometrical_sensitivity_utility.h:79
boost::numeric::ublas::matrix_indirect< const MatrixType, IndirectArrayType > SubMatrixType
Definition: geometrical_sensitivity_utility.h:98
boost::numeric::ublas::indirect_array< DenseVector< std::size_t > > IndirectArrayType
Definition: geometrical_sensitivity_utility.h:96
MatrixType ShapeFunctionsGradientType
Definition: geometrical_sensitivity_utility.h:92
MatrixType ShapeFunctionsLocalGradientType
Definition: geometrical_sensitivity_utility.h:90
MatrixType JacobianType
Definition: geometrical_sensitivity_utility.h:88
boost::numeric::ublas::matrix_row< T > matrix_row
Definition: geometrical_sensitivity_utility.h:101
DenseMatrix< double > MatrixType
Definition: geometrical_sensitivity_utility.h:86
KRATOS_CLASS_POINTER_DEFINITION(GeometricalSensitivityUtility)
unsigned IndexType
Definition: geometrical_sensitivity_utility.h:94
Definition: amatrix_interface.h:41
Definition: geometrical_sensitivity_utility.h:40
Sequence & operator++()
Definition: geometrical_sensitivity_utility.h:62
Sequence(std::size_t NumberOfNodes, std::size_t Dimension)
Definition: geometrical_sensitivity_utility.h:42
const ShapeParameter & CurrentValue() const
Definition: geometrical_sensitivity_utility.h:57
ShapeParameter & CurrentValue()
Definition: geometrical_sensitivity_utility.h:52
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
REACTION_CHECK_STIFFNESS_FACTOR INNER_LOOP_ITERATION DISTANCE_THRESHOLD ACTIVE_CHECK_FACTOR AUXILIAR_COORDINATES NORMAL_GAP WEIGHTED_GAP WEIGHTED_SCALAR_RESIDUAL bool
Definition: contact_structural_mechanics_application_variables.h:93
Definition: geometrical_sensitivity_utility.h:33
std::size_t NodeIndex
Definition: geometrical_sensitivity_utility.h:34
std::size_t Direction
Definition: geometrical_sensitivity_utility.h:35