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>>>;
923 const int verb =
QUIET,
942 const int verb =
QUIET,
957 const int verb =
QUIET,
972 const int verb =
QUIET,
999 boost::shared_ptr<const NumeredEntFiniteElement>
1000 ForcesAndSourcesCore::UserDataOperator::getNumeredEntFiniteElementPtr()
const {
1004 EntityHandle ForcesAndSourcesCore::UserDataOperator::getFEEntityHandle()
const {
1005 return getNumeredEntFiniteElementPtr()->getEnt();
1008 int ForcesAndSourcesCore::UserDataOperator::getFEDim()
const {
1012 EntityType ForcesAndSourcesCore::UserDataOperator::getFEType()
const {
1016 boost::weak_ptr<SideNumber>
1017 ForcesAndSourcesCore::UserDataOperator::getSideNumberPtr(
1018 const int side_number,
const EntityType
type) {
1019 auto &side_table_by_side_and_type =
1020 ptrFE->numeredEntFiniteElementPtr->getSideNumberTable().get<1>();
1022 side_table_by_side_and_type.find(boost::make_tuple(
type, side_number));
1023 if (side_it != side_table_by_side_and_type.end())
1026 return boost::weak_ptr<SideNumber>();
1030 ForcesAndSourcesCore::UserDataOperator::getSideEntity(
const int side_number,
1031 const EntityType
type) {
1032 if (
auto side_ptr = getSideNumberPtr(side_number,
type).lock())
1033 return side_ptr->ent;
1038 int ForcesAndSourcesCore::UserDataOperator::getNumberOfNodesOnElement()
const {
1039 return ptrFE->getNumberOfNodes();
1042 const FEMethod *ForcesAndSourcesCore::UserDataOperator::getFEMethod()
const {
1046 int ForcesAndSourcesCore::UserDataOperator::getOpType()
const {
return opType; }
1048 void ForcesAndSourcesCore::UserDataOperator::setOpType(
const OpType type) {
1052 void ForcesAndSourcesCore::UserDataOperator::addOpType(
const OpType type) {
1056 int ForcesAndSourcesCore::UserDataOperator::getNinTheLoop()
const {
1057 return getFEMethod()->getNinTheLoop();
1060 int ForcesAndSourcesCore::UserDataOperator::getLoopSize()
const {
1061 return getFEMethod()->getLoopSize();
1064 std::string ForcesAndSourcesCore::UserDataOperator::getFEName()
const {
1065 return getFEMethod()->getFEName();
1069 ForcesAndSourcesCore::UserDataOperator::getDataCtx()
const {
1070 return getFEMethod()->data_ctx;
1074 ForcesAndSourcesCore::UserDataOperator::getKSPCtx()
const {
1075 return getFEMethod()->ksp_ctx;
1079 ForcesAndSourcesCore::UserDataOperator::getSNESCtx()
const {
1080 return getFEMethod()->snes_ctx;
1084 ForcesAndSourcesCore::UserDataOperator::getTSCtx()
const {
1085 return getFEMethod()->ts_ctx;
1088 Vec ForcesAndSourcesCore::UserDataOperator::getKSPf()
const {
1090 if (getFEMethod()->ksp_f == PETSC_NULL)
1093 return getFEMethod()->ksp_f;
1096 Mat ForcesAndSourcesCore::UserDataOperator::getKSPA()
const {
1098 if (getFEMethod()->ksp_A == PETSC_NULL)
1101 return getFEMethod()->ksp_A;
1104 Mat ForcesAndSourcesCore::UserDataOperator::getKSPB()
const {
1106 if (getFEMethod()->ksp_B == PETSC_NULL)
1109 return getFEMethod()->ksp_B;
1112 Vec ForcesAndSourcesCore::UserDataOperator::getSNESf()
const {
1114 if (getFEMethod()->snes_f == PETSC_NULL)
1117 return getFEMethod()->snes_f;
1120 Vec ForcesAndSourcesCore::UserDataOperator::getSNESx()
const {
1122 if (getFEMethod()->snes_x == PETSC_NULL)
1125 return getFEMethod()->snes_x;
1128 Mat ForcesAndSourcesCore::UserDataOperator::getSNESA()
const {
1130 if (getFEMethod()->snes_A == PETSC_NULL)
1133 return getFEMethod()->snes_A;
1136 Mat ForcesAndSourcesCore::UserDataOperator::getSNESB()
const {
1138 if (getFEMethod()->snes_B == PETSC_NULL)
1141 return getFEMethod()->snes_B;
1144 Vec ForcesAndSourcesCore::UserDataOperator::getTSu()
const {
1146 if (getFEMethod()->ts_u == PETSC_NULL)
1149 return getFEMethod()->ts_u;
1152 Vec ForcesAndSourcesCore::UserDataOperator::getTSu_t()
const {
1154 if (getFEMethod()->ts_u_t == PETSC_NULL)
1157 return getFEMethod()->ts_u_t;
1160 Vec ForcesAndSourcesCore::UserDataOperator::getTSu_tt()
const {
1162 if (getFEMethod()->ts_u_tt == PETSC_NULL)
1165 return getFEMethod()->ts_u_tt;
1168 Vec ForcesAndSourcesCore::UserDataOperator::getTSf()
const {
1170 if (getFEMethod()->ts_F == PETSC_NULL)
1173 return getFEMethod()->ts_F;
1176 Mat ForcesAndSourcesCore::UserDataOperator::getTSA()
const {
1178 if (getFEMethod()->ts_A == PETSC_NULL)
1181 return getFEMethod()->ts_A;
1184 Mat ForcesAndSourcesCore::UserDataOperator::getTSB()
const {
1186 if (getFEMethod()->ts_B == PETSC_NULL)
1189 return getFEMethod()->ts_B;
1192 int ForcesAndSourcesCore::UserDataOperator::getTSstep()
const {
1194 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1197 return getFEMethod()->ts_step;
1200 double ForcesAndSourcesCore::UserDataOperator::getTStime()
const {
1202 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1205 return getFEMethod()->ts_t;
1208 double ForcesAndSourcesCore::UserDataOperator::getTStimeStep()
const {
1210 if ((getFEMethod()->data_ctx & PetscData::PetscData::CtxSetTime).none())
1213 return getFEMethod()->ts_dt;
1216 double ForcesAndSourcesCore::UserDataOperator::getTSa()
const {
1218 if ((getFEMethod()->data_ctx & (PetscData::CtxSetA | PetscData::CtxSetB))
1220 (getFEMethod()->data_ctx & (PetscData::CtxSetX_T)).none())
1223 return getFEMethod()->ts_a;
1226 double ForcesAndSourcesCore::UserDataOperator::getTSaa()
const {
1228 if ((getFEMethod()->data_ctx & (PetscData::CtxSetA | PetscData::CtxSetB))
1230 (getFEMethod()->data_ctx & (PetscData::CtxSetX_TT)).none())
1233 return getFEMethod()->ts_aa;
1240 auto ForcesAndSourcesCore::UserDataOperator::getFTensor0IntegrationWeight() {
1242 &(getGaussPts()(getGaussPts().size1() - 1, 0)));
1256 ForcesAndSourcesCore::UserDataOperator::getSidePtrFE()
const {
1261 ForcesAndSourcesCore::UserDataOperator::getRefinePtrFE()
const {
1265 MatrixDouble &ForcesAndSourcesCore::UserDataOperator::getCoordsAtGaussPts() {
1269 auto ForcesAndSourcesCore::UserDataOperator::getFTensor1CoordsAtGaussPts() {
1271 &getCoordsAtGaussPts()(0, 0), &getCoordsAtGaussPts()(0, 1),
1272 &getCoordsAtGaussPts()(0, 2));
1275 double ForcesAndSourcesCore::UserDataOperator::getMeasure()
const {
1279 double &ForcesAndSourcesCore::UserDataOperator::getMeasure() {
1289 template <
typename E>
1306 boost::shared_ptr<AdjCache> adj_cache =
nullptr)
1308 sideFEName(fe_name), sideDim(side_dim), sevLevel(sev),
1309 adjCache(adj_cache) {}
1313 return loopSide(sideFEName, sideFEPtr.get(), sideDim, 0,
VERBOSE, sevLevel,
1318 return sideFEPtr->getOpPtrVector();
1346 #endif //__FORCES_AND_SOURCES_CORE__HPP__