NimbleSM
NimbleSM is a solid mechanics simulation code for dynamic systems
|
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <vector>
#include "nimble_defs.h"
#include "nimble_macros.h"
#include "nimble_view.h"
Go to the source code of this file.
Functions | |
NIMBLE_INLINE_FUNCTION int | StringLength (const char *str) |
NIMBLE_INLINE_FUNCTION bool | StringsAreEqual (const char *str1, const char *str2) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | CheckVectorSanity (int vec_length, ScalarT const *const vec, const char *label) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | MultiplySign (const ScalarT x, const ScalarT y) |
Return x times sign of y. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | Minimum (const ScalarT x, const ScalarT y) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | if_then (const bool b, const ScalarT v1, const ScalarT v2) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | if_then_else (const bool b, const ScalarT v1, const ScalarT v2) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | if_then_else_zero (const bool b, const ScalarT v) |
template<typename ScalarT> | |
void | Print_Full33 (std::string label, const ScalarT *const mat, int precision=2) |
template<typename ScalarT> | |
void | Print_Sym33 (std::string label, const ScalarT *const mat, int precision=2) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Square_Full33T_Full33 (const ScalarT *const mat, ScalarT *const result) |
Compute result = mat^T mat. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Mult_Scalar_Full33 (ScalarT a, const ScalarT *const mat, ScalarT *const result) |
Multiply a full tensor by a scalar. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Sum_Full33_Full33 (const ScalarT *const A, const ScalarT *const B, ScalarT *const result) |
Sum of a full tensor and a full tensor. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Sum_Sym33_Full33 (const ScalarT *const A, const ScalarT *const B, ScalarT *const result) |
Sum of a symmetric tensor and a full tensor. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Mult_Full33_Full33 (const ScalarT *const A, const ScalarT *const B, ScalarT *const result) |
Multiply a full tensor by a full tensor. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Mult_Sym33_Full33 (const ScalarT *const sym, const ScalarT *const full, ScalarT *const result) |
Multiply a symmetric tensor by a full tensor. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Mult_Scalar_Full33_Full33 (ScalarT alpha, const ScalarT *const A, const ScalarT *const B, ScalarT *const result) |
Multiply a full tensor by a full tensor and a scalar. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Square_Full33_Full33T (const ScalarT *const mat, ScalarT *const result) |
Compute result = mat mat^T. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Mult_Full33_Sym33_ReturnT (const ScalarT *const full, const ScalarT *const sym, ScalarT *const result) |
Multiply a full tensor by a symmetric tensor, return transpose of resultant. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Rotate_Sym33_Using_Rtranspose_S_R (const ScalarT *const s, const ScalarT *const r, ScalarT *const result) |
Rotate a symetric tensor, result = R^T S R. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Unrotate_Sym33_Using_R_S_Rtranspose (const ScalarT *const s, const ScalarT *const r, ScalarT *const result) |
Unrotate a symetric tensor, result = R S R^T. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | CrossProduct (const ScalarT *const u, const ScalarT *const v, ScalarT *const result) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | Determinant_Full33 (const ScalarT *const mat) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | Norm_Sym33 (const ScalarT *const mat) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | Norm_Full33 (const ScalarT *const mat) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Zero_Full33 (ScalarT *const mat) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | SetEqual_Full33 (const ScalarT *const B, ScalarT *const A) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | SetEqual_Sym33 (const ScalarT *const B, ScalarT *const A) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | SymPart_Full33 (const ScalarT *const mat, ScalarT *const result) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | SkewPart_Full33 (const ScalarT *const mat, ScalarT *const result) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | Invert_Full33 (const ScalarT *mat, ScalarT *inv) |
Function to invert a 3x3 matrix. | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | BCH (const ScalarT *const x, const ScalarT *const y, ScalarT *const result) |
R^N logarithmic map using Baker-Campbell-Hausdorff (BCH) expansion (4 terms) | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | BCH_Sym33_Full33 (const ScalarT *const sym, const ScalarT *const full, ScalarT *const result) |
R^N logarithmic map using Baker-Campbell-Hausdorff (BCH) expansion (4 terms) | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION ScalarT | Cos_Of_Acos_Divided_By_3 (const ScalarT x) |
Pade approximation to cos( acos(x)/3 ) | |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Eigen_Sym33_NonUnit (const ScalarT *const tensor, ScalarT &eval0, ScalarT &eval1, ScalarT &eval2, ScalarT *const evec0, ScalarT *const evec1, ScalarT *const evec2) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Polar_Decomp (const ScalarT *const mat, ScalarT *const left_stretch, ScalarT *const rotation) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Polar_Left_LogV_Lame (const ScalarT *const def_grad_inc, ScalarT *const left_stretch_inc, ScalarT *const rotation_inc, ScalarT *const log_left_stretch_inc) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | CheckCorrectnessOfPolarDecomp (const ScalarT *const mat, const ScalarT *const V, const ScalarT *const R, std::string const &label) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | CheckCorrectnessOfSymSkew (const ScalarT *const mat, const ScalarT *const sym, const ScalarT *const skew, std::string const &label) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Log_Rotation_Pi (const ScalarT *const rotation, ScalarT *const log_rotation) |
template<typename ScalarT> | |
NIMBLE_INLINE_FUNCTION void | Log_Rotation (const ScalarT *const rotation, ScalarT *const log_rotation) |
NIMBLE_INLINE_FUNCTION double | Invert3x3 (const double mat[][3], double inv[][3]) |
template<class Matrix> | |
void | LU_Decompose (int num_entries, Matrix &mat, int *index) |
template<class Matrix> | |
void | LU_Solve (int num_entries, const Matrix &mat, double *vec, const int *index) |
template<class Matrix> | |
void | LU_SolveSystem (int num_entries, Matrix &mat, double *vec, int *scratch) |
NIMBLE_INLINE_FUNCTION void BCH | ( | const ScalarT *const | x, |
const ScalarT *const | y, | ||
ScalarT *const | result ) |
R^N logarithmic map using Baker-Campbell-Hausdorff (BCH) expansion (4 terms)
NIMBLE_INLINE_FUNCTION void BCH_Sym33_Full33 | ( | const ScalarT *const | sym, |
const ScalarT *const | full, | ||
ScalarT *const | result ) |
R^N logarithmic map using Baker-Campbell-Hausdorff (BCH) expansion (4 terms)
NIMBLE_INLINE_FUNCTION void CheckCorrectnessOfPolarDecomp | ( | const ScalarT *const | mat, |
const ScalarT *const | V, | ||
const ScalarT *const | R, | ||
std::string const & | label ) |
NIMBLE_INLINE_FUNCTION void CheckCorrectnessOfSymSkew | ( | const ScalarT *const | mat, |
const ScalarT *const | sym, | ||
const ScalarT *const | skew, | ||
std::string const & | label ) |
NIMBLE_INLINE_FUNCTION void CheckVectorSanity | ( | int | vec_length, |
ScalarT const *const | vec, | ||
const char * | label ) |
NIMBLE_INLINE_FUNCTION ScalarT Cos_Of_Acos_Divided_By_3 | ( | const ScalarT | x | ) |
Pade approximation to cos( acos(x)/3 )
NIMBLE_INLINE_FUNCTION void CrossProduct | ( | const ScalarT *const | u, |
const ScalarT *const | v, | ||
ScalarT *const | result ) |
NIMBLE_INLINE_FUNCTION ScalarT Determinant_Full33 | ( | const ScalarT *const | mat | ) |
NIMBLE_INLINE_FUNCTION void Eigen_Sym33_NonUnit | ( | const ScalarT *const | tensor, |
ScalarT & | eval0, | ||
ScalarT & | eval1, | ||
ScalarT & | eval2, | ||
ScalarT *const | evec0, | ||
ScalarT *const | evec1, | ||
ScalarT *const | evec2 ) |
NIMBLE_INLINE_FUNCTION ScalarT if_then | ( | const bool | b, |
const ScalarT | v1, | ||
const ScalarT | v2 ) |
NIMBLE_INLINE_FUNCTION ScalarT if_then_else | ( | const bool | b, |
const ScalarT | v1, | ||
const ScalarT | v2 ) |
NIMBLE_INLINE_FUNCTION ScalarT if_then_else_zero | ( | const bool | b, |
const ScalarT | v ) |
NIMBLE_INLINE_FUNCTION double Invert3x3 | ( | const double | mat[][3], |
double | inv[][3] ) |
NIMBLE_INLINE_FUNCTION ScalarT Invert_Full33 | ( | const ScalarT * | mat, |
ScalarT * | inv ) |
Function to invert a 3x3 matrix.
ScalarT | Scalar values |
mat | Pointer to 3x3 matrix with a storage based on the indices K_F_** |
inv | Pointer to 3x3 mqtrix with a storage based on the indices K_F_** |
NIMBLE_INLINE_FUNCTION void Log_Rotation | ( | const ScalarT *const | rotation, |
ScalarT *const | log_rotation ) |
NIMBLE_INLINE_FUNCTION void Log_Rotation_Pi | ( | const ScalarT *const | rotation, |
ScalarT *const | log_rotation ) |
void LU_Decompose | ( | int | num_entries, |
Matrix & | mat, | ||
int * | index ) |
void LU_Solve | ( | int | num_entries, |
const Matrix & | mat, | ||
double * | vec, | ||
const int * | index ) |
void LU_SolveSystem | ( | int | num_entries, |
Matrix & | mat, | ||
double * | vec, | ||
int * | scratch ) |
NIMBLE_INLINE_FUNCTION ScalarT Minimum | ( | const ScalarT | x, |
const ScalarT | y ) |
NIMBLE_INLINE_FUNCTION void Mult_Full33_Full33 | ( | const ScalarT *const | A, |
const ScalarT *const | B, | ||
ScalarT *const | result ) |
Multiply a full tensor by a full tensor.
NIMBLE_INLINE_FUNCTION void Mult_Full33_Sym33_ReturnT | ( | const ScalarT *const | full, |
const ScalarT *const | sym, | ||
ScalarT *const | result ) |
Multiply a full tensor by a symmetric tensor, return transpose of resultant.
NIMBLE_INLINE_FUNCTION void Mult_Scalar_Full33 | ( | ScalarT | a, |
const ScalarT *const | mat, | ||
ScalarT *const | result ) |
Multiply a full tensor by a scalar.
NIMBLE_INLINE_FUNCTION void Mult_Scalar_Full33_Full33 | ( | ScalarT | alpha, |
const ScalarT *const | A, | ||
const ScalarT *const | B, | ||
ScalarT *const | result ) |
Multiply a full tensor by a full tensor and a scalar.
NIMBLE_INLINE_FUNCTION void Mult_Sym33_Full33 | ( | const ScalarT *const | sym, |
const ScalarT *const | full, | ||
ScalarT *const | result ) |
Multiply a symmetric tensor by a full tensor.
NIMBLE_INLINE_FUNCTION ScalarT MultiplySign | ( | const ScalarT | x, |
const ScalarT | y ) |
Return x times sign of y.
NIMBLE_INLINE_FUNCTION ScalarT Norm_Full33 | ( | const ScalarT *const | mat | ) |
NIMBLE_INLINE_FUNCTION ScalarT Norm_Sym33 | ( | const ScalarT *const | mat | ) |
NIMBLE_INLINE_FUNCTION void Polar_Decomp | ( | const ScalarT *const | mat, |
ScalarT *const | left_stretch, | ||
ScalarT *const | rotation ) |
NIMBLE_INLINE_FUNCTION void Polar_Left_LogV_Lame | ( | const ScalarT *const | def_grad_inc, |
ScalarT *const | left_stretch_inc, | ||
ScalarT *const | rotation_inc, | ||
ScalarT *const | log_left_stretch_inc ) |
void Print_Full33 | ( | std::string | label, |
const ScalarT *const | mat, | ||
int | precision = 2 ) |
void Print_Sym33 | ( | std::string | label, |
const ScalarT *const | mat, | ||
int | precision = 2 ) |
NIMBLE_INLINE_FUNCTION void Rotate_Sym33_Using_Rtranspose_S_R | ( | const ScalarT *const | s, |
const ScalarT *const | r, | ||
ScalarT *const | result ) |
Rotate a symetric tensor, result = R^T S R.
NIMBLE_INLINE_FUNCTION void SetEqual_Full33 | ( | const ScalarT *const | B, |
ScalarT *const | A ) |
NIMBLE_INLINE_FUNCTION void SetEqual_Sym33 | ( | const ScalarT *const | B, |
ScalarT *const | A ) |
NIMBLE_INLINE_FUNCTION void SkewPart_Full33 | ( | const ScalarT *const | mat, |
ScalarT *const | result ) |
NIMBLE_INLINE_FUNCTION void Square_Full33_Full33T | ( | const ScalarT *const | mat, |
ScalarT *const | result ) |
Compute result = mat mat^T.
NIMBLE_INLINE_FUNCTION void Square_Full33T_Full33 | ( | const ScalarT *const | mat, |
ScalarT *const | result ) |
Compute result = mat^T mat.
NIMBLE_INLINE_FUNCTION int StringLength | ( | const char * | str | ) |
NIMBLE_INLINE_FUNCTION bool StringsAreEqual | ( | const char * | str1, |
const char * | str2 ) |
NIMBLE_INLINE_FUNCTION void Sum_Full33_Full33 | ( | const ScalarT *const | A, |
const ScalarT *const | B, | ||
ScalarT *const | result ) |
Sum of a full tensor and a full tensor.
NIMBLE_INLINE_FUNCTION void Sum_Sym33_Full33 | ( | const ScalarT *const | A, |
const ScalarT *const | B, | ||
ScalarT *const | result ) |
Sum of a symmetric tensor and a full tensor.
NIMBLE_INLINE_FUNCTION void SymPart_Full33 | ( | const ScalarT *const | mat, |
ScalarT *const | result ) |
NIMBLE_INLINE_FUNCTION void Unrotate_Sym33_Using_R_S_Rtranspose | ( | const ScalarT *const | s, |
const ScalarT *const | r, | ||
ScalarT *const | result ) |
Unrotate a symetric tensor, result = R S R^T.
NIMBLE_INLINE_FUNCTION void Zero_Full33 | ( | ScalarT *const | mat | ) |