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

Calculate and assemble Z matrix. More...

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

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

Public Member Functions

 OpCellCurlB (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 Z matrix.

Definition at line 392 of file CellForces.hpp.

Constructor & Destructor Documentation

◆ OpCellCurlB()

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

Definition at line 397 of file CellForces.hpp.

399  "RHO", field_name, UserDataOperator::OPROWCOL),
400  A(a) {
401  sYmm = false;
402  }
ForcesAndSourcesCore::UserDataOperator UserDataOperator

Member Function Documentation

◆ doWork()

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

Definition at line 406 of file CellForces.hpp.

409  {
410 
412 
413  int nb_row = row_data.getIndices().size();
414  int nb_col = col_data.getIndices().size();
415 
416  if (nb_row == 0)
418  if (nb_col == 0)
420 
421  const VectorInt &row_indices = row_data.getIndices();
422  const VectorInt &col_indices = col_data.getIndices();
423 
424  const int nb_gauss_pts = row_data.getN().size1();
425 
426  auto t_base_row = row_data.getFTensor1N<3>();
427 
428  C.resize(nb_row, nb_col, false);
429  C.clear();
430  for (int gg = 0; gg != nb_gauss_pts; gg++) {
431  // get integration weights
432  const double val = getGaussPts()(2, gg) * getArea();
433  for (int rr = 0; rr != nb_row; rr++) {
434  // This is scalar field, diff yield tensor1
435  auto t_base_col = col_data.getFTensor0N(gg, 0);
436  for (int cc = 0; cc != nb_col / 3; cc++) {
437  C(rr, 3 * cc + 0) -= val * t_base_row(0) * t_base_col;
438  C(rr, 3 * cc + 1) -= val * t_base_row(1) * t_base_col;
439  ++t_base_col;
440  }
441  ++t_base_row;
442  }
443  }
444 
445  CHKERR MatSetValues(A, nb_row, &*row_indices.begin(), nb_col,
446  &*col_indices.begin(), &*C.data().begin(), ADD_VALUES);
447 
449  }
#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::OpCellCurlB::A

Definition at line 395 of file CellForces.hpp.

◆ C

MatrixDouble CellEngineering::OpCellCurlB::C

Definition at line 404 of file CellForces.hpp.


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