v0.10.0
Public Member Functions | Public Attributes | List of all members
OpGetDensityField< ALE > Struct Template Reference

Inherits VolUserDataOperator.

Public Member Functions

 OpGetDensityField (const std::string row_field, boost::shared_ptr< MatrixDouble > mat_coords_ptr, boost::shared_ptr< VectorDouble > density_at_pts, boost::shared_ptr< MatrixDouble > rho_grad_at_gauss_pts_ptr)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, HookeElement::EntData &row_data)
 

Public Attributes

boost::shared_ptr< MatrixDoublematCoordsPtr
 
boost::shared_ptr< VectorDoublerhoAtGaussPtsPtr
 
boost::shared_ptr< MatrixDoublerhoGradAtGaussPtsPtr
 

Detailed Description

template<bool ALE>
struct OpGetDensityField< ALE >

Examples
testing_jacobian_of_hook_scaled_with_density_element.cpp.

Definition at line 30 of file testing_jacobian_of_hook_scaled_with_density_element.cpp.

Constructor & Destructor Documentation

◆ OpGetDensityField()

template<bool ALE>
OpGetDensityField< ALE >::OpGetDensityField ( const std::string  row_field,
boost::shared_ptr< MatrixDouble mat_coords_ptr,
boost::shared_ptr< VectorDouble density_at_pts,
boost::shared_ptr< MatrixDouble rho_grad_at_gauss_pts_ptr 
)

Definition at line 35 of file testing_jacobian_of_hook_scaled_with_density_element.cpp.

39  : HookeElement::VolUserDataOperator(row_field, OPROW),
40  matCoordsPtr(mat_coords_ptr), rhoAtGaussPtsPtr(density_at_pts),
41  rhoGradAtGaussPtsPtr(rho_grad_at_gauss_pts_ptr) {}
VolumeElementForcesAndSourcesCore::UserDataOperator VolUserDataOperator
Definition: elasticity.cpp:91
boost::shared_ptr< MatrixDouble > rhoGradAtGaussPtsPtr

Member Function Documentation

◆ doWork()

template<bool ALE>
MoFEMErrorCode OpGetDensityField< ALE >::doWork ( int  row_side,
EntityType  row_type,
HookeElement::EntData row_data 
)

Definition at line 43 of file testing_jacobian_of_hook_scaled_with_density_element.cpp.

44  {
46  if (row_type != MBVERTEX)
48  // get number of integration points
49  const int nb_integration_pts = getGaussPts().size2();
50  rhoAtGaussPtsPtr->resize(nb_integration_pts, false);
51  rhoAtGaussPtsPtr->clear();
52  rhoGradAtGaussPtsPtr->resize(3, nb_integration_pts, false);
53  rhoGradAtGaussPtsPtr->clear();
54 
55  auto t_rho = getFTensor0FromVec(*rhoAtGaussPtsPtr);
56  auto t_grad_rho = getFTensor1FromMat<3>(*rhoGradAtGaussPtsPtr);
57 
58  MatrixDouble coords;
59  if (ALE)
60  coords = *matCoordsPtr;
61  else
62  coords = trans(getCoordsAtGaussPts()); // because the size is (nb_gg,3)
63 
65  auto t_coords = getFTensor1FromMat<3>(coords);
66 
67  for (int gg = 0; gg != nb_integration_pts; ++gg) {
68  t_rho = 1 + t_coords(i) * t_coords(i); // density is equal to
69  // 1+x^2+y^2+z^2 (x,y,z coordines)
70  t_grad_rho(i) = 2 * t_coords(i);
71 
72  ++t_rho;
73  ++t_coords;
74  ++t_grad_rho;
75  }
76 
78  }
static FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:143
ublas::matrix< double, ublas::row_major, DoubleAllocator > MatrixDouble
Definition: Types.hpp:76
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:485
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:516
static Index< 'i', 3 > i
boost::shared_ptr< MatrixDouble > rhoGradAtGaussPtsPtr
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:415

Member Data Documentation

◆ matCoordsPtr

template<bool ALE>
boost::shared_ptr<MatrixDouble> OpGetDensityField< ALE >::matCoordsPtr

◆ rhoAtGaussPtsPtr

template<bool ALE>
boost::shared_ptr<VectorDouble> OpGetDensityField< ALE >::rhoAtGaussPtsPtr

◆ rhoGradAtGaussPtsPtr

template<bool ALE>
boost::shared_ptr<MatrixDouble> OpGetDensityField< ALE >::rhoGradAtGaussPtsPtr

The documentation for this struct was generated from the following file: