v0.8.16
LoopMethods.hpp
Go to the documentation of this file.
1 /** \file LoopMethods.hpp
2  * \brief MoFEM interface
3  *
4  * Data structures for making loops over finite elements and entities in the
5  * problem or MoFEM database.
6  *
7  */
8 
9 /*
10  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
17  */
18 
19 #ifndef __LOOPMETHODS_HPP__
20 #define __LOOPMETHODS_HPP__
21 
22 namespace MoFEM {
23 
36 
37 /**
38  * \brief data structure for ksp (linear solver) context
39  * \ingroup mofem_loops
40  *
41  * Struture stores context data which are set in functions run by PETSc SNES
42  * functions.
43  *
44  */
45 struct KspMethod : virtual public UnknownInterface {
46 
48  UnknownInterface **iface) const {
50  if (uuid == IDD_MOFEMKspMethod) {
51  *iface = const_cast<KspMethod *>(this);
53  }
54  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
55  }
56 
57  /**
58  * \brief pass information about context of KSP/DM for with finite element is
59  * computed
60  */
62 
64  : ksp_ctx(CTX_KSPNONE), ksp(PETSC_NULL), ksp_f(PETSC_NULL),
65  ksp_A(PETSC_NULL), ksp_B(PETSC_NULL) {}
66 
67  virtual ~KspMethod() {}
68 
69  /**
70  * \brief set operator type
71  * @param ctx Context, CTX_SETFUNCTION, CTX_OPERATORS, CTX_KSPNONE
72  * @return error code
73  */
75 
76  /**
77  * \brief set solver
78  * @param ksp solver
79  * @return error code
80  */
82 
83  /**
84  * \brief copy data form another method
85  * @param ksp ksp method
86  * @return error code
87  */
89 
90  KSPContext ksp_ctx; ///< Context
91  KSP ksp; ///< KSP solver
92  Vec ksp_f; ///< the right hand side vector
93  Mat ksp_A; ///< matrix
94  Mat ksp_B; ///< preconditioner matrix
95 };
96 
97 /**
98  * \brief data structure for snes (nonlinear solver) context
99  * \ingroup mofem_loops
100  *
101  * Structure stores context data which are set in functions run by PETSc SNES
102  * functions.
103  *
104  */
105 struct SnesMethod : virtual public UnknownInterface {
106 
108  UnknownInterface **iface) const {
109  if (uuid == IDD_MOFEMSnesMethod) {
110  *iface = const_cast<SnesMethod *>(this);
112  }
113  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
114  }
115 
117 
120  : snes_ctx(CTX_SNESNONE), snes_x(PETSC_NULL), snes_f(PETSC_NULL),
121  snes_A(PETSC_NULL), snes_B(PETSC_NULL) {}
122 
123  virtual ~SnesMethod() {}
124 
125  /**
126  * \brief Set SNES context
127  */
129 
130  /**
131  * \brief Set SNES instance
132  */
134 
135  /**
136  * \brief Copy snes data
137  */
139 
140  SNES snes;
143 
144 };
145 
146 /**
147  * \brief data structure for TS (time stepping) context
148  * \ingroup mofem_loops
149  *
150  * Structure stores context data which are set in functions run by PETSc Time
151  * Stepping functions.
152  */
153 struct TSMethod : virtual public UnknownInterface {
154 
156  UnknownInterface **iface) const {
157  if (uuid == IDD_MOFEMTsMethod) {
158  *iface = const_cast<TSMethod *>(this);
160  }
161  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
162  }
163 
164  enum TSContext {
171  };
172 
175  : ts_ctx(CTX_TSNONE), ts_u(PETSC_NULL), ts_u_t(PETSC_NULL),
176  ts_F(PETSC_NULL), ts_A(PETSC_NULL), ts_B(PETSC_NULL), ts_step(-1),
177  ts_a(0), ts_t(0) {}
178 
179  virtual ~TSMethod() {}
180 
181  /// \brief Set Ts context
182  MoFEMErrorCode setTsCtx(const TSContext &ctx);
183 
184  /// \brief Copy TS solver data
186 
187  /// \brief Set TS solver
188  MoFEMErrorCode setTs(TS _ts);
189 
190  TS ts;
191  Vec ts_u, ts_u_t, ts_F;
192  Mat ts_A, ts_B;
193 
194  PetscInt ts_step;
195  PetscReal ts_a, ts_t;
196 
197 };
198 
199 /**
200  * \brief Data structure to exchange data between mofem and User Loop Methods.
201  * \ingroup mofem_loops
202  *
203  * It allows to exchange data between MoFEM and user functions. It stores
204  * information about multi-indices.
205  *
206  */
208 
210  UnknownInterface **iface) const {
211  if (uuid == IDD_MOFEMBasicMethod) {
212  *iface = const_cast<BasicMethod *>(this);
214  }
215  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "unknown interface");
216  }
217 
218  BasicMethod();
219  virtual ~BasicMethod(){};
220 
221  int nInTheLoop;
222  int loopSize;
223 
224  /** \brief get number of evaluated element in the loop
225  */
226  inline int getNinTheLoop() const { return nInTheLoop; }
227 
228  /** \brief get loop size
229  */
230  inline int getLoopSize() const { return loopSize; }
231 
232  int rAnk, sIze;
242 
244 
245  /**
246  * Hook function for pre-processing
247  */
248  boost::function<MoFEMErrorCode()> preProcessHook;
249 
250  /**
251  * Hook function for post-processing
252  */
253  boost::function<MoFEMErrorCode()> postProcessHook;
254 
255  /**
256  * Hook function for operator
257  */
258  boost::function<MoFEMErrorCode()> operatorHook;
259 
260  /** \brief function is run at the beginning of loop
261  *
262  * It is used to zeroing matrices and vectors, calculation of shape
263  * functions on reference element, preprocessing boundary conditions, etc.
264  */
265  virtual MoFEMErrorCode preProcess();
266 
267  /** \brief function is run for every finite element
268  *
269  * It is used to calculate element local matrices and assembly. It can be
270  * used for post-processing.
271  */
272  virtual MoFEMErrorCode operator()();
273 
274  /** \brief function is run at the end of loop
275  *
276  * It is used to assembly matrices and vectors, calculating global variables,
277  * f.e. total internal energy, ect.
278  *
279  * Iterating over dofs:
280  * Example1 iterating over dofs in row by name of the field
281  * for(_IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP_(this,"DISPLACEMENT",it)) { ... }
282  *
283  *
284  */
285  virtual MoFEMErrorCode postProcess();
286 
287 private:
288  void iNit();
289 };
290 
291 /**
292  * \brief structure for User Loop Methods on finite elements
293  * \ingroup mofem_loops
294  *
295  * It can be used to calculate stiffness matrices, residuals, load vectors etc.
296  * It is low level class however in some class users looking for speed and
297  * efficiency, can use it directly.
298  *
299  * This class is used with Interface::loop_finite_elements, where
300  * user overloaded operator FEMethod::operator() is executed for each element in
301  * the problem. Class have to additional methods which are overloaded by user,
302  * FEMethod::preProcess() and FEMethod::postProcess() executed at beginning and
303  * end of the loop over problem elements, respectively.
304  *
305  */
306 struct FEMethod : public BasicMethod {
307 
309  UnknownInterface **iface) const {
311  if (uuid == IDD_MOFEMFEMethod) {
312  *iface = const_cast<FEMethod *>(this);
314  }
315 
316  ierr = query_interface(uuid, iface);
317  CHKERRG(ierr);
319  }
320 
321  FEMethod();
322 
323  std::string feName;
324 
325  boost::shared_ptr<const NumeredEntFiniteElement> numeredEntFiniteElementPtr;
326  boost::shared_ptr<const FENumeredDofEntity_multiIndex> rowPtr;
327  boost::shared_ptr<const FENumeredDofEntity_multiIndex> colPtr;
328  boost::shared_ptr<const FEDofEntity_multiIndex> dataPtr;
329 
330 /** \brief loop over all dofs which are on a particular FE row
331  * \ingroup mofem_loops
332  */
333 #define _IT_GET_FEROW_DOFS_FOR_LOOP_(FE, IT) \
334  auto IT = FE->rowPtr->begin(); \
335  IT != FE->rowPtr->end(); \
336  IT++
337 
338 /** \brief loop over all dofs which are on a particular FE column
339  * \ingroup mofem_loops
340  */
341 #define _IT_GET_FECOL_DOFS_FOR_LOOP_(FE, IT) \
342  auto IT = FE->colPtr->begin(); \
343  IT != FE->colPtr->end(); \
344  IT++
345 
346 /** \brief loop over all dofs which are on a particular FE data
347  * \ingroup mofem_loops
348  */
349 #define _IT_GET_FEDATA_DOFS_FOR_LOOP_(FE, IT) \
350  auto IT = FE->dataPtr->begin(); \
351  IT != FE->dataPtr->end(); \
352  IT++
353 
354  template <class MULTIINDEX>
355  typename MULTIINDEX::iterator
356  get_begin(const MULTIINDEX &index, const std::string &field_name,
357  const EntityType type, const int side_number) const {
358  return index.lower_bound(boost::make_tuple(field_name, type, side_number));
359  }
360  template <class MULTIINDEX>
361  typename MULTIINDEX::iterator
362  get_end(const MULTIINDEX &index, const std::string &field_name,
363  const EntityType type, const int side_number) const {
364  return index.upper_bound(boost::make_tuple(field_name, type, side_number));
365  }
366 
367  /** \brief loop over all dofs which are on a particular FE row, field,
368  * entity type and canonical side number \ingroup mofem_loops
369  *
370  * \param FE finite elements
371  * \param Name field name
372  * \param Type moab entity type (MBVERTEX, MBEDGE etc)
373  * \param Side side canonical number
374  * \param IT the interator in use
375  */
376 #define _IT_GET_FEROW_BY_SIDE_DOFS_FOR_LOOP_(FE, NAME, TYPE, SIDE, IT) \
377  FENumeredDofEntity_multiIndex::index<Composite_mi_tag>::type::iterator IT = \
378  FE->get_begin< \
379  FENumeredDofEntity_multiIndex::index<Composite_mi_tag>::type>( \
380  FE->rowPtr->get<Composite_mi_tag>(), NAME, TYPE, SIDE); \
381  IT != FE->get_end< \
382  FENumeredDofEntity_multiIndex::index<Composite_mi_tag>::type>( \
383  FE->rowPtr->get<Composite_mi_tag>(), NAME, TYPE, SIDE); \
384  IT++
385 
386 /** \brief loop over all dofs which are on a particular FE column, field, entity
387  * type and canonical side number \ingroup mofem_loops
388  */
389 #define _IT_GET_FECOL_BY_SIDE_DOFS_FOR_LOOP_(FE, NAME, TYPE, SIDE, IT) \
390  FENumeredDofEntity_multiIndex::index<Composite_mi_tag>::type::iterator IT = \
391  FE->get_begin< \
392  FENumeredDofEntity_multiIndex::index<Composite_mi_tag>::type>( \
393  FE->colPtr->get<Composite_mi_tag>(), NAME, TYPE, SIDE); \
394  IT != FE->get_end< \
395  FENumeredDofEntity_multiIndex::index<Composite_mi_tag>::type>( \
396  FE->colPtr->get<Composite_mi_tag>(), NAME, TYPE, SIDE); \
397  IT++
398 
399 /** \brief loop over all dofs which are on a particular FE data, field, entity
400  * type and canonical side number \ingroup mofem_loops
401  */
402 #define _IT_GET_FEDATA_BY_SIDE_DOFS_FOR_LOOP_(FE, NAME, TYPE, SIDE, IT) \
403  FEDofEntity_multiIndex::index<Composite_mi_tag>::type::iterator IT = \
404  FE->get_begin<FEDofEntity_multiIndex::index<Composite_mi_tag>::type>( \
405  FE->dataPtr->get<Composite_mi_tag>(), NAME, TYPE, SIDE); \
406  IT != FE->get_end<FEDofEntity_multiIndex::index<Composite_mi_tag>::type>( \
407  FE->dataPtr->get<Composite_mi_tag>(), NAME, TYPE, SIDE); \
408  IT++
409 
410  template <class MULTIINDEX>
411  typename MULTIINDEX::iterator get_begin(const MULTIINDEX &index,
412  const std::string &field_name,
413  const EntityType type) const {
414  return index.lower_bound(boost::make_tuple(field_name, type));
415  }
416  template <class MULTIINDEX>
417  typename MULTIINDEX::iterator get_end(const MULTIINDEX &index,
418  const std::string &field_name,
419  const EntityType type) const {
420  return index.upper_bound(boost::make_tuple(field_name, type));
421  }
422 
423 /** \brief loop over all dofs which are on a particular FE row, field and entity
424  * type \ingroup mofem_loops
425  */
426 #define _IT_GET_FEROW_BY_TYPE_DOFS_FOR_LOOP_(FE, NAME, TYPE, IT) \
427  auto IT = FE->get_begin<FENumeredDofEntityByNameAndType>( \
428  FE->rowPtr->get<Composite_Name_And_Type_mi_tag>(), NAME, TYPE); \
429  IT != FE->get_end<FENumeredDofEntityByNameAndType>( \
430  FE->rowPtr->get<Composite_Name_And_Type_mi_tag>(), NAME, TYPE); \
431  IT++
432 
433 /** \brief loop over all dofs which are on a particular FE column, field and
434  * entity type \ingroup mofem_loops
435  */
436 #define _IT_GET_FECOL_BY_TYPE_DOFS_FOR_LOOP_(FE, NAME, TYPE, IT) \
437  auto IT = FE->get_begin<FENumeredDofEntityByNameAndType>( \
438  FE->colPtr->get<Composite_Name_And_Type_mi_tag>(), NAME, TYPE); \
439  IT != FE->get_end<FENumeredDofEntityByNameAndType>( \
440  FE->colPtr->get<Composite_Name_And_Type_mi_tag>(), NAME, TYPE); \
441  IT++
442 
443 /** \brief loop over all dofs which are on a particular FE data, field and
444  * entity type \ingroup mofem_loops
445  */
446 #define _IT_GET_FEDATA_BY_TYPE_DOFS_FOR_LOOP_(FE, NAME, TYPE, IT) \
447  auto IT = FE->get_begin<FEDofEntityByNameAndType>( \
448  FE->dataPtr->get<Composite_Name_And_Type_mi_tag>(), NAME, TYPE); \
449  IT != FE->get_end<FEDofEntityByNameAndType>( \
450  FE->dataPtr->get<Composite_Name_And_Type_mi_tag>(), NAME, TYPE); \
451  IT++
452 
453  template <class MULTIINDEX>
454  typename MULTIINDEX::iterator get_begin(const MULTIINDEX &index,
455  const std::string &field_name) const {
456  return index.lower_bound(field_name);
457  }
458  template <class MULTIINDEX>
459  typename MULTIINDEX::iterator get_end(const MULTIINDEX &index,
460  const std::string &field_name) const {
461  return index.upper_bound(field_name);
462  }
463 
464 /** \brief loop over all dofs which are on a particular FE row and field
465  * \ingroup mofem_loops
466  */
467 #define _IT_GET_FEROW_BY_NAME_DOFS_FOR_LOOP_(FE, NAME, IT) \
468  auto IT = FE->get_begin<FENumeredDofEntityByFieldName>( \
469  FE->rowPtr->get<FieldName_mi_tag>(), NAME); \
470  IT != FE->get_end<FENumeredDofEntityByFieldName>( \
471  FE->rowPtr->get<FieldName_mi_tag>(), NAME); \
472  IT++
473 
474 /** \brief loop over all dofs which are on a particular FE column and field
475  * \ingroup mofem_loops
476  */
477 #define _IT_GET_FECOL_BY_NAME_DOFS_FOR_LOOP_(FE, NAME, IT) \
478  auto IT = FE->get_begin<FENumeredDofEntityByFieldName>( \
479  FE->colPtr->get<FieldName_mi_tag>(), NAME); \
480  IT != FE->get_end<FENumeredDofEntityByFieldName>( \
481  FE->colPtr->get<FieldName_mi_tag>(), NAME); \
482  IT++
483 
484 /** \brief loop over all dofs which are on a particular FE data and field
485  * \ingroup mofem_loops
486  */
487 #define _IT_GET_FEDATA_BY_NAME_DOFS_FOR_LOOP_(FE, NAME, IT) \
488  auto IT = FE->get_begin<FEDofEntityByFieldName>( \
489  FE->dataPtr->get<FieldName_mi_tag>(), NAME); \
490  IT != FE->get_end<FEDofEntityByFieldName>( \
491  FE->dataPtr->get<FieldName_mi_tag>(), NAME); \
492  IT++
493 
494  template <class MULTIINDEX>
495  typename MULTIINDEX::iterator get_begin(const MULTIINDEX &index,
496  const EntityHandle ent) const {
497  return index.lower_bound(ent);
498  }
499  template <class MULTIINDEX>
500  typename MULTIINDEX::iterator get_end(const MULTIINDEX &index,
501  const EntityHandle ent) const {
502  return index.upper_bound(ent);
503  }
504 
505 /** \brief loop over all dofs which are on a particular FE row and given element
506  * entity (handle from moab) \ingroup mofem_loops
507  */
508 #define _IT_GET_FEROW_DOFS_BY_ENT_FOR_LOOP_(FE, ENT, IT) \
509  auto IT = FE->get_begin<FENumeredDofEntityByEnt>( \
510  FE->rowPtr->get<Ent_mi_tag>(), ENT); \
511  IT != FE->get_end<FENumeredDofEntityByEnt>(FE->rowPtr->get<Ent_mi_tag>(), \
512  ENT); \
513  IT++
514 
515 /** \brief loop over all dofs which are on a particular FE column and given
516  * element entity (handle from moab) \ingroup mofem_loops
517  */
518 #define _IT_GET_FECOL_DOFS_BY_ENT_FOR_LOOP_(FE, ENT, IT) \
519  auto IT = FE->get_begin<FENumeredDofEntityByEnt>( \
520  FE->colPtr->get<Ent_mi_tag>(), ENT); \
521  IT != FE->get_end<FENumeredDofEntityByEnt>(FE->colPtr->get<Ent_mi_tag>(), \
522  ENT); \
523  IT++
524 
525 /** \brief loop over all dofs which are on a particular FE data and given
526  * element entity (handle from moab) \ingroup mofem_loops
527  */
528 #define _IT_GET_FEDATA_DOFS_BY_ENT_FOR_LOOP_(FE, ENT, IT) \
529  auto IT = FE->get_begin<FEDofEntity_multiIndex::index<Ent_mi_tag>::type>( \
530  FE->dataPtr->get<Ent_mi_tag>(), ENT); \
531  IT != FE->get_end<FEDofEntity_multiIndex::index<Ent_mi_tag>::type>( \
532  FE->dataPtr->get<Ent_mi_tag>(), ENT); \
533  IT++
534 
535  template <class MULTIINDEX>
536  typename MULTIINDEX::iterator get_begin(const MULTIINDEX &index,
537  const std::string &field_name,
538  const EntityHandle ent) const {
539  return index.lower_bound(boost::make_tuple(field_name, ent));
540  }
541  template <class MULTIINDEX>
542  typename MULTIINDEX::iterator get_end(const MULTIINDEX &index,
543  const std::string &field_name,
544  const EntityHandle ent) const {
545  return index.upper_bound(boost::make_tuple(field_name, ent));
546  }
547 
548 /** \brief loop over all dofs which are on a particular FE row, field and given
549  * element entity (handle from moab) \ingroup mofem_loops
550  */
551 #define _IT_GET_FEROW_DOFS_BY_NAME_AND_ENT_FOR_LOOP_(FE, NAME, ENT, IT) \
552  auto IT = FE->get_begin<FENumeredDofEntityByNameAndEnt>( \
553  FE->rowPtr->get<Composite_Name_And_Ent_mi_tag>(), NAME, ENT); \
554  IT != FE->get_end<FENumeredDofEntityByNameAndEnt>( \
555  FE->rowPtr->get<Composite_Name_And_Ent_mi_tag>(), NAME, ENT); \
556  IT++
557 
558 /** \brief loop over all dofs which are on a particular FE column, field and
559  * given element entity (handle from moab) \ingroup mofem_loops
560  */
561 #define _IT_GET_FECOL_DOFS_BY_NAME_AND_ENT_FOR_LOOP_(FE, NAME, ENT, IT) \
562  auto IT = FE->get_begin<FENumeredDofEntityByNameAndEnt>( \
563  FE->colPtr->get<Composite_Name_And_Ent_mi_tag>(), NAME, ENT); \
564  IT != FE->get_end<FENumeredDofEntityByNameAndEnt>( \
565  FE->colPtr->get<Composite_Name_And_Ent_mi_tag>(), NAME, ENT); \
566  IT++
567 
568 /** \brief loop over all dofs which are on a particular FE data, field and given
569  * element entity (handle from moab) \ingroup mofem_loops
570  */
571 #define _IT_GET_FEDATA_DOFS_BY_NAME_AND_ENT_FOR_LOOP_(FE, NAME, ENT, IT) \
572  auto IT = FE->get_begin<FEDofEntityByNameAndEnt>( \
573  FE->dataPtr->get<Composite_Name_And_Ent_mi_tag>(), NAME, ENT); \
574  IT != FE->get_end<FEDofEntityByNameAndEnt>( \
575  FE->dataPtr->get<Composite_Name_And_Ent_mi_tag>(), NAME, ENT); \
576  IT++
577 };
578 
579 /**
580  * \brief Data structure to exchange data between mofem and User Loop Methods on
581  * entities. \ingroup mofem_loops
582  *
583  * \todo Add implementation to loop over entities in the problem
584  *
585  * It allows to exchange data between MoFEM and user functions. It stores
586  * information about multi-indices.
587  */
588 struct EntityMethod : public BasicMethod {
589 
591  UnknownInterface **iface) const {
593  if (uuid == IDD_MOFEMEntityMethod) {
594  *iface = const_cast<EntityMethod *>(this);
596  }
597  CHKERR query_interface(uuid, iface);
599  }
600 
601  EntityMethod();
602 
603  boost::shared_ptr<Field> fieldPtr;
604  boost::shared_ptr<FieldEntity> entPtr;
605 
606 };
607 
608 
609 /**
610  * \brief Data structure to exchange data between mofem and User Loop Methods on
611  * entities. \ingroup mofem_loops
612  *
613  * It allows to exchange data between MoFEM and user functions. It stores
614  * information about multi-indices.
615  */
616 struct DofMethod : public BasicMethod {
617 
619  UnknownInterface **iface) const {
621  if (uuid == IDD_MOFEMDofMethod) {
622  *iface = const_cast<DofMethod *>(this);
624  }
625 
626  CHKERR query_interface(uuid, iface);
628  }
629 
630  DofMethod();
631 
632  boost::shared_ptr<Field> fieldPtr;
633  boost::shared_ptr<DofEntity> dofPtr;
634  boost::shared_ptr<NumeredDofEntity> dofNumeredPtr;
635 };
636 
637 /// \deprecated name changed use DofMethod insead EntMethod
639 
640 } // namespace MoFEM
641 
642 #endif // __LOOPMETHODS_HPP__
643 
644 /***************************************************************************/ /**
645  * \defgroup mofem_loops Loops
646  * \ingroup mofem
647  ******************************************************************************/
MULTIINDEX::iterator get_end(const MULTIINDEX &index, const EntityHandle ent) const
boost::shared_ptr< DofEntity > dofPtr
structure for User Loop Methods on finite elementsIt can be used to calculate stiffness matrices...
const DofEntity_multiIndex * dofsPtr
const FieldEntityEntFiniteElementAdjacencyMap_multiIndex * adjacenciesPtr
MoFEM interface unique ID.
boost::shared_ptr< Field > fieldPtr
KSP ksp
KSP solver.
Definition: LoopMethods.hpp:91
MULTIINDEX::iterator get_begin(const MULTIINDEX &index, const std::string &field_name, const EntityType type, const int side_number) const
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Common.hpp:60
virtual MoFEMErrorCode postProcess()
function is run at the end of loop
Mat ksp_B
preconditioner matrix
Definition: LoopMethods.hpp:94
MULTIINDEX::iterator get_end(const MULTIINDEX &index, const std::string &field_name) const
MULTIINDEX::iterator get_begin(const MULTIINDEX &index, const std::string &field_name, const EntityHandle ent) const
multi_index_container< boost::shared_ptr< RefElement >, indexed_by< ordered_unique< tag< Ent_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityHandle, &RefElement::getRefEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefElement::interface_type_RefEntity, EntityType, &RefElement::getEntType > > > > RefElement_multiIndex
multi_index_container< FieldEntityEntFiniteElementAdjacencyMap, indexed_by< ordered_unique< tag< Composite_Unique_mi_tag >, composite_key< FieldEntityEntFiniteElementAdjacencyMap, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getEntUniqueId >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getFeUniqueId > > >, ordered_non_unique< tag< Unique_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getEntUniqueId > >, ordered_non_unique< tag< FE_Unique_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, UId, &FieldEntityEntFiniteElementAdjacencyMap::getFeUniqueId > >, ordered_non_unique< tag< FEEnt_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, EntityHandle, &FieldEntityEntFiniteElementAdjacencyMap::getFeHandle > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntityEntFiniteElementAdjacencyMap, EntityHandle, &FieldEntityEntFiniteElementAdjacencyMap::getEntHandle > > >> FieldEntityEntFiniteElementAdjacencyMap_multiIndex
MultiIndex container keeps Adjacencies Element and dof entities adjacencies and vice versa...
const Field_multiIndex * fieldsPtr
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
Definition: LoopMethods.hpp:47
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
int getLoopSize() const
get loop size
multi_index_container< boost::shared_ptr< FiniteElement >, indexed_by< hashed_unique< tag< FiniteElement_Meshset_mi_tag >, member< FiniteElement, EntityHandle, &FiniteElement::meshset > >, hashed_unique< tag< BitFEId_mi_tag >, const_mem_fun< FiniteElement, BitFEId, &FiniteElement::getId >, HashBit< BitFEId >, EqBit< BitFEId > >, ordered_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< FiniteElement, boost::string_ref, &FiniteElement::getNameRef > > > > FiniteElement_multiIndex
MultiIndex for entities for FiniteElement.
const FiniteElement_multiIndex * finiteElementsPtr
virtual MoFEMErrorCode operator()()
function is run for every finite element
MoFEMErrorCode setSnes(SNES snes)
Set SNES instance.
Definition: LoopMethods.cpp:48
Data structure to exchange data between mofem and User Loop Methods on entities.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:483
MULTIINDEX::iterator get_begin(const MULTIINDEX &index, const std::string &field_name) const
const FieldEntity_multiIndex * entitiesPtr
base class for all interface classes
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:459
virtual ~BasicMethod()
MULTIINDEX::iterator get_end(const MULTIINDEX &index, const std::string &field_name, const EntityType type, const int side_number) const
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:526
std::string feName
multi_index_container< boost::shared_ptr< Field >, indexed_by< hashed_unique< tag< BitFieldId_mi_tag >, const_mem_fun< Field, const BitFieldId &, &Field::getId >, HashBit< BitFieldId >, EqBit< BitFieldId > >, ordered_unique< tag< Meshset_mi_tag >, member< Field, EntityHandle, &Field::meshSet > >, ordered_unique< tag< FieldName_mi_tag >, const_mem_fun< Field, boost::string_ref, &Field::getNameRef > >, ordered_non_unique< tag< BitFieldId_space_mi_tag >, const_mem_fun< Field, FieldSpace, &Field::getSpace > > > > Field_multiIndex
Field_multiIndex for Field.
const RefElement_multiIndex * refinedFiniteElementsPtr
virtual ~SnesMethod()
data structure for snes (nonlinear solver) contextStructure stores context data which are set in func...
boost::shared_ptr< Field > fieldPtr
int getNinTheLoop() const
get number of evaluated element in the loop
static const MOFEMuuid IDD_MOFEMBasicMethod
Definition: LoopMethods.hpp:29
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:490
Data structure to exchange data between mofem and User Loop Methods on entities.It allows to exchange...
keeps basic data about problemThis is low level structure with information about problem, what elements compose problem and what DOFs are on rows and columns.
KSPContext ksp_ctx
Context.
Definition: LoopMethods.hpp:90
boost::shared_ptr< const FEDofEntity_multiIndex > dataPtr
multi_index_container< boost::shared_ptr< FieldEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< FieldEntity, UId, &FieldEntity::globalUid > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< FieldEntity::interface_type_Field, boost::string_ref, &FieldEntity::getNameRef > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< FieldEntity, EntityHandle, &FieldEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< FieldEntity, const_mem_fun< FieldEntity::interface_type_Field, boost::string_ref, &FieldEntity::getNameRef >, const_mem_fun< FieldEntity, EntityHandle, &FieldEntity::getEnt > > > > > FieldEntity_multiIndex
MultiIndex container keeps FieldEntity.
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
MULTIINDEX::iterator get_end(const MULTIINDEX &index, const std::string &field_name, const EntityHandle ent) const
boost::function< MoFEMErrorCode()> postProcessHook
const Problem * problemPtr
virtual MoFEMErrorCode preProcess()
function is run at the beginning of loop
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
boost::shared_ptr< const NumeredEntFiniteElement > numeredEntFiniteElementPtr
MoFEMErrorCode copyKsp(const KspMethod &ksp)
copy data form another method
Definition: LoopMethods.cpp:32
multi_index_container< boost::shared_ptr< DofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< DofEntity, UId, &DofEntity::getGlobalUniqueId > >, ordered_non_unique< tag< Composite_Ent_and_ShortId_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt >, const_mem_fun< DofEntity, ShortId, &DofEntity::getNonNonuniqueShortId > > >, ordered_non_unique< tag< Composite_Name_And_Ent_And_EntDofIdx_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt >, const_mem_fun< DofEntity, DofIdx, &DofEntity::getEntDofIdx > > >, ordered_non_unique< tag< Unique_Ent_mi_tag >, const_mem_fun< DofEntity, UId, &DofEntity::getEntGlobalUniqueId > >, ordered_non_unique< tag< FieldName_mi_tag >, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt > > >, ordered_non_unique< tag< Composite_Name_And_Type_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity::interface_type_RefEntity, EntityType, &DofEntity::getEntType > > >, ordered_non_unique< tag< Composite_Name_Ent_Order_And_CoeffIdx_mi_tag >, composite_key< DofEntity, const_mem_fun< DofEntity::interface_type_Field, boost::string_ref, &DofEntity::getNameRef >, const_mem_fun< DofEntity, EntityHandle, &DofEntity::getEnt >, const_mem_fun< DofEntity, ApproximationOrder, &DofEntity::getDofOrder >, const_mem_fun< DofEntity, FieldCoefficientsNumber, &DofEntity::getDofCoeffIdx > > > > > DofEntity_multiIndex
MultiIndex container keeps DofEntity.
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
const RefEntity_multiIndex * refinedEntitiesPtr
MoFEMErrorCode copyTs(const TSMethod &ts)
Copy TS solver data.
Definition: LoopMethods.cpp:75
MULTIINDEX::iterator get_begin(const MULTIINDEX &index, const EntityHandle ent) const
MoFEMErrorCode setSnesCtx(const SNESContext &ctx)
Set SNES context.
Definition: LoopMethods.cpp:43
boost::function< MoFEMErrorCode()> operatorHook
MoFEMErrorCode copyBasicMethod(const BasicMethod &basic)
Definition: LoopMethods.cpp:99
MoFEMErrorCode setTs(TS _ts)
Set TS solver.
Definition: LoopMethods.cpp:70
Mat ksp_A
matrix
Definition: LoopMethods.hpp:93
data structure for ksp (linear solver) contextStruture stores context data which are set in functions...
Definition: LoopMethods.hpp:45
MoFEMErrorCode setKsp(KSP ksp)
set solver
Definition: LoopMethods.cpp:27
KSPContext
pass information about context of KSP/DM for with finite element is computed
Definition: LoopMethods.hpp:61
DEPRECATED typedef DofMethod EntMethod
data structure for TS (time stepping) contextStructure stores context data which are set in functions...
virtual ~KspMethod()
Definition: LoopMethods.hpp:67
#define CHKERR
Inline error check.
Definition: definitions.h:578
MoFEMErrorCode setKspCtx(const KSPContext &ctx)
set operator type
Definition: LoopMethods.cpp:22
static const MOFEMuuid IDD_MOFEMEntityMethod
Definition: LoopMethods.hpp:32
boost::shared_ptr< NumeredDofEntity > dofNumeredPtr
MoFEMErrorCode setTsCtx(const TSContext &ctx)
Set Ts context.
Definition: LoopMethods.cpp:65
boost::shared_ptr< FieldEntity > entPtr
multi_index_container< boost::shared_ptr< RefEntity >, indexed_by< ordered_unique< tag< Ent_mi_tag >, member< RefEntity::BasicEntity, EntityHandle, &RefEntity::ent > >, ordered_non_unique< tag< Ent_Ent_mi_tag >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType > >, ordered_non_unique< tag< ParentEntType_mi_tag >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > >, ordered_non_unique< tag< Composite_EntType_and_ParentEntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityType, &RefEntity::getParentEntType > > >, ordered_non_unique< tag< Composite_ParentEnt_And_EntType_mi_tag >, composite_key< RefEntity, const_mem_fun< RefEntity::BasicEntity, EntityType, &RefEntity::getEntType >, const_mem_fun< RefEntity, EntityHandle, &RefEntity::getParentEnt > > > > > RefEntity_multiIndex
#define DEPRECATED
Definition: definitions.h:29
virtual ~TSMethod()
MoFEMErrorCode copySnes(const SnesMethod &snes)
Copy snes data.
Definition: LoopMethods.cpp:53
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
SNESContext snes_ctx
const EntFiniteElement_multiIndex * finiteElementsEntitiesPtr
std::bitset< BITINTERFACEUID_SIZE > BitIntefaceId
Definition: Common.hpp:152
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
MULTIINDEX::iterator get_end(const MULTIINDEX &index, const std::string &field_name, const EntityType type) const
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:403
Vec ksp_f
the right hand side vector
Definition: LoopMethods.hpp:92
static const MOFEMuuid IDD_MOFEMTsMethod
Definition: LoopMethods.hpp:28
TSContext ts_ctx
static const MOFEMuuid IDD_MOFEMKspMethod
Definition: LoopMethods.hpp:24
static const MOFEMuuid IDD_MOFEMDofMethod
Definition: LoopMethods.hpp:34
boost::shared_ptr< const FENumeredDofEntity_multiIndex > colPtr
boost::function< MoFEMErrorCode()> preProcessHook
static const MOFEMuuid IDD_MOFEMFEMethod
Definition: LoopMethods.hpp:31
Data structure to exchange data between mofem and User Loop Methods.It allows to exchange data betwee...
multi_index_container< boost::shared_ptr< EntFiniteElement >, indexed_by< ordered_unique< tag< Unique_mi_tag >, member< EntFiniteElement, UId, &EntFiniteElement::globalUid > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< EntFiniteElement, EntityHandle, &EntFiniteElement::getEnt > >, ordered_non_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, boost::string_ref, &EntFiniteElement::getNameRef > >, ordered_non_unique< tag< BitFEId_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, BitFEId, &EntFiniteElement::getId >, LtBit< BitFEId > >, ordered_non_unique< tag< EntType_mi_tag >, const_mem_fun< EntFiniteElement::interface_type_RefEntity, EntityType, &EntFiniteElement::getEntType > >, ordered_non_unique< tag< Composite_Name_And_Ent_mi_tag >, composite_key< EntFiniteElement, const_mem_fun< EntFiniteElement::interface_type_FiniteElement, boost::string_ref, &EntFiniteElement::getNameRef >, const_mem_fun< EntFiniteElement, EntityHandle, &EntFiniteElement::getEnt > > > > > EntFiniteElement_multiIndex
MultiIndex container for EntFiniteElement.
boost::shared_ptr< const FENumeredDofEntity_multiIndex > rowPtr
MULTIINDEX::iterator get_begin(const MULTIINDEX &index, const std::string &field_name, const EntityType type) const
static const MOFEMuuid IDD_MOFEMSnesMethod
Definition: LoopMethods.hpp:26