|
| v0.14.0
|
Go to the documentation of this file.
7 #ifndef __FORMS_INTEGRATORS_HPP__
8 #define __FORMS_INTEGRATORS_HPP__
24 map<std::string, std::vector<boost::shared_ptr<EssentialBcStorage>>>;
40 boost::shared_ptr<std::vector<unsigned char>> boundary_marker);
76 const double *ptr, InsertMode iora);
95 const double *ptr, InsertMode iora);
144 boost::function<
double(
const double,
const double,
const double)>;
175 using VectorFun = boost::function<FTensor::Tensor1<double, DIM>(
176 const double,
const double,
const double)>;
182 OpBaseImpl(
const std::string row_field_name,
const std::string col_field_name,
183 const OpType type, boost::shared_ptr<Range> ents_ptr =
nullptr)
184 :
EleOp(row_field_name, col_field_name,
type, false),
198 EntityType col_type,
EntData &row_data,
227 return getFTensor1FromArray<DIM, DIM>(
locF);
233 return getFTensor2FromArray<DIM, DIM, DIM>(
locMat, rr);
285 template <AssemblyType A,
typename EleOp>
291 return MatSetValues<AssemblyTypeSelector<A>>(
292 op_ptr->getKSPB(), row_data, col_data,
m, ADD_VALUES);
295 template <
typename OpBase>
296 struct OpBrokenBaseImpl;
349 template <AssemblyType A,
typename EleOp>
352 auto nb_base_functions = data.
getN().size2();
363 nb_base_functions /= 3;
365 if (data.
getN().size2() % 3) {
367 "Number of base functions is not divisible by 3");
378 return nb_base_functions;
381 template <AssemblyType A,
typename EleOp>
390 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
409 nbIntegrationPts = EleOp::getGaussPts().size2();
411 nbRowBaseFunctions = getNbOfBaseFunctions(row_data);
414 locMat.resize(nbRows, nbCols,
false);
418 CHKERR this->iNtegrate(row_data, col_data);
421 auto check_if_assemble_transpose = [&] {
423 if (row_side != col_side || row_type != col_type)
427 }
else if (assembleTranspose) {
433 CHKERR aSsemble(row_data, col_data, check_if_assemble_transpose());
437 template <AssemblyType A,
typename EleOp>
443 if (entsPtr->find(this->getFEEntityHandle()) == entsPtr->end())
455 nbIntegrationPts = EleOp::getGaussPts().size2();
457 nbRowBaseFunctions = getNbOfBaseFunctions(row_data);
462 CHKERR this->iNtegrate(row_data);
464 CHKERR this->aSsemble(row_data);
468 template <AssemblyType A,
typename EleOp>
471 const bool transpose) {
474 if (!this->timeScalingFun.empty())
475 this->locMat *= this->timeScalingFun(this->getFEMethod()->ts_t);
476 if (!this->feScalingFun.empty())
477 this->locMat *= this->feScalingFun(this->getFEMethod());
481 this->locMatTranspose.resize(this->locMat.size2(), this->locMat.size1(),
483 noalias(this->locMatTranspose) = trans(this->locMat);
484 CHKERR matSetValuesHook(
this, col_data, row_data, this->locMatTranspose);
487 if (!this->onlyTranspose) {
489 CHKERR matSetValuesHook(
this, row_data, col_data, this->locMat);
495 template <AssemblyType A,
typename EleOp>
497 if (!this->timeScalingFun.empty())
498 this->locF *= this->timeScalingFun(this->getFEMethod()->ts_t);
499 if (!this->feScalingFun.empty())
500 this->locF *= this->feScalingFun(this->getFEMethod());
502 return VecSetValues<AssemblyTypeSelector<A>>(this->getKSPf(), data,
503 this->locF, ADD_VALUES);
517 #endif //__FORMS_INTEGRATORS_HPP__
FEFun feScalingFun
assumes that time variable is set
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
OpSetBc(std::string field_name, bool yes_set, boost::shared_ptr< std::vector< unsigned char >> boundary_marker)
int nbIntegrationPts
number of integration points
Data on single entity (This is passed as argument to DataOperator::doWork)
virtual MoFEMErrorCode iNtegrate(EntData &data)
Class dedicated to integrate operator.
MatrixDouble locMat
local entity block matrix
structure for User Loop Methods on finite elements
@ L2
field with C-1 continuity
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasMatrix< double > MatrixDouble
map< std::string, std::vector< boost::shared_ptr< EssentialBcStorage > >> HashVectorStorage
Store modifed indices by field.
boost::function< double()> ConstantFun
Constant function type.
OpUnSetBc(std::string field_name)
@ USER_BASE
user implemented approximation base
boost::shared_ptr< std::vector< unsigned char > > boundaryMarker
double scalar_fun_one(const double, const double, const double)
VectorDouble locF
local entity vector
FTensor::Index< 'M', 3 > M
#define CHKERR
Inline error check.
boost::function< double(double)> TimeFun
Lambda function used to scale with time.
FTensor::Tensor2< FTensor::PackPtr< double *, DIM >, DIM, DIM > getLocMat(const int rr)
TimeFun timeScalingFun
assumes that time variable is set
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
implementation of Data Operators for Forces and Sources
Ele::UserDataOperator EleOp
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.
FTensor::Tensor1< FTensor::PackPtr< double *, DIM >, DIM > getNf()
virtual MoFEMErrorCode iNtegrate(EntData &row_data, EntData &col_data)
Integrate grad-grad operator.
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.
const VectorInt & getIndices() const
Get global indices of dofs on entity.
FieldApproximationBase & getBase()
Get approximation base.
static HashVectorStorage feStorage
[Storage and set boundary conditions]
int colSide
column side number
EssentialBcStorage(VectorInt &indices)
typename EleOp::OpType OpType
MatrixDouble locMatTranspose
local entity block matrix
friend class UserDataOperator
boost::function< MoFEMErrorCode(ForcesAndSourcesCore::UserDataOperator *op_ptr, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, MatrixDouble &m)> MatSetValuesHook
EntitiesFieldData::EntData EntData
constexpr auto field_name
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
int nbRowBaseFunctions
number or row base functions
boost::function< double(const FEMethod *fe_ptr)> FEFun
Lambda function used to scale with time.
int rowSide
row side number
int nbCols
number if dof on column
[Storage and set boundary conditions]
const static char *const FieldSpaceNames[]
int nbRows
number of dofs on rows
boost::shared_ptr< Range > entsPtr
Entities on which element is run.
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
static MatSetValuesHook matSetValuesHook
UBlasVector< int > VectorInt
Set indices on entities on finite element.
FieldSpace & getSpace()
Get field space.
@ HCURL
field with continuous tangents
const FTensor::Tensor2< T, Dim, Dim > Vec
@ MOFEM_DATA_INCONSISTENCY
virtual MoFEMErrorCode aSsemble(EntData &row_data, EntData &col_data, const bool trans)
FTensor::Index< 'm', 3 > m
virtual size_t getNbOfBaseFunctions(EntitiesFieldData::EntData &data)
Get number of base functions.
EntityType rowType
row type
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
@ HDIV
field with continuous normal traction
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
EntityType colType
column type
OpBaseImpl(const std::string row_field_name, const std::string col_field_name, const OpType type, boost::shared_ptr< Range > ents_ptr=nullptr)
@ NOFIELD
scalar or vector of scalars describe (no true field)