v0.12.1
Public Member Functions | Public Attributes | List of all members
CellEngineering::OpCellPotentialB Struct Reference

Calculate and assemble B matrix. More...

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

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

Public Member Functions

 OpCellPotentialB (Mat a, const string field_name)
 
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
 
MatrixDouble C
 

Detailed Description

Calculate and assemble B matrix.

\[ \mathbf{B} = \int_{S_0} \mathbf{N}^\textrm{T}_\textrm{u} \frac{\partial \mathbf{N}_\rho}{\partial \mathbf{x}} \textrm{d}S \]

Definition at line 140 of file CellForces.hpp.

Constructor & Destructor Documentation

◆ OpCellPotentialB()

CellEngineering::OpCellPotentialB::OpCellPotentialB ( Mat  a,
const string  field_name 
)

Definition at line 145 of file CellForces.hpp.

147  "RHO", field_name, UserDataOperator::OPROWCOL),
148  A(a) {
149  sYmm = false;
150  }
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

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

Definition at line 154 of file CellForces.hpp.

157  {
158 
160 
161  int nb_row = row_data.getIndices().size();
162  int nb_col = col_data.getIndices().size();
163 
164  if (nb_row == 0)
166  if (nb_col == 0)
168 
169  const VectorInt &row_indices = row_data.getIndices();
170  const VectorInt &col_indices = col_data.getIndices();
171 
172  const int nb_gauss_pts = row_data.getN().size1();
173 
174  C.resize(nb_row, nb_col, false);
175  C.clear();
176  for (int gg = 0; gg != nb_gauss_pts; gg++) {
177  // get integration weights
178  const double val = getGaussPts()(2, gg) * getArea();
179  for (int rr = 0; rr != nb_row; rr++) {
180  const double diff_nr_x = row_data.getDiffN()(gg, 2 * rr + 0);
181  const double diff_nr_y = row_data.getDiffN()(gg, 2 * rr + 1);
182  for (int cc = 0; cc != nb_col / 3; cc++) {
183  const double nc = col_data.getN(gg)[cc];
184  C(rr, 3 * cc + 0) -= val * diff_nr_x * nc;
185  C(rr, 3 * cc + 1) -= val * diff_nr_y * nc;
186  }
187  }
188  }
189 
190  CHKERR MatSetValues(A, nb_row, &*row_indices.begin(), nb_col,
191  &*col_indices.begin(), &*C.data().begin(), ADD_VALUES);
192 
194  }
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:522
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:421
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:491
#define CHKERR
Inline error check.
Definition: definitions.h:610
ublas::vector< int, IntAllocator > VectorInt
Definition: Types.hpp:73
constexpr auto MatSetValues

Member Data Documentation

◆ A

Mat CellEngineering::OpCellPotentialB::A

Definition at line 143 of file CellForces.hpp.

◆ C

MatrixDouble CellEngineering::OpCellPotentialB::C

Definition at line 152 of file CellForces.hpp.


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