v0.14.0
EntitiesFieldData.hpp
Go to the documentation of this file.
1 /** \file EntitiesFieldData.hpp
2 
3 \brief Data structures for accessing information about finite element and its
4 degrees of freedom.
5 
6 */
7 
8 
9 
10 #ifndef __ENTITIES_FIELD_DATA_HPP__
11 #define __ENTITIES_FIELD_DATA_HPP__
12 
13 using namespace boost::numeric;
14 
15 namespace MoFEM {
16 
17 using DofsAllocator = ublas::unbounded_array<
18 
19  FEDofEntity *, std::allocator<FEDofEntity *>
20 
21  >;
22 
23 using VectorDofs = ublas::vector<FEDofEntity *, DofsAllocator>;
24 
25 using FieldEntAllocator = ublas::unbounded_array<
26 
27  FieldEntity *, std::allocator<FieldEntity *>
28 
29  >;
30 
31 using VectorFieldEntities = ublas::vector<FieldEntity *, FieldEntAllocator>;
32 
33 /** \brief data structure for finite element entity
34  * \ingroup mofem_forces_and_sources_user_data_operators
35  *
36  * It keeps that about indices of degrees of freedom, dofs data, base functions
37  * functions, entity side number, type of entities, approximation order, etc.
38  *
39  */
41 
42  struct EntData;
43 
44  std::bitset<LASTBASE> bAse; ///< bases on element
45  MatrixInt facesNodes; ///< nodes on finite element faces
46  MatrixInt facesNodesOrder; ///< order of face nodes on element
47 
48  std::array<std::bitset<LASTSPACE>, MBMAXTYPE>
49  spacesOnEntities; ///< spaces on entity types
50  std::array<std::bitset<LASTBASE>, MBMAXTYPE>
51  basesOnEntities; ///< bases on entity types
52  std::array<std::bitset<LASTBASE>, LASTSPACE>
53  basesOnSpaces; ///< base on spaces
54  std::array<std::bitset<LASTBASE>, LASTSPACE>
55  brokenBasesOnSpaces; ///< base on spaces
56  std::array<boost::ptr_vector<EntData>, MBMAXTYPE>
57  dataOnEntities; ///< data on nodes, base
58  ///< function, dofs
59  ///< values, etc.
60 
61  EntitiesFieldData(const EntityType type);
62  virtual ~EntitiesFieldData() = default;
63 
64  virtual MoFEMErrorCode setElementType(const EntityType type);
65 
66  /**
67  * Reset data associated with particular field name
68  * @return error code
69  */
71 
72  /**
73  * @brief Swap approximation base
74  *
75  * Bernstein-Bezier (BB) base is not hierarchical, and is calculated for
76  * particular field, since it all shape functions change with the order. BB
77  * base is precalculated for every field, and when user push operator with
78  * particular field using BB base, pointers to shape fuctions and
79  * BaseDerivatives of shape functions are set to particular location, once
80  * operator is executed, pointers are switch back to its oroginal position.
81  *
82  * getNSharedPtr(base) <=== getBBNSharedPtr(field_name);
83  * // DO OPERATOR WORK
84  * getNSharedPtr(base) ==> getBBNSharedPtr(field_name);
85  *
86  * @param field_name
87  * @param base
88  * @return MoFEMErrorCode
89  */
90  virtual MoFEMErrorCode baseSwap(const std::string &field_name,
91  const FieldApproximationBase base);
92 
93  friend std::ostream &operator<<(std::ostream &os, const EntitiesFieldData &e);
94 
95 protected:
97 };
98 
99 /** \brief this class derive data form other data structure
100  * \ingroup mofem_forces_and_sources_user_data_operators
101  *
102  *
103  * It behaves like normal data structure it is used to share base functions with
104  * other data structures. Dofs values, approx. order and
105  * indices are not shared.
106  *
107  * Shape functions, senses are shared with other data structure.
108  *
109  */
111 
112  struct DerivedEntData;
113 
115  const boost::shared_ptr<EntitiesFieldData> &data_ptr);
116  MoFEMErrorCode setElementType(const EntityType type);
117 
118 private:
119  const boost::shared_ptr<EntitiesFieldData> dataPtr;
120 };
121 
122 /** \brief Data on single entity (This is passed as argument to
123  * DataOperator::doWork) \ingroup mofem_forces_and_sources_user_data_operators
124  * \nosubgrouping
125  *
126  * \todo Hdiv and Hcurl functions should be accessed through common interface.
127  */
129 
131  ZeroDerivative = 0,
136  LastDerivative
137  };
138 
139  /** \name Constructor and destructor */
140 
141  /**@{*/
142 
143  EntData(const bool allocate_base_matrices = true);
144  virtual ~EntData() = default;
145 
146  /**@}*/
147 
148  /** \name Sense, order and indices */
149 
150  /**@{*/
151 
152  /// \brief get entity sense, need to calculate base functions with
153  /// conforming approximation fields
154  virtual int getSense() const;
155 
156  /// \brief get approximation order
157  inline ApproximationOrder getOrder() const;
158 
159  /// \brief Get global indices of dofs on entity
160  inline const VectorInt &getIndices() const;
161 
162  /// \brief get global indices of dofs on entity up to given order
163  inline const VectorIntAdaptor getIndicesUpToOrder(int order);
164 
165  /// \brief get local indices of dofs on entity
166  inline const VectorInt &getLocalIndices() const;
167 
168  /// \brief get local indices of dofs on entity up to given order
169  inline const VectorIntAdaptor getLocalIndicesUpToOrder(int order);
170 
171  inline int &getSense();
172 
173  inline ApproximationOrder &getOrder();
174 
175  inline VectorInt &getIndices();
176 
177  inline VectorInt &getLocalIndices();
178 
179  /**@}*/
180 
181  /** \name Data on entity */
182 
183  /**@{*/
184 
185  /// \brief get dofs values
186  inline const VectorDouble &getFieldData() const;
187 
188  /// \brief get dofs values up to given order
189  inline const VectorAdaptor getFieldDataUpToOrder(int order);
190 
191  /// \brief get dofs data stature FEDofEntity
192  inline const VectorDofs &getFieldDofs() const;
193 
194  /// \brief get dofs data stature FEDofEntity
195  inline VectorDouble &getFieldData();
196 
197  /// \brief get field entities
198  inline const VectorFieldEntities &getFieldEntities() const;
199 
200  /// \brief get field entities
201  inline VectorFieldEntities &getFieldEntities();
202 
203  //// \brief get entity bit ref level
204  virtual std::vector<BitRefLevel> &getEntDataBitRefLevel();
205 
206  /**
207  * @brief Return FTensor of rank 1, i.e. vector from filed data coefficients
208  *
209  * \code
210  * auto t_vec = data.getFTensor1FieldData<3>();
211  * \endcode
212  *
213  * @tparam Tensor_Dim size of vector
214  * @return FTensor::Tensor1<FTensor::PackPtr<double *, Tensor_Dim>,
215  * Tensor_Dim>
216  */
217  template <int Tensor_Dim>
219  getFTensor1FieldData();
220 
221  /**
222  * @brief Return FTensor rank 2, i.e. matrix from filed data coefficients
223  *
224  * \code
225  * auto t_mat = data.getFTensor2FieldData<3,3>();
226  * \endcode
227  *
228  * @tparam Tensor_Dim0
229  * @tparam Tensor_Dim1
230  * @return FTensor::Tensor2<FTensor::PackPtr<double *, Tensor_Dim0 *
231  * Tensor_Dim1>, Tensor_Dim0, Tensor_Dim1>
232  */
233  template <int Tensor_Dim0, int Tensor_Dim1>
235  Tensor_Dim0, Tensor_Dim1>
236  getFTensor2FieldData();
237 
238  /**
239  * @brief Return symmetric FTensor rank 2, i.e. matrix from field data
240  * coefficients
241  *
242  * \code
243  * auto t_mat = data.getFTensor2SymmetricFieldData<3>();
244  * \endcode
245  *
246  * @tparam Tensor_Dim dimension of the tensor
247  * @return FTensor::Tensor2_symmetric<FTensor::PackPtr<double *, (Tensor_Dim
248  * * (Tensor_Dim + 1)) / 2>, Tensor_Dim>
249  */
250  template <int Tensor_Dim>
252  FTensor::PackPtr<double *, (Tensor_Dim * (Tensor_Dim + 1)) / 2>,
253  Tensor_Dim>
254  getFTensor2SymmetricFieldData();
255 
256  /**
257  * @brief Resturn scalar files as a FTensor of rank 0
258  *
259  * @return FTensor::Tensor0<FTensor::PackPtr<double *,1> >
260  */
261  FTensor::Tensor0<FTensor::PackPtr<double *, 1>> getFTensor0FieldData();
262 
263  inline VectorDofs &getFieldDofs();
264 
265  /**@}*/
266 
267  /** \name Base and space */
268 
269  /**@{*/
270 
271  /**
272  * \brief Get approximation base
273  * @return Approximation base
274  */
275  inline FieldApproximationBase &getBase();
276 
277  /**
278  * \brief Get field space
279  * @return Field space
280  */
281  inline FieldSpace &getSpace();
282 
283  /**
284  * Get shared pointer to base base functions
285  */
286  virtual boost::shared_ptr<MatrixDouble> &
287  getNSharedPtr(const FieldApproximationBase base,
288  const BaseDerivatives direvatie);
289 
290  /**
291  * Get shared pointer to base base functions
292  */
293  virtual boost::shared_ptr<MatrixDouble> &
294  getNSharedPtr(const FieldApproximationBase base);
295 
296  /**
297  * Get shared pointer to derivatives of base base functions
298  */
299  virtual boost::shared_ptr<MatrixDouble> &
300  getDiffNSharedPtr(const FieldApproximationBase base);
301 
302  /**@}*/
303 
304  /** \name Get base functions for H1/L2 */
305 
306  /**@{*/
307 
308  /** \brief get base functions
309  * this return matrix (nb. of rows is equal to nb. of Gauss pts, nb. of
310  * columns is equal to number of base functions on this entity.
311  *
312  * \note Note that for vectorial base, like Hdiv or Hcurl, in columns are
313  * vectorial base functions. For tonsorial would be tonsorial base
314  * functions. Interpretation depends on type of base, scalar, vectorial or
315  * tonsorial and dimension fo problem.
316  *
317  */
318  inline MatrixDouble &getN(const FieldApproximationBase base);
319 
320  /**
321  * @copydoc MoFEM::EntitiesFieldData::EntData::getN
322  */
323  inline MatrixDouble &getN(const std::string &field_name);
324 
325  /**
326  * @copydoc MoFEM::EntitiesFieldData::EntData::getN
327  */
328  inline MatrixDouble &getN();
329 
330  /** \brief get derivatives of base functions
331  *
332  * Matrix at rows has nb. of Gauss pts, at columns it has derivative of
333  * base functions. Columns are structured as follows, [ dN1/dx, dN1/dy,
334  * dN1/dz, dN2/dx, dN2/dy, dN2/dz, ... ]
335  *
336  * Scalar base functions:
337  * Note that base functions are calculated in file H1.c
338  * Above description not apply for derivatives of nodal functions, since
339  * derivative of nodal functions in case of simplexes, EDGES, TRIANGLES and
340  * TETS are constant. So that matrix rows represents nb. of base
341  * functions, columns are derivatives. Nb. of columns depend on element
342  * dimension, for EDGES is one, for TRIS is 2 and TETS is 3.
343  *
344  * \note Note that for node element this function make no sense.
345  *
346  * Tonsorial base functions:
347  * \note Note: In rows ale integration pts, columns are formatted that that
348  * components of vectors and then derivatives, for example row for given
349  * integration points is formatted in array
350  * \f[
351  * t_{0,0}, t_{1,0}, t_{1,0}, t_{0,1}, t_{1,1}, t_{1,1}, t_{0,2}, t_{1,2},
352  * t_{1,2} \f] where comma express derivative, i.e. \f$t_{2,1} =
353  * \frac{\partial t_2}{\partial \xi_1}\f$
354  *
355  */
356  inline MatrixDouble &getDiffN(const FieldApproximationBase base);
357 
358  /**
359  * @brief Get base function derivative
360  *
361  * @param base base
362  * @param derivative derivative
363  * @return MatrixDouble&
364  */
365  inline MatrixDouble &getN(const FieldApproximationBase base,
366  const BaseDerivatives derivative);
367 
368  /**
369  * @copydoc MoFEM::EntitiesFieldData::EntData::getDiffN
370  */
371  inline MatrixDouble &getDiffN(const std::string &field_name);
372 
373  /**
374  * @copydoc MoFEM::EntitiesFieldData::EntData::getDiffN
375  */
376  inline MatrixDouble &getDiffN();
377 
378  /**
379  * @brief Get base function derivative
380  *
381  * @param derivative
382  * @return MatrixDouble&
383  */
384  inline MatrixDouble &getN(const BaseDerivatives derivative);
385 
386  /// \brief get base functions at Gauss pts
387  inline const VectorAdaptor getN(const FieldApproximationBase base,
388  const int gg);
389 
390  /// \brief get base functions at Gauss pts
391  inline const VectorAdaptor getN(const int gg);
392 
393  /** \brief get derivative of base functions at Gauss pts
394 
395  * returned matrix on rows has base functions, in column its derivatives.
396  *
397  * \param base Approximation base
398  * \param gg Nb. of Gauss pts.
399  *
400  */
401  inline const MatrixAdaptor getDiffN(const FieldApproximationBase base,
402  const int gg);
403 
404  /** \brief get derivative of base functions at Gauss pts
405 
406  * returned matrix on rows has base functions, in column its derivatives.
407  *
408  * \param gg nb. of Gauss pts.
409  *
410  */
411  inline const MatrixAdaptor getDiffN(const int gg);
412 
413  /** \brief get base functions at Gauss pts
414 
415  * Note that multi field element, two different field can have different
416  * approximation orders. Since we use hierarchical approximation basis,
417  * base functions are calculated once for element, using maximal
418  * approximation order on given entity.
419  *
420  * \param base Approximation base
421  * \param gg number of Gauss point
422  * \param nb_base_functions number of of base functions returned
423 
424  */
425  inline const VectorAdaptor getN(const FieldApproximationBase base,
426  const int gg, const int nb_base_functions);
427 
428  /** \brief get base functions at Gauss pts
429 
430  * Note that multi field element, two different field can have different
431  * approximation orders. Since we use hierarchical approximation basis,
432  * base functions are calculated once for element, using maximal
433  * approximation order on given entity.
434  *
435  * \param gg number of Gauss point
436  * \param nb_base_functions number of of base functions returned
437 
438  */
439  inline const VectorAdaptor getN(const int gg, const int nb_base_functions);
440 
441  /** \brief get derivatives of base functions at Gauss pts
442  *
443  * Note that multi field element, two different field can have different
444  * approximation orders. Since we use hierarchical approximation basis,
445  * base functions are calculated once for element, using maximal
446  * approximation order on given entity.
447  *
448  * \param base Approximation base
449  * \param gg nb. of Gauss point
450  * \param nb_base_functions number of of base functions
451  *
452  */
453  inline const MatrixAdaptor getDiffN(const FieldApproximationBase base,
454  const int gg,
455  const int nb_base_functions);
456 
457  /** \brief get derivatives of base functions at Gauss pts
458  *
459  * Note that multi field element, two different field can have different
460  * approximation orders. Since we use hierarchical approximation basis,
461  * base functions are calculated once for element, using maximal
462  * approximation order on given entity.
463  *
464  * \param gg nb. of Gauss point
465  * \param nb_base_functions number of of base functions
466  *
467  */
468  inline const MatrixAdaptor getDiffN(const int gg,
469  const int nb_base_functions);
470 
471  /**@}*/
472 
473  /** \name Get base functions for vectorial approximation basese, i.e.
474  * Hdiv/Hcurl */
475 
476  /**@{*/
477 
478  /** \brief get Hdiv of base functions at Gauss pts
479  *
480  * \param base Approximation base
481  * \param gg nb. of Gauss point
482  *
483  */
484  template <int DIM>
485  inline const MatrixAdaptor getVectorN(const FieldApproximationBase base,
486  const int gg);
487 
488  /** \brief get Hdiv of base functions at Gauss pts
489  *
490  * \param gg nb. of Gauss point
491  * \param number of of base functions
492  *
493  */
494  template <int DIM> inline const MatrixAdaptor getVectorN(const int gg);
495 
496  /** \brief get DiffHdiv of base functions at Gauss pts
497  *
498  * \param base Approximation base
499  * \param gg nb. of Gauss point
500  * \param number of of base functions
501  *
502  */
503  template <int DIM0, int DIM1>
504  inline const MatrixAdaptor getVectorDiffN(FieldApproximationBase base,
505  const int gg);
506 
507  /** \brief get DiffHdiv of base functions at Gauss pts
508  *
509  * \param gg nb. of Gauss point
510  * \param number of of base functions
511  *
512  */
513  template <int DIM0, int DIM1>
514  inline const MatrixAdaptor getVectorDiffN(const int gg);
515 
516  /** \brief get DiffHdiv of base functions at Gauss pts
517  *
518  * \param base Approximation base
519  * \param gg nb. of Gauss point
520  * \param number of of base functions
521  *
522  */
523  template <int DIM0, int DIM1>
524  inline const MatrixAdaptor getVectorDiffN(const FieldApproximationBase base,
525  const int dof, const int gg);
526 
527  /** \brief get DiffHdiv of base functions at Gauss pts
528  *
529  * \param gg nb. of Gauss point
530  * \param number of of base functions
531  *
532  */
533  template <int DIM0, int DIM1>
534  inline const MatrixAdaptor getVectorDiffN(const int dof, const int gg);
535 
536  /**@}*/
537 
538  /** \name Get base functions with FTensor */
539 
540  /**@{*/
541 
542  /**
543  * \brief Get base function as Tensor0
544  *
545  * \param base
546  * \return Tensor0
547  *
548  */
550  getFTensor0N(const FieldApproximationBase base);
551 
552  /**
553  * \brief Get base function as Tensor0
554  *
555  * Return base functions for field base
556  *
557  * \return Tensor0
558  *
559  */
560  inline FTensor::Tensor0<FTensor::PackPtr<double *, 1>> getFTensor0N();
561 
562  /**
563  * \brief Get base function as Tensor0 (Loop by integration points)
564  *
565  * \param base
566  * \param gg integration points
567  * \param bb base function
568  * \return Tensor0
569 
570  Note that:
571  \code
572  t0 = data.getFTensor0N(base,bb);
573  ++t0
574  \endcode
575  Increment in above code will move pointer to base function in next
576  integration point.
577 
578  *
579  */
581  getFTensor0N(const FieldApproximationBase base, const int gg, const int bb);
582 
583  /**
584  * \brief Get base function as Tensor0 (Loop by integration points)
585  *
586  * Return base functions for field base
587  *
588  * \param bb base function
589  * \return Tensor0
590  *
591  */
593  getFTensor0N(const int gg, const int bb);
594 
595  /**
596  * \brief Get derivatives of base functions
597  *
598  * For volume element like tetrahedral or prism,
599  * \code
600  * Tensor1<double*,3> diff_base = data.getFTensor1DiffN<3>();
601  * \endcode
602  *
603  * For face element like triangle or quad
604  * \code
605  * Tensor1<double*,2> diff_base = data.getFTensor1DiffN<2>();
606  * \endcode
607  *
608  * \param base functions
609  * \return Tensor rank 1 (vector)
610  *
611  */
612  template <int Tensor_Dim>
614  getFTensor1DiffN(const FieldApproximationBase base);
615 
616  /**
617  * \brief Get derivatives of base functions
618  *
619  * For volume element like tetrahedral or prism,
620  * \code
621  * Tensor1<double*,3> diff_base = data.getFTensor1DiffN<3>();
622  * \endcode
623  *
624  * For face element like triangle or quad
625  * \code
626  * Tensor1<double*,2> diff_base = data.getFTensor1DiffN<2>();
627  * \endcode
628  *
629  * \return Tensor rank 1 (vector)
630  *
631  */
632  template <int Tensor_Dim>
634  getFTensor1DiffN();
635 
636  /**
637  * \brief Get derivatives of base functions (Loop by integration points)
638  *
639  * For volume element like tetrahedral or prism,
640  * \code
641  * Tensor1<double*,3> diff_base = data.getFTensor1DiffN<3>(base,gg,bb);
642  * \endcode
643  * where bb is base function and gg is integration pt. Operator ++diff_base
644  * will move tensor pointer to next integration point.
645  *
646  * For face element like triangle or quad
647  * \code
648  * Tensor1<double*,2> diff_base = data.getFTensor1DiffN<2>(base,gg,bb);
649  * \endcode
650  *
651  * \return Tensor rank 1 (vector)
652  *
653  */
654  template <int Tensor_Dim>
656  getFTensor1DiffN(const FieldApproximationBase base, const int gg,
657  const int bb);
658 
659  /**
660  * \brief Get derivatives of base functions (Loop by integration points)
661  *
662  * For volume element like tetrahedral or prism,
663  * \code
664  * Tensor1<double*,3> diff_base = data.getFTensor1DiffN<3>(gg,bb);
665  * \endcode
666  * where bb is base function and gg is integration pt. Operator ++diff_base
667  * will move tensor pointer to next base function.
668  *
669  * For face element like triangle or quad
670  * \code
671  * Tensor1<double*,2> diff_base = data.getFTensor1DiffN<2>(gg,bb);
672  * \endcode
673  *
674  * \return Tensor rank 1 (vector)
675  *
676  */
677  template <int Tensor_Dim>
679  getFTensor1DiffN(const int gg, const int bb);
680 
681  /** \brief Get base functions for Hdiv/Hcurl spaces
682 
683  \note You probably like to use getFTensor1N(), in typical use base is
684  set automatically based on base set to field.
685 
686  * @param base Approximation base
687 
688  Example:
689  \code
690  FTensor::Index<'i',3> i;
691  int nb_dofs = data.getFieldData().size();
692  auto t_n_hdiv = data.getFTensor1N<3>();
693  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
694  int ll = 0;
695  for(;ll!=nb_dofs;ll++) {
696  double dot_product = t_n_hdiv(i)*t_n_hdiv(i);
697  ++t_n_hdiv;
698  }
699  for(;ll!=data.getVectorN().size2()/3;ll++) {
700  ++t_n_hdiv;
701  }
702  }
703  \endcode
704 
705  */
706  template <int Tensor_Dim>
708  getFTensor1N(FieldApproximationBase base);
709 
710  /** \brief Get base functions for Hdiv space
711 
712  Example:
713  \code
714  FTensor::Index<'i',3> i;
715  int nb_dofs = data.getFieldData().size();
716  auto t_n_hdiv = data.getFTensor1N<3>();
717  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
718  int ll = 0;
719  for(;ll!=nb_dofs;ll++) {
720  double dot_product = t_n_hdiv(i)*t_n_hdiv(i);
721  ++t_n_hdiv;
722  }
723  for(;ll!=data.getVectorN().size2()/3;ll++) {
724  ++t_n_hdiv;
725  }
726  }
727  \endcode
728 
729  */
730  template <int Tensor_Dim> auto getFTensor1N();
731 
732  /** \brief Get derivatives of base functions for Hdiv space
733  */
734  template <int Tensor_Dim0, int Tensor_Dim1>
736  Tensor_Dim0, Tensor_Dim1>
737  getFTensor2DiffN(FieldApproximationBase base);
738 
739  /** \brief Get derivatives of base functions for Hdiv space at integration
740  * pts
741  */
742  template <int Tensor_Dim0, int Tensor_Dim1>
744  Tensor_Dim0, Tensor_Dim1>
745  getFTensor2DiffN(FieldApproximationBase base, const int gg, const int bb);
746 
747  /** \brief Get derivatives of base functions for Hdiv space
748  */
749  template <int Tensor_Dim0, int Tensor_Dim1>
751  Tensor_Dim0, Tensor_Dim1>
753  return getFTensor2DiffN<Tensor_Dim0, Tensor_Dim1>(bAse);
754  }
755 
756  /** \brief Get derivatives of base functions for Hdiv space at integration
757  * pts
758  */
759  template <int Tensor_Dim0, int Tensor_Dim1>
761  Tensor_Dim0, Tensor_Dim1>
762  getFTensor2DiffN(const int gg, const int bb) {
763  return getFTensor2DiffN<Tensor_Dim0, Tensor_Dim1>(bAse, gg, bb);
764  }
765 
766  /** \brief Get second derivatives of base functions for Hvec space
767  */
768  template <int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2>
771  Tensor_Dim0, Tensor_Dim1, Tensor_Dim2>
772  getFTensor3Diff2N(FieldApproximationBase base);
773 
774  /** \brief Get second derivatives of base functions for Hvec space
775  */
776  template <int Tensor_Dim0, int Tensor_Dim1, int Tensor_Dim2>
777  inline FTensor::Tensor3<
779  Tensor_Dim0, Tensor_Dim1, Tensor_Dim2>
781  return getFTensor3Diff2N<Tensor_Dim0, Tensor_Dim1, Tensor_Dim2>(bAse);
782  }
783 
784  /**
785  * \brief Get Hdiv base functions at integration point
786 
787  \code
788  FTensor::Index<'i',3> i;
789  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
790  auto t_base = data.getFTensor1N(base,gg,bb);
791  for(int bb = 0;bb!=nb_base_functions;bb++) {
792  auto dot = t_base(i)*t_base(i);
793  }
794  }
795  \endcode
796 
797  */
798  template <int Tensor_Dim>
800  getFTensor1N(FieldApproximationBase base, const int gg, const int bb);
801 
802  /**
803  * \brief Get Hdiv base functions at integration point
804 
805  \code
806  FTensor::Index<'i',3> i;
807  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
808  auto t_base = data.getFTensor1N(gg,0);
809  for(int bb = 0;bb!=nb_base_functions;bb++) {
810  double dot = t_base(i)*t_base(i);
811  }
812  }
813  \endcode
814 
815  */
816  template <int Tensor_Dim>
817  inline auto getFTensor1N(const int gg, const int bb);
818 
819  /** \brief Get base functions for Hdiv/Hcurl spaces
820 
821  \note You probably like to use getFTensor1N(), in typical use base is
822  set automatically based on base set to field.
823 
824  * @param base Approximation base
825 
826  Example:
827  \code
828  FTensor::Index<'i',3> i;
829  FTensor::Index<'i',3> j;
830  int nb_dofs = data.getFieldData().size();
831  auto t_n_hdiv = data.getFTensor2N<3,3>();
832  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
833  int ll = 0;
834  for(;ll!=nb_dofs;ll++) {
835  double dot_product = t_n_hdiv(i,j)*t_n_hdiv(i,j);
836  ++t_n_hdiv;
837  }
838  for(;ll!=data.getVectorN().size2()/3;ll++) {
839  ++t_n_hdiv;
840  }
841  }
842  \endcode
843 
844  */
845  template <int Tensor_Dim0, int Tensor_Dim1>
847  Tensor_Dim0, Tensor_Dim1>
848  getFTensor2N(FieldApproximationBase base);
849 
850  /** \brief Get base functions for Hdiv space
851 
852  Example:
853  \code
854  FTensor::Index<'i',3> i;
855  FTensor::Index<'j',3> j;
856 
857  int nb_dofs = data.getFieldData().size();
858  auto t_n_hdiv = data.getFTensor2N<3,3>();
859  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
860  int ll = 0;
861  for(;ll!=nb_dofs;ll++) {
862  double dot_product = t_n_hdiv(i,j)*t_n_hdiv(i,j);
863  ++t_n_hdiv;
864  }
865  for(;ll!=data.getVectorN().size2()/3;ll++) {
866  ++t_n_hdiv;
867  }
868  }
869  \endcode
870 
871  */
872  template <int Tensor_Dim0, int Tensor_Dim1> auto getFTensor2N();
873 
874  /** \brief Get base functions for tensor Hdiv/Hcurl spaces
875 
876  \note You probably like to use getFTensor2N(), in typical use base is
877  set automatically based on base set to field.
878 
879  @param base Approximation base
880 
881  Example:
882  \code
883  FTensor::Index<'i',3> i;
884  FTensor::Index<'j',3> i;
885  int nb_dofs = data.getFieldData().size();
886  for(int gg = 0;gg!=nb_gauss_pts;gg++) {
887  auto t_n_hdiv = data.getFTensor2N<3>(base,gg,bb);
888  int ll = 0;
889  for(;ll!=nb_dofs;ll++) {
890  double dot_product = t_n_hdiv(i,j)*t_n_hdiv(i,j);
891  ++t_n_hdiv;
892  }
893  for(;ll!=data.getVectorN().size2()/3;ll++) {
894  ++t_n_hdiv;
895  }
896  }
897  \endcode
898 
899  */
900  template <int Tensor_Dim0, int Tensor_Dim1>
902  Tensor_Dim0, Tensor_Dim1>
903  getFTensor2N(FieldApproximationBase base, const int gg, const int bb);
904 
905  /** \brief Get base functions for Hdiv space
906 
907  Example:
908  \code
909  FTensor::Index<'i',3> i;
910  FTensor::Index<'j',3> j;
911  int nb_dofs = data.getFieldData().size();
912  for(int gg = 0;gg!=nb_gauss_pts;++gg) {
913  int ll = 0;
914  auto t_n_hdiv = data.getFTensor2N<3,3>(gg,0);
915  for(;ll!=nb_dofs;ll++) {
916  double dot_product = t_n_hdiv(i)*t_n_hdiv(i);
917  ++t_n_hdiv;
918  }
919  for(;ll!=data.getVectorN().size2()/3;ll++) {
920  ++t_n_hdiv;
921  }
922  }
923  \endcode
924 
925  */
926  template <int Tensor_Dim0, int Tensor_Dim1>
927  auto getFTensor2N(const int gg, const int bb);
928 
929  /**@}*/
930 
931  /** \name Auxiliary functions */
932 
933  /**@{*/
934 
935  friend std::ostream &operator<<(std::ostream &os,
936  const EntitiesFieldData::EntData &e);
937 
938  /**
939  * Reset data associated with particular field name
940  * @return error code
941  */
942  inline MoFEMErrorCode resetFieldDependentData();
943 
944  /**@}*/
945 
946  /** \name Bernstein-Bezier base only functions */
947 
948  /**@{*/
949 
950  /**
951  * @brief Get orders at the nodes
952  *
953  * @return VectorInt&
954  */
955  inline VectorInt &getBBNodeOrder();
956 
957  /**
958  * @brief Get file BB indices
959  *
960  * @return MatrixInt&
961  */
962  inline MatrixInt &getBBAlphaIndices();
963 
964  virtual boost::shared_ptr<MatrixInt> &
965  getBBAlphaIndicesSharedPtr(const std::string &field_name);
966 
967  /**
968  * Get shared pointer to BB base base functions
969  */
970  virtual boost::shared_ptr<MatrixDouble> &
971  getBBNSharedPtr(const std::string &field_name);
972 
973  /**
974  * Get shared pointer to BB base base functions
975  */
976  virtual const boost::shared_ptr<MatrixDouble> &
977  getBBNSharedPtr(const std::string &field_name) const;
978 
979  /**
980  * Get shared pointer to BB derivatives of base base functions
981  */
982  virtual boost::shared_ptr<MatrixDouble> &
983  getBBDiffNSharedPtr(const std::string &field_name);
984 
985  /**
986  * Get shared pointer to derivatives of BB base base functions
987  */
988  virtual const boost::shared_ptr<MatrixDouble> &
989  getBBDiffNSharedPtr(const std::string &field_name) const;
990 
991  virtual std::map<std::string, boost::shared_ptr<MatrixInt>> &
992  getBBAlphaIndicesMap();
993 
994  /**
995  * @brief get hash map of base function for BB base, key is a field name
996  *
997  * @return std::map<std::string, boost::shared_ptr<MatrixDouble>>&
998  */
999  virtual std::map<std::string, boost::shared_ptr<MatrixDouble>> &getBBNMap();
1000 
1001  /**
1002  * @brief get hash map of direvarives base function for BB base, key is a
1003  * field name
1004  *
1005  * @return std::map<std::string, boost::shared_ptr<MatrixDouble>>&
1006  */
1007  virtual std::map<std::string, boost::shared_ptr<MatrixDouble>> &
1008  getBBDiffNMap();
1009 
1010  /**
1011  * @brief get ALpha indices for BB base by order
1012  *
1013  * @param o approximation order
1014  * @return boost::shared_ptr<MatrixInt>&
1015  */
1016  virtual boost::shared_ptr<MatrixInt> &
1017  getBBAlphaIndicesByOrderSharedPtr(const size_t o);
1018 
1019  /**
1020  * @brief get BB base by order
1021  *
1022  * @param o
1023  * @return boost::shared_ptr<MatrixDouble>&
1024  */
1025  virtual boost::shared_ptr<MatrixDouble> &
1026  getBBNByOrderSharedPtr(const size_t o);
1027 
1028  /**
1029  * @brief get BB base derivative by order
1030  *
1031  * @param o
1032  * @return boost::shared_ptr<MatrixDouble>&
1033  */
1034  virtual boost::shared_ptr<MatrixDouble> &
1035  getBBDiffNByOrderSharedPtr(const size_t o);
1036 
1037  static constexpr size_t MaxBernsteinBezierOrder = BITFEID_SIZE;
1038 
1039  virtual std::array<boost::shared_ptr<MatrixInt>, MaxBernsteinBezierOrder> &
1040  getBBAlphaIndicesByOrderArray();
1041 
1042  virtual std::array<boost::shared_ptr<MatrixDouble>, MaxBernsteinBezierOrder> &
1043  getBBNByOrderArray();
1044 
1045  virtual std::array<boost::shared_ptr<MatrixDouble>, MaxBernsteinBezierOrder> &
1046  getBBDiffNByOrderArray();
1047 
1048  /**
1049  * @brief Swap bases functions
1050  *
1051  * Some base are not hierarchical and depene on approximation order. Such case
1052  * demand special handling, that appropiate base order is set depending on
1053  * field, such that is accessible in operator.
1054  *
1055  * @note Base is not swap on meshsets
1056  *
1057  * @param field_name
1058  * @param base
1059  * @return MoFEMErrorCode
1060  */
1061  virtual MoFEMErrorCode baseSwap(const std::string &field_name,
1062  const FieldApproximationBase base);
1063 
1064  /**@}*/
1065 
1066 protected:
1067  int sEnse; ///< Entity sense (orientation)
1068  ApproximationOrder oRder; ///< Entity order
1069  FieldSpace sPace; ///< Entity space
1070  FieldApproximationBase bAse; ///< Field approximation base
1071  VectorInt iNdices; ///< Global indices on entity
1072  VectorInt localIndices; ///< Local indices on entity
1073  VectorDofs dOfs; ///< DoFs on entity
1074  VectorFieldEntities fieldEntities; ///< Field entities
1075  VectorDouble fieldData; ///< Field data on entity
1076  std::vector<BitRefLevel> entDataBitRefLevel; ///< Bit ref level in entity
1077 
1078  std::array<std::array<boost::shared_ptr<MatrixDouble>, LASTBASE>,
1079  LastDerivative>
1081 
1082  std::array<boost::shared_ptr<MatrixDouble>, LASTBASE> &N; ///< Base functions
1083  std::array<boost::shared_ptr<MatrixDouble>, LASTBASE>
1084  &diffN; ///< Derivatives of base functions
1085 
1086  std::string bbFieldName; ///< field name
1087  VectorInt bbNodeOrder; ///< order of nodes
1088  std::map<std::string, boost::shared_ptr<MatrixDouble>> bbN;
1089  std::map<std::string, boost::shared_ptr<MatrixDouble>> bbDiffN;
1090  std::map<std::string, boost::shared_ptr<MatrixInt>>
1091  bbAlphaIndices; ///< Indices for Bernstein-Bezier (BB) base
1092 
1093  std::array<boost::shared_ptr<MatrixDouble>, MaxBernsteinBezierOrder>
1094  bbNByOrder; ///< BB base functions by order
1095  std::array<boost::shared_ptr<MatrixDouble>, MaxBernsteinBezierOrder>
1096  bbDiffNByOrder; ///< BB base functions directives by order
1097  std::array<boost::shared_ptr<MatrixInt>, MaxBernsteinBezierOrder>
1098  bbAlphaIndicesByOrder; ///< BB alpha indices by order
1099 
1100 protected:
1101  /**
1102  * @brief Used by Bernstein base to keep temporally pointer
1103  *
1104  * @copydoc MoFEM::EntitiesFieldData::baseSwap
1105  */
1106  boost::shared_ptr<MatrixDouble> swapBaseNPtr;
1107 
1108  /**
1109  * @brief Used by Bernstein base to keep temporally pointer
1110  *
1111  * @copydoc MoFEM::EntitiesFieldData::baseSwap
1112  */
1113  boost::shared_ptr<MatrixDouble> swapBaseDiffNPtr;
1114 
1115  friend struct OpAddParentEntData;
1116 
1117  template <typename OpBase> friend struct OpGetBrokenBaseSideData;
1118 };
1119 
1121 
1122 /** \brief Derived ata on single entity (This is passed as argument to
1123  * DataOperator::doWork) \ingroup mofem_forces_and_sources_user_data_operators
1124  * \nosubgrouping
1125  *
1126  * DerivedEntData share part information with EntData except infomation about
1127  * base functions.
1128  *
1129  */
1131  : public EntitiesFieldData::EntData {
1132 
1134  const boost::shared_ptr<EntitiesFieldData::EntData> &ent_data_ptr);
1135 
1136  int getSense() const;
1137 
1138  //// \brief get entity bit ref level
1139  std::vector<BitRefLevel> &getEntDataBitRefLevel();
1140 
1141  boost::shared_ptr<MatrixDouble> &
1142  getNSharedPtr(const FieldApproximationBase base,
1143  const BaseDerivatives derivative);
1144 
1145  boost::shared_ptr<MatrixDouble> &
1146  getNSharedPtr(const FieldApproximationBase base);
1147 
1148  boost::shared_ptr<MatrixDouble> &
1149  getDiffNSharedPtr(const FieldApproximationBase base);
1150 
1151  const boost::shared_ptr<MatrixDouble> &
1152  getNSharedPtr(const FieldApproximationBase base) const;
1153 
1154  const boost::shared_ptr<MatrixDouble> &
1155  getDiffNSharedPtr(const FieldApproximationBase base) const;
1156 
1157  inline boost::shared_ptr<MatrixDouble> &
1158  getDerivedNSharedPtr(const FieldApproximationBase base);
1159 
1160  inline boost::shared_ptr<MatrixDouble> &
1161  getDerivedDiffNSharedPtr(const FieldApproximationBase base);
1162 
1163  boost::shared_ptr<MatrixInt> &
1164  getBBAlphaIndicesSharedPtr(const std::string &field_name);
1165 
1166  /**
1167  * Get shared pointer to BB base base functions
1168  */
1169  boost::shared_ptr<MatrixDouble> &
1170  getBBNSharedPtr(const std::string &field_name);
1171 
1172  /**
1173  * Get shared pointer to BB base base functions
1174  */
1175  const boost::shared_ptr<MatrixDouble> &
1176  getBBNSharedPtr(const std::string &field_name) const;
1177 
1178  /**
1179  * Get shared pointer to BB derivatives of base base functions
1180  */
1181  boost::shared_ptr<MatrixDouble> &
1182  getBBDiffNSharedPtr(const std::string &field_name);
1183 
1184  /**
1185  * Get shared pointer to derivatives of BB base base functions
1186  */
1187  const boost::shared_ptr<MatrixDouble> &
1188  getBBDiffNSharedPtr(const std::string &field_name) const;
1189 
1190  /**
1191  * @copydoc MoFEM::EntitiesFieldData::EntData::swapBaseNPtr
1192  */
1193  MoFEMErrorCode baseSwap(const std::string &field_name,
1194  const FieldApproximationBase base);
1195 
1196 protected:
1197  const boost::shared_ptr<EntitiesFieldData::EntData> entDataPtr;
1198 };
1199 
1200 ApproximationOrder EntitiesFieldData::EntData::getOrder() const {
1201  return oRder;
1202 }
1203 
1204 const VectorInt &EntitiesFieldData::EntData::getIndices() const {
1205  return iNdices;
1206 }
1207 
1208 const VectorIntAdaptor
1209 EntitiesFieldData::EntData::getIndicesUpToOrder(int order) {
1210  unsigned int size = 0;
1211  if (auto dof = dOfs[0]) {
1212  size = dof->getOrderNbDofs(order) * dof->getNbOfCoeffs();
1213  size = size < iNdices.size() ? size : iNdices.size();
1214  }
1215  int *data = &*iNdices.data().begin();
1216  return VectorIntAdaptor(size, ublas::shallow_array_adaptor<int>(size, data));
1217 }
1218 
1219 const VectorInt &EntitiesFieldData::EntData::getLocalIndices() const {
1220  return localIndices;
1221 }
1222 
1223 const VectorIntAdaptor
1224 EntitiesFieldData::EntData::getLocalIndicesUpToOrder(int order) {
1225  unsigned int size = 0;
1226  if (auto dof = dOfs[0]) {
1227  size = dof->getOrderNbDofs(order) * dof->getNbOfCoeffs();
1228  size = size < localIndices.size() ? size : localIndices.size();
1229  }
1230  int *data = &*localIndices.data().begin();
1231  return VectorIntAdaptor(size, ublas::shallow_array_adaptor<int>(size, data));
1232 }
1233 
1234 int &EntitiesFieldData::EntData::getSense() { return sEnse; }
1235 
1236 ApproximationOrder &EntitiesFieldData::EntData::getOrder() { return oRder; }
1237 
1238 VectorInt &EntitiesFieldData::EntData::getIndices() { return iNdices; }
1239 
1240 VectorInt &EntitiesFieldData::EntData::getLocalIndices() {
1241  return localIndices;
1242 }
1243 
1244 const VectorDouble &EntitiesFieldData::EntData::getFieldData() const {
1245  return fieldData;
1246 }
1247 
1248 const VectorAdaptor
1249 EntitiesFieldData::EntData::getFieldDataUpToOrder(int order) {
1250  unsigned int size = 0;
1251  if (auto dof = dOfs[0]) {
1252  size = dof->getOrderNbDofs(order) * dof->getNbOfCoeffs();
1253  size = size < fieldData.size() ? size : fieldData.size();
1254  }
1255  double *data = &*fieldData.data().begin();
1256  return getVectorAdaptor(data, size);
1257 }
1258 
1259 const VectorDofs &EntitiesFieldData::EntData::getFieldDofs() const {
1260  return dOfs;
1261 }
1262 
1263 VectorDofs &EntitiesFieldData::EntData::getFieldDofs() { return dOfs; }
1264 
1265 VectorDouble &EntitiesFieldData::EntData::getFieldData() { return fieldData; }
1266 
1267 VectorFieldEntities &EntitiesFieldData::EntData::getFieldEntities() {
1268  return fieldEntities;
1269 }
1270 
1271 const VectorFieldEntities &
1272 EntitiesFieldData::EntData::getFieldEntities() const {
1273  return fieldEntities;
1274 }
1275 
1276 template <int Tensor_Dim>
1278 EntitiesFieldData::EntData::getFTensor1FieldData() {
1279  std::stringstream s;
1280  s << "Not implemented for this dimension dim = " << Tensor_Dim;
1281  THROW_MESSAGE(s.str());
1282 }
1283 
1284 template <int Tensor_Dim0, int Tensor_Dim1>
1286  Tensor_Dim0, Tensor_Dim1>
1287 EntitiesFieldData::EntData::getFTensor2FieldData() {
1288  std::stringstream s;
1289  s << "Not implemented for this dimension dim0 = " << Tensor_Dim0;
1290  s << " and dim1 " << Tensor_Dim1;
1291  THROW_MESSAGE(s.str());
1292 }
1293 
1294 template <int Tensor_Dim>
1296  FTensor::PackPtr<double *, (Tensor_Dim * (Tensor_Dim + 1)) / 2>, Tensor_Dim>
1297 EntitiesFieldData::EntData::getFTensor2SymmetricFieldData() {
1298  std::stringstream s;
1299  s << "Not implemented for this dimension dim = " << Tensor_Dim;
1300  THROW_MESSAGE(s.str());
1301 }
1302 
1303 FieldApproximationBase &EntitiesFieldData::EntData::getBase() { return bAse; }
1304 
1305 FieldSpace &EntitiesFieldData::EntData::getSpace() { return sPace; }
1306 
1307 MatrixDouble &
1308 EntitiesFieldData::EntData::getN(const FieldApproximationBase base) {
1309  return *(getNSharedPtr(base));
1310 }
1311 
1312 MatrixDouble &EntitiesFieldData::EntData::getN(const std::string &field_name) {
1313  return *(getBBNSharedPtr(field_name));
1314 }
1315 
1316 MatrixDouble &EntitiesFieldData::EntData::getN() { return getN(bAse); }
1317 
1318 MatrixDouble &
1319 EntitiesFieldData::EntData::getDiffN(const FieldApproximationBase base) {
1320  return *(getDiffNSharedPtr(base));
1321 }
1322 
1323 MatrixDouble &
1324 EntitiesFieldData::EntData::getN(const FieldApproximationBase base,
1325  const BaseDerivatives derivative) {
1326 #ifndef NDEBUG
1327  if (!getNSharedPtr(base, derivative)) {
1328  MOFEM_LOG_C("SELF", Sev::error,
1329  "Ptr to base %s functions derivative %d is null",
1330  ApproximationBaseNames[base], derivative);
1331  THROW_MESSAGE("Null pointer");
1332  }
1333 #endif
1334  return *(getNSharedPtr(base, derivative));
1335 }
1336 
1337 MatrixDouble &
1338 EntitiesFieldData::EntData::getDiffN(const std::string &field_name) {
1339  return *(getBBDiffNSharedPtr(field_name));
1340 }
1341 
1342 MatrixDouble &EntitiesFieldData::EntData::getDiffN() { return getDiffN(bAse); }
1343 
1344 MatrixDouble &
1345 EntitiesFieldData::EntData::getN(const BaseDerivatives derivative) {
1346  return getN(bAse, derivative);
1347 }
1348 
1349 const VectorAdaptor
1350 EntitiesFieldData::EntData::getN(const FieldApproximationBase base,
1351  const int gg) {
1352  int size = getN(base).size2();
1353  double *data = &getN(base)(gg, 0);
1354  return VectorAdaptor(size, ublas::shallow_array_adaptor<double>(size, data));
1355 }
1356 
1357 const VectorAdaptor EntitiesFieldData::EntData::getN(const int gg) {
1358  return getN(bAse, gg);
1359 }
1360 
1361 const MatrixAdaptor
1362 EntitiesFieldData::EntData::getDiffN(const FieldApproximationBase base,
1363  const int gg) {
1364  // FIXME: That is bug, it will not work if number of integration pts is
1365  // equal to number of nodes on entity. User who not implementing low
1366  // level DataOperator will not experience this.
1367  if (getN(base).size1() == getDiffN(base).size1()) {
1368  int size = getN(base).size2();
1369  int dim = getDiffN(base).size2() / size;
1370  double *data = &getDiffN(base)(gg, 0);
1371  return MatrixAdaptor(
1372  getN(base).size2(), dim,
1373  ublas::shallow_array_adaptor<double>(getDiffN(base).size2(), data));
1374  } else {
1375  // in some cases, f.e. for derivatives of nodal base functions at only
1376  // one gauss point is needed
1377  return MatrixAdaptor(
1378  getN(base).size1(), getN(base).size2(),
1379  ublas::shallow_array_adaptor<double>(getDiffN(base).data().size(),
1380  &getDiffN(base).data()[0]));
1381  }
1382 }
1383 
1384 const MatrixAdaptor EntitiesFieldData::EntData::getDiffN(const int gg) {
1385  return getDiffN(bAse, gg);
1386 }
1387 
1388 const VectorAdaptor
1389 EntitiesFieldData::EntData::getN(const FieldApproximationBase base,
1390  const int gg, const int nb_base_functions) {
1391  (void)getN()(gg, nb_base_functions -
1392  1); // throw error if nb_base_functions is to big
1393  double *data = &getN(base)(gg, 0);
1394  return VectorAdaptor(nb_base_functions, ublas::shallow_array_adaptor<double>(
1395  nb_base_functions, data));
1396 }
1397 
1398 const VectorAdaptor
1399 EntitiesFieldData::EntData::getN(const int gg, const int nb_base_functions) {
1400  return getN(bAse, gg, nb_base_functions);
1401 }
1402 
1403 const MatrixAdaptor
1404 EntitiesFieldData::EntData::getDiffN(const FieldApproximationBase base,
1405  const int gg,
1406  const int nb_base_functions) {
1407  // FIXME: That is bug, it will not work if number of integration pts is
1408  // equal to number of nodes on entity. User who not implementing low
1409  // level DataOperator will not experience this.
1410  if (getN(base).size1() == getDiffN(base).size1()) {
1411  (void)getN(base)(gg,
1412  nb_base_functions -
1413  1); // throw error if nb_base_functions is to big
1414  int dim = getDiffN(base).size2() / getN(base).size2();
1415  double *data = &getDiffN(base)(gg, 0);
1416  return MatrixAdaptor(
1417  nb_base_functions, dim,
1418  ublas::shallow_array_adaptor<double>(dim * nb_base_functions, data));
1419  } else {
1420  // in some cases, f.e. for derivatives of nodal base functions only one
1421  // gauss point is needed
1422  return MatrixAdaptor(
1423  getN(base).size1(), getN(base).size2(),
1424  ublas::shallow_array_adaptor<double>(getDiffN(base).data().size(),
1425  &getDiffN(base).data()[0]));
1426  }
1427 }
1428 
1429 const MatrixAdaptor
1430 EntitiesFieldData::EntData::getDiffN(const int gg,
1431  const int nb_base_functions) {
1432  return getDiffN(bAse, gg, nb_base_functions);
1433 }
1434 
1435 template <int DIM>
1436 const MatrixAdaptor
1437 EntitiesFieldData::EntData::getVectorN(const FieldApproximationBase base,
1438  const int gg) {
1439  if (PetscUnlikely(getN(base).size2() % DIM)) {
1440  THROW_MESSAGE("Wrong dimension");
1441  }
1442 
1443  const int nb_base_functions = getN(base).size2() / DIM;
1444  double *data = &getN(base)(gg, 0);
1445  return MatrixAdaptor(
1446  nb_base_functions, DIM,
1447  ublas::shallow_array_adaptor<double>(DIM * nb_base_functions, data));
1448 }
1449 
1450 template <int DIM>
1451 const MatrixAdaptor EntitiesFieldData::EntData::getVectorN(const int gg) {
1452  return getVectorN<DIM>(bAse, gg);
1453 }
1454 
1455 template <int DIM0, int DIM1>
1456 const MatrixAdaptor
1457 EntitiesFieldData::EntData::getVectorDiffN(FieldApproximationBase base,
1458  const int gg) {
1459  if (PetscUnlikely(getDiffN(base).size2() % (DIM0 * DIM1))) {
1460  THROW_MESSAGE("Wrong dimension");
1461  }
1462 
1463  const int nb_base_functions = getN(base).size2() / (DIM0 * DIM1);
1464  double *data = &getN(base)(gg, 0);
1465  return MatrixAdaptor(nb_base_functions, DIM0 * DIM1,
1466  ublas::shallow_array_adaptor<double>(
1467  DIM0 * DIM1 * nb_base_functions, data));
1468 }
1469 
1470 template <int DIM0, int DIM1>
1471 const MatrixAdaptor EntitiesFieldData::EntData::getVectorDiffN(const int gg) {
1472  return getVectorDiffN<DIM0, DIM1>(bAse, gg);
1473 }
1474 
1475 template <int DIM0, int DIM1>
1476 const MatrixAdaptor
1477 EntitiesFieldData::EntData::getVectorDiffN(const FieldApproximationBase base,
1478  const int dof, const int gg) {
1479  double *data =
1480  &EntitiesFieldData::EntData::getDiffN(base)(gg, DIM0 * DIM1 * dof);
1481  return MatrixAdaptor(DIM0, DIM1,
1482  ublas::shallow_array_adaptor<double>(DIM0 * DIM1, data));
1483 }
1484 
1485 template <int DIM0, int DIM1>
1486 const MatrixAdaptor EntitiesFieldData::EntData::getVectorDiffN(const int dof,
1487  const int gg) {
1488  return getVectorDiffN<DIM0, DIM1>(bAse, dof, gg);
1489 }
1490 
1492 EntitiesFieldData::EntData::getFTensor0N(const FieldApproximationBase base) {
1493  double *ptr = &*getN(base).data().begin();
1495 };
1496 
1498 EntitiesFieldData::EntData::getFTensor0N() {
1499  return getFTensor0N(bAse);
1500 };
1501 
1503 EntitiesFieldData::EntData::getFTensor0N(const FieldApproximationBase base,
1504  const int gg, const int bb) {
1505  double *ptr = &getN(base)(gg, bb);
1507 };
1508 
1510 EntitiesFieldData::EntData::getFTensor0N(const int gg, const int bb) {
1511  return getFTensor0N(bAse, gg, bb);
1512 };
1513 
1514 template <int Tensor_Dim> auto EntitiesFieldData::EntData::getFTensor1N() {
1515  return getFTensor1N<Tensor_Dim>(bAse);
1516 }
1517 
1518 template <int Tensor_Dim>
1519 auto EntitiesFieldData::EntData::getFTensor1N(const int gg, const int bb) {
1520  return getFTensor1N<Tensor_Dim>(bAse, gg, bb);
1521 }
1522 
1523 template <int Tensor_Dim0, int Tensor_Dim1>
1524 auto EntitiesFieldData::EntData::getFTensor2N() {
1525  return getFTensor2N<Tensor_Dim0, Tensor_Dim1>(bAse);
1526 }
1527 
1528 template <int Tensor_Dim0, int Tensor_Dim1>
1529 auto EntitiesFieldData::EntData::getFTensor2N(const int gg, const int bb) {
1530  return getFTensor2N<Tensor_Dim0, Tensor_Dim1>(bAse, gg, bb);
1531 }
1532 
1533 /** \name Bernstein-Bezier base only functions */
1534 
1535 /**@{*/
1536 
1537 VectorInt &EntitiesFieldData::EntData::getBBNodeOrder() { return bbNodeOrder; }
1538 
1539 MatrixInt &EntitiesFieldData::EntData::getBBAlphaIndices() {
1540  return *getBBAlphaIndicesSharedPtr(bbFieldName);
1541 }
1542 
1543 /**@}*/
1544 
1545 /** \name DerivedEntData */
1546 
1547 /**@{*/
1548 
1549 boost::shared_ptr<MatrixDouble> &
1550 DerivedEntitiesFieldData::DerivedEntData::getDerivedNSharedPtr(
1551  const FieldApproximationBase base) {
1552  return N[base];
1553 }
1554 
1555 boost::shared_ptr<MatrixDouble> &
1556 DerivedEntitiesFieldData::DerivedEntData::getDerivedDiffNSharedPtr(
1557  const FieldApproximationBase base) {
1558  return diffN[base];
1559 }
1560 
1561 /**@}*/
1562 
1563 /**
1564  * @brief Assemble PETSc vector
1565  *
1566  * Function extract indices from entity data and assemble vector
1567  *
1568  * <a
1569  * href=https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecSetValues.html>See
1570  * PETSc documentation</a>
1571  *
1572  * @param V
1573  * @param data
1574  * @param ptr
1575  * @param iora
1576  * @return MoFEMErrorCode
1577  */
1578 template <typename T = EntityStorage>
1580  const EntitiesFieldData::EntData &data,
1581  const double *ptr, InsertMode iora) {
1582  static_assert(!std::is_same<T, T>::value,
1583  "VecSetValues value for this data storage is not implemented");
1584  return MOFEM_NOT_IMPLEMENTED;
1585 }
1586 
1587 template <>
1588 inline MoFEMErrorCode
1590  const double *ptr, InsertMode iora) {
1591  return VecSetValues(V, data.getIndices().size(), &*data.getIndices().begin(),
1592  ptr, iora);
1593 }
1594 
1595 /**
1596  * @brief Assemble PETSc vector
1597  *
1598  * Function extract indices from entity data and assemble vector
1599  *
1600  * <a
1601  * href=https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecSetValues.html>See
1602  * PETSc documentation</a>
1603  *
1604  * @param V
1605  * @param data
1606  * @param vec
1607  * @param iora
1608  * @return MoFEMErrorCode
1609  */
1610 template <typename T = EntityStorage>
1612  const EntitiesFieldData::EntData &data,
1613  const VectorDouble &vec, InsertMode iora) {
1614  return VecSetValues<T>(V, data, &*vec.data().begin(), iora);
1615 }
1616 
1617 /**
1618  * @brief Assemble PETSc matrix
1619  *
1620  * Function extract indices from entity data and assemble vector
1621  *
1622  * <a
1623  * href=https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValues.html>See
1624  * PETSc documentation</a>
1625  *
1626  * @param M
1627  * @param row_data
1628  * @param col_data
1629  * @param ptr
1630  * @param iora
1631  * @return MoFEMErrorCode
1632  */
1633 template <typename T = EntityStorage>
1635  const EntitiesFieldData::EntData &row_data,
1636  const EntitiesFieldData::EntData &col_data,
1637  const double *ptr, InsertMode iora) {
1638  static_assert(!std::is_same<T, T>::value,
1639  "MatSetValues value for this data storage is not implemented");
1640  return MOFEM_NOT_IMPLEMENTED;
1641 }
1642 
1643 /**
1644  * @brief Assemble PETSc matrix
1645  *
1646  * Function extract indices from entity data and assemble vector
1647  *
1648  * <a
1649  * href=https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValues.html>See
1650  * PETSc documentation</a>
1651  *
1652  * @param M
1653  * @param row_data
1654  * @param col_data
1655  * @param mat
1656  * @param iora
1657  * @return MoFEMErrorCode
1658  */
1659 template <typename T = EntityStorage>
1661  const EntitiesFieldData::EntData &row_data,
1662  const EntitiesFieldData::EntData &col_data,
1663  const MatrixDouble &mat, InsertMode iora) {
1664  return MatSetValues<T>(M, row_data, col_data, &*mat.data().begin(), iora);
1665 }
1666 
1667 template <>
1668 inline MoFEMErrorCode
1670  const EntitiesFieldData::EntData &col_data,
1671  const double *ptr, InsertMode iora) {
1672  return MatSetValues(
1673  M, row_data.getIndices().size(), &*row_data.getIndices().begin(),
1674  col_data.getIndices().size(), &*col_data.getIndices().begin(), ptr, iora);
1675 }
1676 
1677 /** \name Specializations for tensor base function */
1678 
1679 /**@{*/
1680 
1681 template <>
1683 EntitiesFieldData::EntData::getFTensor1N<3>(FieldApproximationBase base);
1684 
1685 template <>
1687 EntitiesFieldData::EntData::getFTensor1N<3>(FieldApproximationBase base,
1688  const int gg, const int bb);
1689 
1690 template <>
1692 EntitiesFieldData::EntData::getFTensor2N<3, 3>(FieldApproximationBase base);
1693 
1694 /**@}*/
1695 
1696 /** \name Specializations for direcatives of base functions */
1697 
1698 /**@{*/
1699 
1700 template <>
1702 EntitiesFieldData::EntData::getFTensor1DiffN<3>(
1703  const FieldApproximationBase base);
1704 template <>
1706 EntitiesFieldData::EntData::getFTensor1DiffN<3>();
1707 
1708 template <>
1710 EntitiesFieldData::EntData::getFTensor1DiffN<2>(
1711  const FieldApproximationBase base);
1712 template <>
1714 EntitiesFieldData::EntData::getFTensor1DiffN<2>();
1715 
1716 template <>
1718 EntitiesFieldData::EntData::getFTensor2DiffN<3, 2>(FieldApproximationBase base);
1719 template <>
1721 EntitiesFieldData::EntData::getFTensor2DiffN<3, 2>(FieldApproximationBase base,
1722  const int gg, const int bb);
1723 
1724 template <>
1726 EntitiesFieldData::EntData::getFTensor3Diff2N(FieldApproximationBase base);
1727 
1728 /**@}*/
1729 
1730 /** \name Specializations for field data */
1731 
1732 /**@{*/
1733 
1734 template <>
1736 EntitiesFieldData::EntData::getFTensor1FieldData<3>();
1737 
1738 template <>
1740 EntitiesFieldData::EntData::getFTensor1FieldData<2>();
1741 
1742 template <>
1744 EntitiesFieldData::EntData::getFTensor1FieldData<1>();
1745 
1746 template <>
1748 EntitiesFieldData::EntData::getFTensor2FieldData<1, 1>();
1749 
1750 template <>
1752 EntitiesFieldData::EntData::getFTensor2FieldData<1, 2>();
1753 
1754 template <>
1756 EntitiesFieldData::EntData::getFTensor2FieldData<1, 3>();
1757 
1758 template <>
1760 EntitiesFieldData::EntData::getFTensor2FieldData<2, 2>();
1761 
1762 template <>
1764 EntitiesFieldData::EntData::getFTensor2FieldData<3, 3>();
1765 
1766 template <>
1768 EntitiesFieldData::EntData::getFTensor2SymmetricFieldData<3>();
1769 
1770 template <>
1772 EntitiesFieldData::EntData::getFTensor2SymmetricFieldData<2>();
1773 
1774 /**@}*/
1775 
1776 /**
1777  * @deprecated Use EntitiesFieldData
1778  */
1780 
1781 /**
1782  * @deprecated Use DerivedEntitiesFieldData
1783  */
1785 
1786 } // namespace MoFEM
1787 
1788 #endif //__ENTITIES_FIELD_DATA_HPP__
1789 
1790 /**
1791  * \defgroup mofem_forces_and_sources_user_data_operators User data operator
1792  * data structures \ingroup
1793  *
1794  * \brief Users data structures and operator
1795  *
1796  * Data structures passed by argument to MoFEM::DataOperator::doWork and generic
1797  * user operators operating on those structures.
1798  *
1799  */
UBlasMatrix< double >
MoFEM::operator<<
std::ostream & operator<<(std::ostream &os, const EntitiesFieldData::EntData &e)
Definition: EntitiesFieldData.cpp:240
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
MoFEM::EntitiesFieldData::EntData::resetFieldDependentData
MoFEMErrorCode resetFieldDependentData()
Definition: EntitiesFieldData.cpp:115
MoFEM::EntitiesFieldData::EntData::getFTensor3Diff2N
FTensor::Tensor3< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 *Tensor_Dim2 >, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2 > getFTensor3Diff2N()
Get second derivatives of base functions for Hvec space.
Definition: EntitiesFieldData.hpp:780
MoFEM::EntitiesFieldData::facesNodesOrder
MatrixInt facesNodesOrder
order of face nodes on element
Definition: EntitiesFieldData.hpp:46
DEPRECATED
#define DEPRECATED
Definition: definitions.h:17
MoFEM::MatSetValues< EntityStorage >
MoFEMErrorCode MatSetValues< EntityStorage >(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Definition: EntitiesFieldData.hpp:1669
MoFEM::EntitiesFieldData::EntData::N
std::array< boost::shared_ptr< MatrixDouble >, LASTBASE > & N
Base functions.
Definition: EntitiesFieldData.hpp:1082
LASTBASE
@ LASTBASE
Definition: definitions.h:69
BITFEID_SIZE
#define BITFEID_SIZE
max number of finite elements
Definition: definitions.h:234
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
MoFEM::EntitiesFieldData::EntData::sPace
FieldSpace sPace
Entity space.
Definition: EntitiesFieldData.hpp:1069
MoFEM::EntitiesFieldData::basesOnEntities
std::array< std::bitset< LASTBASE >, MBMAXTYPE > basesOnEntities
bases on entity types
Definition: EntitiesFieldData.hpp:51
MoFEM::VecSetValues
MoFEMErrorCode VecSetValues(Vec V, const EntitiesFieldData::EntData &data, const VectorDouble &vec, InsertMode iora)
Assemble PETSc vector.
Definition: EntitiesFieldData.hpp:1611
MoFEM::EntitiesFieldData::EntData::ForthDerivative
@ ForthDerivative
Definition: EntitiesFieldData.hpp:135
MoFEM::DofsAllocator
ublas::unbounded_array< FEDofEntity *, std::allocator< FEDofEntity * > > DofsAllocator
Definition: EntitiesFieldData.hpp:21
MoFEM::EntitiesFieldData::EntData::getFTensor2DiffN
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2DiffN(const int gg, const int bb)
Get derivatives of base functions for Hdiv space at integration pts.
Definition: EntitiesFieldData.hpp:762
ApproximationBaseNames
const static char *const ApproximationBaseNames[]
Definition: definitions.h:72
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::Types::MatrixDouble
UBlasMatrix< double > MatrixDouble
Definition: Types.hpp:77
MoFEM::EntitiesFieldData::EntData::bbFieldName
std::string bbFieldName
field name
Definition: EntitiesFieldData.hpp:1086
MoFEM::Types::VectorIntAdaptor
VectorShallowArrayAdaptor< int > VectorIntAdaptor
Definition: Types.hpp:116
MoFEM::EntitiesFieldData::EntData::getFTensor2DiffN
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2DiffN()
Get derivatives of base functions for Hdiv space.
Definition: EntitiesFieldData.hpp:752
MoFEM::DerivedEntitiesFieldData
this class derive data form other data structure
Definition: EntitiesFieldData.hpp:110
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
MoFEM::EntitiesFieldData::spacesOnEntities
std::array< std::bitset< LASTSPACE >, MBMAXTYPE > spacesOnEntities
spaces on entity types
Definition: EntitiesFieldData.hpp:49
MoFEM::EntitiesFieldData::EntitiesFieldData
EntitiesFieldData()
Definition: EntitiesFieldData.hpp:96
THROW_MESSAGE
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
MoFEM::EntitiesFieldData::EntData::sEnse
int sEnse
Entity sense (orientation)
Definition: EntitiesFieldData.hpp:1067
MoFEM::EntitiesFieldData::EntData::swapBaseNPtr
boost::shared_ptr< MatrixDouble > swapBaseNPtr
Used by Bernstein base to keep temporally pointer.
Definition: EntitiesFieldData.hpp:1106
MoFEM::EntitiesFieldData::facesNodes
MatrixInt facesNodes
nodes on finite element faces
Definition: EntitiesFieldData.hpp:45
MoFEM::DerivedEntitiesFieldData::DerivedEntData
Derived ata on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:1130
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
order
constexpr int order
Definition: dg_projection.cpp:18
MoFEM::EntitiesFieldData::basesOnSpaces
std::array< std::bitset< LASTBASE >, LASTSPACE > basesOnSpaces
base on spaces
Definition: EntitiesFieldData.hpp:53
MoFEM::BaseDerivatives
EntitiesFieldData::EntData::BaseDerivatives BaseDerivatives
Definition: EntitiesFieldData.hpp:1120
FieldSpace
FieldSpace
approximation spaces
Definition: definitions.h:82
PlasticOps::M
FTensor::Index< 'M', 3 > M
Definition: PlasticOps.hpp:117
MoFEM::OpGetBrokenBaseSideData
Definition: FormsBrokenSpaceConstraintImpl.hpp:68
FTensor::Tensor3
Definition: Tensor3_value.hpp:12
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::EntitiesFieldData::EntData::BaseDerivatives
BaseDerivatives
Definition: EntitiesFieldData.hpp:130
MoFEM::EntitiesFieldData::EntData::bbAlphaIndices
std::map< std::string, boost::shared_ptr< MatrixInt > > bbAlphaIndices
Indices for Bernstein-Bezier (BB) base.
Definition: EntitiesFieldData.hpp:1091
MoFEM::EntitiesFieldData::EntData::bAse
FieldApproximationBase bAse
Field approximation base.
Definition: EntitiesFieldData.hpp:1070
MoFEM::getVectorAdaptor
auto getVectorAdaptor(T1 ptr, const size_t n)
Get Vector adaptor.
Definition: Templates.hpp:31
MoFEM::EntitiesFieldData::EntData::ThirdDerivative
@ ThirdDerivative
Definition: EntitiesFieldData.hpp:134
MoFEM::EntitiesFieldData::EntData::iNdices
VectorInt iNdices
Global indices on entity.
Definition: EntitiesFieldData.hpp:1071
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
MoFEM::EntitiesFieldData::EntData::FirstDerivative
@ FirstDerivative
Definition: EntitiesFieldData.hpp:132
MoFEM::EntitiesFieldData::EntData::bbDiffN
std::map< std::string, boost::shared_ptr< MatrixDouble > > bbDiffN
Definition: EntitiesFieldData.hpp:1089
MoFEM::Types::MatrixInt
UBlasMatrix< int > MatrixInt
Definition: Types.hpp:76
DIM1
constexpr int DIM1
Definition: level_set.cpp:21
MoFEM::DerivedEntitiesFieldData::DerivedEntData::entDataPtr
const boost::shared_ptr< EntitiesFieldData::EntData > entDataPtr
Definition: EntitiesFieldData.hpp:1197
MoFEM::EntitiesFieldData::EntData::fieldEntities
VectorFieldEntities fieldEntities
Field entities.
Definition: EntitiesFieldData.hpp:1074
convert.type
type
Definition: convert.py:64
MoFEM::EntitiesFieldData::EntData::bbNodeOrder
VectorInt bbNodeOrder
order of nodes
Definition: EntitiesFieldData.hpp:1087
MoFEM::DerivedEntitiesFieldData::dataPtr
const boost::shared_ptr< EntitiesFieldData > dataPtr
Definition: EntitiesFieldData.hpp:119
MoFEM::EntitiesFieldData::EntData::getIndices
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Definition: EntitiesFieldData.hpp:1204
MoFEM::VectorDofs
ublas::vector< FEDofEntity *, DofsAllocator > VectorDofs
Definition: EntitiesFieldData.hpp:23
MoFEM::FieldEntity
Struct keeps handle to entity in the field.
Definition: FieldEntsMultiIndices.hpp:24
LASTSPACE
@ LASTSPACE
FieldSpace in [ 0, LASTSPACE )
Definition: definitions.h:89
FTensor::PackPtr
Definition: FTensor.hpp:54
MoFEM::VecSetValues< EntityStorage >
MoFEMErrorCode VecSetValues< EntityStorage >(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Definition: EntitiesFieldData.hpp:1589
MoFEM::EntitiesFieldData::brokenBasesOnSpaces
std::array< std::bitset< LASTBASE >, LASTSPACE > brokenBasesOnSpaces
base on spaces
Definition: EntitiesFieldData.hpp:55
MoFEM::EntitiesFieldData::EntData::bbAlphaIndicesByOrder
std::array< boost::shared_ptr< MatrixInt >, MaxBernsteinBezierOrder > bbAlphaIndicesByOrder
BB alpha indices by order.
Definition: EntitiesFieldData.hpp:1098
MoFEM::Types::VectorAdaptor
VectorShallowArrayAdaptor< double > VectorAdaptor
Definition: Types.hpp:115
MoFEM::EntitiesFieldData::bAse
std::bitset< LASTBASE > bAse
bases on element
Definition: EntitiesFieldData.hpp:42
MoFEM::EntitiesFieldData::EntData::bbNByOrder
std::array< boost::shared_ptr< MatrixDouble >, MaxBernsteinBezierOrder > bbNByOrder
BB base functions by order.
Definition: EntitiesFieldData.hpp:1094
MoFEM::DerivedDataForcesAndSourcesCore
DEPRECATED typedef DerivedEntitiesFieldData DerivedDataForcesAndSourcesCore
Definition: EntitiesFieldData.hpp:1784
EntData
EntitiesFieldData::EntData EntData
Definition: child_and_parent.cpp:37
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
N
const int N
Definition: speed_test.cpp:3
MoFEM::EntitiesFieldData::EntData::bbDiffNByOrder
std::array< boost::shared_ptr< MatrixDouble >, MaxBernsteinBezierOrder > bbDiffNByOrder
BB base functions directives by order.
Definition: EntitiesFieldData.hpp:1096
MoFEM::MatSetValues
MoFEMErrorCode MatSetValues(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const MatrixDouble &mat, InsertMode iora)
Assemble PETSc matrix.
Definition: EntitiesFieldData.hpp:1660
MoFEM::EntitiesFieldData::EntData::entDataBitRefLevel
std::vector< BitRefLevel > entDataBitRefLevel
Bit ref level in entity.
Definition: EntitiesFieldData.hpp:1076
MoFEM::Types::ApproximationOrder
int ApproximationOrder
Approximation on the entity.
Definition: Types.hpp:26
FTensor::Tensor0
Definition: Tensor0.hpp:16
MoFEM::EntitiesFieldData::EntData::localIndices
VectorInt localIndices
Local indices on entity.
Definition: EntitiesFieldData.hpp:1072
MoFEM::Types::VectorInt
UBlasVector< int > VectorInt
Definition: Types.hpp:67
UBlasVector< double >
EigenMatrix::Vec
const FTensor::Tensor2< T, Dim, Dim > Vec
Definition: MatrixFunction.hpp:66
FieldApproximationBase
FieldApproximationBase
approximation base
Definition: definitions.h:58
MoFEM::Types::VectorDouble
UBlasVector< double > VectorDouble
Definition: Types.hpp:68
MoFEM::EntitiesFieldData::EntData::baseFunctionsAndBaseDerivatives
std::array< std::array< boost::shared_ptr< MatrixDouble >, LASTBASE >, LastDerivative > baseFunctionsAndBaseDerivatives
Definition: EntitiesFieldData.hpp:1080
MoFEM::EntitiesFieldData::dataOnEntities
std::array< boost::ptr_vector< EntData >, MBMAXTYPE > dataOnEntities
Definition: EntitiesFieldData.hpp:57
MoFEM::EntitiesFieldData::EntData::bbN
std::map< std::string, boost::shared_ptr< MatrixDouble > > bbN
Definition: EntitiesFieldData.hpp:1088
MoFEM::EntitiesFieldData::EntData::swapBaseDiffNPtr
boost::shared_ptr< MatrixDouble > swapBaseDiffNPtr
Used by Bernstein base to keep temporally pointer.
Definition: EntitiesFieldData.hpp:1113
MoFEM::EntitiesFieldData::EntData::baseSwap
virtual MoFEMErrorCode baseSwap(const std::string &field_name, const FieldApproximationBase base)
Swap bases functions.
Definition: EntitiesFieldData.cpp:136
MoFEM::EntitiesFieldData::EntData::oRder
ApproximationOrder oRder
Entity order.
Definition: EntitiesFieldData.hpp:1068
MoFEM::VectorFieldEntities
ublas::vector< FieldEntity *, FieldEntAllocator > VectorFieldEntities
Definition: EntitiesFieldData.hpp:31
MoFEM::Types::MatrixAdaptor
MatrixShallowArrayAdaptor< double > MatrixAdaptor
Matrix adaptor.
Definition: Types.hpp:132
MoFEM::EntitiesFieldData::EntData::fieldData
VectorDouble fieldData
Field data on entity.
Definition: EntitiesFieldData.hpp:1075
MoFEM::FieldEntAllocator
ublas::unbounded_array< FieldEntity *, std::allocator< FieldEntity * > > FieldEntAllocator
Definition: EntitiesFieldData.hpp:29
MoFEM::DataForcesAndSourcesCore
DEPRECATED typedef EntitiesFieldData DataForcesAndSourcesCore
Definition: EntitiesFieldData.hpp:1779
MoFEM::EntitiesFieldData::EntData::dOfs
VectorDofs dOfs
DoFs on entity.
Definition: EntitiesFieldData.hpp:1073
MoFEM::EntitiesFieldData
data structure for finite element entity
Definition: EntitiesFieldData.hpp:40
MoFEM::EntitiesFieldData::EntData::SecondDerivative
@ SecondDerivative
Definition: EntitiesFieldData.hpp:133
MoFEM::OpAddParentEntData
Operator to project base functions from parent entity to child.
Definition: MeshProjectionDataOperators.hpp:66
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::EntitiesFieldData::EntData::diffN
std::array< boost::shared_ptr< MatrixDouble >, LASTBASE > & diffN
Derivatives of base functions.
Definition: EntitiesFieldData.hpp:1084