v0.5.86
Classes | Public Types | Public Member Functions | Public 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 (MoFEM::Interface &m_field)
 
virtual ~ForcesAndSourcesCore ()
 
PetscErrorCode 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...
 
PetscErrorCode getSense (EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 get sense (orientation) of entity More...
 
PetscErrorCode getDataOrder (const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 get maximal approximation order of approximation on the entity More...
 
PetscErrorCode getDataOrderSpaceAndBase (const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 get maximal approximation order on entity More...
 
PetscErrorCode getEdgesSense (DataForcesAndSourcesCore &data) const
 
PetscErrorCode getTrisSense (DataForcesAndSourcesCore &data) const
 
PetscErrorCode getQuadSense (DataForcesAndSourcesCore &data) const
 
PetscErrorCode getEdgesDataOrder (DataForcesAndSourcesCore &data, const FieldSpace space) const
 
PetscErrorCode getTrisDataOrder (DataForcesAndSourcesCore &data, const FieldSpace space) const
 
PetscErrorCode getQuadDataOrder (DataForcesAndSourcesCore &data, const FieldSpace space) const
 
PetscErrorCode getTetDataOrder (DataForcesAndSourcesCore &data, const FieldSpace space) const
 
PetscErrorCode getPrismDataOrder (DataForcesAndSourcesCore &data, const FieldSpace space) const
 
PetscErrorCode getEdgesDataOrderSpaceAndBase (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getTrisDataOrderSpaceAndBase (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getQuadDataOrderSpaceAndBase (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getTetDataOrderSpaceAndBase (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getPrismDataOrderSpaceAndBase (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getNodesIndices (const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices, VectorInt &local_nodes_indices) const
 get node indices More...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode getRowNodesIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get row node indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getColNodesIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get col node indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getEdgesRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Edges row indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getEdgesColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Edges col indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getTrisRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Tris row indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getTrisColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Tris col indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getTetsRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Tets row indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getTetsColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Tets col indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getQuadRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Quad row indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getQuadColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Quad col indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getPrismRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Prism row indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getPrismColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get Prism col indices from FENumeredDofEntity_multiIndex More...
 
PetscErrorCode getNoFieldIndices (const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
 get NoField indices More...
 
PetscErrorCode getNoFieldRowIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get col NoField indices More...
 
PetscErrorCode getNoFieldColIndices (DataForcesAndSourcesCore &data, const std::string &field_name) const
 get col NoField indices More...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode getTypeFieldData (const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
 
PetscErrorCode getNoFieldFieldData (const boost::string_ref field_name, FEDofEntity_multiIndex &dofs, VectorDouble &ent_field_data, VectorDofs &ent_field_dofs) const
 
PetscErrorCode getNoFieldFieldData (DataForcesAndSourcesCore &data, const boost::string_ref field_name) const
 
PetscErrorCode getNodesFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 Get data on nodes. More...
 
PetscErrorCode getEdgesFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getTrisFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getQuadFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getTetsFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getPrismFieldData (DataForcesAndSourcesCore &data, const std::string &field_name) const
 
PetscErrorCode getFaceTriNodes (DataForcesAndSourcesCore &data) const
 Get nodes on triangles. More...
 
PetscErrorCode getSpacesAndBaseOnEntities (DataForcesAndSourcesCore &data) const
 Get field approximation space and base on entities. More...
 
PetscErrorCode 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...
 
PetscErrorCode 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...
 
PetscErrorCode getProblemNodesRowIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
PetscErrorCode getProblemTypeRowIndices (const std::string &field_name, EntityType type, int side_number, VectorInt &indices) const
 
PetscErrorCode getProblemNodesColIndices (const std::string &field_name, VectorInt &nodes_indices) const
 
PetscErrorCode 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 PetscErrorCode setGaussPts (int order)
 It will be removed in the future use other variant. More...
 
virtual PetscErrorCode 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...
 
virtual PetscErrorCode preProcess ()
 function is run at the beginning of loop More...
 
virtual PetscErrorCode operator() ()
 function is run for every finite element More...
 
virtual PetscErrorCode postProcess ()
 function is run at the end of loop More...
 
- Public Member Functions inherited from MoFEM::FEMethod
PetscErrorCode queryInterface (const MOFEMuuid &uuid, UnknownInterface **iface)
 
 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...
 
PetscErrorCode copyBasicMethod (const BasicMethod &basic)
 
- Public Member Functions inherited from MoFEM::KspMethod
 KspMethod ()
 
virtual ~KspMethod ()
 
PetscErrorCode setKspCtx (const KSPContext &ctx)
 set operator type More...
 
PetscErrorCode setKsp (KSP ksp)
 set solver More...
 
PetscErrorCode copyKsp (const KspMethod &ksp)
 copy data form another method More...
 
- Public Member Functions inherited from MoFEM::UnknownInterface
virtual ~UnknownInterface ()
 
virtual PetscErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const PetscErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual PetscErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
- Public Member Functions inherited from MoFEM::SnesMethod
 SnesMethod ()
 
virtual ~SnesMethod ()
 
PetscErrorCode setSnesCtx (const SNESContext &ctx)
 Set SNES context. More...
 
PetscErrorCode setSnes (SNES snes)
 Set SNES instance. More...
 
PetscErrorCode copySnes (const SnesMethod &snes)
 Copy snes data. More...
 
DEPRECATED PetscErrorCode set_snes (SNES snes)
 
DEPRECATED PetscErrorCode set_snes_ctx (const SNESContext &ctx)
 
DEPRECATED PetscErrorCode copy_snes (const SnesMethod &snes)
 
- Public Member Functions inherited from MoFEM::TSMethod
 TSMethod ()
 
virtual ~TSMethod ()
 
PetscErrorCode setTsCtx (const TSContext &ctx)
 Set Ts context. More...
 
PetscErrorCode copyTs (const TSMethod &ts)
 Copy TS solver data. More...
 
PetscErrorCode setTs (TS _ts)
 Set TS solver. More...
 
DEPRECATED PetscErrorCode set_ts_ctx (const TSContext &ctx)
 
DEPRECATED PetscErrorCode copy_ts (const TSMethod &ts)
 
DEPRECATED PetscErrorCode set_ts (TS _ts)
 

Public Attributes

InterfacemField
 
RuleHookFun getRuleHook
 Hook to get rule. More...
 
boost::ptr_vector< UserDataOperatoropPtrVector
 
- 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< PetscErrorCode()> preProcessHook
 
boost::function< PetscErrorCode()> postProcessHook
 
boost::function< PetscErrorCode()> 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
 

Detailed Description

structure to get information form mofem into DataForcesAndSourcesCore

Definition at line 36 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 311 of file ForcesAndSourcesCore.hpp.

Constructor & Destructor Documentation

◆ ForcesAndSourcesCore()

MoFEM::ForcesAndSourcesCore::ForcesAndSourcesCore ( MoFEM::Interface m_field)

Definition at line 39 of file ForcesAndSourcesCore.hpp.

39  :
40  mField(m_field),
41  getRuleHook(0) {
42  }
RuleHookFun getRuleHook
Hook to get rule.

◆ ~ForcesAndSourcesCore()

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

Definition at line 43 of file ForcesAndSourcesCore.hpp.

43  {
44 
45  }

Member Function Documentation

◆ getColNodesIndices()

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

get col node indices from FENumeredDofEntity_multiIndex

Definition at line 414 of file ForcesAndSourcesCore.cpp.

414  {
415 
416  PetscFunctionBegin;
418  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getColsDofs()),
419  data.dataOnEntities[MBVERTEX][0].getIndices(),data.dataOnEntities[MBVERTEX][0].getLocalIndices()
420  ); CHKERRQ(ierr);
421  PetscFunctionReturn(0);
422 }
static PetscErrorCode ierr
Definition: Common.hpp:26
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)
PetscErrorCode getNodesIndices(const boost::string_ref field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices, VectorInt &local_nodes_indices) const
get node indices

◆ getDataOrder()

PetscErrorCode 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 177 of file ForcesAndSourcesCore.cpp.

177  {
178  PetscFunctionBegin;
179  try {
180  SideNumber_multiIndex& side_table = const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
181  if(data.size() < side_table.get<2>().count(type)) {
182  // prims has 9 edges, some of edges for "flat" prism are not active
183  SETERRQ2(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,
184  "data inconsistency %d < %d",
185  data.size(),side_table.get<2>().count(type)
186  );
187  }
188  for(unsigned int side = 0;side<data.size();side++) {
189  data[side].getDataOrder() = 0;
190  }
191  FEDofEntity_multiIndex::index<Composite_EntType_and_Space_mi_tag>::type &data_dofs =
192  const_cast<FEDofEntity_multiIndex::index<Composite_EntType_and_Space_mi_tag>::type&>(
193  numeredEntFiniteElementPtr->getDataDofs().get<Composite_EntType_and_Space_mi_tag>()
194  );
195  FEDofEntity_multiIndex::index<Composite_EntType_and_Space_mi_tag>::type::iterator dit,hi_dit;
196  dit = data_dofs.lower_bound(boost::make_tuple(type,space));
197  hi_dit = data_dofs.upper_bound(boost::make_tuple(type,space));
198  for(;dit!=hi_dit;dit++) {
199  ApproximationOrder ent_order = (*dit)->getMaxOrder();
200  int side_number = (*dit)->sideNumberPtr->side_number;
201  if(side_number < 0) {
202  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
203  }
204  data[side_number].getDataOrder() = data[side_number].getDataOrder() > ent_order ? data[side_number].getDataOrder() : ent_order;
205  if((*dit)->sideNumberPtr->brother_side_number!=-1) {
206  if(data.size() < (unsigned int)(*dit)->sideNumberPtr->brother_side_number) {
207  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
208  }
209  data[(*dit)->sideNumberPtr->brother_side_number].getDataOrder() = data[side_number].getDataOrder();
210  }
211  }
212  } catch (std::exception& ex) {
213  std::ostringstream ss;
214  ss << "thorw in method: " << ex.what() << " at line " << __LINE__ << " in file " << __FILE__;
215  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
216  }
217  PetscFunctionReturn(0);
218 }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
int ApproximationOrder
Approximation on the entity.
Definition: Common.hpp:33
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.

◆ getDataOrderSpaceAndBase()

PetscErrorCode 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 255 of file ForcesAndSourcesCore.cpp.

257  {
258  PetscFunctionBegin;
259 
260  SideNumber_multiIndex& side_table = const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
261  if(data.size() < side_table.get<2>().count(type)) {
262  // prims has 9 edges, some of edges for "flat" prism are not active
263  SETERRQ2(
264  PETSC_COMM_SELF,
266  "data inconsistency %d < %d",
267  data.size(),side_table.get<2>().count(type)
268  );
269  }
270 
271  for(unsigned int side = 0;side<data.size();side++) {
272  data[side].getDataOrder() = 0;
273  data[side].getBase() = NOBASE;
274  data[side].getSpace() = NOSPACE;
275  }
276 
277  const FEDofEntity_multiIndex::index<Composite_Name_Type_And_Side_Number_mi_tag>::type
278  &data_dofs = numeredEntFiniteElementPtr->getDataDofs().get<Composite_Name_Type_And_Side_Number_mi_tag>();
279  FEDofEntity_multiIndex::index<Composite_Name_Type_And_Side_Number_mi_tag>::type::iterator dit,hi_dit;
280  dit = data_dofs.lower_bound(boost::make_tuple(field_name,type,0));
281  if(dit == data_dofs.end()) {
282  PetscFunctionReturn(0);
283  }
284  hi_dit = data_dofs.lower_bound(boost::make_tuple(field_name,type,data.size()));
285 
286  for(;dit!=hi_dit;) {
287 
288  // std::cerr << ApproximationBaseNames[dit->getApproxBase()] << std::endl;
289 
290  int side_number = (*dit)->sideNumberPtr->side_number;
291  if(data[side_number].getDataOrder()) continue;
292 
293  ApproximationOrder ent_order = (*dit)->getMaxOrder();
294  if(side_number < 0) {
295  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
296  }
297  data[side_number].getBase() = (*dit)->getApproxBase();
298  data[side_number].getSpace() = (*dit)->getSpace();
299  data[side_number].getDataOrder() = data[side_number].getDataOrder() > ent_order ? data[side_number].getDataOrder() : ent_order;
300  if((*dit)->sideNumberPtr->brother_side_number!=-1) {
301  if(data.size() < (unsigned int)(*dit)->sideNumberPtr->brother_side_number) {
302  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
303  }
304  data[(*dit)->sideNumberPtr->brother_side_number].getBase() = data[side_number].getBase();
305  data[(*dit)->sideNumberPtr->brother_side_number].getSpace() = data[side_number].getSpace();
306  data[(*dit)->sideNumberPtr->brother_side_number].getDataOrder() = data[side_number].getDataOrder();
307  }
308 
309  const int nb_dofs_on_ent = (*dit)->getNbDofsOnEnt();
310  for(int i = 0;i!=nb_dofs_on_ent;i++,dit++) {}
311 
312  }
313 
314  PetscFunctionReturn(0);
315 }
PetscErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
int ApproximationOrder
Approximation on the entity.
Definition: Common.hpp:33
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.

◆ getEdgesColIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getEdgesColIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Edges col indices from FENumeredDofEntity_multiIndex

Definition at line 530 of file ForcesAndSourcesCore.cpp.

530  {
531 
532  PetscFunctionBegin;
534  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getColsDofs()),MBEDGE,data.dataOnEntities[MBEDGE]
535  ); CHKERRQ(ierr);
536  PetscFunctionReturn(0);
537 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getEdgesDataOrder()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getEdgesDataOrder ( DataForcesAndSourcesCore data,
const FieldSpace  space 
) const

Definition at line 220 of file ForcesAndSourcesCore.cpp.

220  {
221 
222  PetscFunctionBegin;
223  ierr = getDataOrder(MBEDGE,space,data.dataOnEntities[MBEDGE]); CHKERRQ(ierr);
224  PetscFunctionReturn(0);
225 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity
CHKERRQ(ierr)

◆ getEdgesDataOrderSpaceAndBase()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getEdgesDataOrderSpaceAndBase ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 317 of file ForcesAndSourcesCore.cpp.

317  {
318 
319  PetscFunctionBegin;
320  ierr = getDataOrderSpaceAndBase(field_name,MBEDGE,data.dataOnEntities[MBEDGE]); CHKERRQ(ierr);
321  PetscFunctionReturn(0);
322 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrderSpaceAndBase(const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order on entity
CHKERRQ(ierr)

◆ getEdgesFieldData()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getEdgesFieldData ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 1000 of file ForcesAndSourcesCore.cpp.

1000  {
1001 
1002  PetscFunctionBegin;
1004  field_name,const_cast<FEDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getDataDofs()),MBEDGE,data.dataOnEntities[MBEDGE]
1005  ); CHKERRQ(ierr);
1006  PetscFunctionReturn(0);
1007 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
CHKERRQ(ierr)

◆ getEdgesRowIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getEdgesRowIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Edges row indices from FENumeredDofEntity_multiIndex

Definition at line 521 of file ForcesAndSourcesCore.cpp.

521  {
522 
523  PetscFunctionBegin;
525  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getRowsDofs()),MBEDGE,data.dataOnEntities[MBEDGE]
526  ); CHKERRQ(ierr);
527  PetscFunctionReturn(0);
528 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getEdgesSense()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getEdgesSense ( DataForcesAndSourcesCore data) const

get edge sense )orientation) in respect finite element entity

Parameters
datastructure where results are stored
Returns
error code

Definition at line 126 of file ForcesAndSourcesCore.cpp.

126  {
127 
128  PetscFunctionBegin;
129  ierr = getSense(MBEDGE,data.dataOnEntities[MBEDGE]); CHKERRQ(ierr);
130  PetscFunctionReturn(0);
131 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getSense(EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get sense (orientation) of entity
CHKERRQ(ierr)

◆ getFaceTriNodes()

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

Get nodes on triangles.

Definition at line 1066 of file ForcesAndSourcesCore.cpp.

1066  {
1067  //
1068  PetscFunctionBegin;
1069  //PetscAttachDebugger();
1070  data.facesNodes.resize(4,3,false);
1071  SideNumber_multiIndex& side_table = const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
1072  SideNumber_multiIndex::nth_index<1>::type::iterator siit = side_table.get<1>().lower_bound(boost::make_tuple(MBTRI,0));
1073  SideNumber_multiIndex::nth_index<1>::type::iterator hi_siit = side_table.get<1>().upper_bound(boost::make_tuple(MBTRI,4));
1074  if(distance(siit,hi_siit)!=4) {
1075  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"Should be 4 triangles on tet, side_table not initialized");
1076  }
1077  const int cannonical_face_sense_p1[4][3] = { {0,1,3}, {1,2,3}, {0,3,2}/**/, {0,2,1}/**/ }; //secon index is offset (positive sense)
1078  const int cannonical_face_sense_m1[4][3] = { {0,3,1}, {1,3,2}, {0,2,3}, {0,1,2} }; //second index is offset (negative sense
1079  for(;siit!=hi_siit;siit++) {
1080  const boost::shared_ptr<SideNumber> side = *siit;
1081  int face_conn[3] = {-1,-1,-1};
1082  if(side->offset == 0) {
1083  face_conn[0] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][0] : cannonical_face_sense_m1[(int)side->side_number][0];
1084  face_conn[1] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][1] : cannonical_face_sense_m1[(int)side->side_number][1];
1085  face_conn[2] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][2] : cannonical_face_sense_m1[(int)side->side_number][2];
1086  }
1087  if(side->offset == 1) {
1088  face_conn[0] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][1] : cannonical_face_sense_m1[(int)side->side_number][2]/**/;
1089  face_conn[1] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][2] : cannonical_face_sense_m1[(int)side->side_number][0];
1090  face_conn[2] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][0] : cannonical_face_sense_m1[(int)side->side_number][1];
1091  }
1092  if(side->offset == 2) {
1093  face_conn[0] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][2] : cannonical_face_sense_m1[(int)side->side_number][1]/**/;
1094  face_conn[1] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][0] : cannonical_face_sense_m1[(int)side->side_number][2];
1095  face_conn[2] = side->sense == 1 ? cannonical_face_sense_p1[(int)side->side_number][1] : cannonical_face_sense_m1[(int)side->side_number][0];
1096  }
1097  for(int nn = 0;nn<3;nn++) data.facesNodes(side->side_number,nn) = face_conn[nn];
1098  {
1099  const EntityHandle *conn_tet;
1100  int num_nodes_tet;
1101  EntityHandle ent = numeredEntFiniteElementPtr->getEnt();
1102  rval = mField.get_moab().get_connectivity(ent,conn_tet,num_nodes_tet,true); CHKERRQ_MOAB(rval);
1103  if(num_nodes_tet != 4) SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
1104  int num_nodes_face;
1105  const EntityHandle *conn_face;
1106  rval = mField.get_moab().get_connectivity(side->ent,conn_face,num_nodes_face,true); CHKERRQ_MOAB(rval);
1107  if(num_nodes_face != 3) SETERRQ(PETSC_COMM_SELF,1,"data inconsistency");
1108  if(conn_face[0] != conn_tet[data.facesNodes(side->side_number,0)])
1109  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
1110  if(conn_face[1] != conn_tet[data.facesNodes(side->side_number,1)])
1111  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
1112  if(conn_face[2] != conn_tet[data.facesNodes(side->side_number,2)])
1113  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
1114  }
1115  }
1116  PetscFunctionReturn(0);
1117 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:362
static MoABErrorCode rval
Definition: Common.hpp:25
virtual moab::Interface & get_moab()=0
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
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.

◆ getMaxColOrder()

int MoFEM::ForcesAndSourcesCore::getMaxColOrder ( ) const

Get max order of approximation for field in columns.

Definition at line 173 of file ForcesAndSourcesCore.cpp.

173  {
174  return getMaxOrder(numeredEntFiniteElementPtr->getColsDofs());
175 }
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 165 of file ForcesAndSourcesCore.cpp.

165  {
166  return getMaxOrder(numeredEntFiniteElementPtr->getDataDofs());
167 }
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 169 of file ForcesAndSourcesCore.cpp.

169  {
170  return getMaxOrder(numeredEntFiniteElementPtr->getRowsDofs());
171 }
static int getMaxOrder(const DOFMULTIINDEX &dof_multi_index)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr

◆ getNodesFieldData() [1/2]

PetscErrorCode 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 774 of file ForcesAndSourcesCore.cpp.

781  {
782 
783  PetscFunctionBegin;
784  try {
785  FEDofEntityByNameAndType::iterator dit,hi_dit,it;
786  dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(boost::make_tuple(field_name,MBVERTEX));
787  hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(boost::make_tuple(field_name,MBVERTEX));
788 
789  int num_nodes;
790  ierr = getNumberOfNodes(num_nodes); CHKERRQ(ierr);
791  int max_nb_dofs = 0;
792  if(dit!=hi_dit) {
793  max_nb_dofs = (*dit)->getNbOfCoeffs()*num_nodes;
794  }
795 
796  if(distance(dit,hi_dit)!=max_nb_dofs) {
797  nodes_data.resize(max_nb_dofs,false);
798  nodes_data.clear();
799  nodes_dofs.resize(max_nb_dofs,false);
800  } else {
801  int size = distance(dit,hi_dit);
802  nodes_data.resize(size,false);
803  nodes_dofs.resize(size,false);
804  }
805 
806  if(dit!=hi_dit) {
807  space = (*dit)->getSpace();
808  base = (*dit)->getApproxBase();
809  }
810 
811  for(;dit!=hi_dit;dit++) {
812  FieldData val = (*dit)->getFieldData();
813  int side_number = (*dit)->sideNumberPtr->side_number;
814  if(side_number == -1) {
815  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
816  }
817  int pos = side_number*(*dit)->getNbOfCoeffs()+(*dit)->getDofCoeffIdx();
818  nodes_data[pos] = val;
819  nodes_dofs[pos] = *dit;
820  int brother_side_number = (*dit)->sideNumberPtr->brother_side_number;
821  if(brother_side_number!=-1) {
822  if(nodes_data.size()<(unsigned int)(brother_side_number*(*dit)->getNbOfCoeffs()+(*dit)->getNbOfCoeffs())) {
823  nodes_data.resize(brother_side_number*(*dit)->getNbOfCoeffs()+(*dit)->getNbOfCoeffs());
824  nodes_dofs.resize(brother_side_number*(*dit)->getNbOfCoeffs()+(*dit)->getNbOfCoeffs());
825  }
826  int brother_pos = brother_side_number*(*dit)->getNbOfCoeffs()+(*dit)->getDofCoeffIdx();
827  nodes_data[brother_pos] = val;
828  nodes_dofs[brother_pos] = *dit;
829  }
830  }
831 
832  } catch (std::exception& ex) {
833  std::ostringstream ss;
834  ss << "thorw in method: " << ex.what() << " at line " << __LINE__ << " in file " << __FILE__;
835  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
836  }
837  PetscFunctionReturn(0);
838 }
static PetscErrorCode ierr
Definition: Common.hpp:26
double FieldData
Field data type.
Definition: Common.hpp:32
PetscErrorCode getNumberOfNodes(int &num_nodes) const
CHKERRQ(ierr)

◆ getNodesFieldData() [2/2]

PetscErrorCode 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 840 of file ForcesAndSourcesCore.cpp.

840  {
841  PetscFunctionBegin;
842 
844  field_name,
845  const_cast<FEDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getDataDofs()),
846  data.dataOnEntities[MBVERTEX][0].getFieldData(),
847  data.dataOnEntities[MBVERTEX][0].getFieldDofs(),
848  data.dataOnEntities[MBVERTEX][0].getSpace(),
849  data.dataOnEntities[MBVERTEX][0].getBase()
850  ); CHKERRQ(ierr);
851  PetscFunctionReturn(0);
852 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
CHKERRQ(ierr)

◆ getNodesIndices()

PetscErrorCode 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 354 of file ForcesAndSourcesCore.cpp.

356  {
357 
358  PetscFunctionBegin;
359 
360  FENumeredDofEntityByNameAndType::iterator dit,hi_dit,it;
361  dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(boost::make_tuple(field_name,MBVERTEX));
362  hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(boost::make_tuple(field_name,MBVERTEX));
363 
364  int num_nodes;
365  ierr = getNumberOfNodes(num_nodes); CHKERRQ(ierr);
366  int max_nb_dofs = 0;
367  if(dit!=hi_dit) {
368  max_nb_dofs = (*dit)->getNbOfCoeffs()*num_nodes;
369  }
370 
371  if(distance(dit,hi_dit)!=max_nb_dofs) {
372  nodes_indices.resize(max_nb_dofs,false);
373  local_nodes_indices.resize(max_nb_dofs,false);
374  for(int dd = 0;dd<max_nb_dofs;dd++) {
375  nodes_indices[dd] = -1;
376  local_nodes_indices[dd] = -1;
377  }
378  } else {
379  nodes_indices.resize(distance(dit,hi_dit),false);
380  local_nodes_indices.resize(distance(dit,hi_dit),false);
381  }
382 
383  for(;dit!=hi_dit;dit++) {
384  const int idx = (*dit)->getPetscGlobalDofIdx();
385  const int local_idx = (*dit)->getPetscLocalDofIdx();
386  const int side_number = (*dit)->sideNumberPtr->side_number;
387  const int pos = side_number*(*dit)->getNbOfCoeffs()+(*dit)->getDofCoeffIdx();
388  nodes_indices[pos] = idx;
389  local_nodes_indices[pos] = local_idx;
390  const int brother_side_number = (*dit)->sideNumberPtr->brother_side_number;
391  if(brother_side_number!=-1) {
392  if(nodes_indices.size()<(unsigned int)(brother_side_number*(*dit)->getNbOfCoeffs()+(*dit)->getNbOfCoeffs())) {
393  nodes_indices.resize(brother_side_number*(*dit)->getNbOfCoeffs()+(*dit)->getNbOfCoeffs());
394  }
395  const int elem_idx = brother_side_number*(*dit)->getNbOfCoeffs()+(*dit)->getDofCoeffIdx();
396  nodes_indices[elem_idx] = idx;
397  local_nodes_indices[elem_idx] = local_idx;
398  }
399  }
400 
401  PetscFunctionReturn(0);
402 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getNumberOfNodes(int &num_nodes) const
CHKERRQ(ierr)
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:28

◆ getNoFieldColIndices()

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

get col NoField indices

Definition at line 654 of file ForcesAndSourcesCore.cpp.

654  {
655 
656  PetscFunctionBegin;
657  if(data.dataOnEntities[MBENTITYSET].size() == 0) {
658  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
659  }
661  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getColsDofs()),data.dataOnEntities[MBENTITYSET][0].getIndices()
662  ); CHKERRQ(ierr);
663  PetscFunctionReturn(0);
664 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getNoFieldIndices(const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
get NoField indices
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getNoFieldFieldData() [1/2]

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

Definition at line 962 of file ForcesAndSourcesCore.cpp.

967  {
968  //
969  PetscFunctionBegin;
970  FEDofEntityByFieldName::iterator dit,hi_dit;
971  dit = dofs.get<FieldName_mi_tag>().lower_bound(field_name);
972  hi_dit = dofs.get<FieldName_mi_tag>().upper_bound(field_name);
973  int size = distance(dit,hi_dit);
974  ent_field_data.resize(size,false);
975  ent_field_dofs.resize(size,false);
976  for(;dit!=hi_dit;dit++) {
977  int idx = (*dit)->getDofCoeffIdx();
978  ent_field_data[idx] = (*dit)->getFieldData();
979  ent_field_dofs[idx] = *dit;
980  }
981  PetscFunctionReturn(0);
982 }

◆ getNoFieldFieldData() [2/2]

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

Definition at line 984 of file ForcesAndSourcesCore.cpp.

986  {
987 
988  PetscFunctionBegin;
989  if(data.dataOnEntities[MBENTITYSET].size() == 0) {
990  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
991  }
993  field_name,const_cast<FEDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getDataDofs()),
994  data.dataOnEntities[MBENTITYSET][0].getFieldData(),
995  data.dataOnEntities[MBENTITYSET][0].getFieldDofs()
996  ); CHKERRQ(ierr);
997  PetscFunctionReturn(0);
998 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
CHKERRQ(ierr)

◆ getNoFieldIndices()

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

get NoField indices

Definition at line 625 of file ForcesAndSourcesCore.cpp.

627  {
628  //
629  PetscFunctionBegin;
630  FENumeredDofEntityByFieldName::iterator dit,hi_dit;
631  dit = dofs.get<FieldName_mi_tag>().lower_bound(field_name);
632  hi_dit = dofs.get<FieldName_mi_tag>().upper_bound(field_name);
633  indices.resize(distance(dit,hi_dit));
634  for(;dit!=hi_dit;dit++) {
635  int idx = (*dit)->getPetscGlobalDofIdx();
636  indices[(*dit)->getDofCoeffIdx()] = idx;
637  }
638  PetscFunctionReturn(0);
639 }

◆ getNoFieldRowIndices()

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

get col NoField indices

Definition at line 641 of file ForcesAndSourcesCore.cpp.

641  {
642 
643  PetscFunctionBegin;
644  //EntityType fe_type = numeredEntFiniteElementPtr->getEntType();
645  if(data.dataOnEntities[MBENTITYSET].size() == 0) {
646  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
647  }
649  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getRowsDofs()),data.dataOnEntities[MBENTITYSET][0].getIndices()
650  ); CHKERRQ(ierr);
651  PetscFunctionReturn(0);
652 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getNoFieldIndices(const std::string &field_name, FENumeredDofEntity_multiIndex &dofs, VectorInt &nodes_indices) const
get NoField indices
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getNumberOfNodes()

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

Definition at line 69 of file ForcesAndSourcesCore.cpp.

69  {
70  PetscFunctionBegin;
71 
73  switch(mField.get_moab().type_from_handle(ent)) {
74  case MBVERTEX:
75  num_nodes = 1;
76  break;
77  case MBEDGE:
78  num_nodes = 2;
79  break;
80  case MBTRI:
81  num_nodes = 3;
82  break;
83  case MBTET:
84  num_nodes = 4;
85  break;
86  case MBPRISM:
87  num_nodes = 6;
88  break;
89  default:
90  SETERRQ(PETSC_COMM_SELF,MOFEM_NOT_IMPLEMENTED,"not implemented");
91  }
92 
93  PetscFunctionReturn(0);
94 }
virtual moab::Interface & get_moab()=0
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:
cell_forces.cpp, elasticity.cpp, and MagneticElement.hpp.

Definition at line 566 of file ForcesAndSourcesCore.hpp.

566 { return opPtrVector; }
boost::ptr_vector< UserDataOperator > opPtrVector

◆ getPrismColIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getPrismColIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Prism col indices from FENumeredDofEntity_multiIndex

Definition at line 616 of file ForcesAndSourcesCore.cpp.

616  {
617 
618  PetscFunctionBegin;
620  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getColsDofs()),MBPRISM,data.dataOnEntities[MBPRISM]
621  ); CHKERRQ(ierr);
622  PetscFunctionReturn(0);
623 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getPrismDataOrder()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getPrismDataOrder ( DataForcesAndSourcesCore data,
const FieldSpace  space 
) const

Definition at line 248 of file ForcesAndSourcesCore.cpp.

248  {
249 
250  PetscFunctionBegin;
251  ierr = getDataOrder(MBPRISM,space,data.dataOnEntities[MBPRISM]); CHKERRQ(ierr);
252  PetscFunctionReturn(0);
253 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity
CHKERRQ(ierr)

◆ getPrismDataOrderSpaceAndBase()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getPrismDataOrderSpaceAndBase ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 345 of file ForcesAndSourcesCore.cpp.

345  {
346 
347  PetscFunctionBegin;
348  ierr = getDataOrderSpaceAndBase(field_name,MBPRISM,data.dataOnEntities[MBPRISM]); CHKERRQ(ierr);
349  PetscFunctionReturn(0);
350 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrderSpaceAndBase(const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order on entity
CHKERRQ(ierr)

◆ getPrismFieldData()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getPrismFieldData ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 1047 of file ForcesAndSourcesCore.cpp.

1047  {
1048 
1049  PetscFunctionBegin;
1050  if(data.dataOnEntities[MBPRISM].size() == 0) {
1051  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
1052  }
1054  field_name,
1055  const_cast<FEDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getDataDofs()),
1056  MBPRISM,
1057  0,
1058  data.dataOnEntities[MBPRISM][0].getFieldData(),
1059  data.dataOnEntities[MBPRISM][0].getFieldDofs()
1060  ); CHKERRQ(ierr);
1061  PetscFunctionReturn(0);
1062 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
CHKERRQ(ierr)

◆ getPrismRowIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getPrismRowIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Prism row indices from FENumeredDofEntity_multiIndex

Definition at line 605 of file ForcesAndSourcesCore.cpp.

607  {
608 
609  PetscFunctionBegin;
611  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getRowsDofs()),MBPRISM,data.dataOnEntities[MBPRISM]
612  ); CHKERRQ(ierr);
613  PetscFunctionReturn(0);
614 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getProblemNodesColIndices()

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

Definition at line 758 of file ForcesAndSourcesCore.cpp.

758  {
759  PetscFunctionBegin;
760 
761  ierr = getProblemNodesIndices(field_name,*(problemPtr->numeredDofsCols),nodes_indices); CHKERRQ(ierr);
762  PetscFunctionReturn(0);
763 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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 ...
const Problem * problemPtr
CHKERRQ(ierr)
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsCols
store DOFs on columns for this problem

◆ getProblemNodesIndices()

PetscErrorCode 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 668 of file ForcesAndSourcesCore.cpp.

672  {
673  PetscFunctionBegin;
674 
675  nodes_indices.resize(0);
676 
677  SideNumber_multiIndex& side_table = const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
678  SideNumber_multiIndex::nth_index<1>::type::iterator siit = side_table.get<1>().lower_bound(boost::make_tuple(MBVERTEX,0));
679  SideNumber_multiIndex::nth_index<1>::type::iterator hi_siit = side_table.get<1>().lower_bound(boost::make_tuple(MBVERTEX,10000));
680 
681  int nn = 0;
682  for(;siit!=hi_siit;siit++,nn++) {
683 
684  if(siit->get()->side_number == -1) continue;
685 
686  const EntityHandle ent = siit->get()->ent;
687  NumeredDofEntity_multiIndex::index<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>::type::iterator dit,hi_dit;
688  dit = dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().lower_bound(boost::make_tuple(field_name,ent,0));
689  hi_dit = dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().upper_bound(boost::make_tuple(field_name,ent,10000)); /// very large number
690 
691  if(dit!=hi_dit) {
692 
693  if(!nn) {
694  nodes_indices.resize((*dit)->getNbOfCoeffs()*distance(siit,hi_siit));
695  }
696  for(;dit!=hi_dit;dit++) {
697  nodes_indices[siit->get()->side_number*(*dit)->getNbOfCoeffs()+(*dit)->getDofCoeffIdx()] = (*dit)->getPetscGlobalDofIdx();
698  }
699 
700  }
701 
702  }
703 
704  PetscFunctionReturn(0);
705 
706 }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
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.

◆ getProblemNodesRowIndices()

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

Definition at line 744 of file ForcesAndSourcesCore.cpp.

744  {
745  PetscFunctionBegin;
746 
747  ierr = getProblemNodesIndices(field_name,*(problemPtr->numeredDofsRows),nodes_indices); CHKERRQ(ierr);
748  PetscFunctionReturn(0);
749 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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 ...
const Problem * problemPtr
CHKERRQ(ierr)
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsRows
store DOFs on rows for this problem

◆ getProblemTypeColIndices()

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

Definition at line 765 of file ForcesAndSourcesCore.cpp.

765  {
766  PetscFunctionBegin;
767 
768  ierr = getProblemTypeIndices(field_name,*(problemPtr->numeredDofsCols),type,side_number,indices); CHKERRQ(ierr);
769  PetscFunctionReturn(0);
770 }
static PetscErrorCode ierr
Definition: Common.hpp:26
const Problem * problemPtr
CHKERRQ(ierr)
PetscErrorCode 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()

PetscErrorCode 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 708 of file ForcesAndSourcesCore.cpp.

711  {
712  PetscFunctionBegin;
713 
714  indices.resize(0);
715 
716  SideNumber_multiIndex& side_table =
717  const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
718  SideNumber_multiIndex::nth_index<1>::type::iterator siit =
719  side_table.get<1>().lower_bound(boost::make_tuple(type,side_number));
720  SideNumber_multiIndex::nth_index<1>::type::iterator hi_siit =
721  side_table.get<1>().upper_bound(boost::make_tuple(type,side_number));
722 
723  for(;siit!=hi_siit;siit++) {
724 
725  if(siit->get()->side_number == -1) continue;
726 
727  const EntityHandle ent = siit->get()->ent;
728  NumeredDofEntity_multiIndex::index<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>::type::iterator dit,hi_dit;
729  dit = dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().lower_bound(boost::make_tuple(field_name,ent,0));
730  hi_dit = dofs.get<Composite_Name_And_Ent_And_EntDofIdx_mi_tag>().upper_bound(boost::make_tuple(field_name,ent,10000)); /// very large number
731 
732  indices.resize(distance(dit,hi_dit));
733  for(;dit!=hi_dit;dit++) {
734 
735  indices[(*dit)->getEntDofIdx()] = (*dit)->getPetscGlobalDofIdx();
736 
737  }
738 
739  }
740 
741  PetscFunctionReturn(0);
742 }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
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.

◆ getProblemTypeRowIndices()

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

Definition at line 751 of file ForcesAndSourcesCore.cpp.

751  {
752  PetscFunctionBegin;
753 
754  ierr = getProblemTypeIndices(field_name,*(problemPtr->numeredDofsRows),type,side_number,indices); CHKERRQ(ierr);
755  PetscFunctionReturn(0);
756 }
static PetscErrorCode ierr
Definition: Common.hpp:26
const Problem * problemPtr
CHKERRQ(ierr)
boost::shared_ptr< NumeredDofEntity_multiIndex > numeredDofsRows
store DOFs on rows for this problem
PetscErrorCode 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...

◆ getQuadColIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getQuadColIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Quad col indices from FENumeredDofEntity_multiIndex

Definition at line 596 of file ForcesAndSourcesCore.cpp.

596  {
597 
598  PetscFunctionBegin;
600  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getColsDofs()),MBQUAD,data.dataOnEntities[MBQUAD]
601  ); CHKERRQ(ierr);
602  PetscFunctionReturn(0);
603 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getQuadDataOrder()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getQuadDataOrder ( DataForcesAndSourcesCore data,
const FieldSpace  space 
) const

Definition at line 234 of file ForcesAndSourcesCore.cpp.

234  {
235 
236  PetscFunctionBegin;
237  ierr = getDataOrder(MBQUAD,space,data.dataOnEntities[MBQUAD]); CHKERRQ(ierr);
238  PetscFunctionReturn(0);
239 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity
CHKERRQ(ierr)

◆ getQuadDataOrderSpaceAndBase()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getQuadDataOrderSpaceAndBase ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 331 of file ForcesAndSourcesCore.cpp.

331  {
332 
333  PetscFunctionBegin;
334  ierr = getDataOrderSpaceAndBase(field_name,MBQUAD,data.dataOnEntities[MBQUAD]); CHKERRQ(ierr);
335  PetscFunctionReturn(0);
336 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrderSpaceAndBase(const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order on entity
CHKERRQ(ierr)

◆ getQuadFieldData()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getQuadFieldData ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 1020 of file ForcesAndSourcesCore.cpp.

1022  {
1023 
1024  PetscFunctionBegin;
1026  field_name,const_cast<FEDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getDataDofs()),MBQUAD,data.dataOnEntities[MBQUAD]
1027  ); CHKERRQ(ierr);
1028  PetscFunctionReturn(0);
1029 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
CHKERRQ(ierr)

◆ getQuadRowIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getQuadRowIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Quad row indices from FENumeredDofEntity_multiIndex

Definition at line 585 of file ForcesAndSourcesCore.cpp.

587  {
588 
589  PetscFunctionBegin;
591  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getRowsDofs()),MBQUAD,data.dataOnEntities[MBQUAD]
592  ); CHKERRQ(ierr);
593  PetscFunctionReturn(0);
594 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getQuadSense()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getQuadSense ( DataForcesAndSourcesCore data) const

Definition at line 140 of file ForcesAndSourcesCore.cpp.

140  {
141 
142  PetscFunctionBegin;
143  ierr = getSense(MBQUAD,data.dataOnEntities[MBQUAD]); CHKERRQ(ierr);
144  PetscFunctionReturn(0);
145 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getSense(EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get sense (orientation) of entity
CHKERRQ(ierr)

◆ getRowNodesIndices()

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

get row node indices from FENumeredDofEntity_multiIndex

Definition at line 404 of file ForcesAndSourcesCore.cpp.

404  {
405 
406  PetscFunctionBegin;
408  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getRowsDofs()),
409  data.dataOnEntities[MBVERTEX][0].getIndices(),data.dataOnEntities[MBVERTEX][0].getLocalIndices()
410  ); CHKERRQ(ierr);
411  PetscFunctionReturn(0);
412 }
static PetscErrorCode ierr
Definition: Common.hpp:26
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)
PetscErrorCode 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 coefficents 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, MoFEM::VolumeElementForcesAndSourcesCoreOnSide, GelModule::Gel::GelFE, SmallStrainPlasticity::MyVolumeFE, PostProcTemplateVolumeOnRefinedMesh< MoFEM::VolumeElementForcesAndSourcesCore >, KelvinVoigtDamper::DamperFE, NitscheMethod::MyVolumeFE, SurfaceSlidingConstrains::MyTriangleFE, GriffithForceElement::MyTriangleFE, ThermalElement::MyTriFE, MixTransport::MixTransportElement::MyTriFE, NonlinearElasticElement::MyVolumeFE, NeummanForcesSurface::MyTriangleFE, MagneticElement::TriFE, MoFEM::NormElement::MyTriFE, NeummanForcesSurfaceComplexForLazy::MyTriangleSpatialFE, ThermalElement::MyVolumeFE, CellEngineering::FaceElement, MixTransport::MixTransportElement::MyVolumeFE, MoFEM::NormElement::MyVolumeFE, OptimalMassTransport::TriFE, MagneticElement::VolumeFE, 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, BodyFroceConstantField::MyVolumeFE, ThermalStressElement::MyVolumeFE, TestFE, and CellEngineering::DispMapFe.

Definition at line 309 of file ForcesAndSourcesCore.hpp.

309 { 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 330 of file ForcesAndSourcesCore.hpp.

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

◆ getSense()

PetscErrorCode 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 98 of file ForcesAndSourcesCore.cpp.

98  {
99  PetscFunctionBegin;
100  try {
101  SideNumber_multiIndex& side_table = const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
102  if(data.size() < side_table.get<2>().count(type)) {
103  // prims has 9 edges, some of edges for "flat" prism are not active
104  SETERRQ2(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency %u < %u",data.size(),side_table.get<2>().count(type));
105  }
106  SideNumber_multiIndex::nth_index<2>::type::iterator siit = side_table.get<2>().lower_bound(type);
107  SideNumber_multiIndex::nth_index<2>::type::iterator hi_siit = side_table.get<2>().upper_bound(type);
108  for(;siit!=hi_siit;siit++) {
109  data[siit->get()->side_number].getSense() = siit->get()->sense;
110  if(siit->get()->brother_side_number!=-1) {
111  if(data.size() < (unsigned)siit->get()->brother_side_number) {
112  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
113  }
114  data[siit->get()->brother_side_number].getSense() = siit->get()->sense;
115  }
116  }
117  } catch (std::exception& ex) {
118  std::ostringstream ss;
119  ss << "thorw in method: " << ex.what() << " at line " << __LINE__ << " in file " << __FILE__;
120  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
121  }
122 
123  PetscFunctionReturn(0);
124 }
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
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.

◆ getSpacesAndBaseOnEntities()

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

Get field approximation space and base on entities.

Definition at line 1121 of file ForcesAndSourcesCore.cpp.

1121  {
1122  //
1123  PetscFunctionBegin;
1124  try {
1125  if(nInTheLoop==0) {
1126  data.sPace.reset();
1127  data.bAse.reset();
1128  for(EntityType t = MBVERTEX;t!=MBMAXTYPE;t++) {
1129  data.spacesOnEntities[t].reset();
1130  data.basesOnEntities[t].reset();
1131  }
1132  }
1133  for(_IT_GET_FEDATA_DOFS_FOR_LOOP_(this,dof)) {
1134  if(dof->get()->getEntDofIdx()!=0) continue;
1135  // std::cerr << *dof << std::endl;
1136  // std::cerr << dof->getSpace() << " " << data.sPace.size() << std::endl;
1137  // std::cerr << dof->getApproxBase() << " " << data.bAse.size() << std::endl;
1138  const FieldSpace space = dof->get()->getSpace();
1139  const FieldApproximationBase approx = dof->get()->getApproxBase();
1140  data.sPace.set(space);
1141  data.bAse.set(approx);
1142  const EntityType type = dof->get()->getEntType();
1143  data.spacesOnEntities[type].set(space);
1144  data.basesOnEntities[type].set(approx);
1145  // std::cerr << "approx base " << ApproximationBaseNames[dof->getApproxBase()] << " " << data.basesOnEntities[dof->getEntType()] << std::endl;
1146  }
1147  } catch (std::exception& ex) {
1148  std::ostringstream ss;
1149  ss << "thorw in method: " << ex.what() << " at line " << __LINE__ << " in file " << __FILE__;
1150  SETERRQ(PETSC_COMM_SELF,MOFEM_STD_EXCEPTION_THROW,ss.str().c_str());
1151  }
1152  PetscFunctionReturn(0);
1153 }
#define _IT_GET_FEDATA_DOFS_FOR_LOOP_(FE, IT)
loop over all dofs which are on a particular FE data
FieldApproximationBase
approximation base
Definition: definitions.h:123
FieldSpace
approximation spaces
Definition: definitions.h:156

◆ getTetDataOrder()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTetDataOrder ( DataForcesAndSourcesCore data,
const FieldSpace  space 
) const

Definition at line 241 of file ForcesAndSourcesCore.cpp.

241  {
242 
243  PetscFunctionBegin;
244  ierr = getDataOrder(MBTET,space,data.dataOnEntities[MBTET]); CHKERRQ(ierr);
245  PetscFunctionReturn(0);
246 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity
CHKERRQ(ierr)

◆ getTetDataOrderSpaceAndBase()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTetDataOrderSpaceAndBase ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 338 of file ForcesAndSourcesCore.cpp.

338  {
339 
340  PetscFunctionBegin;
341  ierr = getDataOrderSpaceAndBase(field_name,MBTET,data.dataOnEntities[MBTET]); CHKERRQ(ierr);
342  PetscFunctionReturn(0);
343 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrderSpaceAndBase(const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order on entity
CHKERRQ(ierr)

◆ getTetsColIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTetsColIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Tets col indices from FENumeredDofEntity_multiIndex

Definition at line 572 of file ForcesAndSourcesCore.cpp.

572  {
573 
574  PetscFunctionBegin;
575  if(data.dataOnEntities[MBTET].size() == 0) {
576  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
577  }
579  field_name,const_cast<FENumeredDofEntity_multiIndex&>(
580  numeredEntFiniteElementPtr->getColsDofs()),MBTET,0,data.dataOnEntities[MBTET][0].getIndices(),data.dataOnEntities[MBTET][0].getLocalIndices()
581  ); CHKERRQ(ierr);
582  PetscFunctionReturn(0);
583 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getTetsFieldData()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTetsFieldData ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 1031 of file ForcesAndSourcesCore.cpp.

1031  {
1032 
1033  PetscFunctionBegin;
1034  if(data.dataOnEntities[MBTET].size() == 0) {
1035  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
1036  }
1038  field_name,const_cast<FEDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getDataDofs()),
1039  MBTET,
1040  0,
1041  data.dataOnEntities[MBTET][0].getFieldData(),
1042  data.dataOnEntities[MBTET][0].getFieldDofs()
1043  ); CHKERRQ(ierr);
1044  PetscFunctionReturn(0);
1045 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
CHKERRQ(ierr)

◆ getTetsRowIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTetsRowIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Tets row indices from FENumeredDofEntity_multiIndex

Definition at line 559 of file ForcesAndSourcesCore.cpp.

559  {
560 
561  PetscFunctionBegin;
562  if(data.dataOnEntities[MBTET].size() == 0) {
563  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
564  }
566  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getRowsDofs()),MBTET,0,
567  data.dataOnEntities[MBTET][0].getIndices(),data.dataOnEntities[MBTET][0].getLocalIndices()
568  ); CHKERRQ(ierr);
569  PetscFunctionReturn(0);
570 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getTrisColIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTrisColIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Tris col indices from FENumeredDofEntity_multiIndex

Definition at line 550 of file ForcesAndSourcesCore.cpp.

550  {
551 
552  PetscFunctionBegin;
554  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getColsDofs()),MBTRI,data.dataOnEntities[MBTRI]
555  ); CHKERRQ(ierr);
556  PetscFunctionReturn(0);
557 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getTrisDataOrder()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTrisDataOrder ( DataForcesAndSourcesCore data,
const FieldSpace  space 
) const

Definition at line 227 of file ForcesAndSourcesCore.cpp.

227  {
228 
229  PetscFunctionBegin;
230  ierr = getDataOrder(MBTRI,space,data.dataOnEntities[MBTRI]); CHKERRQ(ierr);
231  PetscFunctionReturn(0);
232 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrder(const EntityType type, const FieldSpace space, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order of approximation on the entity
CHKERRQ(ierr)

◆ getTrisDataOrderSpaceAndBase()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTrisDataOrderSpaceAndBase ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 324 of file ForcesAndSourcesCore.cpp.

324  {
325 
326  PetscFunctionBegin;
327  ierr = getDataOrderSpaceAndBase(field_name,MBTRI,data.dataOnEntities[MBTRI]); CHKERRQ(ierr);
328  PetscFunctionReturn(0);
329 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getDataOrderSpaceAndBase(const std::string &field_name, const EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get maximal approximation order on entity
CHKERRQ(ierr)

◆ getTrisFieldData()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTrisFieldData ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

Definition at line 1009 of file ForcesAndSourcesCore.cpp.

1011  {
1012 
1013  PetscFunctionBegin;
1015  field_name,const_cast<FEDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getDataDofs()),MBTRI,data.dataOnEntities[MBTRI]
1016  ); CHKERRQ(ierr);
1017  PetscFunctionReturn(0);
1018 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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
CHKERRQ(ierr)

◆ getTrisRowIndices()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTrisRowIndices ( DataForcesAndSourcesCore data,
const std::string &  field_name 
) const

get Tris row indices from FENumeredDofEntity_multiIndex

Definition at line 539 of file ForcesAndSourcesCore.cpp.

541  {
542 
543  PetscFunctionBegin;
545  field_name,const_cast<FENumeredDofEntity_multiIndex&>(numeredEntFiniteElementPtr->getRowsDofs()),MBTRI,data.dataOnEntities[MBTRI]
546  ); CHKERRQ(ierr);
547  PetscFunctionReturn(0);
548 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)

◆ getTrisSense()

PetscErrorCode MoFEM::ForcesAndSourcesCore::getTrisSense ( DataForcesAndSourcesCore data) const

get triangle sense (orientation)

Parameters
datastructure where results are stored
Returns
error code

Definition at line 133 of file ForcesAndSourcesCore.cpp.

133  {
134 
135  PetscFunctionBegin;
136  ierr = getSense(MBTRI,data.dataOnEntities[MBTRI]); CHKERRQ(ierr);
137  PetscFunctionReturn(0);
138 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode getSense(EntityType type, boost::ptr_vector< DataForcesAndSourcesCore::EntData > &data) const
get sense (orientation) of entity
CHKERRQ(ierr)

◆ getTypeFieldData() [1/2]

PetscErrorCode 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 854 of file ForcesAndSourcesCore.cpp.

861  {
862  //
863  PetscFunctionBegin;
864  FEDofEntity_multiIndex::index<Composite_Name_Type_And_Side_Number_mi_tag>::type::iterator dit,hi_dit;
865  dit = dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().lower_bound(boost::make_tuple(field_name,type,side_number));
866  if(dit == dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().end()) {
867  ent_field_data.resize(0,false);
868  ent_field_dofs.resize(0,false);
869  PetscFunctionReturn(0);
870  }
871  hi_dit = dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().upper_bound(boost::make_tuple(field_name,type,side_number));
872  if(dit!=hi_dit) {
873  ent_field_data.resize((*dit)->getNbDofsOnEnt(),false);
874  ent_field_dofs.resize((*dit)->getNbDofsOnEnt(),false);
875  for(;dit!=hi_dit;dit++) {
876  const FieldData val = (*dit)->getFieldData();
877  const int idx = (*dit)->getEntDofIdx();
878  ent_field_data[idx] = val;
879  ent_field_dofs[idx] = *dit;
880  }
881  } else {
882  ent_field_data.resize(0,false);
883  ent_field_dofs.resize(0,false);
884  }
885  PetscFunctionReturn(0);
886 }
double FieldData
Field data type.
Definition: Common.hpp:32

◆ getTypeFieldData() [2/2]

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

Definition at line 888 of file ForcesAndSourcesCore.cpp.

893  {
894 
895  PetscFunctionBegin;
896  SideNumber_multiIndex& side_table = const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
897  // if(data.size() < side_table.get<2>().count(type)) {
898  // SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
899  // }
900  SideNumber_multiIndex::nth_index<2>::type::iterator siit,hi_siit;
901  siit = side_table.get<2>().lower_bound(type);
902  hi_siit = side_table.get<2>().upper_bound(type);
903  const boost::tuple<const boost::string_ref,EntityType> tuple = boost::make_tuple(field_name,type);
904  FEDofEntityByNameAndType::iterator dit,hi_dit;
905  dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(tuple);
906  if(dit == dofs.get<Composite_Name_And_Type_mi_tag>().end()) {
907  for(
908  SideNumber_multiIndex::nth_index<2>::type::iterator
909  siiit = siit;siiit!=hi_siit;siiit++
910  ) {
911  const int side_number = siiit->get()->side_number;
912  data[side_number].getFieldData().resize(0,false);
913  data[side_number].getFieldDofs().resize(0,false);
914  }
915  PetscFunctionReturn(0);
916  }
917  for(
918  SideNumber_multiIndex::nth_index<2>::type::iterator
919  siiit = siit;siiit!=hi_siit;siiit++
920  ) {
921  const int side_number = siiit->get()->side_number;
922  data[side_number].semaphore = false;
923  }
924  hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(tuple);
925  for(;dit!=hi_dit;dit++) {
926  const int side = dit->get()->sideNumberPtr->side_number;
927  const int nb_dofs_on_ent = (*dit)->getNbDofsOnEnt();
928  VectorDouble &ent_field_data = data[side].getFieldData();
929  VectorDofs &ent_field_dofs = data[side].getFieldDofs();
930  if(!data[side].semaphore) {
931  data[side].semaphore = true;
932  ent_field_data.resize(nb_dofs_on_ent,false);
933  ent_field_dofs.resize(nb_dofs_on_ent,false);
934  }
935  if(!nb_dofs_on_ent) {
936  continue;
937  }
938  const int idx = dit->get()->getEntDofIdx();
939  ent_field_data[idx] = dit->get()->getFieldData();
940  ent_field_dofs[idx] = *dit;
941  }
942  for(;siit!=hi_siit;siit++) {
943  const int side_number = siit->get()->side_number;
944  if(!data[side_number].semaphore) {
945  data[side_number].getFieldData().resize(0,false);
946  data[side_number].getFieldDofs().resize(0,false);
947  }
948  if(siit->get()->brother_side_number!=-1) {
949  if(data.size() < (unsigned int)siit->get()->brother_side_number) {
950  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
951  }
953  field_name,dofs,type,side_number,
954  data[siit->get()->brother_side_number].getFieldData(),
955  data[siit->get()->brother_side_number].getFieldDofs()
956  ); CHKERRQ(ierr);
957  }
958  }
959  PetscFunctionReturn(0);
960 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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.
ublas::vector< boost::shared_ptr< const FEDofEntity >, DofsAllacator > VectorDofs
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)
ublas::vector< double, DoubleAllacator > VectorDouble
Definition: Common.hpp:135
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.

◆ getTypeIndices() [1/2]

PetscErrorCode 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 424 of file ForcesAndSourcesCore.cpp.

426  {
427  //
428  PetscFunctionBegin;
429  FENumeredDofEntity_multiIndex::index<Composite_Name_Type_And_Side_Number_mi_tag>::type::iterator dit,hi_dit;
430  dit = dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().lower_bound(boost::make_tuple(field_name,type,side_number));
431  if(dit==dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().end()) {
432  indices.resize(0);
433  local_indices.resize(0);
434  PetscFunctionReturn(0);
435  }
436  hi_dit = dofs.get<Composite_Name_Type_And_Side_Number_mi_tag>().upper_bound(boost::make_tuple(field_name,type,side_number));
437  if(dit!=hi_dit) {
438  indices.resize((*dit)->getNbDofsOnEnt(),false);
439  local_indices.resize((*dit)->getNbDofsOnEnt(),false);
440  for(;dit!=hi_dit;dit++) {
441  int idx = (*dit)->getPetscGlobalDofIdx();
442  int elemem_idx = (*dit)->getEntDofIdx();
443  indices[elemem_idx] = idx;
444  int local_idx = (*dit)->getPetscLocalDofIdx();
445  local_indices[elemem_idx] = local_idx;
446  }
447  } else {
448  indices.resize(0);
449  local_indices.resize(0);
450  }
451  PetscFunctionReturn(0);
452 }

◆ getTypeIndices() [2/2]

PetscErrorCode 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 454 of file ForcesAndSourcesCore.cpp.

457  {
458 
459  PetscFunctionBegin;
460  SideNumber_multiIndex& side_table = const_cast<SideNumber_multiIndex&>(numeredEntFiniteElementPtr->getSideNumberTable());
461  SideNumber_multiIndex::nth_index<2>::type::iterator siit = side_table.get<2>().lower_bound(type);
462  SideNumber_multiIndex::nth_index<2>::type::iterator hi_siit = side_table.get<2>().upper_bound(type);
463  const boost::tuple<const boost::string_ref,EntityType> tuple
464  = boost::make_tuple(field_name,type);
465  FENumeredDofEntityByNameAndType::iterator dit,hi_dit;
466  dit = dofs.get<Composite_Name_And_Type_mi_tag>().lower_bound(tuple);
467  if(dit == dofs.get<Composite_Name_And_Type_mi_tag>().end()) {
468  for(
469  SideNumber_multiIndex::nth_index<2>::type::iterator
470  siiit = siit;siiit!=hi_siit;siiit++
471  ) {
472  data[siiit->get()->side_number].getIndices().resize(0,false);
473  data[siiit->get()->side_number].getLocalIndices().resize(0,false);
474  }
475  PetscFunctionReturn(0);
476  }
477  for(
478  SideNumber_multiIndex::nth_index<2>::type::iterator
479  siiit = siit;siiit!=hi_siit;siiit++
480  ) {
481  const int side_number = siiit->get()->side_number;
482  data[side_number].semaphore = false;
483  }
484  hi_dit = dofs.get<Composite_Name_And_Type_mi_tag>().upper_bound(tuple);
485  for(;dit!=hi_dit;dit++) {
486  const int side = dit->get()->sideNumberPtr->side_number;
487  const int nb_dofs_on_ent = dit->get()->getNbDofsOnEnt();
488  VectorInt &indices = data[side].getIndices();
489  VectorInt &local_indices = data[side].getLocalIndices();
490  if(!data[side].semaphore) {
491  data[side].semaphore = true;
492  indices.resize(nb_dofs_on_ent,false);
493  local_indices.resize(nb_dofs_on_ent,false);
494  }
495  if(!nb_dofs_on_ent) {
496  continue;
497  }
498  const int idx = dit->get()->getEntDofIdx();
499  indices[idx] = dit->get()->getPetscGlobalDofIdx();
500  local_indices[idx] = dit->get()->getPetscLocalDofIdx();
501  }
502  for(;siit!=hi_siit;siit++) {
503  const int side_number = siit->get()->side_number;
504  if(!data[side_number].semaphore) {
505  data[side_number].getIndices().resize(0,false);
506  data[side_number].getLocalIndices().resize(0,false);
507  }
508  if(siit->get()->brother_side_number!=-1) {
510  field_name,
511  dofs,type,
512  side_number,
513  data[siit->get()->brother_side_number].getIndices(),
514  data[siit->get()->brother_side_number].getLocalIndices()
515  ); CHKERRQ(ierr);
516  }
517  }
518  PetscFunctionReturn(0);
519 }
static PetscErrorCode ierr
Definition: Common.hpp:26
PetscErrorCode 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)
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
CHKERRQ(ierr)
ublas::vector< int, IntAllacator > VectorInt
Definition: Common.hpp:134
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.

◆ operator()()

virtual PetscErrorCode 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 575 of file ForcesAndSourcesCore.hpp.

575  {
576  PetscFunctionBegin;
577  if(operatorHook) {
579  }
580  PetscFunctionReturn(0);
581  }
boost::function< PetscErrorCode()> operatorHook
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)

◆ postProcess()

virtual PetscErrorCode 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.

Examples:
Remodeling.hpp.

Definition at line 582 of file ForcesAndSourcesCore.hpp.

582  {
583  PetscFunctionBegin;
584  if(postProcessHook) {
586  }
587  PetscFunctionReturn(0);
588  }
static PetscErrorCode ierr
Definition: Common.hpp:26
boost::function< PetscErrorCode()> postProcessHook
CHKERRQ(ierr)

◆ preProcess()

virtual PetscErrorCode 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, SurfaceSlidingConstrains::MyTriangleFE, SolidShellModule::SolidShellPrismElement::SolidShellError, SolidShellModule::SolidShellPrismElement::SolidShell, NeummanForcesSurfaceComplexForLazy::MyTriangleSpatialFE, GriffithForceElement::MyTriangleFE, NonlinearElasticElement::MyVolumeFE, Smoother::MyVolumeFE, and FluidPressure::MyTriangleFE.

Examples:
Remodeling.hpp.

Definition at line 568 of file ForcesAndSourcesCore.hpp.

568  {
569  PetscFunctionBegin;
570  if(preProcessHook) {
572  }
573  PetscFunctionReturn(0);
574  }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
boost::function< PetscErrorCode()> preProcessHook

◆ setGaussPts() [1/2]

virtual PetscErrorCode 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 336 of file ForcesAndSourcesCore.hpp.

336  {
337  PetscFunctionBegin;
338  SETERRQ(PETSC_COMM_SELF,MOFEM_NOT_IMPLEMENTED,"sorry, not implemented");
339  PetscFunctionReturn(0);
340  }

◆ setGaussPts() [2/2]

virtual PetscErrorCode 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

MatrixDouble gaussPts;

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 364 of file ForcesAndSourcesCore.hpp.

364  {
365 
366  PetscFunctionBegin;
367  ierr = setGaussPts(order_data); CHKERRQ(ierr);
368  PetscFunctionReturn(0);
369  }
static PetscErrorCode ierr
Definition: Common.hpp:26
CHKERRQ(ierr)
virtual PetscErrorCode setGaussPts(int order)
It will be removed in the future use other variant.

Member Data Documentation

◆ 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 319 of file ForcesAndSourcesCore.hpp.

◆ mField

Interface& MoFEM::ForcesAndSourcesCore::mField

◆ opPtrVector

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

Definition at line 559 of file ForcesAndSourcesCore.hpp.


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