v0.14.0
Public Member Functions | Public Attributes | List of all members
OpGetDensityField< ALE > Struct Template Reference
Inheritance diagram for OpGetDensityField< ALE >:
[legend]
Collaboration diagram for OpGetDensityField< ALE >:
[legend]

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< MatrixDouble > matCoordsPtr
 
boost::shared_ptr< VectorDouble > rhoAtGaussPtsPtr
 
boost::shared_ptr< MatrixDouble > rhoGradAtGaussPtsPtr
 

Detailed Description

template<bool ALE>
struct OpGetDensityField< ALE >

Examples
testing_jacobian_of_hook_scaled_with_density_element.cpp.

Definition at line 19 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 
)
inline

Definition at line 24 of file testing_jacobian_of_hook_scaled_with_density_element.cpp.

28  : HookeElement::VolUserDataOperator(row_field, OPROW),
29  matCoordsPtr(mat_coords_ptr), rhoAtGaussPtsPtr(density_at_pts),
30  rhoGradAtGaussPtsPtr(rho_grad_at_gauss_pts_ptr) {}

Member Function Documentation

◆ doWork()

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

Definition at line 32 of file testing_jacobian_of_hook_scaled_with_density_element.cpp.

33  {
35  if (row_type != MBVERTEX)
37  // get number of integration points
38  const int nb_integration_pts = getGaussPts().size2();
39  rhoAtGaussPtsPtr->resize(nb_integration_pts, false);
40  rhoAtGaussPtsPtr->clear();
41  rhoGradAtGaussPtsPtr->resize(3, nb_integration_pts, false);
42  rhoGradAtGaussPtsPtr->clear();
43 
44  auto t_rho = getFTensor0FromVec(*rhoAtGaussPtsPtr);
45  auto t_grad_rho = getFTensor1FromMat<3>(*rhoGradAtGaussPtsPtr);
46 
47  MatrixDouble coords;
48  if (ALE)
49  coords = *matCoordsPtr;
50  else
51  coords = trans(getCoordsAtGaussPts()); // because the size is (nb_gg,3)
52 
54  auto t_coords = getFTensor1FromMat<3>(coords);
55 
56  for (int gg = 0; gg != nb_integration_pts; ++gg) {
57  t_rho = 1 + t_coords(i) * t_coords(i); // density is equal to
58  // 1+x^2+y^2+z^2 (x,y,z coordines)
59  t_grad_rho(i) = 2 * t_coords(i);
60 
61  ++t_rho;
62  ++t_coords;
63  ++t_grad_rho;
64  }
65 
67  }

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:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
VolUserDataOperator
VolumeElementForcesAndSourcesCore::UserDataOperator VolUserDataOperator
Definition: elasticity.cpp:76
OpGetDensityField::rhoGradAtGaussPtsPtr
boost::shared_ptr< MatrixDouble > rhoGradAtGaussPtsPtr
Definition: testing_jacobian_of_hook_scaled_with_density_element.cpp:23
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 3 >
OpGetDensityField::rhoAtGaussPtsPtr
boost::shared_ptr< VectorDouble > rhoAtGaussPtsPtr
Definition: testing_jacobian_of_hook_scaled_with_density_element.cpp:22
OpGetDensityField::matCoordsPtr
boost::shared_ptr< MatrixDouble > matCoordsPtr
Definition: testing_jacobian_of_hook_scaled_with_density_element.cpp:21
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359