PRISMS-PF Manual
Loading...
Searching...
No Matches
utilities.h File Reference
#include <deal.II/base/exceptions.h>
#include <deal.II/base/point.h>
#include <deal.II/base/tensor.h>
#include <deal.II/base/vectorization.h>
#include <deal.II/matrix_free/evaluation_flags.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>
#include <prismspf/config.h>
#include <array>
#include <string>
#include <string_view>
#include <unordered_map>
#include <prismspf/utilities/vectorized_operations.h>
Include dependency graph for utilities.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename Type >
PRISMS_PF_BEGIN_NAMESPACE Type string_to_type (const std::string &string, const std::unordered_map< std::string, Type > &table)
 Helper function that converts a string to some type, given a mapping.
 
template<typename Type , typename OtherType >
std::pair< OtherType, Typestring_to_type_pair_with_delimiters (const std::string &string, const std::unordered_map< std::string, Type > &table, const std::unordered_map< std::string, OtherType > &other_table, const std::pair< char, char > &delimiters={'(', ')'})
 Helper function that converts a string to some type pair, given two mappings and a set of delimiters.
 
template<typename Real , typename OtherReal >
Real pmod (const Real &value, const OtherReal &modulus)
 Positive moldulo (remainder) returns the normal remainder. (c++ fmod is defined abnormally for negative numbers)
 
template<unsigned int dim, typename T >
void compute_stress (const dealii::Tensor< 2, voigt_tensor_size< dim >, T > &elasticity_tensor, const dealii::Tensor< 1, voigt_tensor_size< dim >, T > &strain, dealii::Tensor< 1, voigt_tensor_size< dim >, T > &stress)
 Compute the stress with a given displacement and elasticity tensor. This assumes that the provided parameters are in Voigt notation.
 
template<unsigned int dim, typename T >
void compute_stress (const dealii::Tensor< 2, voigt_tensor_size< dim >, T > &elasticity_tensor, const dealii::Tensor< 2, dim, T > &strain, dealii::Tensor< 2, dim, T > &stress)
 Compute the stress with a given displacement and elasticity tensor. Note: this functions internally converts to Voigt notation.
 
std::string strip_whitespace (const std::string &_text)
 Remove whitespace from strings.
 
const charbool_to_string (bool boolean)
 Convert bool to string.
 
std::string eval_flags_to_string (dealii::EvaluationFlags::EvaluationFlags flag)
 Convert evaluation flags to string.
 
template<unsigned int dim, typename number >
std::vector< numberdealii_point_to_vector (const dealii::Point< dim, number > &point)
 

Variables

template<unsigned int dim>
constexpr unsigned int voigt_tensor_size = (2 * dim) - 1 + (dim / 3)
 Voigt notation index range.
 

Function Documentation

◆ bool_to_string()

const char * bool_to_string ( bool  boolean)
inline

Convert bool to string.

◆ compute_stress() [1/2]

template<unsigned int dim, typename T >
void compute_stress ( const dealii::Tensor< 2, voigt_tensor_size< dim >, T > &  elasticity_tensor,
const dealii::Tensor< 1, voigt_tensor_size< dim >, T > &  strain,
dealii::Tensor< 1, voigt_tensor_size< dim >, T > &  stress 
)
inline

Compute the stress with a given displacement and elasticity tensor. This assumes that the provided parameters are in Voigt notation.

◆ compute_stress() [2/2]

template<unsigned int dim, typename T >
void compute_stress ( const dealii::Tensor< 2, voigt_tensor_size< dim >, T > &  elasticity_tensor,
const dealii::Tensor< 2, dim, T > &  strain,
dealii::Tensor< 2, dim, T > &  stress 
)
inline

Compute the stress with a given displacement and elasticity tensor. Note: this functions internally converts to Voigt notation.

◆ dealii_point_to_vector()

template<unsigned int dim, typename number >
std::vector< number > dealii_point_to_vector ( const dealii::Point< dim, number > &  point)
inline

◆ eval_flags_to_string()

std::string eval_flags_to_string ( dealii::EvaluationFlags::EvaluationFlags  flag)
inline

Convert evaluation flags to string.

◆ pmod()

Real pmod ( const Real value,
const OtherReal modulus 
)
inline

Positive moldulo (remainder) returns the normal remainder. (c++ fmod is defined abnormally for negative numbers)

◆ string_to_type()

template<typename Type >
PRISMS_PF_BEGIN_NAMESPACE Type string_to_type ( const std::string string,
const std::unordered_map< std::string, Type > &  table 
)

Helper function that converts a string to some type, given a mapping.

◆ string_to_type_pair_with_delimiters()

std::pair< OtherType, Type > string_to_type_pair_with_delimiters ( const std::string string,
const std::unordered_map< std::string, Type > &  table,
const std::unordered_map< std::string, OtherType > &  other_table,
const std::pair< char, char > &  delimiters = {'(', ')'} 
)

Helper function that converts a string to some type pair, given two mappings and a set of delimiters.

Note that this function requires the general form of one of the below cases. Parentheses are used for delimiters for simplicity.

Case 1: Input - Type(OtherType) Output - {OtherType, Type} Case 2: Input - OtherType Output - {OtherType, Type}

The input string would have the types replaced with their respective mappings.

◆ strip_whitespace()

std::string strip_whitespace ( const std::string _text)
inline

Remove whitespace from strings.

Variable Documentation

◆ voigt_tensor_size

template<unsigned int dim>
constexpr unsigned int voigt_tensor_size = (2 * dim) - 1 + (dim / 3)
constexpr

Voigt notation index range.