83#ifndef __FORMS_INTEGRATORS_HPP__
84#define __FORMS_INTEGRATORS_HPP__
100 map<std::string, std::vector<boost::shared_ptr<EssentialBcStorage>>>;
116 boost::shared_ptr<std::vector<unsigned char>> boundary_marker);
172 const double *ptr, InsertMode iora);
191 const double *ptr, InsertMode iora);
249 boost::function<
double(
const double,
const double,
const double)>;
289using VectorFun = boost::function<FTensor::Tensor1<double, DIM>(
290 const double,
const double,
const double)>;
303 OpBaseImpl(
const std::string row_field_name,
const std::string col_field_name,
304 const OpType type, boost::shared_ptr<Range> ents_ptr =
nullptr)
319 EntityType col_type,
EntData &row_data,
353 return getFTensor1FromArray<DIM, DIM>(
locF);
363 template <
int ROW_DIM,
int COL_DIM = ROW_DIM>
366 return getFTensor2FromArray<ROW_DIM, COL_DIM, COL_DIM>(
locMat, rr);
430template <AssemblyType A,
typename EleOp>
433 [](ForcesAndSourcesCore::UserDataOperator *op_ptr,
434 const EntitiesFieldData::EntData &row_data,
435 const EntitiesFieldData::EntData &col_data,
MatrixDouble &
m) {
436 return MatSetValues<AssemblyTypeSelector<A>>(
437 op_ptr->getKSPB(), row_data, col_data,
m, ADD_VALUES);
440template <
typename OpBase>
441struct OpBrokenBaseImpl;
494template <AssemblyType A,
typename EleOp>
501 <<
" functions is null, returning 0";
505 auto nb_base_functions = data.
getN().size2();
516 nb_base_functions /= 3;
518 if (data.
getN().size2() % 3) {
520 "Number of base functions is not divisible by 3");
531 return nb_base_functions;
534template <AssemblyType A,
typename EleOp>
543 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
562 nbIntegrationPts = EleOp::getGaussPts().size2();
564 nbRowBaseFunctions = getNbOfBaseFunctions(row_data);
567 locMat.resize(nbRows, nbCols,
false);
571 CHKERR this->iNtegrate(row_data, col_data);
574 auto check_if_assemble_transpose = [&] {
576 if (row_side != col_side || row_type != col_type)
580 }
else if (assembleTranspose) {
586 CHKERR aSsemble(row_data, col_data, check_if_assemble_transpose());
590template <AssemblyType A,
typename EleOp>
596 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
608 nbIntegrationPts = EleOp::getGaussPts().size2();
610 nbRowBaseFunctions = getNbOfBaseFunctions(row_data);
615 CHKERR this->iNtegrate(row_data);
617 CHKERR this->aSsemble(row_data);
621template <AssemblyType A,
typename EleOp>
624 const bool transpose) {
627 if (!this->timeScalingFun.empty())
628 this->locMat *= this->timeScalingFun(this->getFEMethod()->ts_t);
629 if (!this->feScalingFun.empty())
630 this->locMat *= this->feScalingFun(this->getFEMethod());
634 this->locMatTranspose.resize(this->locMat.size2(), this->locMat.size1(),
636 noalias(this->locMatTranspose) = trans(this->locMat);
637 CHKERR matSetValuesHook(
this, col_data, row_data, this->locMatTranspose);
640 if (!this->onlyTranspose) {
642 CHKERR matSetValuesHook(
this, row_data, col_data, this->locMat);
648template <AssemblyType A,
typename EleOp>
650 if (!this->timeScalingFun.empty())
651 this->locF *= this->timeScalingFun(this->getFEMethod()->ts_t);
652 if (!this->feScalingFun.empty())
653 this->locF *= this->feScalingFun(this->getFEMethod());
655 return VecSetValues<AssemblyTypeSelector<A>>(this->getKSPf(), data,
656 this->locF, ADD_VALUES);
@ USER_BASE
user implemented approximation base
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ L2
field with C-1 continuity
@ NOFIELD
scalar or vector of scalars describe (no true field)
@ HCURL
field with continuous tangents
@ HDIV
field with continuous normal traction
static const char *const FieldSpaceNames[]
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
static const char *const ApproximationBaseNames[]
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MOFEM_LOG(channel, severity)
Log.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
UBlasVector< int > VectorInt
implementation of Data Operators for Forces and Sources
boost::function< double(const FEMethod *fe_ptr)> FEFun
Lambda function used to scale with time.
boost::function< double(double)> TimeFun
Lambda function used to scale with time.
MoFEMErrorCode MatSetValues< EssentialBcStorage >(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Set values to matrix in operator.
boost::function< double()> ConstantFun
Constant function type.
constexpr auto field_name
FTensor::Index< 'm', 3 > m
Template selector for assembly type.
Data on single entity (This is passed as argument to DataOperator::doWork)
FieldApproximationBase & getBase()
Get approximation base.
virtual boost::shared_ptr< MatrixDouble > & getNSharedPtr(const FieldApproximationBase base, const BaseDerivatives derivative)
Get shared pointer to base functions with derivatives.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
FieldSpace & getSpace()
Get field space.
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
[Storage and set boundary conditions]
static HashVectorStorage feStorage
[Storage and set boundary conditions]
map< std::string, std::vector< boost::shared_ptr< EssentialBcStorage > > > HashVectorStorage
Store modified indices by field.
EssentialBcStorage(VectorInt &indices)
Structure for user loop methods on finite elements.
OpBaseImpl(const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=nullptr)
Constructor for base operator implementation.
auto getNf()
Get local vector tensor for assembly.
VectorDouble locF
local entity vector
typename EleOp::OpType OpType
TimeFun timeScalingFun
assumes that time variable is set
MatrixDouble locMatTranspose
local entity block matrix
int rowSide
row side number
int colSide
column side number
boost::shared_ptr< Range > entsPtr
Entities on which element is run.
static MatSetValuesHook matSetValuesHook
int nbRows
number of dofs on rows
EntityType colType
column type
int nbIntegrationPts
number of integration points
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.
virtual MoFEMErrorCode aSsemble(EntData &row_data, EntData &col_data, const bool trans)
Assemble local matrix into global matrix.
MatrixDouble locMat
local entity block matrix
virtual size_t getNbOfBaseFunctions(EntitiesFieldData::EntData &data)
Get number of base functions.
FEFun feScalingFun
set by fe entity handle
virtual MoFEMErrorCode iNtegrate(EntData &, EntData &)
Integrate grad-grad operator.
FTensor::Tensor2< FTensor::PackPtr< double *, COL_DIM >, ROW_DIM, COL_DIM > getLocMat(const int rr)
Get local matrix tensor for assembly.
int nbCols
number if dof on column
virtual MoFEMErrorCode iNtegrate(EntData &)
Class dedicated to integrate operator.
int nbRowBaseFunctions
number or row base functions
EntityType rowType
row type
boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)> MatSetValuesHook
Set indices on entities on finite element.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
Unset indices on entities on finite element.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Perform unset operation on entity data.