CArl
Code Arlequin / C++ implementation
anisotropic_elasticity_cubic_sym.h
Go to the documentation of this file.
1 /*
2  * anisotropic_elasticity_cubic_sym.h
3  *
4  * Created on: Sep 4, 2016
5  * Author: Thiago Milanetto Schlittler
6  */
7 
8 #ifndef COMMON_LIBMESH_CODE_ANISOTROPIC_ELASTICITY_CUBIC_SYM_H_
9 #define COMMON_LIBMESH_CODE_ANISOTROPIC_ELASTICITY_CUBIC_SYM_H_
10 
11 #include "carl_headers.h"
12 
14 {
15 private:
16  int m_dim;
17  std::vector<int> m_idx_mult;
18  unsigned int m_idx;
19 
20 public:
22  m_dim { 0 },
23  m_idx { 0 }
24  {
25 
26  };
27 
28  Order4Tensor(int dim) :
29  m_idx { 0 }
30  {
31  m_dim = dim;
32  set_dimension(dim);
33  };
34 
35  std::vector<libMesh::Real> vector;
36 
37  void set_dimension(int dim)
38  {
39  m_dim = dim;
40  m_idx_mult.resize(4);
41  vector.resize(std::pow(m_dim,4),0);
42 
43  for(int iii = 0; iii < 4; ++iii)
44  {
45  m_idx_mult[iii] = std::pow(m_dim,iii);
46  }
47  }
48  libMesh::Real& operator () (unsigned int iii, unsigned int jjj, unsigned int kkk, unsigned int lll);
49 };
50 
51 inline libMesh::Real& Order4Tensor::operator () (unsigned int iii, unsigned int jjj, unsigned int kkk, unsigned int lll)
52 {
53  m_idx = m_idx_mult[0] * iii
54  + m_idx_mult[1] * jjj
55  + m_idx_mult[2] * kkk
56  + m_idx_mult[3] * lll;
57  return vector[m_idx];
58 }
59 
61 {
62 private:
63  std::vector<libMesh::DenseMatrix<libMesh::Real> > m_Rotation_matrices;
64  std::vector<Order4Tensor> m_Elasticity_tensors;
65  std::vector<double> m_angles_x;
66  std::vector<double> m_angles_y;
67  std::vector<double> m_angles_z;
68  std::unordered_map<int,int> m_domain_to_vec_map;
69 
70  double m_c11;
71  double m_c12;
72  double m_c44;
73 
74  int m_nb_grains;
75 
76  void generate_rotation_matrices();
77  void generate_elasticity_tensors();
78 
79 public:
80 
82  m_c11 { -1 },
83  m_c12 { -1 },
84  m_c44 { -1 },
85  m_nb_grains { -1}
86  {
87 
88  };
89 
90  anisotropic_elasticity_tensor_cubic_sym(libMesh::EquationSystems& es, std::string& physicalParamsFile)
91  {
92  this->set_parameters(es, physicalParamsFile);
93  };
94 
95  libMesh::Real eval_internal_elasticity_tensor(unsigned int i,
96  unsigned int j,
97  unsigned int k,
98  unsigned int l);
99 
100  void set_parameters(libMesh::EquationSystems& es, std::string& physicalParamsFile);
101 
102  libMesh::DenseMatrix<libMesh::Real>& get_rotation(int idx_grain);
103  Order4Tensor& get_elasticity(int idx_grain);
104 
105  libMesh::Real eval_elasticity_tensor(unsigned int i,
106  unsigned int j,
107  unsigned int k,
108  unsigned int l,
109  int idx_grain);
110 };
111 
112 #endif /* COMMON_LIBMESH_CODE_ANISOTROPIC_ELASTICITY_CUBIC_SYM_H_ */
void set_parameters(libMesh::EquationSystems &es, std::string &physicalParamsFile)
std::vector< libMesh::Real > vector
libMesh::Real eval_internal_elasticity_tensor(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
libMesh::Real & operator()(unsigned int iii, unsigned int jjj, unsigned int kkk, unsigned int lll)
libMesh::Real eval_elasticity_tensor(unsigned int i, unsigned int j, unsigned int k, unsigned int l, int idx_grain)
anisotropic_elasticity_tensor_cubic_sym(libMesh::EquationSystems &es, std::string &physicalParamsFile)
libMesh::DenseMatrix< libMesh::Real > & get_rotation(int idx_grain)