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