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

Calculate and assemble S matrix. More...

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

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

Public Member Functions

 OpCellS (Mat a, const double eps_u)
 
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 epsU
 
MatrixDouble C
 

Detailed Description

Calculate and assemble S matrix.

Examples
cell_forces.cpp.

Definition at line 201 of file CellForces.hpp.

Constructor & Destructor Documentation

◆ OpCellS()

CellEngineering::OpCellS::OpCellS ( Mat  a,
const double  eps_u 
)

Definition at line 207 of file CellForces.hpp.

209  "UPSILON", "U", UserDataOperator::OPROWCOL),
210  A(a), epsU(eps_u) {
211  sYmm = false;
212  }
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

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

Definition at line 216 of file CellForces.hpp.

219  {
220 
222 
223  int nb_row = row_data.getIndices().size();
224  int nb_col = col_data.getIndices().size();
225 
226  if (nb_row == 0)
228  if (nb_col == 0)
230 
231  const VectorInt &row_indices = row_data.getIndices();
232  const VectorInt &col_indices = col_data.getIndices();
233 
234  const int nb_gauss_pts = row_data.getN().size1();
235 
236  C.resize(nb_row, nb_col, false);
237  C.clear();
238  for (int gg = 0; gg != nb_gauss_pts; gg++) {
239  // get integration weights
240  const double val = getGaussPts()(2, gg) * getArea() * pow(epsU, -1);
241  for (int rr = 0; rr != nb_row / 3; rr++) {
242  const double nr = row_data.getN(gg)[rr];
243  for (int cc = 0; cc != nb_col / 3; cc++) {
244  const double nc = col_data.getN(gg)[cc];
245  const double c = val * nr * nc;
246  C(3 * rr + 0, 3 * cc + 0) += c;
247  C(3 * rr + 1, 3 * cc + 1) += c;
248  }
249  }
250  }
251 
252  CHKERR MatSetValues(A, nb_row, &*row_indices.begin(), nb_col,
253  &*col_indices.begin(), &*C.data().begin(), ADD_VALUES);
254 
256  }
#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::OpCellS::A

Definition at line 204 of file CellForces.hpp.

◆ C

MatrixDouble CellEngineering::OpCellS::C

Definition at line 214 of file CellForces.hpp.

◆ epsU

const double CellEngineering::OpCellS::epsU

Definition at line 205 of file CellForces.hpp.


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