23#ifndef __FORCES_AND_SOURCES_CORE__HPP__
24#define __FORCES_AND_SOURCES_CORE__HPP__
26using namespace boost::numeric;
39 typedef boost::function<
int(
int order_row,
int order_col,
int order_data)>
43 int order_row,
int order_col,
190 boost::ptr_vector<EntitiesFieldData::EntData> &data)
const;
202 boost::ptr_vector<EntitiesFieldData::EntData> &data)
const;
211 template <EntityType type>
224 template <EntityType type>
235 template <
typename EXTRACTOR>
239 VectorInt &local_nodes_indices, EXTRACTOR &&extractor)
const;
243 const int bit_number)
const;
247 const int bit_number)
const;
249 template <
typename EXTRACTOR>
254 EXTRACTOR &&extractor)
const;
259 const EntityType type_hi = MBPOLYHEDRON)
const;
264 const EntityType type_hi = MBPOLYHEDRON)
const;
269 boost::shared_ptr<FENumeredDofEntity_multiIndex> dofs,
274 const int bit_number)
const;
278 const int bit_number)
const;
299 const int bit_number)
const;
308 const int bit_number)
const;
313 const EntityType type_hi = MBPOLYHEDRON)
const;
391 virtual int getRule(
int order_row,
int order_col,
int order_data);
472 const std::array<boost::shared_ptr<EntitiesFieldData>,
LASTSPACE>
479 const std::array<boost::shared_ptr<EntitiesFieldData>,
LASTSPACE>
598 const bool symm =
true);
601 const bool symm =
true);
604 const std::string &col_field_name,
const char type,
605 const bool symm =
true);
609 inline boost::shared_ptr<const NumeredEntFiniteElement>
811 inline Mat
getTSA()
const;
813 inline Mat
getTSB()
const;
819 inline double getTSa()
const;
947 const size_t dim,
const EntityHandle ent_for_side = 0,
948 const int verb =
QUIET,
963 const int verb =
QUIET,
978 const int verb =
QUIET,
993 const int verb =
QUIET,
1020boost::shared_ptr<const NumeredEntFiniteElement>
1026 return getNumeredEntFiniteElementPtr()->getEnt();
1037boost::weak_ptr<SideNumber>
1040 auto &side_table_by_side_and_type =
1041 ptrFE->numeredEntFiniteElementPtr->getSideNumberTable().get<1>();
1043 side_table_by_side_and_type.find(boost::make_tuple(
type, side_number));
1044 if (side_it != side_table_by_side_and_type.end())
1047 return boost::weak_ptr<SideNumber>();
1053 if (
auto side_ptr = getSideNumberPtr(side_number,
type).lock())
1054 return side_ptr->ent;
1060 return ptrFE->getNumberOfNodes();
1078 return getFEMethod()->getNinTheLoop();
1082 return getFEMethod()->getLoopSize();
1086 return getFEMethod()->getFEName();
1091 return getFEMethod()->data_ctx;
1096 return getFEMethod()->ksp_ctx;
1101 return getFEMethod()->snes_ctx;
1106 return getFEMethod()->ts_ctx;
1111 if (getFEMethod()->
ksp_f == PETSC_NULL)
1114 return getFEMethod()->ksp_f;
1119 if (getFEMethod()->
ksp_A == PETSC_NULL)
1122 return getFEMethod()->ksp_A;
1127 if (getFEMethod()->
ksp_B == PETSC_NULL)
1130 return getFEMethod()->ksp_B;
1135 if (getFEMethod()->
snes_f == PETSC_NULL)
1138 return getFEMethod()->snes_f;
1143 if (getFEMethod()->
snes_x == PETSC_NULL)
1146 return getFEMethod()->snes_x;
1151 if (getFEMethod()->
snes_A == PETSC_NULL)
1154 return getFEMethod()->snes_A;
1159 if (getFEMethod()->
snes_B == PETSC_NULL)
1162 return getFEMethod()->snes_B;
1167 if (getFEMethod()->
ts_u == PETSC_NULL)
1170 return getFEMethod()->ts_u;
1175 if (getFEMethod()->
ts_u_t == PETSC_NULL)
1178 return getFEMethod()->ts_u_t;
1183 if (getFEMethod()->
ts_u_tt == PETSC_NULL)
1186 return getFEMethod()->ts_u_tt;
1191 if (getFEMethod()->
ts_F == PETSC_NULL)
1194 return getFEMethod()->ts_F;
1199 if (getFEMethod()->
ts_A == PETSC_NULL)
1202 return getFEMethod()->ts_A;
1207 if (getFEMethod()->
ts_B == PETSC_NULL)
1210 return getFEMethod()->ts_B;
1215 if ((getFEMethod()->
data_ctx & PetscData::PetscData::CtxSetTime).none())
1218 return getFEMethod()->ts_step;
1223 if ((getFEMethod()->
data_ctx & PetscData::PetscData::CtxSetTime).none())
1226 return getFEMethod()->ts_t;
1236 return getFEMethod()->ts_a;
1246 return getFEMethod()->ts_aa;
1255 &(getGaussPts()(getGaussPts().size1() - 1, 0)));
1284 &getCoordsAtGaussPts()(0, 0), &getCoordsAtGaussPts()(0, 1),
1285 &getCoordsAtGaussPts()(0, 2));
FieldApproximationBase
approximation base
FieldSpace
approximation spaces
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, UId, &NumeredDofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, ordered_non_unique< tag< Idx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::dofIdx > >, ordered_non_unique< tag< PetscGlobalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscGloablDofIdx > >, ordered_non_unique< tag< PetscLocalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscLocalDofIdx > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.
SeverityLevel
Severity levels.
const FTensor::Tensor2< T, Dim, Dim > Vec
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
UBlasVector< int > VectorInt
implementation of Data Operators for Forces and Sources
auto type_from_handle(const EntityHandle h)
get type from entity handle
ublas::vector< FieldEntity *, FieldEntAllocator > VectorFieldEntities
DEPRECATED typedef ForcesAndSourcesCore ForcesAndSurcesCore
auto dimension_from_handle(const EntityHandle h)
get entity dimension form handle
std::vector< boost::weak_ptr< FieldEntity > > FieldEntity_vector_view
ublas::vector< FEDofEntity *, DofsAllocator > VectorDofs
constexpr auto field_name
base operator to do operations at Gauss Pt. level
Deprecated interface functions.
Base face element used to integrate on skeleton.
data structure for finite element entity
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
structure for User Loop Methods on finite elements
EntityHandle getFEEntityHandle() const
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
Base face element used to integrate on skeleton.
Base face element used to integrate on skeleton.
void setOpType(const OpType type)
Set operator type.
EntityHandle getFEEntityHandle() const
Return finite element entity handle.
MoFEMErrorCode getProblemColIndices(const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
Get col indices.
int getLoopSize() const
get size of elements in the loop
EntityType getFEType() const
Get dimension of finite element.
const KspMethod::KSPContext getKSPCtx() const
static const char *const OpTypeNames[]
UserDataOperator(const FieldSpace space, const char type=OPSPACE, const bool symm=true)
int getNinTheLoop() const
get number of finite element in the loop
auto getFTensor1CoordsAtGaussPts()
Get coordinates at integration points assuming linear geometry.
MoFEMErrorCode loopThis(const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
User call this function to loop over parent elements. This function calls finite element with is oper...
int getNumberOfNodesOnElement() const
Get the number of nodes on finite element.
boost::weak_ptr< SideNumber > getSideNumberPtr(const int side_number, const EntityType type)
Get the side number pointer.
const SnesMethod::SNESContext getSNESCtx() const
MoFEMErrorCode loopParent(const string &fe_name, ForcesAndSourcesCore *parent_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
User call this function to loop over parent elements. This function calls finite element with is oper...
const PetscData::Switches & getDataCtx() const
ForcesAndSourcesCore * ptrFE
EntityHandle getSideEntity(const int side_number, const EntityType type)
Get the side entity.
MatrixDouble & getCoordsAtGaussPts()
Gauss points and weight, matrix (nb. of points x 3)
auto getFTensor0IntegrationWeight()
Get integration weights.
const TSMethod::TSContext getTSCtx() const
double getMeasure() const
get measure of element
std::string getFEName() const
Get name of the element.
ForcesAndSourcesCore * getRefinePtrFE() const
MoFEMErrorCode loopSide(const string &fe_name, ForcesAndSourcesCore *side_fe, const size_t dim, const EntityHandle ent_for_side=0, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
User call this function to loop over elements on the side of face. This function calls finite element...
MoFEMErrorCode getProblemRowIndices(const std::string filed_name, const EntityType type, const int side, VectorInt &indices) const
Get row indices.
boost::shared_ptr< const NumeredEntFiniteElement > getNumeredEntFiniteElementPtr() const
Return raw pointer to NumeredEntFiniteElement.
void addOpType(const OpType type)
Add operator type.
ForcesAndSourcesCore * getPtrFE() const
int getOpType() const
Get operator types.
OpType
Controls loop over entities on element.
@ OPCOL
operator doWork function is executed on FE columns
@ OPROW
operator doWork function is executed on FE rows
@ OPROWCOL
operator doWork is executed on FE rows &columns
@ OPSPACE
operator do Work is execute on space data
MoFEMErrorCode loopChildren(const string &fe_name, ForcesAndSourcesCore *child_fe, const int verb=QUIET, const LogManager::SeverityLevel sev=Sev::noisy)
User call this function to loop over parent elements. This function calls finite element with is oper...
virtual MoFEMErrorCode setPtrFE(ForcesAndSourcesCore *ptr)
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
ForcesAndSourcesCore * getSidePtrFE() const
int getFEDim() const
Get dimension of finite element.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
structure to get information form mofem into EntitiesFieldData
MoFEMErrorCode loopOverOperators()
Iterate user data operators.
MoFEMErrorCode getProblemNodesRowIndices(const std::string &field_name, VectorInt &nodes_indices) const
EntitiesFieldData & dataNoField
auto & getDataOnElementBySpaceArray()
Get data on entities and space.
MoFEMErrorCode getEntityIndices(EntitiesFieldData &data, const int bit_number, FieldEntity_vector_view &ents_field, const EntityType type_lo, const EntityType type_hi, EXTRACTOR &&extractor) const
MoFEMErrorCode getEntityRowIndices(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
MoFEMErrorCode getRowNodesIndices(EntitiesFieldData &data, const int bit_number) const
get row node indices from FENumeredDofEntity_multiIndex
int getMaxRowOrder() const
Get max order of approximation for field in rows.
auto & getUserPolynomialBase()
Get the User Polynomial Base object.
MoFEMErrorCode getEntitySense(EntitiesFieldData &data) const
Get the entity sense (orientation)
EntitiesFieldData & dataHdiv
MoFEMErrorCode getSpacesAndBaseOnEntities(EntitiesFieldData &data) const
Get field approximation space and base on entities.
MoFEMErrorCode getProblemTypeColIndices(const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
MoFEMErrorCode getNoFieldIndices(const int bit_number, boost::shared_ptr< FENumeredDofEntity_multiIndex > dofs, VectorInt &nodes_indices) const
get NoField indices
virtual MoFEMErrorCode operator()()
function is run for every finite element
MoFEMErrorCode getFaceNodes(EntitiesFieldData &data) const
Get nodes on faces.
const std::array< boost::shared_ptr< EntitiesFieldData >, LASTSPACE > derivedDataOnElement
Entity data on element entity columns fields.
MoFEMErrorCode getNoFieldRowIndices(EntitiesFieldData &data, const int bit_number) const
get col NoField indices
virtual MoFEMErrorCode setGaussPts(int order_row, int order_col, int order_data)
set user specific integration rule
MoFEMErrorCode getNodesIndices(const int bit_number, FieldEntity_vector_view &ents_field, VectorInt &nodes_indices, VectorInt &local_nodes_indices, EXTRACTOR &&extractor) const
get node indices
MoFEMErrorCode getEntityFieldData(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
EntitiesFieldData & dataHcurl
MoFEMErrorCode setRefineFEPtr(const ForcesAndSourcesCore *refine_fe_ptr)
Set the pointer to face element refined.
auto & getElementPolynomialBase()
Get the Entity Polynomial Base object.
ForcesAndSourcesCore * sidePtrFE
Element to integrate on the sides.
ForcesAndSourcesCore(Interface &m_field)
EntitiesFieldData & dataH1
boost::ptr_vector< UserDataOperator > & getOpPtrVector()
Use to push back operator for row operator.
MatrixDouble coordsAtGaussPts
coordinated at gauss points
boost::function< MoFEMErrorCode(ForcesAndSourcesCore *fe_raw_ptr, int order_row, int order_col, int order_data)> GaussHookFun
virtual int getRule(int order_row, int order_col, int order_data)
another variant of getRule
MoFEMErrorCode getEntitySense(const EntityType type, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
get sense (orientation) of entity
const std::array< boost::shared_ptr< EntitiesFieldData >, LASTSPACE > dataOnElement
Entity data on element entity rows fields.
auto & getDerivedDataOnElementBySpaceArray()
Get derived data on entities and space.
MoFEMErrorCode getProblemNodesColIndices(const std::string &field_name, VectorInt &nodes_indices) const
MoFEMErrorCode calHierarchicalBaseFunctionsOnElement()
Calculate base functions.
MatrixDouble gaussPts
Matrix of integration points.
MoFEMErrorCode calBernsteinBezierBaseFunctionsOnElement()
Calculate Bernstein-Bezier base.
auto & getEntData(const FieldSpace space, const EntityType type, const int side)
Get the entity data.
MoFEMErrorCode getEntityDataOrder(EntitiesFieldData &data, const FieldSpace space) const
Get the entity data order for given space.
virtual MoFEMErrorCode preProcess()
function is run at the beginning of loop
MoFEMErrorCode getColNodesIndices(EntitiesFieldData &data, const int bit_number) const
get col node indices from FENumeredDofEntity_multiIndex
MoFEMErrorCode setSideFEPtr(const ForcesAndSourcesCore *side_fe_ptr)
Set the pointer to face element on the side.
int getMaxColOrder() const
Get max order of approximation for field in columns.
EntityType lastEvaluatedElementEntityType
Last evaluated type of element entity.
boost::function< int(int order_row, int order_col, int order_data)> RuleHookFun
boost::ptr_vector< UserDataOperator > opPtrVector
Vector of finite element users data operators.
MoFEMErrorCode getProblemNodesIndices(const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
get indices of nodal indices which are declared for problem but not this particular element
GaussHookFun setRuleHook
Set function to calculate integration rule.
MoFEMErrorCode getBitRefLevelOnData()
MoFEMErrorCode getNodesFieldData(EntitiesFieldData &data, const int bit_number) const
Get data on nodes.
MoFEMErrorCode getEntityColIndices(EntitiesFieldData &data, const int bit_number, const EntityType type_lo=MBVERTEX, const EntityType type_hi=MBPOLYHEDRON) const
boost::shared_ptr< BaseFunction > elementPolynomialBasePtr
Pointer to entity polynomial base.
MoFEMErrorCode getEntityDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< EntitiesFieldData::EntData > &data) const
Get the entity data order.
ForcesAndSourcesCore * refinePtrFE
Element to integrate parent or child.
MoFEMErrorCode getNoFieldColIndices(EntitiesFieldData &data, const int bit_number) const
get col NoField indices
int getMaxDataOrder() const
Get max order of approximation for data fields.
MoFEMErrorCode getNoFieldFieldData(const int bit_number, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs, VectorFieldEntities &ent_field) const
Get field data on nodes.
boost::shared_ptr< BaseFunction > userPolynomialBasePtr
Pointer to user polynomail base.
MoFEMErrorCode getProblemTypeRowIndices(const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
MoFEMErrorCode getProblemTypeIndices(const std::string &field_name, const NumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices) const
get indices by type (generic function) which are declared for problem but not this particular element
RuleHookFun getRuleHook
Hook to get rule.
MoFEMErrorCode createDataOnElement(EntityType type)
Create a entity data on element object.
virtual MoFEMErrorCode postProcess()
function is run at the end of loop
EntitiesFieldData & dataL2
KSPContext
pass information about context of KSP/DM for with finite element is computed
static constexpr Switches CtxSetA
static constexpr Switches CtxSetX_TT
std::bitset< 8 > Switches
static constexpr Switches CtxSetX_T
static constexpr Switches CtxSetB
Mat & snes_B
preconditioner of jacobian matrix
Mat & snes_A
jacobian matrix
Vec & ts_F
residual vector
Vec & ts_u_tt
second time derivative of state vector
Vec & ts_u_t
time derivative of state vector
Mat & ts_B
Preconditioner for ts_A.
Base volume element used to integrate on skeleton.