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