v0.13.0
Public Member Functions | Private Attributes | List of all members
StdRDOperators::OpAssembleStiffLhs< DIM > Struct Template Reference

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

Inheritance diagram for StdRDOperators::OpAssembleStiffLhs< DIM >:
[legend]
Collaboration diagram for StdRDOperators::OpAssembleStiffLhs< DIM >:
[legend]

Public Member Functions

 OpAssembleStiffLhs (std::string fieldu, boost::shared_ptr< PreviousData > &data, std::map< int, BlockData > &block_map)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 

Private Attributes

boost::shared_ptr< PreviousDatacommonData
 
std::map< int, BlockDatasetOfBlock
 
MatrixDouble mat
 
MatrixDouble transMat
 

Detailed Description

template<int DIM>
struct StdRDOperators::OpAssembleStiffLhs< DIM >

Definition at line 395 of file rd_stdOperators.hpp.

Constructor & Destructor Documentation

◆ OpAssembleStiffLhs()

template<int DIM>
StdRDOperators::OpAssembleStiffLhs< DIM >::OpAssembleStiffLhs ( std::string  fieldu,
boost::shared_ptr< PreviousData > &  data,
std::map< int, BlockData > &  block_map 
)

Definition at line 397 of file rd_stdOperators.hpp.

399  : OpEle(fieldu, fieldu, OpEle::OPROWCOL), commonData(data),
401  sYmm = true;
402  }
FaceElementForcesAndSourcesCore::UserDataOperator OpEle
std::map< int, BlockData > setOfBlock
boost::shared_ptr< PreviousData > commonData

Member Function Documentation

◆ doWork()

template<int DIM>
MoFEMErrorCode StdRDOperators::OpAssembleStiffLhs< DIM >::doWork ( int  row_side,
int  col_side,
EntityType  row_type,
EntityType  col_type,
EntData row_data,
EntData col_data 
)

Definition at line 403 of file rd_stdOperators.hpp.

405  {
407 
408  const int nb_row_dofs = row_data.getIndices().size();
409  const int nb_col_dofs = col_data.getIndices().size();
410  // cerr << "In doWork() : (row, col) = (" << nb_row_dofs << ", " <<
411  // nb_col_dofs << ")" << endl;
412  if (nb_row_dofs && nb_col_dofs) {
413  auto find_block_data = [&]() {
414  EntityHandle fe_ent = getFEEntityHandle();
415  BlockData *block_raw_ptr = nullptr;
416  for (auto &m : setOfBlock) {
417  if (m.second.block_ents.find(fe_ent) != m.second.block_ents.end()) {
418  block_raw_ptr = &m.second;
419  break;
420  }
421  }
422  return block_raw_ptr;
423  };
424 
425  auto block_data_ptr = find_block_data();
426  if (!block_data_ptr)
427  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Block not found");
428 
429  auto &block_data = *block_data_ptr;
430 
431  mat.resize(nb_row_dofs, nb_col_dofs, false);
432  mat.clear();
433  const int nb_integration_pts = getGaussPts().size2();
434  auto t_row_base = row_data.getFTensor0N();
435 
436  auto t_val = getFTensor0FromVec(commonData->values);
437  auto t_grad = getFTensor1FromMat<DIM>(commonData->grads);
438 
439  auto t_row_diff_base = row_data.getFTensor1DiffN<DIM>();
440  auto t_w = getFTensor0IntegrationWeight();
441  const double ts_a = getFEMethod()->ts_a;
442  const double vol = getMeasure();
443 
445 
446  // cout << "B0 : " << block_data.B0 << endl;
447 
448  for (int gg = 0; gg != nb_integration_pts; ++gg) {
449  const double a = vol * t_w;
450 
451  for (int rr = 0; rr != nb_row_dofs; ++rr) {
452  auto t_col_base = col_data.getFTensor0N(gg, 0);
453  auto t_col_diff_base = col_data.getFTensor1DiffN<DIM>(gg, 0);
454  for (int cc = 0; cc != nb_col_dofs; ++cc) {
455 
456  mat(rr, cc) +=
457  a * (t_row_base * t_col_base * ts_a +
458  (block_data.B0 + B * t_val) * t_row_diff_base(i) *
459  t_col_diff_base(i) +
460  B * t_col_base * t_grad(i) * t_row_diff_base(i));
461 
462  ++t_col_base;
463  ++t_col_diff_base;
464  }
465  ++t_row_base;
466  ++t_row_diff_base;
467  }
468  ++t_w;
469  ++t_val;
470  ++t_grad;
471  }
472  CHKERR MatSetValues(getFEMethod()->ts_B, row_data, col_data, &mat(0, 0),
473  ADD_VALUES);
474  if (row_side != col_side || row_type != col_type) {
475  transMat.resize(nb_col_dofs, nb_row_dofs, false);
476  noalias(transMat) = trans(mat);
477  CHKERR MatSetValues(getFEMethod()->ts_B, col_data, row_data,
478  &transMat(0, 0), ADD_VALUES);
479  }
480  }
482  }
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
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:44
#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
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:149
FTensor::Index< 'i', 3 > i
const double B
FTensor::Index< 'm', 3 > m
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
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

◆ commonData

template<int DIM>
boost::shared_ptr<PreviousData> StdRDOperators::OpAssembleStiffLhs< DIM >::commonData
private

Definition at line 485 of file rd_stdOperators.hpp.

◆ mat

template<int DIM>
MatrixDouble StdRDOperators::OpAssembleStiffLhs< DIM >::mat
private

Definition at line 487 of file rd_stdOperators.hpp.

◆ setOfBlock

template<int DIM>
std::map<int, BlockData> StdRDOperators::OpAssembleStiffLhs< DIM >::setOfBlock
private

Definition at line 486 of file rd_stdOperators.hpp.

◆ transMat

template<int DIM>
MatrixDouble StdRDOperators::OpAssembleStiffLhs< DIM >::transMat
private

Definition at line 487 of file rd_stdOperators.hpp.


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