v0.9.0
Public Member Functions | Public Attributes | List of all members
CellEngineering::OpCellPotentialD Struct Reference

Calculate and assemble D matrix. More...

#include <users_modules/cell_engineering/src/CellForces.hpp>

Inheritance diagram for CellEngineering::OpCellPotentialD:
[legend]
Collaboration diagram for CellEngineering::OpCellPotentialD:
[legend]

Public Member Functions

 OpCellPotentialD (Mat a, const double rho)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, DataForcesAndSourcesCore::EntData &row_data, DataForcesAndSourcesCore::EntData &col_data)
 

Public Attributes

Mat A
 
const double epsRho
 
MatrixDouble C
 

Detailed Description

Calculate and assemble D matrix.

Examples
cell_forces.cpp.

Definition at line 73 of file CellForces.hpp.

Constructor & Destructor Documentation

◆ OpCellPotentialD()

CellEngineering::OpCellPotentialD::OpCellPotentialD ( Mat  a,
const double  rho 
)

Definition at line 79 of file CellForces.hpp.

81  "RHO", "RHO", UserDataOperator::OPROWCOL),
82  A(a), epsRho(rho) {
83  sYmm = false;
84  }
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

MoFEMErrorCode CellEngineering::OpCellPotentialD::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
DataForcesAndSourcesCore::EntData row_data,
DataForcesAndSourcesCore::EntData col_data 
)

Definition at line 88 of file CellForces.hpp.

91  {
92 
94 
95  int nb_row = row_data.getIndices().size();
96  int nb_col = col_data.getIndices().size();
97 
98  if (nb_row == 0)
100  if (nb_col == 0)
102 
103  const VectorInt &row_indices = row_data.getIndices();
104  const VectorInt &col_indices = col_data.getIndices();
105 
106  const int nb_gauss_pts = row_data.getN().size1();
107 
108  C.resize(nb_row, nb_col, false);
109  C.clear();
110  for (int gg = 0; gg != nb_gauss_pts; gg++) {
111  // get integration weights
112  const double val = getGaussPts()(2, gg) * getArea() * epsRho;
113  for (int rr = 0; rr != nb_row; rr++) {
114  const double diff_nr_x = row_data.getDiffN()(gg, 2 * rr + 0);
115  const double diff_nr_y = row_data.getDiffN()(gg, 2 * rr + 1);
116  for (int cc = 0; cc != nb_col; cc++) {
117  const double diff_nc_x = col_data.getDiffN()(gg, 2 * cc + 0);
118  const double diff_nc_y = col_data.getDiffN()(gg, 2 * cc + 1);
119  C(rr, cc) += val * (diff_nr_x * diff_nc_x + diff_nr_y * diff_nc_y);
120  }
121  }
122  }
123 
124  CHKERR MatSetValues(A, nb_row, &*row_indices.begin(), nb_col,
125  &*col_indices.begin(), &*C.data().begin(), ADD_VALUES);
126 
128  }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:477
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:508
MoFEMErrorCode MatSetValues(Mat M, const DataForcesAndSourcesCore::EntData &row_data, const DataForcesAndSourcesCore::EntData &col_data, const double *ptr, InsertMode iora)
Assemble PETSc matrix.
#define CHKERR
Inline error check.
Definition: definitions.h:596
ublas::vector< int, IntAllocator > VectorInt
Definition: Types.hpp:71
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:407

Member Data Documentation

◆ A

Mat CellEngineering::OpCellPotentialD::A

Definition at line 76 of file CellForces.hpp.

◆ C

MatrixDouble CellEngineering::OpCellPotentialD::C

Definition at line 86 of file CellForces.hpp.

◆ epsRho

const double CellEngineering::OpCellPotentialD::epsRho

Definition at line 77 of file CellForces.hpp.


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