v0.14.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase > Struct Template Reference

#include <src/finite_elements/BiLinearFormsIntegrators.hpp>

Inheritance diagram for MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >:
[legend]
Collaboration diagram for MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >:
[legend]

Public Member Functions

 OpGradSymTensorGradImpl (const std::string row_field_name, const std::string col_field_name, boost::shared_ptr< MatrixDouble > mat_D, boost::shared_ptr< Range > ents_ptr=nullptr, ScalarFun beta=scalar_fun_one)
 
- Public Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
 OpBaseImpl (const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=nullptr)
 
MoFEMErrorCode doWork (int row_side, int col_side, EntityType row_type, EntityType col_type, EntData &row_data, EntData &col_data)
 Do calculations for the left hand side. More...
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntData &row_data)
 Do calculations for the right hand side. More...
 

Public Attributes

FTensor::Index< 'i', SPACE_DIMi
 summit Index More...
 
- Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
TimeFun timeScalingFun
 assumes that time variable is set More...
 
FEFun feScalingFun
 assumes that time variable is set More...
 
boost::shared_ptr< RangeentsPtr
 Entities on which element is run. More...
 

Protected Member Functions

MoFEMErrorCode iNtegrate (EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
 Integrate grad-grad operator. More...
 
- Protected Member Functions inherited from MoFEM::OpBaseImpl< A, EleOp >
template<int DIM>
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf ()
 
template<int DIM>
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > getLocMat (const int rr)
 
virtual MoFEMErrorCode aSsemble (EntData &row_data, EntData &col_data, const bool trans)
 
virtual MoFEMErrorCode iNtegrate (EntData &data)
 Class dedicated to integrate operator. More...
 
virtual MoFEMErrorCode aSsemble (EntData &data)
 
virtual size_t getNbOfBaseFunctions (EntitiesFieldData::EntData &data)
 Get number of base functions. More...
 

Protected Attributes

boost::shared_ptr< MatrixDoublematD
 
ScalarFun betaCoeff
 
- Protected Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
int nbRows
 number of dofs on rows More...
 
int nbCols
 number if dof on column More...
 
int nbIntegrationPts
 number of integration points More...
 
int nbRowBaseFunctions
 number or row base functions More...
 
int rowSide
 row side number More...
 
int colSide
 column side number More...
 
EntityType rowType
 row type More...
 
EntityType colType
 column type More...
 
bool assembleTranspose
 
bool onlyTranspose
 
MatrixDouble locMat
 local entity block matrix More...
 
MatrixDouble locMatTranspose
 local entity block matrix More...
 
VectorDouble locF
 local entity vector More...
 

Additional Inherited Members

- Public Types inherited from MoFEM::OpBaseImpl< A, EleOp >
using OpType = typename EleOp::OpType
 
using EntData = EntitiesFieldData::EntData
 
using MatSetValuesHook = boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)>
 
- Static Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
static MatSetValuesHook matSetValuesHook
 

Detailed Description

template<int SPACE_DIM, int S, typename OpBase>
struct MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >

Definition at line 150 of file BiLinearFormsIntegrators.hpp.

Constructor & Destructor Documentation

◆ OpGradSymTensorGradImpl()

template<int SPACE_DIM, int S, typename OpBase >
MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::OpGradSymTensorGradImpl ( const std::string  row_field_name,
const std::string  col_field_name,
boost::shared_ptr< MatrixDouble mat_D,
boost::shared_ptr< Range ents_ptr = nullptr,
ScalarFun  beta = scalar_fun_one 
)
inline

Definition at line 153 of file BiLinearFormsIntegrators.hpp.

158  : OpBase(row_field_name, col_field_name, OpBase::OPROWCOL, ents_ptr),
159  matD(mat_D), betaCoeff(beta) {
160  if (row_field_name == col_field_name)
161  this->sYmm = true;
162  }

Member Function Documentation

◆ iNtegrate()

template<int SPACE_DIM, int S, typename OpBase >
MoFEMErrorCode MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::iNtegrate ( EntitiesFieldData::EntData row_data,
EntitiesFieldData::EntData col_data 
)
protectedvirtual

Integrate grad-grad operator.

Parameters
row_datarow data (consist base functions on row entity)
col_datacolumn data (consist base functions on column entity)
Returns
error code

Reimplemented from MoFEM::OpBaseImpl< A, EleOp >.

Definition at line 882 of file BiLinearFormsIntegrators.hpp.

884  {
886 
887  const size_t nb_row_dofs = row_data.getIndices().size();
888  const size_t nb_col_dofs = col_data.getIndices().size();
889 
890  if (nb_row_dofs && nb_col_dofs) {
891 
892  const bool diag = (row_data.getFieldEntities()[0]->getLocalUniqueId() ==
893  col_data.getFieldEntities()[0]->getLocalUniqueId());
894 
899 
900  // get element volume
901  double vol = OpBase::getMeasure();
902 
903  // get intergrayion weights
904  auto t_w = OpBase::getFTensor0IntegrationWeight();
905 
906  // get derivatives of base functions on rows
907  auto t_row_diff_base = row_data.getFTensor1DiffN<SPACE_DIM>();
908 
909  // Elastic stiffness tensor (4th rank tensor with minor and major
910  // symmetry)
911  auto t_D = getFTensor4DdgFromMat<SPACE_DIM, SPACE_DIM, S>(*matD);
912 
913  // get coordinate at integration points
914  auto t_coords = OpBase::getFTensor1CoordsAtGaussPts();
915 
916  // iterate over integration points
917  for (int gg = 0; gg != OpBase::nbIntegrationPts; ++gg) {
918 
919  // calculate scalar weight times element volume
920  double a = t_w * vol * betaCoeff(t_coords(0), t_coords(1), t_coords(2));
921 
922  // iterate over row base functions
923  int rr = 0;
924  for (; rr != OpBase::nbRows / SPACE_DIM; ++rr) {
925 
926  // get sub matrix for the row
927  auto t_m = OpBase::template getLocMat<SPACE_DIM>(SPACE_DIM * rr);
928 
930  // I mix up the indices here so that it behaves like a
931  // Dg. That way I don't have to have a separate wrapper
932  // class Christof_Expr, which simplifies things.
933  t_rowD(l, j, k) = t_D(i, j, k, l) * (a * t_row_diff_base(i));
934 
935  // get derivatives of base functions for columns
936  auto t_col_diff_base = col_data.getFTensor1DiffN<SPACE_DIM>(gg, 0);
937 
938  // iterate column base functions
939  const auto nb_cols = (diag) ? rr : OpBase::nbCols / SPACE_DIM - 1;
940  for (int cc = 0; cc <= nb_cols; ++cc) {
941 
942  // integrate block local stiffens matrix
943  t_m(i, j) += t_rowD(i, j, k) * t_col_diff_base(k);
944 
945  // move to next column base function
946  ++t_col_diff_base;
947 
948  // move to next block of local stiffens matrix
949  ++t_m;
950  }
951 
952  // move to next row base function
953  ++t_row_diff_base;
954  }
955 
956  for (; rr < OpBase::nbRowBaseFunctions; ++rr)
957  ++t_row_diff_base;
958 
959  // move to next integration weight
960  ++t_w;
961  ++t_D;
962  ++t_coords;
963  }
964 
965  // Copy symmetry
966  if (diag) {
967  for (int rr = 0; rr != OpBase::nbRows / SPACE_DIM - 1; ++rr) {
968  auto t_m_rr = getFTensor2FromArray<SPACE_DIM, SPACE_DIM, SPACE_DIM>(
969  this->locMat, SPACE_DIM * rr, SPACE_DIM * (rr + 1));
970  auto t_m_cc = getFTensor2FromArray<SPACE_DIM, SPACE_DIM>(
971  this->locMat, SPACE_DIM * (rr + 1), SPACE_DIM * rr,
973  for (int cc = rr + 1; cc < OpBase::nbCols / SPACE_DIM; ++cc) {
974  t_m_rr(i, j) = t_m_cc(j, i);
975  ++t_m_rr;
976  ++t_m_cc;
977  }
978  }
979  }
980  }
981 
983 }

Member Data Documentation

◆ betaCoeff

template<int SPACE_DIM, int S, typename OpBase >
ScalarFun MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::betaCoeff
protected

Definition at line 166 of file BiLinearFormsIntegrators.hpp.

◆ i

template<int SPACE_DIM, int S, typename OpBase >
FTensor::Index<'i', SPACE_DIM> MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::i

summit Index

Definition at line 152 of file BiLinearFormsIntegrators.hpp.

◆ matD

template<int SPACE_DIM, int S, typename OpBase >
boost::shared_ptr<MatrixDouble> MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::matD
protected

Definition at line 165 of file BiLinearFormsIntegrators.hpp.


The documentation for this struct was generated from the following file:
MoFEM::OpBaseImpl::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: FormsIntegrators.hpp:228
FTensor::Christof
Definition: Christof_value.hpp:9
MoFEM::OpBaseImpl::locMat
MatrixDouble locMat
local entity block matrix
Definition: FormsIntegrators.hpp:239
OpBase
OpBaseImpl< PETSC, EdgeEleOp > OpBase
Definition: radiation.cpp:29
MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::matD
boost::shared_ptr< MatrixDouble > matD
Definition: BiLinearFormsIntegrators.hpp:165
MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::i
FTensor::Index< 'i', SPACE_DIM > i
summit Index
Definition: BiLinearFormsIntegrators.hpp:152
SPACE_DIM
constexpr int SPACE_DIM
Definition: child_and_parent.cpp:16
a
constexpr double a
Definition: approx_sphere.cpp:30
MoFEM::OpGradSymTensorGradImpl< 1, SPACE_DIM, SPACE_DIM, S, GAUSS, OpBase >::betaCoeff
ScalarFun betaCoeff
Definition: BiLinearFormsIntegrators.hpp:166
FTensor::Index< 'i', SPACE_DIM >
MoFEM::OpBaseImpl::nbRowBaseFunctions
int nbRowBaseFunctions
number or row base functions
Definition: FormsIntegrators.hpp:229
MoFEM::OpBaseImpl::nbCols
int nbCols
number if dof on column
Definition: FormsIntegrators.hpp:227
MoFEM::OpBaseImpl::nbRows
int nbRows
number of dofs on rows
Definition: FormsIntegrators.hpp:226
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21