v0.13.0
Public Member Functions | Private Attributes | List of all members
StdRDOperators::OpAssembleMass Struct Reference

#include <users_modules/softmech/chemo_mech/src/rd_stdOperators.hpp>

Inheritance diagram for StdRDOperators::OpAssembleMass:
[legend]
Collaboration diagram for StdRDOperators::OpAssembleMass:
[legend]

Public Member Functions

 OpAssembleMass (std::string fieldu, SmartPetscObj< Mat > m)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 

Private Attributes

MatrixDouble mat
 
MatrixDouble transMat
 
SmartPetscObj< Mat > M
 

Detailed Description

Definition at line 74 of file rd_stdOperators.hpp.

Constructor & Destructor Documentation

◆ OpAssembleMass()

StdRDOperators::OpAssembleMass::OpAssembleMass ( std::string  fieldu,
SmartPetscObj< Mat >  m 
)

Definition at line 75 of file rd_stdOperators.hpp.

76  : OpEle(fieldu, fieldu, OpEle::OPROWCOL), M(m)
77 
78  {
79  sYmm = true;
80  }
FaceElementForcesAndSourcesCore::UserDataOperator OpEle
FTensor::Index< 'm', 3 > m

Member Function Documentation

◆ doWork()

MoFEMErrorCode StdRDOperators::OpAssembleMass::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
EntData row_data,
EntData col_data 
)

Definition at line 81 of file rd_stdOperators.hpp.

83  {
85  const int nb_row_dofs = row_data.getIndices().size();
86  const int nb_col_dofs = col_data.getIndices().size();
87  if (nb_row_dofs && nb_col_dofs) {
88  const int nb_integration_pts = getGaussPts().size2();
89  mat.resize(nb_row_dofs, nb_col_dofs, false);
90  mat.clear();
91  auto t_row_base = row_data.getFTensor0N();
92  auto t_w = getFTensor0IntegrationWeight();
93  const double vol = getMeasure();
94  for (int gg = 0; gg != nb_integration_pts; ++gg) {
95  const double a = t_w * vol;
96  for (int rr = 0; rr != nb_row_dofs; ++rr) {
97  auto t_col_base = col_data.getFTensor0N(gg, 0);
98  for (int cc = 0; cc != nb_col_dofs; ++cc) {
99  mat(rr, cc) += a * t_row_base * t_col_base;
100  ++t_col_base;
101  }
102  ++t_row_base;
103  }
104  ++t_w;
105  }
106  CHKERR MatSetValues(M, row_data, col_data, &mat(0, 0), ADD_VALUES);
107  if (row_side != col_side || row_type != col_type) {
108  transMat.resize(nb_col_dofs, nb_row_dofs, false);
109  noalias(transMat) = trans(mat);
110  CHKERR MatSetValues(M, col_data, row_data, &transMat(0, 0), ADD_VALUES);
111  }
112  }
114  }
constexpr double a
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
const VectorInt & getIndices() const
Get global indices of dofs on entity.

Member Data Documentation

◆ M

SmartPetscObj<Mat> StdRDOperators::OpAssembleMass::M
private

Definition at line 118 of file rd_stdOperators.hpp.

◆ mat

MatrixDouble StdRDOperators::OpAssembleMass::mat
private

Definition at line 117 of file rd_stdOperators.hpp.

◆ transMat

MatrixDouble StdRDOperators::OpAssembleMass::transMat
private

Definition at line 117 of file rd_stdOperators.hpp.


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