v0.16.0
Loading...
Searching...
No Matches
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< MatrixDoublematCoordsPtr
 
boost::shared_ptr< VectorDoublerhoAtGaussPtsPtr
 
boost::shared_ptr< MatrixDoublerhoGradAtGaussPtsPtr
 

Detailed Description

template<bool ALE>
struct OpGetDensityField< ALE >
Examples
mofem/users_modules/basic_finite_elements/atom_tests/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
Examples
mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_scaled_with_density_element.cpp.

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
45 auto t_grad_rho =
46 getFTensor1FromMat<3, -1, CoeffsByGauss>(*rhoGradAtGaussPtsPtr);
47
48 FTensor::Index<'i', 3> i;
49 auto set_density = [&](auto t_coords) {
50 for (int gg = 0; gg != nb_integration_pts; ++gg) {
51 t_rho = 1 + t_coords(i) * t_coords(i); // 1+x^2+y^2+z^2
52 t_grad_rho(i) = 2 * t_coords(i);
53
54 ++t_rho;
55 ++t_coords;
56 ++t_grad_rho;
57 }
58 };
59
60 if constexpr (ALE) {
61 set_density(getFTensor1FromMat<3>(*matCoordsPtr));
62 } else {
63 MatrixDouble coords =
64 trans(getCoordsAtGaussPts()); // because the size is (nb_gg,3)
65 set_density(getFTensor1FromMat<3, -1, CoeffsByGauss>(coords));
66 }
67
69 }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FTensor::Index< 'i', SPACE_DIM > i
auto getFTensor1FromMat(M &data, int rr=0, int cc=0)
Get tensor rank 1 (vector) form data matrix.
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.

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: