11 #ifndef __FORCES_AND_SOURCES_CORE__HPP__
12 #define __FORCES_AND_SOURCES_CORE__HPP__
14 using namespace boost::numeric;
27 typedef boost::function<
int(
int order_row,
int order_col,
int order_data)>
31 int order_row,
int order_col,
128 int getMaxDataOrder()
const;
131 int getMaxRowOrder()
const;
134 int getMaxColOrder()
const;
146 return dataOnElement[space]->dataOnEntities[
type][side];
177 const EntityType
type,
178 boost::ptr_vector<EntitiesFieldData::EntData> &data)
const;
190 boost::ptr_vector<EntitiesFieldData::EntData> &data)
const;
199 template <EntityType type>
212 template <EntityType type>
223 template <
typename EXTRACTOR>
225 getNodesIndices(
const int bit_number,
227 VectorInt &local_nodes_indices, EXTRACTOR &&extractor)
const;
231 const int bit_number)
const;
235 const int bit_number)
const;
237 template <
typename EXTRACTOR>
240 const EntityType type_lo,
241 const EntityType type_hi,
242 EXTRACTOR &&extractor)
const;
246 const EntityType type_lo = MBVERTEX,
247 const EntityType type_hi = MBPOLYHEDRON)
const;
251 const EntityType type_lo = MBVERTEX,
252 const EntityType type_hi = MBPOLYHEDRON)
const;
256 getNoFieldIndices(
const int bit_number,
257 boost::shared_ptr<FENumeredDofEntity_multiIndex> dofs,
262 const int bit_number)
const;
266 const int bit_number)
const;
287 const int bit_number)
const;
296 const int bit_number)
const;
300 const EntityType type_lo = MBVERTEX,
301 const EntityType type_hi = MBPOLYHEDRON)
const;
326 EntityType
type,
int side_number,
332 EntityType
type,
int side_number,
337 EntityType
type,
int side_number,
379 virtual int getRule(
int order_row,
int order_col,
int order_data);
448 virtual int getRule(
int order);
460 const std::array<boost::shared_ptr<EntitiesFieldData>,
LASTSPACE>
467 const std::array<boost::shared_ptr<EntitiesFieldData>,
LASTSPACE>
574 static const char *
const OpTypeNames[];
589 const bool symm =
true);
592 const bool symm =
true);
595 const std::string col_field_name,
const char type,
596 const bool symm =
true);
600 inline boost::shared_ptr<const NumeredEntFiniteElement>
601 getNumeredEntFiniteElementPtr()
const;
614 inline int getFEDim()
const;
621 inline EntityType getFEType()
const;
634 inline boost::weak_ptr<SideNumber> getSideNumberPtr(
const int side_number,
635 const EntityType
type);
669 inline EntityHandle getSideEntity(
const int side_number,
670 const EntityType
type);
677 inline int getNumberOfNodesOnElement()
const;
694 const EntityType
type,
const int side,
712 const EntityType
type,
const int side,
717 inline const FEMethod *getFEMethod()
const;
723 inline int getOpType()
const;
740 inline int getNinTheLoop()
const;
746 inline int getLoopSize()
const;
750 inline std::string getFEName()
const;
768 inline Vec getKSPf()
const;
770 inline Mat getKSPA()
const;
772 inline Mat getKSPB()
const;
780 inline Vec getSNESf()
const;
782 inline Vec getSNESx()
const;
784 inline Mat getSNESA()
const;
786 inline Mat getSNESB()
const;
794 inline Vec getTSu()
const;
796 inline Vec getTSu_t()
const;
798 inline Vec getTSu_tt()
const;
800 inline Vec getTSf()
const;
802 inline Mat getTSA()
const;
804 inline Mat getTSB()
const;
806 inline int getTSstep()
const;
808 inline double getTStime()
const;
810 inline double getTStimeStep()
const;
812 inline double getTSa()
const;
814 inline double getTSaa()
const;
848 inline auto getFTensor0IntegrationWeight();
876 inline auto getFTensor1CoordsAtGaussPts();
888 inline double getMeasure()
const;
894 inline double &getMeasure();
904 std::vector<boost::weak_ptr<NumeredEntFiniteElement>>>;
922 const int verb =
QUIET,
941 const int verb =
QUIET,
956 const int verb =
QUIET,
971 const int verb =
QUIET,
998 boost::shared_ptr<const NumeredEntFiniteElement>
999 ForcesAndSourcesCore::UserDataOperator::getNumeredEntFiniteElementPtr()
const {
1003 EntityHandle ForcesAndSourcesCore::UserDataOperator::getFEEntityHandle()
const {
1004 return getNumeredEntFiniteElementPtr()->getEnt();
1007 int ForcesAndSourcesCore::UserDataOperator::getFEDim()
const {
1011 EntityType ForcesAndSourcesCore::UserDataOperator::getFEType()
const {
1015 boost::weak_ptr<SideNumber>
1016 ForcesAndSourcesCore::UserDataOperator::getSideNumberPtr(
1017 const int side_number,
const EntityType
type) {
1018 auto &side_table_by_side_and_type =
1019 ptrFE->numeredEntFiniteElementPtr->getSideNumberTable().get<1>();
1021 side_table_by_side_and_type.find(boost::make_tuple(
type, side_number));
1022 if (side_it != side_table_by_side_and_type.end())
1025 return boost::weak_ptr<SideNumber>();
1029 ForcesAndSourcesCore::UserDataOperator::getSideEntity(
const int side_number,
1030 const EntityType
type) {
1031 if (
auto side_ptr = getSideNumberPtr(side_number,
type).lock())
1032 return side_ptr->ent;
1037 int ForcesAndSourcesCore::UserDataOperator::getNumberOfNodesOnElement()
const {
1038 return ptrFE->getNumberOfNodes();
1041 const FEMethod *ForcesAndSourcesCore::UserDataOperator::getFEMethod()
const {
1045 int ForcesAndSourcesCore::UserDataOperator::getOpType()
const {
return opType; }
1047 void ForcesAndSourcesCore::UserDataOperator::setOpType(
const OpType type) {
1051 void ForcesAndSourcesCore::UserDataOperator::addOpType(
const OpType type) {
1055 int ForcesAndSourcesCore::UserDataOperator::getNinTheLoop()
const {
1056 return getFEMethod()->getNinTheLoop();
1059 int ForcesAndSourcesCore::UserDataOperator::getLoopSize()
const {
1060 return getFEMethod()->getLoopSize();
1063 std::string ForcesAndSourcesCore::UserDataOperator::getFEName()
const {
1064 return getFEMethod()->getFEName();
1068 ForcesAndSourcesCore::UserDataOperator::getDataCtx()
const {
1069 return getFEMethod()->data_ctx;
1073 ForcesAndSourcesCore::UserDataOperator::getKSPCtx()
const {
1074 return getFEMethod()->ksp_ctx;
1078 ForcesAndSourcesCore::UserDataOperator::getSNESCtx()
const {
1079 return getFEMethod()->snes_ctx;
1083 ForcesAndSourcesCore::UserDataOperator::getTSCtx()
const {
1084 return getFEMethod()->ts_ctx;
1087 Vec ForcesAndSourcesCore::UserDataOperator::getKSPf()
const {
1089 if (getFEMethod()->ksp_f == PETSC_NULL)
1092 return getFEMethod()->ksp_f;
1095 Mat ForcesAndSourcesCore::UserDataOperator::getKSPA()
const {
1097 if (getFEMethod()->ksp_A == PETSC_NULL)
1100 return getFEMethod()->ksp_A;
1103 Mat ForcesAndSourcesCore::UserDataOperator::getKSPB()
const {
1105 if (getFEMethod()->ksp_B == PETSC_NULL)
1108 return getFEMethod()->ksp_B;
1111 Vec ForcesAndSourcesCore::UserDataOperator::getSNESf()
const {
1113 if (getFEMethod()->snes_f == PETSC_NULL)
1116 return getFEMethod()->snes_f;
1119 Vec ForcesAndSourcesCore::UserDataOperator::getSNESx()
const {
1121 if (getFEMethod()->snes_x == PETSC_NULL)
1124 return getFEMethod()->snes_x;
1127 Mat ForcesAndSourcesCore::UserDataOperator::getSNESA()
const {
1129 if (getFEMethod()->snes_A == PETSC_NULL)
1132 return getFEMethod()->snes_A;
1135 Mat ForcesAndSourcesCore::UserDataOperator::getSNESB()
const {
1137 if (getFEMethod()->snes_B == PETSC_NULL)
1140 return getFEMethod()->snes_B;
1143 Vec ForcesAndSourcesCore::UserDataOperator::getTSu()
const {
1145 if (getFEMethod()->ts_u == PETSC_NULL)
1148 return getFEMethod()->ts_u;
1151 Vec ForcesAndSourcesCore::UserDataOperator::getTSu_t()
const {
1153 if (getFEMethod()->ts_u_t == PETSC_NULL)
1156 return getFEMethod()->ts_u_t;
1159 Vec ForcesAndSourcesCore::UserDataOperator::getTSu_tt()
const {
1161 if (getFEMethod()->ts_u_tt == PETSC_NULL)
1164 return getFEMethod()->ts_u_tt;
1167 Vec ForcesAndSourcesCore::UserDataOperator::getTSf()
const {
1169 if (getFEMethod()->ts_F == PETSC_NULL)
1172 return getFEMethod()->ts_F;
1175 Mat ForcesAndSourcesCore::UserDataOperator::getTSA()
const {
1177 if (getFEMethod()->ts_A == PETSC_NULL)
1180 return getFEMethod()->ts_A;
1183 Mat ForcesAndSourcesCore::UserDataOperator::getTSB()
const {
1185 if (getFEMethod()->ts_B == PETSC_NULL)
1188 return getFEMethod()->ts_B;
1191 int ForcesAndSourcesCore::UserDataOperator::getTSstep()
const {
1193 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1196 return getFEMethod()->ts_step;
1199 double ForcesAndSourcesCore::UserDataOperator::getTStime()
const {
1201 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1204 return getFEMethod()->ts_t;
1207 double ForcesAndSourcesCore::UserDataOperator::getTStimeStep()
const {
1209 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1212 return getFEMethod()->ts_dt;
1215 double ForcesAndSourcesCore::UserDataOperator::getTSa()
const {
1217 if ((getFEMethod()->data_ctx & (PetscData::CtxSetA | PetscData::CtxSetB))
1219 (getFEMethod()->data_ctx & (PetscData::CtxSetX_T)).none())
1222 return getFEMethod()->ts_a;
1225 double ForcesAndSourcesCore::UserDataOperator::getTSaa()
const {
1227 if ((getFEMethod()->data_ctx & (PetscData::CtxSetA | PetscData::CtxSetB))
1229 (getFEMethod()->data_ctx & (PetscData::CtxSetX_TT)).none())
1232 return getFEMethod()->ts_aa;
1239 auto ForcesAndSourcesCore::UserDataOperator::getFTensor0IntegrationWeight() {
1241 &(getGaussPts()(getGaussPts().size1() - 1, 0)));
1255 ForcesAndSourcesCore::UserDataOperator::getSidePtrFE()
const {
1260 ForcesAndSourcesCore::UserDataOperator::getRefinePtrFE()
const {
1264 MatrixDouble &ForcesAndSourcesCore::UserDataOperator::getCoordsAtGaussPts() {
1268 auto ForcesAndSourcesCore::UserDataOperator::getFTensor1CoordsAtGaussPts() {
1270 &getCoordsAtGaussPts()(0, 0), &getCoordsAtGaussPts()(0, 1),
1271 &getCoordsAtGaussPts()(0, 2));
1274 double ForcesAndSourcesCore::UserDataOperator::getMeasure()
const {
1278 double &ForcesAndSourcesCore::UserDataOperator::getMeasure() {
1288 template <
typename E>
1303 boost::shared_ptr<AdjCache> adj_cache =
nullptr)
1305 fieldName(fe_name), sideDim(side_dim), sevLevel(sev),
1306 adjCache(adj_cache) {}
1311 CHKERR loopSide(fieldName, sideFEPtr.get(), sideDim, 0,
VERBOSE, sevLevel,
1317 return sideFEPtr->getOpPtrVector();
1345 #endif //__FORCES_AND_SOURCES_CORE__HPP__