v0.14.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase > Struct Template Reference

#include <src/finite_elements/FormsBrokenSpaceConstraintImpl.hpp>

Inheritance diagram for MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >:
[legend]
Collaboration diagram for MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >:
[legend]

Public Types

using OP = OpBase
 
- 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)>
 

Public Member Functions

 OpBrokenSpaceConstrainImpl (const std::string row_field, boost::shared_ptr< std::vector< BrokenBaseSideData >> broken_base_side_data, const double beta, const bool assmb_transpose, const bool only_transpose)
 
 OpBrokenSpaceConstrainImpl (const std::string row_field, const std::string col_field, const double beta, const bool assmb_transpose, const bool only_transpose)
 
MoFEMErrorCode doWork (int row_side, EntityType row_type, EntitiesFieldData::EntData &row_data)
 
- 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...
 

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

double scalarBeta
 
boost::shared_ptr< std::vector< BrokenBaseSideData > > brokenBaseSideData
 
MatrixDouble transposedC
 
- 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 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...
 
- Static Public Attributes inherited from MoFEM::OpBaseImpl< A, EleOp >
static MatSetValuesHook matSetValuesHook
 

Detailed Description

template<int FIELD_DIM, typename OpBase>
struct MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >

Definition at line 175 of file FormsBrokenSpaceConstraintImpl.hpp.

Member Typedef Documentation

◆ OP

template<int FIELD_DIM, typename OpBase >
using MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::OP = OpBase

Definition at line 177 of file FormsBrokenSpaceConstraintImpl.hpp.

Constructor & Destructor Documentation

◆ OpBrokenSpaceConstrainImpl() [1/2]

template<int FIELD_DIM, typename OpBase >
MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::OpBrokenSpaceConstrainImpl ( const std::string  row_field,
boost::shared_ptr< std::vector< BrokenBaseSideData >>  broken_base_side_data,
const double  beta,
const bool  assmb_transpose,
const bool  only_transpose 
)
inline

Definition at line 179 of file FormsBrokenSpaceConstraintImpl.hpp.

183  : OpBase(row_field, row_field, OpBase::OPROW),
184  brokenBaseSideData(broken_base_side_data), scalarBeta(beta) {
185  this->assembleTranspose = assmb_transpose;
186  this->onlyTranspose = only_transpose;
187  this->sYmm = false;
188  }

◆ OpBrokenSpaceConstrainImpl() [2/2]

template<int FIELD_DIM, typename OpBase >
MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::OpBrokenSpaceConstrainImpl ( const std::string  row_field,
const std::string  col_field,
const double  beta,
const bool  assmb_transpose,
const bool  only_transpose 
)
inline

Definition at line 190 of file FormsBrokenSpaceConstraintImpl.hpp.

194  : OpBase(row_field, col_field, OpBase::OPROWCOL),
195  brokenBaseSideData(nullptr), scalarBeta(beta) {
196  this->assembleTranspose = assmb_transpose;
197  this->onlyTranspose = only_transpose;
198  this->sYmm = false;
199  }

Member Function Documentation

◆ doWork()

template<int FIELD_DIM, typename OpBase >
MoFEMErrorCode MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::doWork ( int  row_side,
EntityType  row_type,
EntitiesFieldData::EntData row_data 
)

Definition at line 215 of file FormsBrokenSpaceConstraintImpl.hpp.

216  {
218 
219  if (OP::entsPtr) {
220  if (OP::entsPtr->find(this->getFEEntityHandle()) == OP::entsPtr->end())
222  }
223 
224 #ifndef NDEBUG
225  if (!brokenBaseSideData) {
226  SETERRQ(PETSC_COMM_SELF, MOFEM_IMPOSSIBLE_CASE, "space not set");
227  }
228 #endif // NDEBUG
229 
230  // get number of integration points
231  OP::nbRows = row_data.getIndices().size();
232  if (!OP::nbRows)
234  OP::nbIntegrationPts = OP::getGaussPts().size2();
235 
236  auto check_if_assemble_transpose = [&] {
237  if (this->sYmm) {
238  if (OP::rowSide != OP::colSide || OP::rowType != OP::colType)
239  return true;
240  else
241  return false;
242  } else if (OP::assembleTranspose) {
243  return true;
244  }
245  return false;
246  };
247 
248  auto do_work = [&](int row_side, int col_side, EntityType row_type,
249  EntityType col_type, EntitiesFieldData::EntData &row_data,
250  EntitiesFieldData::EntData &col_data, int sense) {
252  OP::rowSide = row_side;
253  OP::rowType = row_type;
254  OP::colSide = col_side;
255  OP::colType = col_type;
256  OP::nbRowBaseFunctions = OP::getNbOfBaseFunctions(row_data);
257  OP::nbCols = col_data.getIndices().size();
258  OP::locMat.resize(OP::nbRows, OP::nbCols, false);
259  OP::locMat.clear();
260  CHKERR this->iNtegrate(row_data, col_data);
261  OP::locMat *= sense;
262  CHKERR this->aSsemble(row_data, col_data, check_if_assemble_transpose());
264  };
265 
266  for (auto &bd : *brokenBaseSideData) {
267 
268 #ifndef NDEBUG
269  if (bd.getData().getSpace() != HDIV && bd.getData().getSpace() != HCURL) {
270  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
271  (std::string("Expect Hdiv or Hcurl space but received ") +
272  FieldSpaceNames[bd.getData().getSpace()])
273  .c_str());
274  }
275  if (!bd.getData().getNSharedPtr(bd.getData().getBase())) {
276  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
277  "base functions not set");
278  }
279 #endif
280 
281  CHKERR do_work(
282 
283  // side
284  row_side, bd.getSide(),
285 
286  // type
287  row_type, bd.getType(),
288 
289  // row_data
290  row_data, bd.getData(),
291 
292  // sense
293  bd.getSense()
294 
295  );
296  }
297 
298  brokenBaseSideData->clear();
299 
301 }

◆ iNtegrate()

template<int FIELD_DIM, typename OpBase >
MoFEMErrorCode MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, 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 304 of file FormsBrokenSpaceConstraintImpl.hpp.

306  {
308 
309  auto nb_row_dofs = row_data.getIndices().size();
310  auto nb_col_dofs = col_data.getIndices().size();
311  if (!nb_row_dofs || !nb_col_dofs)
313 
315  FTENSOR_INDEX(3, J);
316 
317  auto t_w = this->getFTensor0IntegrationWeight();
318  auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
319  size_t nb_base_functions = col_data.getN().size2() / 3;
320 
321  auto t_col_base = col_data.getFTensor1N<3>();
322  transposedC.resize(nb_col_dofs, nb_row_dofs, false);
323  transposedC.clear();
324 
325  for (size_t gg = 0; gg != OpBase::nbIntegrationPts; ++gg) {
326 
327  auto t_m = getFTensor1FromPtr<FIELD_DIM>(&*transposedC.data().begin());
328 
329  int cc = 0;
330  for (; cc != nb_col_dofs / FIELD_DIM; cc++) {
331  auto t_row_base = row_data.getFTensor0N(gg, 0);
332  for (auto rr = 0; rr != nb_row_dofs / FIELD_DIM; ++rr) {
333  t_m(i) += (t_w * t_row_base) * (t_normal(J) * t_col_base(J));
334  ++t_row_base;
335  ++t_m;
336  }
337 
338  ++t_col_base;
339  }
340 
341  for (; cc < nb_base_functions; ++cc)
342  ++t_col_base;
343 
344  ++t_w;
345  ++t_normal;
346  }
347 
349  OP::locMat.resize(nb_row_dofs, nb_col_dofs, false);
350  noalias(OP::locMat) = trans(transposedC);
351 
353 }

Member Data Documentation

◆ brokenBaseSideData

template<int FIELD_DIM, typename OpBase >
boost::shared_ptr<std::vector<BrokenBaseSideData> > MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::brokenBaseSideData
protected

Definition at line 206 of file FormsBrokenSpaceConstraintImpl.hpp.

◆ scalarBeta

template<int FIELD_DIM, typename OpBase >
double MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::scalarBeta
protected

Definition at line 205 of file FormsBrokenSpaceConstraintImpl.hpp.

◆ transposedC

template<int FIELD_DIM, typename OpBase >
MatrixDouble MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::transposedC
protected

Definition at line 211 of file FormsBrokenSpaceConstraintImpl.hpp.


The documentation for this struct was generated from the following file:
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::OpBaseImpl::nbIntegrationPts
int nbIntegrationPts
number of integration points
Definition: FormsIntegrators.hpp:238
MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::transposedC
MatrixDouble transposedC
Definition: FormsBrokenSpaceConstraintImpl.hpp:211
MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::iNtegrate
MoFEMErrorCode iNtegrate(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data)
Integrate grad-grad operator.
Definition: FormsBrokenSpaceConstraintImpl.hpp:304
MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::scalarBeta
double scalarBeta
Definition: FormsBrokenSpaceConstraintImpl.hpp:205
MoFEM::OpBaseImpl::assembleTranspose
bool assembleTranspose
Definition: FormsIntegrators.hpp:246
J
FTensor::Index< 'J', DIM1 > J
Definition: level_set.cpp:30
OpBase
OpBaseImpl< PETSC, EdgeEleOp > OpBase
Definition: radiation.cpp:29
FTENSOR_INDEX
#define FTENSOR_INDEX(DIM, I)
Definition: Templates.hpp:1985
MOFEM_IMPOSSIBLE_CASE
@ MOFEM_IMPOSSIBLE_CASE
Definition: definitions.h:35
FIELD_DIM
constexpr int FIELD_DIM
Definition: child_and_parent.cpp:15
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::OpBaseImpl::onlyTranspose
bool onlyTranspose
Definition: FormsIntegrators.hpp:247
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
EntData
EntitiesFieldData::EntData EntData
Definition: child_and_parent.cpp:37
FieldSpaceNames
const static char *const FieldSpaceNames[]
Definition: definitions.h:92
HCURL
@ HCURL
field with continuous tangents
Definition: definitions.h:86
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::OpBrokenSpaceConstrainImpl< FIELD_DIM, GAUSS, OpBase >::brokenBaseSideData
boost::shared_ptr< std::vector< BrokenBaseSideData > > brokenBaseSideData
Definition: FormsBrokenSpaceConstraintImpl.hpp:206
MoFEM::OpBaseImpl::aSsemble
virtual MoFEMErrorCode aSsemble(EntData &row_data, EntData &col_data, const bool trans)
Definition: FormsIntegrators.hpp:463
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
HDIV
@ HDIV
field with continuous normal traction
Definition: definitions.h:87
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359