v0.8.14
Classes | Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
MoFEM::ForcesAndSourcesCore Struct Reference

structure to get information form mofem into DataForcesAndSourcesCore More...

#include <src/finite_elements/ForcesAndSourcesCore.hpp>

Inheritance diagram for MoFEM::ForcesAndSourcesCore:
[legend]
Collaboration diagram for MoFEM::ForcesAndSourcesCore:
[legend]

Classes

struct  UserDataOperator
 Data operator to do calculations at integration points.Is inherited and implemented by user to do calculations. It can be used in many different ways but typically is used to integrate matrices (f.e. stiffness matrix) and the right hand vector (f.e. force vector). More...
 

Public Types

typedef boost::function< int(int order_row, int order_col, int order_data)> RuleHookFun
 
- Public Types inherited from MoFEM::KspMethod
enum  KSPContext { CTX_SETFUNCTION, CTX_OPERATORS, CTX_KSPNONE }
 pass information about context of KSP/DM for with finite element is computed More...
 
- Public Types inherited from MoFEM::SnesMethod
enum  SNESContext { CTX_SNESSETFUNCTION, CTX_SNESSETJACOBIAN, CTX_SNESNONE }
 
- Public Types inherited from MoFEM::TSMethod
enum  TSContext {
  CTX_TSSETRHSFUNCTION, CTX_TSSETRHSJACOBIAN, CTX_TSSETIFUNCTION, CTX_TSSETIJACOBIAN,
  CTX_TSTSMONITORSET, CTX_TSNONE
}
 

Public Member Functions

 ForcesAndSourcesCore (Interface &m_field)
 
virtual ~ForcesAndSourcesCore ()
 
MoFEMErrorCode getNumberOfNodes (int &num_nodes) const
 
int getMaxDataOrder () const
 Get max order of approximation for data fields. More...
 
int getMaxRowOrder () const
 Get max order of approximation for field in rows. More...
 
int getMaxColOrder () const
 Get max order of approximation for field in columns. More...
 
MoFEMErrorCode getSense (EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 get sense (orientation) of entity More...
 
MoFEMErrorCode getDataOrder (const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 get maximal approximation order of approximation on the entity More...
 
MoFEMErrorCode getDataOrderSpaceAndBase (const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 get maximal approximation order on entity More...
 
template<EntityType type>
MoFEMErrorCode getEntitySense (DataForcesAndSourcesCore &data) const
 
template<EntityType type>
MoFEMErrorCode getEntityDataOrder (DataForcesAndSourcesCore &data, const FieldSpace space) const
 
template<EntityType type>
MoFEMErrorCode getEntityDataOrderSpaceAndBase (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
MoFEMErrorCode getNodesIndices (const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices, VectorInt &local_nodes_indices) const
 get node indices More...
 
MoFEMErrorCode getTypeIndices (const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices, VectorInt &local_indices) const
 get indices by type (generic function) More...
 
MoFEMErrorCode getTypeIndices (const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 get indices by type (generic function) More...
 
MoFEMErrorCode getRowNodesIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get row node indices from FENumeredDofEntity_multiIndex More...
 
MoFEMErrorCode getColNodesIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get col node indices from FENumeredDofEntity_multiIndex More...
 
template<EntityType type>
MoFEMErrorCode getEntityRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
template<EntityType type>
MoFEMErrorCode getEntityColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
MoFEMErrorCode getNoFieldIndices (const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
 get NoField indices More...
 
MoFEMErrorCode getNoFieldRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get col NoField indices More...
 
MoFEMErrorCode getNoFieldColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get col NoField indices More...
 
MoFEMErrorCode getNodesFieldData (const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &nodes_data, VectorDofs &nodes_dofs, FieldSpace &space, FieldApproximationBase &base) const
 Get field data on nodes. More...
 
MoFEMErrorCode getTypeFieldData (const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
 Get field data on entities. More...
 
MoFEMErrorCode getTypeFieldData (const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 
MoFEMErrorCode getNoFieldFieldData (const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
 
MoFEMErrorCode getNoFieldFieldData (DataForcesAndSourcesCore &data, const boost::string_ref field_name) const
 
MoFEMErrorCode getNodesFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 Get data on nodes. More...
 
template<EntityType type>
MoFEMErrorCode getEntityFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
MoFEMErrorCode getFaceTriNodes (DataForcesAndSourcesCore &data) const
 Get nodes on triangles. More...
 
MoFEMErrorCode getSpacesAndBaseOnEntities (DataForcesAndSourcesCore &data) const
 Get field approximation space and base on entities. More...
 
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 More...
 
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 More...
 
MoFEMErrorCode getProblemNodesRowIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
MoFEMErrorCode getProblemTypeRowIndices (const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
 
MoFEMErrorCode getProblemNodesColIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
MoFEMErrorCode getProblemTypeColIndices (const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
 
virtual int getRule (int order)
 set integration rule for finite element More...
 
virtual int getRule (int order_row, int order_col, int order_data)
 another variant of getRule More...
 
virtual MoFEMErrorCode setGaussPts (int order)
 It will be removed in the future use other variant. More...
 
virtual MoFEMErrorCode setGaussPts (int order_row, int order_col, int order_data)
 set user specific integration rule More...
 
boost::ptr_vector< UserDataOperator > & getOpPtrVector ()
 Use to push back operator for row operator. More...
 
auto & getElementPolynomialBase ()
 Get the Entity Polynomial Base object. More...
 
auto & getUserPolynomialBase ()
 Get the User Polynomial Base object. More...
 
virtual MoFEMErrorCode preProcess ()
 function is run at the beginning of loop More...
 
virtual MoFEMErrorCode operator() ()
 function is run for every finite element More...
 
virtual MoFEMErrorCode postProcess ()
 function is run at the end of loop More...
 
MoFEMErrorCode calculateBaseFunctionsOnElement (const FieldApproximationBase b)
 Calculate base functions. More...
 
MoFEMErrorCode calculateBaseFunctionsOnElement ()
 Calculate base functions. More...
 
MoFEMErrorCode createDataOnElement ()
 Create a entity data on element object. More...
 
MoFEMErrorCode loopOverOperators ()
 Iterate user data operators. More...
 
- Public Member Functions inherited from MoFEM::FEMethod
MoFEMErrorCode query_interface (const MOFEMuuid &uuid, UnknownInterface **iface) const
 
 FEMethod ()
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_begin (const MULTIINDEX &index, const std::string &field_name, const EntityType type, const int side_number) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_end (const MULTIINDEX &index, const std::string &field_name, const EntityType type, const int side_number) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_begin (const MULTIINDEX &index, const std::string &field_name, const EntityType type) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_end (const MULTIINDEX &index, const std::string &field_name, const EntityType type) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_begin (const MULTIINDEX &index, const std::string &field_name) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_end (const MULTIINDEX &index, const std::string &field_name) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_begin (const MULTIINDEX &index, const EntityHandle ent) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_end (const MULTIINDEX &index, const EntityHandle ent) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_begin (const MULTIINDEX &index, const std::string &field_name, const EntityHandle ent) const
 
template<class MULTIINDEX >
MULTIINDEX::iterator get_end (const MULTIINDEX &index, const std::string &field_name, const EntityHandle ent) const
 
- Public Member Functions inherited from MoFEM::BasicMethod
 BasicMethod ()
 
virtual ~BasicMethod ()
 
int getNinTheLoop () const
 get number of evaluated element in the loop More...
 
int getLoopSize () const
 get loop size More...
 
MoFEMErrorCode copyBasicMethod (const BasicMethod &basic)
 
- Public Member Functions inherited from MoFEM::KspMethod
 KspMethod ()
 
virtual ~KspMethod ()
 
MoFEMErrorCode setKspCtx (const KSPContext &ctx)
 set operator type More...
 
MoFEMErrorCode setKsp (KSP ksp)
 set solver More...
 
MoFEMErrorCode copyKsp (const KspMethod &ksp)
 copy data form another method More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 
- Public Member Functions inherited from MoFEM::SnesMethod
 SnesMethod ()
 
virtual ~SnesMethod ()
 
MoFEMErrorCode setSnesCtx (const SNESContext &ctx)
 Set SNES context. More...
 
MoFEMErrorCode setSnes (SNES snes)
 Set SNES instance. More...
 
MoFEMErrorCode copySnes (const SnesMethod &snes)
 Copy snes data. More...
 
- Public Member Functions inherited from MoFEM::TSMethod
 TSMethod ()
 
virtual ~TSMethod ()
 
MoFEMErrorCode setTsCtx (const TSContext &ctx)
 Set Ts context. More...
 
MoFEMErrorCode copyTs (const TSMethod &ts)
 Copy TS solver data. More...
 
MoFEMErrorCode setTs (TS _ts)
 Set TS solver. More...
 

Public Attributes

InterfacemField
 
const boost::shared_ptr< DataForcesAndSourcesCoredataOnElement [LASTSPACE]
 Entity data on element entity rows fields. More...
 
const boost::shared_ptr< DataForcesAndSourcesCorederivedDataOnElement [LASTSPACE]
 Entity data on element entity columns fields. More...
 
DataForcesAndSourcesCoredataNoField
 
DataForcesAndSourcesCoredataH1
 
DataForcesAndSourcesCoredataHcurl
 
DataForcesAndSourcesCoredataHdiv
 
DataForcesAndSourcesCoredataL2
 
RuleHookFun getRuleHook
 Hook to get rule. More...
 
boost::ptr_vector< UserDataOperatoropPtrVector
 Vector of finite element users data operators. More...
 
MatrixDouble gaussPts
 Matrix of integration points. More...
 
- Public Attributes inherited from MoFEM::FEMethod
std::string feName
 
boost::shared_ptr< const NumeredEntFiniteElementnumeredEntFiniteElementPtr
 
boost::shared_ptr< const FENumeredDofEntity_multiIndexrowPtr
 
boost::shared_ptr< const FENumeredDofEntity_multiIndexcolPtr
 
boost::shared_ptr< const FEDofEntity_multiIndexdataPtr
 
- Public Attributes inherited from MoFEM::BasicMethod
int nInTheLoop
 
int loopSize
 
int rAnk
 
int sIze
 
const RefEntity_multiIndexrefinedEntitiesPtr
 
const RefElement_multiIndexrefinedFiniteElementsPtr
 
const ProblemproblemPtr
 
const Field_multiIndexfieldsPtr
 
const FieldEntity_multiIndexentitiesPtr
 
const DofEntity_multiIndexdofsPtr
 
const FiniteElement_multiIndexfiniteElementsPtr
 
const EntFiniteElement_multiIndexfiniteElementsEntitiesPtr
 
const FieldEntityEntFiniteElementAdjacencyMap_multiIndexadjacenciesPtr
 
boost::function< MoFEMErrorCode()> preProcessHook
 
boost::function< MoFEMErrorCode()> postProcessHook
 
boost::function< MoFEMErrorCode()> operatorHook
 
- Public Attributes inherited from MoFEM::KspMethod
KSPContext ksp_ctx
 Context. More...
 
KSP ksp
 KSP solver. More...
 
Vec ksp_f
 the right hand side vector More...
 
Mat ksp_A
 matrix More...
 
Mat ksp_B
 preconditioner matrix More...
 
- Public Attributes inherited from MoFEM::SnesMethod
SNESContext snes_ctx
 
SNES snes
 
Vec snes_x
 
Vec snes_f
 
Mat snes_A
 
Mat snes_B
 
- Public Attributes inherited from MoFEM::TSMethod
TSContext ts_ctx
 
TS ts
 
Vec ts_u
 
Vec ts_u_t
 
Vec ts_F
 
Mat ts_A
 
Mat ts_B
 
PetscInt ts_step
 
PetscReal ts_a
 
PetscReal ts_t
 

Private Attributes

EntityType lastEvaluatedElementEntityType
 Last evaluated type of element entity. More...
 
boost::shared_ptr< BaseFunctionelementPolynomialBasePtr
 Pointer to entity polynomial base. More...
 
boost::shared_ptr< BaseFunctionuserPolynomialBasePtr
 Pointer to user polynomail base. More...
 

Additional Inherited Members

- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 

Detailed Description

structure to get information form mofem into DataForcesAndSourcesCore

Examples:
hello_world.cpp.

Definition at line 34 of file ForcesAndSourcesCore.hpp.

Member Typedef Documentation

◆ RuleHookFun

typedef boost::function<int(int order_row, int order_col, int order_data)> MoFEM::ForcesAndSourcesCore::RuleHookFun

Definition at line 318 of file ForcesAndSourcesCore.hpp.

Constructor & Destructor Documentation

◆ ForcesAndSourcesCore()

MoFEM::ForcesAndSourcesCore::ForcesAndSourcesCore ( Interface m_field)

Definition at line 72 of file ForcesAndSourcesCore.cpp.

73  :
74 
75  mField(m_field),
77 
78  nullptr,
79  boost::shared_ptr<DataForcesAndSourcesCore>(
80  new DataForcesAndSourcesCore(MBENTITYSET)), // NOFIELD
81  boost::shared_ptr<DataForcesAndSourcesCore>(
82  new DataForcesAndSourcesCore(MBENTITYSET)), // H1
83  boost::shared_ptr<DataForcesAndSourcesCore>(
84  new DataForcesAndSourcesCore(MBENTITYSET)), // HCURL
85  boost::shared_ptr<DataForcesAndSourcesCore>(
86  new DataForcesAndSourcesCore(MBENTITYSET)), // HDIV
87  boost::shared_ptr<DataForcesAndSourcesCore>(
88  new DataForcesAndSourcesCore(MBENTITYSET)) // L2
89 
90  },
92 
93  nullptr,
94  boost::shared_ptr<DataForcesAndSourcesCore>(
95  new DerivedDataForcesAndSourcesCore(dataOnElement[NOFIELD])),
96  boost::shared_ptr<DataForcesAndSourcesCore>(
97  new DerivedDataForcesAndSourcesCore(dataOnElement[H1])),
98  boost::shared_ptr<DataForcesAndSourcesCore>(
99  new DerivedDataForcesAndSourcesCore(dataOnElement[HCURL])),
100  boost::shared_ptr<DataForcesAndSourcesCore>(
101  new DerivedDataForcesAndSourcesCore(dataOnElement[HDIV])),
102  boost::shared_ptr<DataForcesAndSourcesCore>(
103  new DerivedDataForcesAndSourcesCore(dataOnElement[L2]))
104 
105  },
107  dataH1(*dataOnElement[H1].get()), dataHcurl(*dataOnElement[HCURL].get()),
108  dataHdiv(*dataOnElement[HDIV].get()), dataL2(*dataOnElement[L2].get()),
DataForcesAndSourcesCore & dataL2
field with continuous normal traction
Definition: definitions.h:170
DataForcesAndSourcesCore & dataH1
const boost::shared_ptr< DataForcesAndSourcesCore > derivedDataOnElement[LASTSPACE]
Entity data on element entity columns fields.
scalar or vector of scalars describe (no true field)
Definition: definitions.h:167
const boost::shared_ptr< DataForcesAndSourcesCore > dataOnElement[LASTSPACE]
Entity data on element entity rows fields.
RuleHookFun getRuleHook
Hook to get rule.
DataForcesAndSourcesCore & dataHcurl
EntityType lastEvaluatedElementEntityType
Last evaluated type of element entity.
field with continuous tangents
Definition: definitions.h:169
DataForcesAndSourcesCore & dataHdiv
continuous field
Definition: definitions.h:168
field with C-1 continuity
Definition: definitions.h:171
DataForcesAndSourcesCore & dataNoField

◆ ~ForcesAndSourcesCore()

virtual MoFEM::ForcesAndSourcesCore::~ForcesAndSourcesCore ( )
virtual

Definition at line 63 of file ForcesAndSourcesCore.hpp.

63 {}

Member Function Documentation

◆ calculateBaseFunctionsOnElement() [1/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::calculateBaseFunctionsOnElement ( const FieldApproximationBase  b)

Calculate base functions.

Returns
Error code

Definition at line 964 of file ForcesAndSourcesCore.cpp.

965  {
967  if (dataOnElement[H1]->bAse.test(b)) {
968  switch (static_cast<FieldApproximationBase>(b)) {
969  case NOBASE:
970  break;
974  if (!getElementPolynomialBase()) {
975  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
976  "Functions genrating approximation base not defined");
977  }
978  for (int space = H1; space != LASTSPACE; ++space) {
979  if (dataOnElement[H1]->sPace.test(space) &&
980  dataOnElement[H1]->bAse.test(b) &&
981  dataOnElement[H1]->basesOnSpaces[space].test(b)) {
982  CHKERR getElementPolynomialBase()->getValue(
983  gaussPts,
984  boost::shared_ptr<BaseFunctionCtx>(new EntPolynomialBaseCtx(
985  *dataOnElement[space], static_cast<FieldSpace>(space),
986  static_cast<FieldApproximationBase>(b), NOBASE)));
987  }
988  }
989  break;
990  case USER_BASE:
991  if (!getUserPolynomialBase()) {
992  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
993  "Functions genrating user approximation base not defined");
994  }
995  for (int space = H1; space != LASTSPACE; ++space)
996  if (dataOnElement[H1]->sPace.test(space) &&
997  dataOnElement[H1]->bAse.test(b) &&
998  dataOnElement[H1]->basesOnSpaces[space].test(b)) {
999  CHKERR getUserPolynomialBase()->getValue(
1000  gaussPts,
1001  boost::shared_ptr<BaseFunctionCtx>(new EntPolynomialBaseCtx(
1002  *dataOnElement[space], static_cast<FieldSpace>(space),
1003  static_cast<FieldApproximationBase>(b), NOBASE)));
1004  }
1005  break;
1006  default:
1008  "Base <%s> not yet implemented",
1010  }
1011  }
1013 }
MatrixDouble gaussPts
Matrix of integration points.
user implemented approximation base
Definition: definitions.h:151
auto & getUserPolynomialBase()
Get the User Polynomial Base object.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
const boost::shared_ptr< DataForcesAndSourcesCore > dataOnElement[LASTSPACE]
Entity data on element entity rows fields.
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:172
static const char *const ApproximationBaseNames[]
Definition: definitions.h:155
FieldApproximationBase
approximation base
Definition: definitions.h:140
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:142
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
virtual MPI_Comm & get_comm() const =0
continuous field
Definition: definitions.h:168
auto & getElementPolynomialBase()
Get the Entity Polynomial Base object.

◆ calculateBaseFunctionsOnElement() [2/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::calculateBaseFunctionsOnElement ( )

Calculate base functions.

Returns
Error code

Definition at line 1015 of file ForcesAndSourcesCore.cpp.

1015  {
1017  /// Use the some node base. Node base is usually used for construction other
1018  /// bases.
1019  for (int space = HCURL; space != LASTSPACE; ++space) {
1020  dataOnElement[space]->dataOnEntities[MBVERTEX][0].getNSharedPtr(NOBASE) =
1021  dataOnElement[H1]->dataOnEntities[MBVERTEX][0].getNSharedPtr(NOBASE);
1022  }
1023  for (int b = AINSWORTH_LEGENDRE_BASE; b != LASTBASE; b++) {
1025  static_cast<FieldApproximationBase>(b));
1026  }
1028 }
MoFEMErrorCode calculateBaseFunctionsOnElement()
Calculate base functions.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
const boost::shared_ptr< DataForcesAndSourcesCore > dataOnElement[LASTSPACE]
Entity data on element entity rows fields.
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:172
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:142
field with continuous tangents
Definition: definitions.h:169
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
continuous field
Definition: definitions.h:168

◆ createDataOnElement()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::createDataOnElement ( )

Create a entity data on element object.

Returns
MoFEMErrorCode

Definition at line 1030 of file ForcesAndSourcesCore.cpp.

1030  {
1032 
1033  const EntityType type = numeredEntFiniteElementPtr->getEntType();
1034  if (type == lastEvaluatedElementEntityType)
1036 
1037  // Data on elements for proper spaces
1038  for (int space = H1; space != LASTSPACE; ++space) {
1039  dataOnElement[space]->setElementType(type);
1040  derivedDataOnElement[space]->setElementType(type);
1041  }
1042 
1044 
1046 }
const boost::shared_ptr< DataForcesAndSourcesCore > derivedDataOnElement[LASTSPACE]
Entity data on element entity columns fields.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
const boost::shared_ptr< DataForcesAndSourcesCore > dataOnElement[LASTSPACE]
Entity data on element entity rows fields.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:172
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
EntityType lastEvaluatedElementEntityType
Last evaluated type of element entity.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
continuous field
Definition: definitions.h:168

◆ getColNodesIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getColNodesIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get col node indices from FENumeredDofEntity_multiIndex

Definition at line 388 of file ForcesAndSourcesCore.cpp.

389  {
390  return getNodesIndices(field_name,
391  const_cast<FENumeredDofEntity_multiIndex &>(
392  numeredEntFiniteElementPtr->getColsDofs()),
393  data.dataOnEntities[MBVERTEX][0].getIndices(),
394  data.dataOnEntities[MBVERTEX][0].getLocalIndices());
395 }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
MoFEMErrorCode getNodesIndices(const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices, VectorInt &local_nodes_indices) const
get node indices

◆ getDataOrder()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getDataOrder ( const EntityType  type,
const FieldSpace  space,
boost::ptr_vector< DataForcesAndSourcesCore::EntData > &  data 
) const

get maximal approximation order of approximation on the entity

Definition at line 199 of file ForcesAndSourcesCore.cpp.

201  {
203  SideNumber_multiIndex &side_table = const_cast<SideNumber_multiIndex &>(
204  numeredEntFiniteElementPtr->getSideNumberTable());
205  if (data.size() < side_table.get<2>().count(type)) {
206  // prims has 9 edges, some of edges for "flat" prism are not active
207  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
208  "data inconsistency %d < %d", data.size(),
209  side_table.get<2>().count(type));
210  }
211  for (unsigned int side = 0; side < data.size(); side++) {
212  data[side].getDataOrder() = 0;
213  }
214  FEDofEntity_multiIndex::index<Composite_EntType_and_Space_mi_tag>::type
215  &data_dofs = const_cast<FEDofEntity_multiIndex::index<
216  Composite_EntType_and_Space_mi_tag>::type &>(
217  numeredEntFiniteElementPtr->getDataDofs()
218  .get<Composite_EntType_and_Space_mi_tag>());
219  FEDofEntity_multiIndex::index<
220  Composite_EntType_and_Space_mi_tag>::type::iterator dit,
221  hi_dit;
222  dit = data_dofs.lower_bound(boost::make_tuple(type, space));
223  hi_dit = data_dofs.upper_bound(boost::make_tuple(type, space));
224  for (; dit != hi_dit; dit++) {
225  ApproximationOrder ent_order = (*dit)->getMaxOrder();
226  int side_number = (*dit)->sideNumberPtr->side_number;
227  if (side_number < 0) {
228  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
229  }
230  data[side_number].getDataOrder() =
231  data[side_number].getDataOrder() > ent_order
232  ? data[side_number].getDataOrder()
233  : ent_order;
234  if ((*dit)->sideNumberPtr->brother_side_number != -1) {
235  if (data.size() <
236  (unsigned int)(*dit)->sideNumberPtr->brother_side_number) {
237  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
238  "data inconsistency");
239  }
240  data[(*dit)->sideNumberPtr->brother_side_number].getDataOrder() =
241  data[side_number].getDataOrder();
242  }
243  }
245 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
int ApproximationOrder
Approximation on the entity.
Definition: Common.hpp:131
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getDataOrderSpaceAndBase()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getDataOrderSpaceAndBase ( const std::string &  field_name,
const EntityType  type,
boost::ptr_vector< DataForcesAndSourcesCore::EntData > &  data 
) const

get maximal approximation order on entity

Definition at line 247 of file ForcesAndSourcesCore.cpp.

249  {
250  auto &side_table = const_cast<SideNumber_multiIndex &>(
251  numeredEntFiniteElementPtr->getSideNumberTable());
252  if (data.size() < side_table.get<2>().count(type)) {
253  // prims has 9 edges, some of edges for "flat" prism are not active
254  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
255  "data inconsistency %d < %d", data.size(),
256  side_table.get<2>().count(type));
257  }
258 
259  for (unsigned int side = 0; side != data.size(); ++side) {
260  data[side].getDataOrder() = 0;
261  data[side].getBase() = NOBASE;
262  data[side].getSpace() = NOSPACE;
263  }
264 
265  // get dofs by name, type and side
266  const auto &data_dofs =
267  numeredEntFiniteElementPtr->getDataDofs()
268  .get<Composite_Name_Type_And_Side_Number_mi_tag>();
269  auto dit = data_dofs.lower_bound(boost::make_tuple(field_name, type, 0));
270  if (dit == data_dofs.end()) {
272  }
273  auto hi_dit =
274  data_dofs.upper_bound(boost::make_tuple(field_name, type, data.size()));
275 
276  for (; dit != hi_dit;) {
277 
278  // std::cerr << ApproximationBaseNames[dit->getApproxBase()] << std::endl;
279 
280  int side_number = (*dit)->sideNumberPtr->side_number;
281  if (data[side_number].getDataOrder()) {
282  const int nb_dofs_on_ent = (*dit)->getNbDofsOnEnt();
283  for (int i = 0; i != nb_dofs_on_ent; ++i, ++dit) {
284  }
285  continue;
286  }
287 
288  ApproximationOrder ent_order = (*dit)->getMaxOrder();
289  if (PetscUnlikely(side_number < 0)) {
290  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
291  "Side number is not set to dof entity");
292  }
293  data[side_number].getBase() = (*dit)->getApproxBase();
294  data[side_number].getSpace() = (*dit)->getSpace();
295  data[side_number].getDataOrder() =
296  data[side_number].getDataOrder() > ent_order
297  ? data[side_number].getDataOrder()
298  : ent_order;
299  if ((*dit)->sideNumberPtr->brother_side_number != -1) {
300  if (data.size() <
301  (unsigned int)(*dit)->sideNumberPtr->brother_side_number) {
302  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
303  "data inconsistency");
304  }
305  data[(*dit)->sideNumberPtr->brother_side_number].getBase() =
306  data[side_number].getBase();
307  data[(*dit)->sideNumberPtr->brother_side_number].getSpace() =
308  data[side_number].getSpace();
309  data[(*dit)->sideNumberPtr->brother_side_number].getDataOrder() =
310  data[side_number].getDataOrder();
311  }
312 
313  const int nb_dofs_on_ent = (*dit)->getNbDofsOnEnt();
314  for (int i = 0; i != nb_dofs_on_ent; ++i, ++dit) {
315  }
316  }
317 
319 }
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
int ApproximationOrder
Approximation on the entity.
Definition: Common.hpp:131
MoFEMErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity

◆ getElementPolynomialBase()

auto& MoFEM::ForcesAndSourcesCore::getElementPolynomialBase ( )

Get the Entity Polynomial Base object.

Returns
boost::shared_ptr<BaseFunction>&&

Definition at line 667 of file ForcesAndSourcesCore.hpp.

667 { return elementPolynomialBasePtr; }
boost::shared_ptr< BaseFunction > elementPolynomialBasePtr
Pointer to entity polynomial base.

◆ getEntityColIndices()

template<EntityType type>
MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getEntityColIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 163 of file ForcesAndSourcesCore.hpp.

164  {
165  return getTypeIndices(field_name,
166  const_cast<FENumeredDofEntity_multiIndex &>(
167  numeredEntFiniteElementPtr->getColsDofs()),
168  type, data.dataOnEntities[type]);
169  }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
MoFEMErrorCode getTypeIndices(const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices, VectorInt &local_indices) const
get indices by type (generic function)

◆ getEntityDataOrder()

template<EntityType type>
MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getEntityDataOrder ( DataForcesAndSourcesCore data,
const FieldSpace  space 
) const

Definition at line 112 of file ForcesAndSourcesCore.hpp.

113  {
114  return getDataOrder(type, space, data.dataOnEntities[type]);
115  }
MoFEMErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity

◆ getEntityDataOrderSpaceAndBase()

template<EntityType type>
MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getEntityDataOrderSpaceAndBase ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 118 of file ForcesAndSourcesCore.hpp.

119  {
120  return getDataOrderSpaceAndBase(field_name, type,
121  data.dataOnEntities[type]);
122  }
MoFEMErrorCode getDataOrderSpaceAndBase(const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order on entity

◆ getEntityFieldData()

template<EntityType type>
MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getEntityFieldData ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 240 of file ForcesAndSourcesCore.hpp.

241  {
242  return getTypeFieldData(field_name,
243  const_cast<FEDofEntity_multiIndex &>(
244  numeredEntFiniteElementPtr->getDataDofs()),
245  type, data.dataOnEntities[type]);
246  }
MoFEMErrorCode getTypeFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
Get field data on entities.
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getEntityRowIndices()

template<EntityType type>
MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getEntityRowIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 154 of file ForcesAndSourcesCore.hpp.

155  {
156  return getTypeIndices(field_name,
157  const_cast<FENumeredDofEntity_multiIndex &>(
158  numeredEntFiniteElementPtr->getRowsDofs()),
159  type, data.dataOnEntities[type]);
160  }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
MoFEMErrorCode getTypeIndices(const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices, VectorInt &local_indices) const
get indices by type (generic function)

◆ getEntitySense()

template<EntityType type>
MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getEntitySense ( DataForcesAndSourcesCore data) const

Definition at line 107 of file ForcesAndSourcesCore.hpp.

107  {
108  return getSense(type, data.dataOnEntities[type]);
109  }
MoFEMErrorCode getSense(EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get sense (orientation) of entity

◆ getFaceTriNodes()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getFaceTriNodes ( DataForcesAndSourcesCore data) const

Get nodes on triangles.

Definition at line 842 of file ForcesAndSourcesCore.cpp.

842  {
844  // PetscAttachDebugger();
845  data.facesNodes.resize(4, 3, false);
846  auto &side_table = const_cast<SideNumber_multiIndex &>(
847  numeredEntFiniteElementPtr->getSideNumberTable());
848  auto siit = side_table.get<1>().lower_bound(boost::make_tuple(MBTRI, 0));
849  auto hi_siit = side_table.get<1>().upper_bound(boost::make_tuple(MBTRI, 4));
850  if (std::distance(siit, hi_siit) != 4) {
851  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
852  "Should be 4 triangles on tet, side_table not initialized");
853  }
854  const int canonical_face_sense_p1[4][3] = {
855  {0, 1, 3},
856  {1, 2, 3},
857  {0, 3, 2} /**/,
858  {0, 2, 1} /**/}; // second index is offset (positive sense)
859  const int canonical_face_sense_m1[4][3] = {
860  {0, 3, 1},
861  {1, 3, 2},
862  {0, 2, 3},
863  {0, 1, 2}}; // second index is offset (negative sense
864  for (; siit != hi_siit; siit++) {
865  const boost::shared_ptr<SideNumber> side = *siit;
866  int face_conn[3] = {-1, -1, -1};
867  if (side->offset == 0) {
868  face_conn[0] = side->sense == 1
869  ? canonical_face_sense_p1[(int)side->side_number][0]
870  : canonical_face_sense_m1[(int)side->side_number][0];
871  face_conn[1] = side->sense == 1
872  ? canonical_face_sense_p1[(int)side->side_number][1]
873  : canonical_face_sense_m1[(int)side->side_number][1];
874  face_conn[2] = side->sense == 1
875  ? canonical_face_sense_p1[(int)side->side_number][2]
876  : canonical_face_sense_m1[(int)side->side_number][2];
877  }
878  if (side->offset == 1) {
879  face_conn[0] =
880  side->sense == 1
881  ? canonical_face_sense_p1[(int)side->side_number][1]
882  : canonical_face_sense_m1[(int)side->side_number][2] /**/;
883  face_conn[1] = side->sense == 1
884  ? canonical_face_sense_p1[(int)side->side_number][2]
885  : canonical_face_sense_m1[(int)side->side_number][0];
886  face_conn[2] = side->sense == 1
887  ? canonical_face_sense_p1[(int)side->side_number][0]
888  : canonical_face_sense_m1[(int)side->side_number][1];
889  }
890  if (side->offset == 2) {
891  face_conn[0] =
892  side->sense == 1
893  ? canonical_face_sense_p1[(int)side->side_number][2]
894  : canonical_face_sense_m1[(int)side->side_number][1] /**/;
895  face_conn[1] = side->sense == 1
896  ? canonical_face_sense_p1[(int)side->side_number][0]
897  : canonical_face_sense_m1[(int)side->side_number][2];
898  face_conn[2] = side->sense == 1
899  ? canonical_face_sense_p1[(int)side->side_number][1]
900  : canonical_face_sense_m1[(int)side->side_number][0];
901  }
902  for (int nn = 0; nn < 3; nn++)
903  data.facesNodes(side->side_number, nn) = face_conn[nn];
904  {
905  const EntityHandle *conn_tet;
906  int num_nodes_tet;
908  CHKERR mField.get_moab().get_connectivity(ent, conn_tet, num_nodes_tet,
909  true);
910  if (num_nodes_tet != 4)
911  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
912  "data inconsistency");
913  int num_nodes_face;
914  const EntityHandle *conn_face;
915  CHKERR mField.get_moab().get_connectivity(side->ent, conn_face,
916  num_nodes_face, true);
917  if (num_nodes_face != 3)
918  SETERRQ(PETSC_COMM_SELF, 1, "data inconsistency");
919  if (conn_face[0] != conn_tet[data.facesNodes(side->side_number, 0)])
920  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
921  "data inconsistency");
922  if (conn_face[1] != conn_tet[data.facesNodes(side->side_number, 1)])
923  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
924  "data inconsistency");
925  if (conn_face[2] != conn_tet[data.facesNodes(side->side_number, 2)])
926  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
927  "data inconsistency");
928  }
929  }
931 }
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getMaxColOrder()

int MoFEM::ForcesAndSourcesCore::getMaxColOrder ( ) const

Get max order of approximation for field in columns.

Definition at line 195 of file ForcesAndSourcesCore.cpp.

195  {
196  return getMaxOrder(numeredEntFiniteElementPtr->getColsDofs());
197 }
static int getMaxOrder(const DOFMULTIINDEX &dof_multi_index)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getMaxDataOrder()

int MoFEM::ForcesAndSourcesCore::getMaxDataOrder ( ) const

Get max order of approximation for data fields.

Method getMaxDataOrder () return maximal order on entities, for all data on the element. So for example if finite element is triangle, and triangle base function have order 4 and on edges base function have order 2, this function return 4.

If finite element has for example 2 or more approximated fields, for example Pressure (order 3) and displacement field (order 5), this function returns 5.

Definition at line 187 of file ForcesAndSourcesCore.cpp.

187  {
188  return getMaxOrder(numeredEntFiniteElementPtr->getDataDofs());
189 }
static int getMaxOrder(const DOFMULTIINDEX &dof_multi_index)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getMaxRowOrder()

int MoFEM::ForcesAndSourcesCore::getMaxRowOrder ( ) const

Get max order of approximation for field in rows.

Definition at line 191 of file ForcesAndSourcesCore.cpp.

191  {
192  return getMaxOrder(numeredEntFiniteElementPtr->getRowsDofs());
193 }
static int getMaxOrder(const DOFMULTIINDEX &dof_multi_index)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getNodesFieldData() [1/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNodesFieldData ( const boost::string_ref  field_name,
FEDofEntity_multiIndex dofs,
VectorDouble nodes_data,
VectorDofs nodes_dofs,
FieldSpace space,
FieldApproximationBase base 
) const

Get field data on nodes.

Parameters
field_nameName of field
dofsDofs (element) multi index
nodes_dataReturned DOFs values
nodes_dofsVector of pointers to DOFs data structure
spaceGet space on nodes (Only H! is valid)
baseGet base on nodes
Returns
Error code

Definition at line 639 of file ForcesAndSourcesCore.cpp.

642  {
644  auto dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(
645  boost::make_tuple(field_name, MBVERTEX));
646  auto hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(
647  boost::make_tuple(field_name, MBVERTEX));
648 
649  int num_nodes;
650  CHKERR getNumberOfNodes(num_nodes);
651  int max_nb_dofs = 0;
652  if (dit != hi_dit) {
653  max_nb_dofs = (*dit)->getNbOfCoeffs() * num_nodes;
654  }
655 
656  if (std::distance(dit, hi_dit) != max_nb_dofs) {
657  nodes_data.resize(max_nb_dofs, false);
658  nodes_data.clear();
659  nodes_dofs.resize(max_nb_dofs, false);
660  } else {
661  int size = std::distance(dit, hi_dit);
662  nodes_data.resize(size, false);
663  nodes_dofs.resize(size, false);
664  }
665 
666  if (dit != hi_dit) {
667  space = (*dit)->getSpace();
668  base = (*dit)->getApproxBase();
669  }
670 
671  for (; dit != hi_dit; dit++) {
672  FieldData val = (*dit)->getFieldData();
673  int side_number = (*dit)->sideNumberPtr->side_number;
674  if (side_number == -1) {
675  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
676  }
677  int pos = side_number * (*dit)->getNbOfCoeffs() + (*dit)->getDofCoeffIdx();
678  nodes_data[pos] = val;
679  nodes_dofs[pos] = *dit;
680  int brother_side_number = (*dit)->sideNumberPtr->brother_side_number;
681  if (brother_side_number != -1) {
682  if (nodes_data.size() <
683  (unsigned int)(brother_side_number * (*dit)->getNbOfCoeffs() +
684  (*dit)->getNbOfCoeffs())) {
685  nodes_data.resize(brother_side_number * (*dit)->getNbOfCoeffs() +
686  (*dit)->getNbOfCoeffs());
687  nodes_dofs.resize(brother_side_number * (*dit)->getNbOfCoeffs() +
688  (*dit)->getNbOfCoeffs());
689  }
690  int brother_pos = brother_side_number * (*dit)->getNbOfCoeffs() +
691  (*dit)->getDofCoeffIdx();
692  nodes_data[brother_pos] = val;
693  nodes_dofs[brother_pos] = *dit;
694  }
695  }
697 }
double FieldData
Field data type.
Definition: Common.hpp:130
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
MoFEMErrorCode getNumberOfNodes(int &num_nodes) const
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getNodesFieldData() [2/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNodesFieldData ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Get data on nodes.

Parameters
dataData structure
field_nameField name
Returns
Error code

Definition at line 700 of file ForcesAndSourcesCore.cpp.

701  {
702  return getNodesFieldData(field_name,
703  const_cast<FEDofEntity_multiIndex &>(
704  numeredEntFiniteElementPtr->getDataDofs()),
705  data.dataOnEntities[MBVERTEX][0].getFieldData(),
706  data.dataOnEntities[MBVERTEX][0].getFieldDofs(),
707  data.dataOnEntities[MBVERTEX][0].getSpace(),
708  data.dataOnEntities[MBVERTEX][0].getBase());
709 }
MoFEMErrorCode getNodesFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &nodes_data, VectorDofs &nodes_dofs, FieldSpace &space, FieldApproximationBase &base) const
Get field data on nodes.
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getNodesIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNodesIndices ( const boost::string_ref  field_name,
FENumeredDofEntity_multiIndex dofs,
VectorInt nodes_indices,
VectorInt local_nodes_indices 
) const

get node indices

Definition at line 323 of file ForcesAndSourcesCore.cpp.

325  {
327  auto dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(
328  boost::make_tuple(field_name, MBVERTEX));
329  auto hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(
330  boost::make_tuple(field_name, MBVERTEX));
331 
332  int num_nodes;
333  CHKERR getNumberOfNodes(num_nodes);
334  int max_nb_dofs = 0;
335  if (dit != hi_dit) {
336  max_nb_dofs = (*dit)->getNbOfCoeffs() * num_nodes;
337  }
338 
339  if (std::distance(dit, hi_dit) != max_nb_dofs) {
340  nodes_indices.resize(max_nb_dofs, false);
341  local_nodes_indices.resize(max_nb_dofs, false);
342  for (int dd = 0; dd < max_nb_dofs; dd++) {
343  nodes_indices[dd] = -1;
344  local_nodes_indices[dd] = -1;
345  }
346  } else {
347  nodes_indices.resize(std::distance(dit, hi_dit), false);
348  local_nodes_indices.resize(std::distance(dit, hi_dit), false);
349  }
350 
351  for (; dit != hi_dit; dit++) {
352  const int idx = (*dit)->getPetscGlobalDofIdx();
353  const int local_idx = (*dit)->getPetscLocalDofIdx();
354  const int side_number = (*dit)->sideNumberPtr->side_number;
355  const int pos =
356  side_number * (*dit)->getNbOfCoeffs() + (*dit)->getDofCoeffIdx();
357  nodes_indices[pos] = idx;
358  local_nodes_indices[pos] = local_idx;
359  const int brother_side_number = (*dit)->sideNumberPtr->brother_side_number;
360  if (brother_side_number != -1) {
361  if (nodes_indices.size() <
362  (unsigned int)(brother_side_number * (*dit)->getNbOfCoeffs() +
363  (*dit)->getNbOfCoeffs())) {
364  nodes_indices.resize(brother_side_number * (*dit)->getNbOfCoeffs() +
365  (*dit)->getNbOfCoeffs());
366  }
367  const int elem_idx = brother_side_number * (*dit)->getNbOfCoeffs() +
368  (*dit)->getDofCoeffIdx();
369  nodes_indices[elem_idx] = idx;
370  local_nodes_indices[elem_idx] = local_idx;
371  }
372  }
373 
375 }
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T *> &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
#define CHKERR
Inline error check.
Definition: definitions.h:578
MoFEMErrorCode getNumberOfNodes(int &num_nodes) const
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getNoFieldColIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNoFieldColIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get col NoField indices

Definition at line 515 of file ForcesAndSourcesCore.cpp.

516  {
518  if (data.dataOnEntities[MBENTITYSET].size() == 0) {
519  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
520  }
521  CHKERR getNoFieldIndices(field_name,
522  const_cast<FENumeredDofEntity_multiIndex &>(
523  numeredEntFiniteElementPtr->getColsDofs()),
524  data.dataOnEntities[MBENTITYSET][0].getIndices());
526 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
#define CHKERR
Inline error check.
Definition: definitions.h:578
MoFEMErrorCode getNoFieldIndices(const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
get NoField indices
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getNoFieldFieldData() [1/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNoFieldFieldData ( const boost::string_ref  field_name,
FEDofEntity_multiIndex dofs,
VectorDouble ent_field_data,
VectorDofs ent_field_dofs 
) const

Definition at line 807 of file ForcesAndSourcesCore.cpp.

809  {
811  auto dit = dofs.get<FieldName_mi_tag>().lower_bound(field_name);
812  auto hi_dit = dofs.get<FieldName_mi_tag>().upper_bound(field_name);
813  int size = std::distance(dit, hi_dit);
814  ent_field_data.resize(size, false);
815  ent_field_dofs.resize(size, false);
816  for (; dit != hi_dit; dit++) {
817  int idx = (*dit)->getDofCoeffIdx();
818  ent_field_data[idx] = (*dit)->getFieldData();
819  ent_field_dofs[idx] = *dit;
820  }
822 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ getNoFieldFieldData() [2/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNoFieldFieldData ( DataForcesAndSourcesCore data,
const boost::string_ref  field_name 
) const

Definition at line 824 of file ForcesAndSourcesCore.cpp.

825  {
827  if (data.dataOnEntities[MBENTITYSET].size() == 0) {
828  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
829  }
831  field_name,
832  const_cast<FEDofEntity_multiIndex &>(
833  numeredEntFiniteElementPtr->getDataDofs()),
834  data.dataOnEntities[MBENTITYSET][0].getFieldData(),
835  data.dataOnEntities[MBENTITYSET][0].getFieldDofs());
837 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
MoFEMErrorCode getNoFieldFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getNoFieldIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNoFieldIndices ( const std::string &  field_name,
FENumeredDofEntity_multiIndex dofs,
VectorInt nodes_indices 
) const

get NoField indices

Definition at line 488 of file ForcesAndSourcesCore.cpp.

490  {
492  auto dit = dofs.get<FieldName_mi_tag>().lower_bound(field_name);
493  auto hi_dit = dofs.get<FieldName_mi_tag>().upper_bound(field_name);
494  indices.resize(std::distance(dit, hi_dit));
495  for (; dit != hi_dit; dit++) {
496  int idx = (*dit)->getPetscGlobalDofIdx();
497  indices[(*dit)->getDofCoeffIdx()] = idx;
498  }
500 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ getNoFieldRowIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNoFieldRowIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get col NoField indices

Definition at line 502 of file ForcesAndSourcesCore.cpp.

503  {
505  if (data.dataOnEntities[MBENTITYSET].size() == 0) {
506  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
507  }
508  CHKERR getNoFieldIndices(field_name,
509  const_cast<FENumeredDofEntity_multiIndex &>(
510  numeredEntFiniteElementPtr->getRowsDofs()),
511  data.dataOnEntities[MBENTITYSET][0].getIndices());
513 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
#define CHKERR
Inline error check.
Definition: definitions.h:578
MoFEMErrorCode getNoFieldIndices(const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
get NoField indices
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getNumberOfNodes()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getNumberOfNodes ( int num_nodes) const

Definition at line 111 of file ForcesAndSourcesCore.cpp.

111  {
113 
115  switch (mField.get_moab().type_from_handle(ent)) {
116  case MBVERTEX:
117  num_nodes = 1;
118  break;
119  case MBEDGE:
120  num_nodes = 2;
121  break;
122  case MBTRI:
123  num_nodes = 3;
124  break;
125  case MBQUAD:
126  num_nodes = 4;
127  break;
128  case MBTET:
129  num_nodes = 4;
130  break;
131  case MBPRISM:
132  num_nodes = 6;
133  break;
134  default:
135  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "not implemented");
136  }
137 
139 }
virtual moab::Interface & get_moab()=0
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getOpPtrVector()

boost::ptr_vector<UserDataOperator>& MoFEM::ForcesAndSourcesCore::getOpPtrVector ( )

Use to push back operator for row operator.

It can be used to calculate nodal forces or other quantities on the mesh.

Examples:
forces_and_sources_testing_edge_element.cpp, and MagneticElement.hpp.

Definition at line 660 of file ForcesAndSourcesCore.hpp.

660 { return opPtrVector; }
boost::ptr_vector< UserDataOperator > opPtrVector
Vector of finite element users data operators.

◆ getProblemNodesColIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getProblemNodesColIndices ( const std::string &  field_name,
VectorInt nodes_indices 
) const

Definition at line 623 of file ForcesAndSourcesCore.cpp.

624  {
625  return getProblemNodesIndices(field_name, *(problemPtr->numeredDofsCols),
626  nodes_indices);
627 }
const Problem * problemPtr
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsCols
store DOFs on columns for this problem
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 ...

◆ getProblemNodesIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::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

Definition at line 530 of file ForcesAndSourcesCore.cpp.

532  {
534  nodes_indices.resize(0);
535  auto &side_table = const_cast<SideNumber_multiIndex &>(
536  numeredEntFiniteElementPtr->getSideNumberTable());
537  auto siit = side_table.get<1>().lower_bound(boost::make_tuple(MBVERTEX, 0));
538  auto hi_siit =
539  side_table.get<1>().lower_bound(boost::make_tuple(MBVERTEX, 10000));
540 
541  int nn = 0;
542  for (; siit != hi_siit; siit++, nn++) {
543 
544  if (siit->get()->side_number == -1)
545  continue;
546 
547  const EntityHandle ent = siit->get()->ent;
548  auto dit =
549  dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().lower_bound(
550  boost::make_tuple(field_name, ent, 0));
551  auto hi_dit =
552  dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().upper_bound(
553  boost::make_tuple(field_name, ent, 10000)); /// very large number
554  if (dit != hi_dit) {
555  if (!nn) {
556  nodes_indices.resize((*dit)->getNbOfCoeffs() *
557  std::distance(siit, hi_siit));
558  }
559  for (; dit != hi_dit; dit++) {
560  nodes_indices[siit->get()->side_number * (*dit)->getNbOfCoeffs() +
561  (*dit)->getDofCoeffIdx()] =
562  (*dit)->getPetscGlobalDofIdx();
563  }
564  }
565  }
566 
568 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getProblemNodesRowIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getProblemNodesRowIndices ( const std::string &  field_name,
VectorInt nodes_indices 
) const

Definition at line 609 of file ForcesAndSourcesCore.cpp.

610  {
611  return getProblemNodesIndices(field_name, *(problemPtr->numeredDofsRows),
612  nodes_indices);
613 }
const Problem * problemPtr
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsRows
store DOFs on rows for this problem
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 ...

◆ getProblemTypeColIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getProblemTypeColIndices ( const std::string &  field_name,
EntityType  type,
int  side_number,
VectorInt indices 
) const

Definition at line 630 of file ForcesAndSourcesCore.cpp.

632  {
633  return getProblemTypeIndices(field_name, *(problemPtr->numeredDofsCols), type,
634  side_number, indices);
635 }
const Problem * problemPtr
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...
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsCols
store DOFs on columns for this problem

◆ getProblemTypeIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::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

Definition at line 570 of file ForcesAndSourcesCore.cpp.

572  {
574 
575  indices.resize(0);
576 
577  auto &side_table = const_cast<SideNumber_multiIndex &>(
578  numeredEntFiniteElementPtr->getSideNumberTable());
579  auto siit =
580  side_table.get<1>().lower_bound(boost::make_tuple(type, side_number));
581  auto hi_siit =
582  side_table.get<1>().upper_bound(boost::make_tuple(type, side_number));
583 
584  for (; siit != hi_siit; siit++) {
585 
586  if (siit->get()->side_number == -1)
587  continue;
588 
589  const EntityHandle ent = siit->get()->ent;
590  NumeredDofEntity_multiIndex::index<
591  Composite_Name_And_Ent_And_EntDofIdx_mi_tag>::type::iterator dit,
592  hi_dit;
593  dit = dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().lower_bound(
594  boost::make_tuple(field_name, ent, 0));
595  hi_dit =
596  dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().upper_bound(
597  boost::make_tuple(field_name, ent, 10000)); /// very large number
598 
599  indices.resize(std::distance(dit, hi_dit));
600  for (; dit != hi_dit; dit++) {
601 
602  indices[(*dit)->getEntDofIdx()] = (*dit)->getPetscGlobalDofIdx();
603  }
604  }
605 
607 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getProblemTypeRowIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getProblemTypeRowIndices ( const std::string &  field_name,
EntityType  type,
int  side_number,
VectorInt indices 
) const

Definition at line 616 of file ForcesAndSourcesCore.cpp.

618  {
619  return getProblemTypeIndices(field_name, *(problemPtr->numeredDofsRows), type,
620  side_number, indices);
621 }
const Problem * problemPtr
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsRows
store DOFs on rows for this problem
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...

◆ getRowNodesIndices()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getRowNodesIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get row node indices from FENumeredDofEntity_multiIndex

Definition at line 378 of file ForcesAndSourcesCore.cpp.

379  {
380  return getNodesIndices(field_name,
381  const_cast<FENumeredDofEntity_multiIndex &>(
382  numeredEntFiniteElementPtr->getRowsDofs()),
383  data.dataOnEntities[MBVERTEX][0].getIndices(),
384  data.dataOnEntities[MBVERTEX][0].getLocalIndices());
385 }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
MoFEMErrorCode getNodesIndices(const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices, VectorInt &local_nodes_indices) const
get node indices

◆ getRule() [1/2]

virtual int MoFEM::ForcesAndSourcesCore::getRule ( int  order)
virtual

set integration rule for finite element

This function is overloaded by the user. The integration rule is set such that specific operator implemented by the user is integrated accurately. For example if user implement bilinear operator

\[ b(u,v) = \int_\mathcal{T} \frac{\partial u_i}{\partial x_j}\frac{\partial v_i}{\partial x_j} \textrm{d}\mathcal{T} \]

then if \(u\) and \(v\) are polynomial of given order, then exact integral would be

int getRule(int order) { return 2*(order-1); };

The integration points and weights are set appropriately for given entity type and integration rule from quad.c

Method ForcesAndSourcesCore::getRule takes at argument takes maximal polynomial order set on the element on all fields defined on the element. If a user likes to have more control, another variant of this function can be called which distinguishing between field orders on rows, columns and data, the i.e. first argument of a bilinear form, the second argument of bilinear form and field coefficients on the element.

Note
If user set rule to -1 or any other negative integer, then method ForcesAndSourcesCore::setGaussPts is called. In that method user can implement own (specific) integration method.
Bug:
this function should be const

Reimplemented in PostProcFaceOnRefinedMesh, BoneRemodeling::DensityMapFe, GelModule::Gel::GelFE, MoFEM::VolumeElementForcesAndSourcesCoreOnSide, SmallStrainPlasticity::MyVolumeFE, PostProcTemplateVolumeOnRefinedMesh< MoFEM::VolumeElementForcesAndSourcesCore >, KelvinVoigtDamper::DamperFE, NitscheMethod::MyVolumeFE, ThermalElement::MyTriFE, MixTransport::MixTransportElement::MyTriFE, MagneticElement::TriFE, NonlinearElasticElement::MyVolumeFE, NeummanForcesSurface::MyTriangleFE, MoFEM::NormElement::MyTriFE, NeummanForcesSurfaceComplexForLazy::MyTriangleSpatialFE, ThermalElement::MyVolumeFE, MixTransport::MixTransportElement::MyVolumeFE, MoFEM::NormElement::MyVolumeFE, OptimalMassTransport::TriFE, MagneticElement::VolumeFE, CellEngineering::FaceElement, BoneRemodeling::Remodeling::Fe, AnalyticalDirichletBC::ApproxField::MyTriFE, AnalyticalDirichletHelmholtzBC::ApproxField::MyTriFE, AnalyticalDirihletBC::ApproxField::MyTriFE, FluidPressure::MyTriangleFE, NitscheMethod::MyFace, OptimalMassTransport::VolumeFE, AnalyticalDirihletBC::ApproxField::MyTriFE, CohesiveElement::CohesiveInterfaceElement::MyPrism, EdgeForce::MyFE, BodyForceConstantField::MyVolumeFE, ThermalStressElement::MyVolumeFE, TestFE, and CellEngineering::DispMapFe.

Definition at line 315 of file ForcesAndSourcesCore.hpp.

315 { return 2 * order; }

◆ getRule() [2/2]

virtual int MoFEM::ForcesAndSourcesCore::getRule ( int  order_row,
int  order_col,
int  order_data 
)
virtual

another variant of getRule

Parameters
order_roworder of base function on row
order_colorder of base function on columns
order_dataorder of base function approximating data
Returns
integration rule
Bug:
this function should be const

Definition at line 338 of file ForcesAndSourcesCore.hpp.

338  {
339  return getRuleHook ? getRuleHook(order_row, order_col, order_data)
340  : getRule(order_data);
341  }
RuleHookFun getRuleHook
Hook to get rule.
virtual int getRule(int order)
set integration rule for finite element

◆ getSense()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getSense ( EntityType  type,
boost::ptr_vector< DataForcesAndSourcesCore::EntData > &  data 
) const

get sense (orientation) of entity

Parameters
typetype of entity
dataentity data
Returns
error code

Definition at line 143 of file ForcesAndSourcesCore.cpp.

145  {
147  auto &side_table = const_cast<SideNumber_multiIndex &>(
148  numeredEntFiniteElementPtr->getSideNumberTable());
149  if (data.size() < side_table.get<2>().count(type)) {
150  // prims has 9 edges, some of edges for "flat" prism are not active
151  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
152  "data inconsistency %u < %u", data.size(),
153  side_table.get<2>().count(type));
154  }
155  auto siit = side_table.get<2>().lower_bound(type);
156  auto hi_siit = side_table.get<2>().upper_bound(type);
157  for (; siit != hi_siit; siit++) {
158  data[siit->get()->side_number].getSense() = siit->get()->sense;
159  if (siit->get()->brother_side_number != -1) {
160  if (data.size() < (unsigned)siit->get()->brother_side_number) {
161  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
162  "data inconsistency");
163  }
164  data[siit->get()->brother_side_number].getSense() = siit->get()->sense;
165  }
166  }
168 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getSpacesAndBaseOnEntities()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getSpacesAndBaseOnEntities ( DataForcesAndSourcesCore data) const

Get field approximation space and base on entities.

Definition at line 935 of file ForcesAndSourcesCore.cpp.

936  {
938  if (nInTheLoop == 0) {
939  data.sPace.reset();
940  data.bAse.reset();
941  for (EntityType t = MBVERTEX; t != MBMAXTYPE; ++t) {
942  data.spacesOnEntities[t].reset();
943  data.basesOnEntities[t].reset();
944  }
945  for (int s = 0; s != LASTSPACE; ++s) {
946  data.basesOnSpaces[s].reset();
947  }
948  }
949  for (_IT_GET_FEDATA_DOFS_FOR_LOOP_(this, dof)) {
950  if (dof->get()->getEntDofIdx() != 0)
951  continue;
952  const EntityType type = dof->get()->getEntType();
953  const FieldSpace space = dof->get()->getSpace();
954  const FieldApproximationBase approx = dof->get()->getApproxBase();
955  data.sPace.set(space);
956  data.bAse.set(approx);
957  data.spacesOnEntities[type].set(space);
958  data.basesOnEntities[type].set(approx);
959  data.basesOnSpaces[space].set(approx);
960  }
962 }
#define _IT_GET_FEDATA_DOFS_FOR_LOOP_(FE, IT)
loop over all dofs which are on a particular FE data
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:172
FieldApproximationBase
approximation base
Definition: definitions.h:140
FieldSpace
approximation spaces
Definition: definitions.h:165

◆ getTypeFieldData() [1/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getTypeFieldData ( const boost::string_ref  field_name,
FEDofEntity_multiIndex dofs,
EntityType  type,
int  side_number,
VectorDouble ent_field_data,
VectorDofs ent_field_dofs 
) const

Get field data on entities.

Parameters
field_nameField name
dofsDofs (element) multi index
typeEntity type
side_numberSide number (Local number of entity on element in canonical order)
ent_field_dataVector of DOFs values on entities
ent_field_dofsVector of pointers to DOFs data structure
Returns
Error code

Definition at line 711 of file ForcesAndSourcesCore.cpp.

714  {
715  //
717  auto dit = dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().lower_bound(
718  boost::make_tuple(field_name, type, side_number));
719  if (dit == dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().end()) {
720  ent_field_data.resize(0, false);
721  ent_field_dofs.resize(0, false);
723  }
724  auto hi_dit =
725  dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().upper_bound(
726  boost::make_tuple(field_name, type, side_number));
727  if (dit != hi_dit) {
728  ent_field_data.resize((*dit)->getNbDofsOnEnt(), false);
729  ent_field_dofs.resize((*dit)->getNbDofsOnEnt(), false);
730  for (; dit != hi_dit; dit++) {
731  const FieldData val = (*dit)->getFieldData();
732  const int idx = (*dit)->getEntDofIdx();
733  ent_field_data[idx] = val;
734  ent_field_dofs[idx] = *dit;
735  }
736  } else {
737  ent_field_data.resize(0, false);
738  ent_field_dofs.resize(0, false);
739  }
741 }
double FieldData
Field data type.
Definition: Common.hpp:130
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ getTypeFieldData() [2/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getTypeFieldData ( const boost::string_ref  field_name,
FEDofEntity_multiIndex dofs,
EntityType  type,
boost::ptr_vector< DataForcesAndSourcesCore::EntData > &  data 
) const

Definition at line 743 of file ForcesAndSourcesCore.cpp.

746  {
748  auto &side_table = const_cast<SideNumber_multiIndex &>(
749  numeredEntFiniteElementPtr->getSideNumberTable());
750  // if(data.size() < side_table.get<2>().count(type)) {
751  // SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
752  // }
753  auto siit = side_table.get<2>().lower_bound(type);
754  auto hi_siit = side_table.get<2>().upper_bound(type);
755  auto tuple = boost::make_tuple(field_name, type);
756  auto dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(tuple);
757  if (dit == dofs.get<Composite_Name_And_Type_mi_tag>().end()) {
758  for (auto siiit = siit; siiit != hi_siit; siiit++) {
759  const int side_number = siiit->get()->side_number;
760  data[side_number].getFieldData().resize(0, false);
761  data[side_number].getFieldDofs().resize(0, false);
762  }
764  }
765  for (auto siiit = siit; siiit != hi_siit; siiit++) {
766  const int side_number = siiit->get()->side_number;
767  data[side_number].semaphore = false;
768  }
769  auto hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(tuple);
770  for (; dit != hi_dit; dit++) {
771  const int side = dit->get()->sideNumberPtr->side_number;
772  const int nb_dofs_on_ent = (*dit)->getNbDofsOnEnt();
773  auto &ent_field_data = data[side].getFieldData();
774  auto &ent_field_dofs = data[side].getFieldDofs();
775  if (!data[side].semaphore) {
776  data[side].semaphore = true;
777  ent_field_data.resize(nb_dofs_on_ent, false);
778  ent_field_dofs.resize(nb_dofs_on_ent, false);
779  }
780  if (!nb_dofs_on_ent) {
781  continue;
782  }
783  const int idx = dit->get()->getEntDofIdx();
784  ent_field_data[idx] = dit->get()->getFieldData();
785  ent_field_dofs[idx] = *dit;
786  }
787  for (; siit != hi_siit; siit++) {
788  const int side_number = siit->get()->side_number;
789  if (!data[side_number].semaphore) {
790  data[side_number].getFieldData().resize(0, false);
791  data[side_number].getFieldDofs().resize(0, false);
792  }
793  if (siit->get()->brother_side_number != -1) {
794  if (data.size() < (unsigned int)siit->get()->brother_side_number) {
795  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
796  "data inconsistency");
797  }
799  field_name, dofs, type, side_number,
800  data[siit->get()->brother_side_number].getFieldData(),
801  data[siit->get()->brother_side_number].getFieldDofs());
802  }
803  }
805 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
MoFEMErrorCode getTypeFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
Get field data on entities.
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getTypeIndices() [1/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getTypeIndices ( const boost::string_ref  field_name,
FENumeredDofEntity_multiIndex dofs,
EntityType  type,
int  side_number,
VectorInt indices,
VectorInt local_indices 
) const

get indices by type (generic function)

Definition at line 397 of file ForcesAndSourcesCore.cpp.

400  {
401  //
403  auto dit = dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().lower_bound(
404  boost::make_tuple(field_name, type, side_number));
405  if (dit == dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().end()) {
406  indices.resize(0);
407  local_indices.resize(0);
409  }
410  auto hi_dit =
411  dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().upper_bound(
412  boost::make_tuple(field_name, type, side_number));
413  if (dit != hi_dit) {
414  indices.resize((*dit)->getNbDofsOnEnt(), false);
415  local_indices.resize((*dit)->getNbDofsOnEnt(), false);
416  for (; dit != hi_dit; dit++) {
417  int idx = (*dit)->getPetscGlobalDofIdx();
418  int elem_idx = (*dit)->getEntDofIdx();
419  indices[elem_idx] = idx;
420  int local_idx = (*dit)->getPetscLocalDofIdx();
421  local_indices[elem_idx] = local_idx;
422  }
423  } else {
424  indices.resize(0);
425  local_indices.resize(0);
426  }
428 }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ getTypeIndices() [2/2]

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::getTypeIndices ( const boost::string_ref  field_name,
FENumeredDofEntity_multiIndex dofs,
EntityType  type,
boost::ptr_vector< DataForcesAndSourcesCore::EntData > &  data 
) const

get indices by type (generic function)

Definition at line 430 of file ForcesAndSourcesCore.cpp.

433  {
435  SideNumber_multiIndex &side_table = const_cast<SideNumber_multiIndex &>(
436  numeredEntFiniteElementPtr->getSideNumberTable());
437  auto siit = side_table.get<2>().lower_bound(type);
438  auto hi_siit = side_table.get<2>().upper_bound(type);
439  const auto tuple = boost::make_tuple(field_name, type);
440  auto dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(tuple);
441  if (dit == dofs.get<Composite_Name_And_Type_mi_tag>().end()) {
442  for (SideNumber_multiIndex::nth_index<2>::type::iterator siiit = siit;
443  siiit != hi_siit; siiit++) {
444  data[siiit->get()->side_number].getIndices().resize(0, false);
445  data[siiit->get()->side_number].getLocalIndices().resize(0, false);
446  }
448  }
449  for (auto siiit = siit; siiit != hi_siit; siiit++) {
450  const int side_number = siiit->get()->side_number;
451  data[side_number].semaphore = false;
452  }
453  auto hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(tuple);
454  for (; dit != hi_dit; dit++) {
455  const int side = dit->get()->sideNumberPtr->side_number;
456  const int nb_dofs_on_ent = dit->get()->getNbDofsOnEnt();
457  VectorInt &indices = data[side].getIndices();
458  VectorInt &local_indices = data[side].getLocalIndices();
459  if (!data[side].semaphore) {
460  data[side].semaphore = true;
461  indices.resize(nb_dofs_on_ent, false);
462  local_indices.resize(nb_dofs_on_ent, false);
463  }
464  if (!nb_dofs_on_ent) {
465  continue;
466  }
467  const int idx = dit->get()->getEntDofIdx();
468  indices[idx] = dit->get()->getPetscGlobalDofIdx();
469  local_indices[idx] = dit->get()->getPetscLocalDofIdx();
470  }
471  for (; siit != hi_siit; siit++) {
472  const int side_number = siit->get()->side_number;
473  if (!data[side_number].semaphore) {
474  data[side_number].getIndices().resize(0, false);
475  data[side_number].getLocalIndices().resize(0, false);
476  }
477  if (siit->get()->brother_side_number != -1) {
479  field_name, dofs, type, side_number,
480  data[siit->get()->brother_side_number].getIndices(),
481  data[siit->get()->brother_side_number].getLocalIndices());
482  }
483  }
485 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
multi_index_container< boost::shared_ptr< SideNumber >, indexed_by< hashed_unique< member< SideNumber, EntityHandle, &SideNumber::ent > >, ordered_non_unique< composite_key< SideNumber, const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType >, member< SideNumber, char, &SideNumber::side_number > > >, ordered_non_unique< const_mem_fun< SideNumber, EntityType, &SideNumber::getEntType > > > > SideNumber_multiIndex
SideNumber_multiIndex for SideNumber.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
ublas::vector< int, IntAllocator > VectorInt
Definition: Common.hpp:210
MoFEMErrorCode getTypeIndices(const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, EntityType type, int side_number, VectorInt &indices, VectorInt &local_indices) const
get indices by type (generic function)
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403

◆ getUserPolynomialBase()

auto& MoFEM::ForcesAndSourcesCore::getUserPolynomialBase ( )

Get the User Polynomial Base object.

Returns
boost::shared_ptr<BaseFunction>&

Definition at line 674 of file ForcesAndSourcesCore.hpp.

674 { return userPolynomialBasePtr; }
boost::shared_ptr< BaseFunction > userPolynomialBasePtr
Pointer to user polynomail base.

◆ loopOverOperators()

MoFEMErrorCode MoFEM::ForcesAndSourcesCore::loopOverOperators ( )

Iterate user data operators.

Returns
MoFEMErrorCode

Definition at line 1077 of file ForcesAndSourcesCore.cpp.

1077  {
1079 
1080  const EntityType type = numeredEntFiniteElementPtr->getEntType();
1081  const int dim = mField.get_moab().dimension_from_handle(
1082  numeredEntFiniteElementPtr->getEnt());
1085  std::vector<std::string> last_eval_field_name(2);
1086  DataForcesAndSourcesCore *op_data[2];
1087  FieldSpace space[2];
1088 
1089  boost::ptr_vector<UserDataOperator>::iterator oit, hi_oit;
1090  oit = opPtrVector.begin();
1091  hi_oit = opPtrVector.end();
1092 
1093  for (; oit != hi_oit; oit++) {
1094 
1095  oit->setPtrFE(this);
1096 
1097  if (oit->opType == UserDataOperator::OPLAST) {
1098 
1099  // Set field
1100  switch (oit->sPace) {
1101  case NOSPACE:
1102  SETERRQ(mField.get_comm(), MOFEM_DATA_INCONSISTENCY, "unknown space");
1103  case NOFIELD:
1104  case H1:
1105  case HCURL:
1106  case HDIV:
1107  case L2:
1108  op_data[0] = dataOnElement[oit->sPace].get();
1109  break;
1110  default:
1111  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1112  "Not implemented for this space", oit->sPace);
1113  }
1114 
1115  // Reseat all data which all field dependent
1116  op_data[0]->resetFieldDependentData();
1117  last_eval_field_name[0] = "";
1118  last_eval_field_name[1] = "";
1119 
1120  // Run operator
1121  try {
1122  CHKERR oit->opRhs(*op_data[0], oit->doVertices, oit->doEdges,
1123  oit->doQuads, oit->doTris, oit->doTets, false);
1124  }
1125  CATCH_OP_ERRORS(*oit);
1126 
1127  } else {
1128 
1129  for (int ss = 0; ss != 2; ss++) {
1130 
1131  std::string field_name = !ss ? oit->rowFieldName : oit->colFieldName;
1132  const Field *field_struture = mField.get_field_structure(field_name);
1133  BitFieldId data_id = field_struture->getId();
1134 
1135  if ((oit->getNumeredEntFiniteElementPtr()->getBitFieldIdData() &
1136  data_id)
1137  .none()) {
1139  "no data field < %s > on finite element < %s >",
1140  field_name.c_str(), feName.c_str());
1141  }
1142 
1143  if (oit->getOpType() & types[ss] ||
1144  oit->getOpType() & UserDataOperator::OPROWCOL) {
1145 
1146  space[ss] = field_struture->getSpace();
1147  switch (space[ss]) {
1148  case NOSPACE:
1150  "unknown space");
1151  break;
1152  case NOFIELD:
1153  case H1:
1154  case HCURL:
1155  case HDIV:
1156  case L2:
1157  op_data[ss] = !ss ? dataOnElement[space[ss]].get()
1158  : derivedDataOnElement[space[ss]].get();
1159  break;
1160  default:
1161  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1162  "Not implemented for this space", space[ss]);
1163  }
1164 
1165  if (last_eval_field_name[ss] != field_name) {
1166 
1167  switch (space[ss]) {
1168  case NOSPACE:
1170  "unknown space");
1171  break;
1172  case H1:
1173  if (!ss) {
1174  CHKERR getRowNodesIndices(*op_data[ss], field_name);
1175  } else {
1176  CHKERR getColNodesIndices(*op_data[ss], field_name);
1177  }
1178  CHKERR getNodesFieldData(*op_data[ss], field_name);
1179  if (dim == 0)
1180  break;
1181  case HCURL:
1182  if (!ss) {
1183  CHKERR getEntityRowIndices<MBEDGE>(*op_data[ss], field_name);
1184  } else {
1185  CHKERR getEntityColIndices<MBEDGE>(*op_data[ss], field_name);
1186  }
1187  CHKERR getEntityDataOrderSpaceAndBase<MBEDGE>(*op_data[ss],
1188  field_name);
1189  CHKERR getEntityFieldData<MBEDGE>(*op_data[ss], field_name);
1190  if (dim == 1)
1191  break;
1192  case HDIV:
1193  if (!ss) {
1194  CHKERR getEntityRowIndices<MBTRI>(*op_data[ss], field_name);
1195  CHKERR getEntityRowIndices<MBQUAD>(*op_data[ss], field_name);
1196  } else {
1197  CHKERR getEntityColIndices<MBTRI>(*op_data[ss], field_name);
1198  CHKERR getEntityColIndices<MBQUAD>(*op_data[ss], field_name);
1199  }
1200  CHKERR getEntityDataOrderSpaceAndBase<MBTRI>(*op_data[ss],
1201  field_name);
1202  CHKERR getEntityFieldData<MBTRI>(*op_data[ss], field_name);
1203  CHKERR getEntityDataOrderSpaceAndBase<MBQUAD>(*op_data[ss],
1204  field_name);
1205  CHKERR getEntityFieldData<MBQUAD>(*op_data[ss], field_name);
1206  if (dim == 2)
1207  break;
1208  case L2:
1209  switch (type) {
1210  case MBPRISM:
1211  if (!ss) {
1212  CHKERR getEntityRowIndices<MBPRISM>(*op_data[ss], field_name);
1213  } else {
1214  CHKERR getEntityColIndices<MBPRISM>(*op_data[ss], field_name);
1215  }
1216  CHKERR getEntityDataOrderSpaceAndBase<MBPRISM>(*op_data[ss],
1217  field_name);
1218  CHKERR getEntityFieldData<MBPRISM>(*op_data[ss], field_name);
1219  break;
1220  case MBTET:
1221  if (!ss) {
1222  CHKERR getEntityRowIndices<MBTET>(*op_data[ss], field_name);
1223  } else {
1224  CHKERR getEntityColIndices<MBTET>(*op_data[ss], field_name);
1225  }
1226  CHKERR getEntityDataOrderSpaceAndBase<MBTET>(*op_data[ss],
1227  field_name);
1228  CHKERR getEntityFieldData<MBTET>(*op_data[ss], field_name);
1229  break;
1230  case MBTRI:
1231  if (!ss) {
1232  CHKERR getEntityRowIndices<MBTRI>(*op_data[ss], field_name);
1233  } else {
1234  CHKERR getEntityColIndices<MBTRI>(*op_data[ss], field_name);
1235  }
1236  CHKERR getEntityDataOrderSpaceAndBase<MBTRI>(*op_data[ss],
1237  field_name);
1238  CHKERR getEntityFieldData<MBTRI>(*op_data[ss], field_name);
1239  break;
1240  case MBEDGE:
1241  if (!ss) {
1242  CHKERR getEntityRowIndices<MBEDGE>(*op_data[ss], field_name);
1243  } else {
1244  CHKERR getEntityColIndices<MBEDGE>(*op_data[ss], field_name);
1245  }
1246  CHKERR getEntityDataOrderSpaceAndBase<MBEDGE>(*op_data[ss],
1247  field_name);
1248  CHKERR getEntityFieldData<MBEDGE>(*op_data[ss], field_name);
1249  break;
1250  case MBVERTEX:
1251  if (!ss) {
1252  CHKERR getRowNodesIndices(*op_data[ss], field_name);
1253  } else {
1254  CHKERR getColNodesIndices(*op_data[ss], field_name);
1255  }
1256  CHKERR getNodesFieldData(*op_data[ss], field_name);
1257  break;
1258  default:
1260  "not implemented");
1261  break;
1262  }
1263  break;
1264  case NOFIELD:
1265  if (!getNinTheLoop()) {
1266  // NOFIELD data are the same for each element, can be
1267  // retrieved only once
1268  if (!ss) {
1269  CHKERR getNoFieldRowIndices(*op_data[ss], field_name);
1270  } else {
1271  CHKERR getNoFieldColIndices(*op_data[ss], field_name);
1272  }
1273  CHKERR getNoFieldFieldData(*op_data[ss], field_name);
1274  }
1275  break;
1276  default:
1277  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
1278  "Not implemented for this space", space[ss]);
1279  }
1280  last_eval_field_name[ss] = field_name;
1281  }
1282  }
1283  }
1284 
1285  if (oit->getOpType() & UserDataOperator::OPROW) {
1286  try {
1287  CHKERR oit->opRhs(*op_data[0], false);
1288  }
1289  CATCH_OP_ERRORS(*oit);
1290  }
1291 
1292  if (oit->getOpType() & UserDataOperator::OPCOL) {
1293  try {
1294  CHKERR oit->opRhs(*op_data[1], false);
1295  }
1296  CATCH_OP_ERRORS(*oit);
1297  }
1298 
1299  if (oit->getOpType() & UserDataOperator::OPROWCOL) {
1300  try {
1301  CHKERR oit->opLhs(*op_data[0], *op_data[1], oit->sYmm);
1302  }
1303  CATCH_OP_ERRORS(*oit);
1304  }
1305  }
1306  }
1308 }
boost::ptr_vector< UserDataOperator > opPtrVector
Vector of finite element users data operators.
field with continuous normal traction
Definition: definitions.h:170
MoFEMErrorCode getNoFieldColIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get col NoField indices
virtual moab::Interface & get_moab()=0
MoFEMErrorCode getColNodesIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get col node indices from FENumeredDofEntity_multiIndex
const boost::shared_ptr< DataForcesAndSourcesCore > derivedDataOnElement[LASTSPACE]
Entity data on element entity columns fields.
scalar or vector of scalars describe (no true field)
Definition: definitions.h:167
MoFEMErrorCode getNodesFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &nodes_data, VectorDofs &nodes_dofs, FieldSpace &space, FieldApproximationBase &base) const
Get field data on nodes.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
const boost::shared_ptr< DataForcesAndSourcesCore > dataOnElement[LASTSPACE]
Entity data on element entity rows fields.
std::string feName
std::bitset< BITFIELDID_SIZE > BitFieldId
Definition: Common.hpp:149
int getNinTheLoop() const
get number of evaluated element in the loop
MoFEMErrorCode getNoFieldRowIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get col NoField indices
OpType
Controls loop over entities on element.
MoFEMErrorCode getNoFieldFieldData(const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
#define CATCH_OP_ERRORS(OP)
field with continuous tangents
Definition: definitions.h:169
FieldSpace
approximation spaces
Definition: definitions.h:165
#define CHKERR
Inline error check.
Definition: definitions.h:578
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
virtual MPI_Comm & get_comm() const =0
continuous field
Definition: definitions.h:168
virtual const Field * get_field_structure(const std::string &name)=0
get field structure
MoFEMErrorCode getRowNodesIndices(DataForcesAndSourcesCore &data, const std::string &field_name) const
get row node indices from FENumeredDofEntity_multiIndex
field with C-1 continuity
Definition: definitions.h:171

◆ operator()()

virtual MoFEMErrorCode MoFEM::ForcesAndSourcesCore::operator() ( )
virtual

function is run for every finite element

It is used to calculate element local matrices and assembly. It can be used for post-processing.

Reimplemented from MoFEM::BasicMethod.

Reimplemented in MoFEM::FaceElementForcesAndSourcesCore, MoFEM::VolumeElementForcesAndSourcesCore, MoFEM::FatPrismElementForcesAndSourcesCore, MoFEM::FlatPrismElementForcesAndSourcesCore, MoFEM::EdgeElementForcesAndSourcesCore, NeummanForcesSurfaceComplexForLazy::MyTriangleSpatialFE, and MoFEM::VertexElementForcesAndSourcesCore.

Definition at line 696 of file ForcesAndSourcesCore.hpp.

696  {
698  if (operatorHook) {
699  ierr = operatorHook();
700  CHKERRG(ierr);
701  }
703  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
boost::function< MoFEMErrorCode()> operatorHook

◆ postProcess()

virtual MoFEMErrorCode MoFEM::ForcesAndSourcesCore::postProcess ( )
virtual

function is run at the end of loop

It is used to assembly matrices and vectors, calculating global variables, f.e. total internal energy, ect.

Iterating over dofs: Example1 iterating over dofs in row by name of the field for(IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP(this,"DISPLACEMENT",it)) { ... }

Reimplemented from MoFEM::BasicMethod.

Reimplemented in PostProcFaceOnRefinedMesh, PostProcFatPrismOnRefinedMesh, SolidShellModule::SolidShellPrismElement::PostProcFatPrismOnTriangleOnRefinedMesh, PostProcTemplateVolumeOnRefinedMesh< MoFEM::VolumeElementForcesAndSourcesCore >, GelModule::Gel::GelFE, MoFEM::FatPrismElementForcesAndSourcesCore, KelvinVoigtDamper::DamperFE, SolidShellModule::SolidShellPrismElement::SolidShellError, SolidShellModule::SolidShellPrismElement::SolidShell, Smoother::MyVolumeFE, and NonlinearElasticElement::MyVolumeFE.

Definition at line 704 of file ForcesAndSourcesCore.hpp.

704  {
706  if (postProcessHook) {
707  ierr = postProcessHook();
708  CHKERRG(ierr);
709  }
711  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
boost::function< MoFEMErrorCode()> postProcessHook
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80

◆ preProcess()

virtual MoFEMErrorCode MoFEM::ForcesAndSourcesCore::preProcess ( )
virtual

function is run at the beginning of loop

It is used to zeroing matrices and vectors, calculation of shape functions on reference element, preprocessing boundary conditions, etc.

Reimplemented from MoFEM::BasicMethod.

Reimplemented in PostProcFaceOnRefinedMesh, PostProcFatPrismOnRefinedMesh, PostProcTemplateVolumeOnRefinedMesh< MoFEM::VolumeElementForcesAndSourcesCore >, GelModule::Gel::GelFE, MoFEM::FatPrismElementForcesAndSourcesCore, KelvinVoigtDamper::DamperFE, SolidShellModule::SolidShellPrismElement::SolidShellError, SolidShellModule::SolidShellPrismElement::SolidShell, NeummanForcesSurfaceComplexForLazy::MyTriangleSpatialFE, Smoother::MyVolumeFE, NonlinearElasticElement::MyVolumeFE, and FluidPressure::MyTriangleFE.

Definition at line 688 of file ForcesAndSourcesCore.hpp.

688  {
690  if (preProcessHook) {
691  ierr = preProcessHook();
692  CHKERRG(ierr);
693  }
695  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
boost::function< MoFEMErrorCode()> preProcessHook

◆ setGaussPts() [1/2]

virtual MoFEMErrorCode MoFEM::ForcesAndSourcesCore::setGaussPts ( int  order)
virtual

It will be removed in the future use other variant.

Reimplemented in PostProcFaceOnRefinedMesh, PostProcTemplateVolumeOnRefinedMesh< MoFEM::VolumeElementForcesAndSourcesCore >, MoFEM::VolumeElementForcesAndSourcesCoreOnSide, and NitscheMethod::MyVolumeFE.

Definition at line 345 of file ForcesAndSourcesCore.hpp.

345  {
347  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "sorry, not implemented");
349  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490

◆ setGaussPts() [2/2]

virtual MoFEMErrorCode MoFEM::ForcesAndSourcesCore::setGaussPts ( int  order_row,
int  order_col,
int  order_data 
)
virtual

set user specific integration rule

This function allows for user defined integration rule. The key is to called matrix gaussPts, which is used by other MoFEM procedures. Matrix has number of rows equal to problem dimension plus one, where last index is used to store weight values. Number of columns is equal to number of integration points.

Note
This function is called if method ForcesAndSourcesCore::getRule is returning integer -1 or any other negative integer.

User sets

where

gaussPts.resize(dim+1,nb_gauss_pts);

number rows represents local coordinates of integration points in reference element, where last index in row is for integration weight.

Definition at line 374 of file ForcesAndSourcesCore.hpp.

375  {
376 
378  ierr = setGaussPts(order_data);
379  CHKERRG(ierr);
381  }
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
virtual MoFEMErrorCode setGaussPts(int order)
It will be removed in the future use other variant.

Member Data Documentation

◆ dataH1

DataForcesAndSourcesCore& MoFEM::ForcesAndSourcesCore::dataH1

Definition at line 57 of file ForcesAndSourcesCore.hpp.

◆ dataHcurl

DataForcesAndSourcesCore& MoFEM::ForcesAndSourcesCore::dataHcurl

Definition at line 58 of file ForcesAndSourcesCore.hpp.

◆ dataHdiv

DataForcesAndSourcesCore& MoFEM::ForcesAndSourcesCore::dataHdiv

Definition at line 59 of file ForcesAndSourcesCore.hpp.

◆ dataL2

DataForcesAndSourcesCore& MoFEM::ForcesAndSourcesCore::dataL2

Definition at line 60 of file ForcesAndSourcesCore.hpp.

◆ dataNoField

DataForcesAndSourcesCore& MoFEM::ForcesAndSourcesCore::dataNoField

Definition at line 56 of file ForcesAndSourcesCore.hpp.

◆ dataOnElement

const boost::shared_ptr<DataForcesAndSourcesCore> MoFEM::ForcesAndSourcesCore::dataOnElement[LASTSPACE]

Entity data on element entity rows fields.

FIXME: that should be moved to private class data and acessed only by member function

Definition at line 45 of file ForcesAndSourcesCore.hpp.

◆ derivedDataOnElement

const boost::shared_ptr<DataForcesAndSourcesCore> MoFEM::ForcesAndSourcesCore::derivedDataOnElement[LASTSPACE]

Entity data on element entity columns fields.

FIXME: that should be moved to private class data and acessed only by member function

Definition at line 54 of file ForcesAndSourcesCore.hpp.

◆ elementPolynomialBasePtr

boost::shared_ptr<BaseFunction> MoFEM::ForcesAndSourcesCore::elementPolynomialBasePtr
private

Pointer to entity polynomial base.

Definition at line 751 of file ForcesAndSourcesCore.hpp.

◆ gaussPts

MatrixDouble MoFEM::ForcesAndSourcesCore::gaussPts

Matrix of integration points.

Columns is equal to number of integration points, numver of rows depends on dimension of finite element entity, for example for tetrahedron rows are x,y,z,weight. Last row is integration weight.

FIXME: that should be moved to private class data and acessed only by member function

Definition at line 686 of file ForcesAndSourcesCore.hpp.

◆ getRuleHook

RuleHookFun MoFEM::ForcesAndSourcesCore::getRuleHook

Hook to get rule.

Todo:
check preferred format how works with gcc and clang, see http://www.boost.org/doc/libs/1_64_0/doc/html/function/tutorial.html#idp247873024

Definition at line 327 of file ForcesAndSourcesCore.hpp.

◆ lastEvaluatedElementEntityType

EntityType MoFEM::ForcesAndSourcesCore::lastEvaluatedElementEntityType
private

Last evaluated type of element entity.

Definition at line 745 of file ForcesAndSourcesCore.hpp.

◆ mField

Interface& MoFEM::ForcesAndSourcesCore::mField

Definition at line 36 of file ForcesAndSourcesCore.hpp.

◆ opPtrVector

boost::ptr_vector<UserDataOperator> MoFEM::ForcesAndSourcesCore::opPtrVector

Vector of finite element users data operators.

FIXME: that should be moved to private class data and acessed only by member function

Definition at line 653 of file ForcesAndSourcesCore.hpp.

◆ userPolynomialBasePtr

boost::shared_ptr<BaseFunction> MoFEM::ForcesAndSourcesCore::userPolynomialBasePtr
private

Pointer to user polynomail base.

Definition at line 756 of file ForcesAndSourcesCore.hpp.


The documentation for this struct was generated from the following files: