v0.14.0
UserDataOperators.hpp
Go to the documentation of this file.
1 /** \file UserDataOperators.hpp
2  * \brief User data Operators
3 
4 */
5 
6 #ifndef __USER_DATA_OPERATORS_HPP__
7 #define __USER_DATA_OPERATORS_HPP__
8 
9 namespace MoFEM {
10 
11 /** \name Get values at Gauss pts */
12 
13 /**@{*/
14 
15 /** \name Scalar values */
16 
17 /**@{*/
18 
19 /** \brief Scalar field values at integration points
20  *
21  */
22 template <class T, class A>
25 
27  const std::string field_name,
28  boost::shared_ptr<ublas::vector<T, A>> data_ptr,
29  const EntityType zero_type = MBVERTEX)
31  dataPtr(data_ptr), zeroType(zero_type) {
32  if (!dataPtr)
33  THROW_MESSAGE("Pointer is not set");
34  }
35 
37  const std::string field_name,
38  boost::shared_ptr<ublas::vector<T, A>> data_ptr,
39  SmartPetscObj<Vec> data_vec, const EntityType zero_type = MBVERTEX)
41  dataPtr(data_ptr), zeroType(zero_type), dataVec(data_vec) {
42  if (!dataPtr)
43  THROW_MESSAGE("Pointer is not set");
44  }
45 
46  /**
47  * \brief calculate values of scalar field at integration points
48  * @param side side entity number
49  * @param type side entity type
50  * @param data entity data
51  * @return error code
52  */
53  MoFEMErrorCode doWork(int side, EntityType type,
55 
56 protected:
57  boost::shared_ptr<ublas::vector<T, A>> dataPtr;
61 };
62 
63 /**
64  * \brief Specialization of member function
65  *
66  */
67 template <class T, class A>
69  int side, EntityType type, EntitiesFieldData::EntData &data) {
71  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED, "Not implemented for T = %s",
72  typeid(T).name() // boost::core::demangle(typeid(T).name()).c_str()
73  );
75 }
76 
77 /**
78  * \brief Get value at integration points for scalar field
79  *
80  * \ingroup mofem_forces_and_sources_user_data_operators
81  */
83  : public OpCalculateScalarFieldValues_General<double, DoubleAllocator> {
84 
87 
88  /**
89  * \brief calculate values of scalar field at integration points
90  * @param side side entity number
91  * @param type side entity type
92  * @param data entity data
93  * @return error code
94  */
95  MoFEMErrorCode doWork(int side, EntityType type,
98  VectorDouble &vec = *dataPtr;
99  const size_t nb_gauss_pts = getGaussPts().size2();
100  if (type == zeroType || vec.size() != nb_gauss_pts) {
101  vec.resize(nb_gauss_pts, false);
102  vec.clear();
103  }
104 
105  const size_t nb_dofs = data.getFieldData().size();
106 
107  if (nb_dofs) {
108 
109  if (dataVec.use_count()) {
110  dotVector.resize(nb_dofs, false);
111  const double *array;
112  CHKERR VecGetArrayRead(dataVec, &array);
113  const auto &local_indices = data.getLocalIndices();
114  for (int i = 0; i != local_indices.size(); ++i)
115  if (local_indices[i] != -1)
116  dotVector[i] = array[local_indices[i]];
117  else
118  dotVector[i] = 0;
119  CHKERR VecRestoreArrayRead(dataVec, &array);
120  data.getFieldData().swap(dotVector);
121  }
122 
123  const size_t nb_base_functions = data.getN().size2();
124  auto base_function = data.getFTensor0N();
125  auto values_at_gauss_pts = getFTensor0FromVec(vec);
126  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
127  auto field_data = data.getFTensor0FieldData();
128  size_t bb = 0;
129  for (; bb != nb_dofs; ++bb) {
130  values_at_gauss_pts += field_data * base_function;
131  ++field_data;
132  ++base_function;
133  }
134  // It is possible to have more base functions than dofs
135  for (; bb < nb_base_functions; ++bb)
136  ++base_function;
137  ++values_at_gauss_pts;
138  }
139 
140  if (dataVec.use_count()) {
141  data.getFieldData().swap(dotVector);
142  }
143  }
144 
146  }
147 };
148 
149 /**
150  * @brief Get rate of scalar field at integration points
151  *
152  * \ingroup mofem_forces_and_sources_user_data_operators
153  */
154 
155 template <PetscData::DataContext CTX>
158 
160  const std::string field_name, boost::shared_ptr<VectorDouble> data_ptr,
161  const EntityType zero_at_type = MBVERTEX)
164  dataPtr(data_ptr), zeroAtType(zero_at_type) {
165  if (!dataPtr)
166  THROW_MESSAGE("Pointer is not set");
167  }
168 
169  MoFEMErrorCode doWork(int side, EntityType type,
172 
173  const size_t nb_gauss_pts = getGaussPts().size2();
174 
175  VectorDouble &vec = *dataPtr;
176  if (type == zeroAtType || vec.size() != nb_gauss_pts) {
177  vec.resize(nb_gauss_pts, false);
178  vec.clear();
179  }
180 
181  auto &local_indices = data.getLocalIndices();
182  const size_t nb_dofs = local_indices.size();
183  if (nb_dofs) {
184 
185  const double *array;
186 
187  auto get_array = [&](const auto ctx, auto vec) {
189 #ifndef NDEBUG
190  if ((getFEMethod()->data_ctx & ctx).none()) {
191  MOFEM_LOG_CHANNEL("SELF");
192  MOFEM_LOG("SELF", Sev::error)
193  << "In this case filed degrees of freedom are read from vector. "
194  "That usually happens when time solver is used, and acces to "
195  "first or second rates is needed. You probably not set ts_u, "
196  "ts_u_t, or ts_u_tt and associated data structure, i.e. "
197  "data_ctx to CTX_SET_X, CTX_SET_X_T, or CTX_SET_X_TT "
198  "respectively";
199  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Vector not set!");
200  }
201 #endif
202  CHKERR VecGetArrayRead(vec, &array);
204  };
205 
206  auto restore_array = [&](auto vec) {
207  return VecRestoreArrayRead(vec, &array);
208  };
209 
210  switch (CTX) {
212  CHKERR get_array(PetscData::CtxSetX, getFEMethod()->ts_u);
213  break;
215  CHKERR get_array(PetscData::CtxSetX_T, getFEMethod()->ts_u_t);
216  break;
218  CHKERR get_array(PetscData::CtxSetX_TT, getFEMethod()->ts_u_tt);
219  break;
220  default:
221  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
222  "That case is not implemented");
223  }
224 
225  std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
226  for (int i = 0; i != local_indices.size(); ++i)
227  if (local_indices[i] != -1)
228  dot_dofs_vector[i] = array[local_indices[i]];
229  else
230  dot_dofs_vector[i] = 0;
231 
232  switch (CTX) {
234  CHKERR restore_array(getFEMethod()->ts_u);
235  break;
237  CHKERR restore_array(getFEMethod()->ts_u_t);
238  break;
240  CHKERR restore_array(getFEMethod()->ts_u_tt);
241  break;
242  default:
243  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
244  "That case is not implemented");
245  }
246 
247  const size_t nb_base_functions = data.getN().size2();
248  auto base_function = data.getFTensor0N();
249  auto values_at_gauss_pts = getFTensor0FromVec(vec);
250 
251  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
252  size_t bb = 0;
253  for (; bb != nb_dofs; ++bb) {
254  values_at_gauss_pts += dot_dofs_vector[bb] * base_function;
255  ++base_function;
256  }
257  // Number of dofs can be smaller than number of Tensor_Dim x base
258  // functions
259  for (; bb < nb_base_functions; ++bb)
260  ++base_function;
261  ++values_at_gauss_pts;
262  }
263  }
265  }
266 
267 private:
268  boost::shared_ptr<VectorDouble> dataPtr;
270 };
271 
276 
277 /**
278  * \deprecated Name inconsistent with other operators
279  *
280  */
282 
283 /**@}*/
284 
285 /** \name Vector field values at integration points */
286 
287 /**@{*/
288 
289 /** \brief Calculate field values for tenor field rank 1, i.e. vector field
290  *
291  */
292 template <int Tensor_Dim, class T, class L, class A>
295 
297  const std::string field_name,
298  boost::shared_ptr<ublas::matrix<T, L, A>> data_ptr,
299  const EntityType zero_type = MBVERTEX)
302  dataPtr(data_ptr), zeroType(zero_type) {
303  if (!dataPtr)
304  THROW_MESSAGE("Pointer is not set");
305  }
306 
307  /**
308  * \brief calculate values of vector field at integration points
309  * @param side side entity number
310  * @param type side entity type
311  * @param data entity data
312  * @return error code
313  */
314  MoFEMErrorCode doWork(int side, EntityType type,
316 
317 protected:
318  boost::shared_ptr<ublas::matrix<T, L, A>> dataPtr;
320 };
321 
322 template <int Tensor_Dim, class T, class L, class A>
325  int side, EntityType type, EntitiesFieldData::EntData &data) {
327  SETERRQ2(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
328  "Not implemented for T = %s and dim = %d",
329  typeid(T).name(), // boost::core::demangle(typeid(T).name()),
330  Tensor_Dim);
332 }
333 
334 /** \brief Calculate field values (template specialization) for tensor field
335  * rank 1, i.e. vector field
336  *
337  */
338 template <int Tensor_Dim>
340  ublas::row_major, DoubleAllocator>
342 
344  boost::shared_ptr<MatrixDouble> data_ptr,
345  const EntityType zero_type = MBVERTEX)
348  dataPtr(data_ptr), zeroType(zero_type) {
349  if (!dataPtr)
350  THROW_MESSAGE("Pointer is not set");
351  }
352 
354  boost::shared_ptr<MatrixDouble> data_ptr,
355  SmartPetscObj<Vec> data_vec,
356  const EntityType zero_type = MBVERTEX)
359  dataPtr(data_ptr), dataVec(data_vec), zeroType(zero_type) {
360  if (!dataPtr)
361  THROW_MESSAGE("Pointer is not set");
362  }
363 
364  MoFEMErrorCode doWork(int side, EntityType type,
366 
367 protected:
368  boost::shared_ptr<MatrixDouble> dataPtr;
372 };
373 
374 /**
375  * \brief Member function specialization calculating values for tenor field rank
376  *
377  */
378 template <int Tensor_Dim>
380  Tensor_Dim, double, ublas::row_major,
381  DoubleAllocator>::doWork(int side, EntityType type,
384 
385  const size_t nb_gauss_pts = getGaussPts().size2();
386  auto &mat = *dataPtr;
387  if (type == zeroType || mat.size2() != nb_gauss_pts) {
388  mat.resize(Tensor_Dim, nb_gauss_pts, false);
389  mat.clear();
390  }
391 
392  const size_t nb_dofs = data.getFieldData().size();
393  if (nb_dofs) {
394 
395  if (dataVec.use_count()) {
396  dotVector.resize(nb_dofs, false);
397  const double *array;
398  CHKERR VecGetArrayRead(dataVec, &array);
399  const auto &local_indices = data.getLocalIndices();
400  for (int i = 0; i != local_indices.size(); ++i)
401  if (local_indices[i] != -1)
402  dotVector[i] = array[local_indices[i]];
403  else
404  dotVector[i] = 0;
405  CHKERR VecRestoreArrayRead(dataVec, &array);
406  data.getFieldData().swap(dotVector);
407  }
408 
409  if (nb_gauss_pts) {
410  const size_t nb_base_functions = data.getN().size2();
411  auto base_function = data.getFTensor0N();
412  auto values_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
414  const size_t size = nb_dofs / Tensor_Dim;
415  if (nb_dofs % Tensor_Dim) {
416  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
417  "Nb. of DOFs is inconsistent with Tensor_Dim");
418  }
419  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
420  auto field_data = data.getFTensor1FieldData<Tensor_Dim>();
421 
422 #ifndef NDEBUG
423  if (field_data.l2() != field_data.l2()) {
424  MOFEM_LOG("SELF", Sev::error) << "field data: " << field_data;
425  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
426  "Wrong number in coefficients");
427  }
428 #endif
429 
430  size_t bb = 0;
431  for (; bb != size; ++bb) {
432 
433 #ifndef NDEBUG
434  if (base_function != base_function) {
435  MOFEM_LOG("SELF", Sev::error) << "base finction: " << base_function;
436  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
437  "Wrong number number in base functions");
438  }
439 #endif
440 
441  values_at_gauss_pts(I) += field_data(I) * base_function;
442  ++field_data;
443  ++base_function;
444  }
445  // Number of dofs can be smaller than number of Tensor_Dim x base
446  // functions
447  for (; bb < nb_base_functions; ++bb)
448  ++base_function;
449  ++values_at_gauss_pts;
450  }
451  }
452 
453  if (dataVec.use_count()) {
454  data.getFieldData().swap(dotVector);
455  }
456  }
458 }
459 
460 /** \brief Get values at integration pts for tensor filed rank 1, i.e. vector
461  * field
462  *
463  * \ingroup mofem_forces_and_sources_user_data_operators
464  */
465 template <int Tensor_Dim>
468  Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
469 
471  Tensor_Dim, double, ublas::row_major,
473 };
474 
475 /**@}*/
476 
477 /** \name Vector field values at integration points */
478 
479 /**@{*/
480 
481 /** \brief Calculate field values (template specialization) for tensor field
482  * rank 1, i.e. vector field
483  *
484  */
485 template <int Tensor_Dim, CoordinateTypes COORDINATE_SYSTEM = CARTESIAN>
488 
490  const std::string field_name, boost::shared_ptr<VectorDouble> data_ptr,
491  const EntityType zero_type = MBVERTEX)
494  dataPtr(data_ptr), zeroType(zero_type) {
495  if (!dataPtr)
496  THROW_MESSAGE("Pointer is not set");
497  }
498 
499  MoFEMErrorCode doWork(int side, EntityType type,
502 
503  // When we move to C++17 add if constexpr()
504  if constexpr (COORDINATE_SYSTEM == POLAR || COORDINATE_SYSTEM == SPHERICAL)
505  SETERRQ1(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
506  "%s coordiante not implemented",
507  CoordinateTypesNames[COORDINATE_SYSTEM]);
508 
509  const size_t nb_gauss_pts = getGaussPts().size2();
510  auto &vec = *dataPtr;
511  if (type == zeroType) {
512  vec.resize(nb_gauss_pts, false);
513  vec.clear();
514  }
515 
516  const size_t nb_dofs = data.getFieldData().size();
517  if (nb_dofs) {
518 
519  if (nb_gauss_pts) {
520  const size_t nb_base_functions = data.getN().size2();
521  auto values_at_gauss_pts = getFTensor0FromVec(vec);
523  const size_t size = nb_dofs / Tensor_Dim;
524 #ifndef NDEBUG
525  if (nb_dofs % Tensor_Dim) {
526  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
527  "Number of dofs should multiple of dimensions");
528  }
529 #endif
530 
531  // When we move to C++17 add if constexpr()
532  if constexpr (COORDINATE_SYSTEM == CARTESIAN) {
533  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim>();
534  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
535  auto field_data = data.getFTensor1FieldData<Tensor_Dim>();
536  size_t bb = 0;
537  for (; bb != size; ++bb) {
538  values_at_gauss_pts += field_data(I) * diff_base_function(I);
539  ++field_data;
540  ++diff_base_function;
541  }
542  // Number of dofs can be smaller than number of Tensor_Dim x base
543  // functions
544  for (; bb < nb_base_functions; ++bb)
545  ++diff_base_function;
546  ++values_at_gauss_pts;
547  }
548  }
549 
550  // When we move to C++17 add if constexpr()
551  if constexpr (COORDINATE_SYSTEM == CYLINDRICAL) {
552  auto t_coords = getFTensor1CoordsAtGaussPts();
553  auto values_at_gauss_pts = getFTensor0FromVec(vec);
554  auto base_function = data.getFTensor0N();
555  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim>();
556  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
557  auto field_data = data.getFTensor1FieldData<Tensor_Dim>();
558  size_t bb = 0;
559  for (; bb != size; ++bb) {
560  values_at_gauss_pts += field_data(I) * diff_base_function(I);
561  values_at_gauss_pts +=
562  base_function * (field_data(0) / t_coords(0));
563  ++field_data;
564  ++base_function;
565  ++diff_base_function;
566  }
567  // Number of dofs can be smaller than number of Tensor_Dim x base
568  // functions
569  for (; bb < nb_base_functions; ++bb) {
570  ++base_function;
571  ++diff_base_function;
572  }
573  ++values_at_gauss_pts;
574  ++t_coords;
575  }
576  }
577  }
578  }
580  }
581 
582 protected:
583  boost::shared_ptr<VectorDouble> dataPtr;
585 };
586 
587 /** \brief Approximate field values for given petsc vector
588  *
589  * \note Look at PetscData to see what vectors could be extracted with that user
590  * data operator.
591  *
592  * \ingroup mofem_forces_and_sources_user_data_operators
593  */
594 template <int Tensor_Dim, PetscData::DataContext CTX>
597 
599  const std::string field_name, boost::shared_ptr<MatrixDouble> data_ptr,
600  const EntityType zero_at_type = MBVERTEX)
603  dataPtr(data_ptr), zeroAtType(zero_at_type) {
604  if (!dataPtr)
605  THROW_MESSAGE("Pointer is not set");
606  }
607 
608  MoFEMErrorCode doWork(int side, EntityType type,
611  auto &local_indices = data.getLocalIndices();
612  const size_t nb_dofs = local_indices.size();
613  const size_t nb_gauss_pts = getGaussPts().size2();
614 
615  MatrixDouble &mat = *dataPtr;
616  if (type == zeroAtType) {
617  mat.resize(Tensor_Dim, nb_gauss_pts, false);
618  mat.clear();
619  }
620  if (!nb_dofs)
622 
623  const double *array;
624 
625  auto get_array = [&](const auto ctx, auto vec) {
627 #ifndef NDEBUG
628  if ((getFEMethod()->data_ctx & ctx).none()) {
629  MOFEM_LOG_CHANNEL("SELF");
630  MOFEM_LOG("SELF", Sev::error)
631  << "In this case filed degrees of freedom are read from vector. "
632  "That usually happens when time solver is used, and acces to "
633  "first or second rates is needed. You probably not set ts_u, "
634  "ts_u_t, or ts_u_tt and associated data structure, i.e. "
635  "data_ctx to CTX_SET_X, CTX_SET_X_T, or CTX_SET_X_TT "
636  "respectively";
637  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Vector not set");
638  }
639 #endif
640  CHKERR VecGetArrayRead(vec, &array);
642  };
643 
644  auto restore_array = [&](auto vec) {
645  return VecRestoreArrayRead(vec, &array);
646  };
647 
648  switch (CTX) {
650  CHKERR get_array(PetscData::CtxSetX, getFEMethod()->ts_u);
651  break;
653  CHKERR get_array(PetscData::CtxSetX_T, getFEMethod()->ts_u_t);
654  break;
656  CHKERR get_array(PetscData::CtxSetX_TT, getFEMethod()->ts_u_tt);
657  break;
658  default:
659  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
660  "That case is not implemented");
661  }
662 
663  dotVector.resize(local_indices.size());
664  for (int i = 0; i != local_indices.size(); ++i)
665  if (local_indices[i] != -1)
666  dotVector[i] = array[local_indices[i]];
667  else
668  dotVector[i] = 0;
669 
670  switch (CTX) {
672  CHKERR restore_array(getFEMethod()->ts_u);
673  break;
675  CHKERR restore_array(getFEMethod()->ts_u_t);
676  break;
678  CHKERR restore_array(getFEMethod()->ts_u_tt);
679  break;
680  default:
681  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
682  "That case is not implemented");
683  }
684 
685  const size_t nb_base_functions = data.getN().size2();
686  auto base_function = data.getFTensor0N();
687  auto values_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
688 
690  const size_t size = nb_dofs / Tensor_Dim;
691  if (nb_dofs % Tensor_Dim) {
692  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
693  }
694  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
695  auto field_data = getFTensor1FromArray<Tensor_Dim, Tensor_Dim>(dotVector);
696  size_t bb = 0;
697  for (; bb != size; ++bb) {
698  values_at_gauss_pts(I) += field_data(I) * base_function;
699  ++field_data;
700  ++base_function;
701  }
702  // Number of dofs can be smaller than number of Tensor_Dim x base
703  // functions
704  for (; bb < nb_base_functions; ++bb)
705  ++base_function;
706  ++values_at_gauss_pts;
707  }
709  }
710 
711 protected:
712  boost::shared_ptr<MatrixDouble> dataPtr;
715 };
716 
717 /** \brief Get time derivatives of values at integration pts for tensor filed
718  * rank 1, i.e. vector field
719  *
720  * \ingroup mofem_forces_and_sources_user_data_operators
721  */
722 template <int Tensor_Dim>
726 
727 /** \brief Get second time derivatives of values at integration pts for tensor
728  * filed rank 1, i.e. vector field
729  *
730  * \ingroup mofem_forces_and_sources_user_data_operators
731  */
732 template <int Tensor_Dim>
736 
737 /**@}*/
738 
739 /** \name Tensor field values at integration points */
740 
741 /**@{*/
742 
743 /** \brief Calculate field values for tenor field rank 2.
744  *
745  */
746 template <int Tensor_Dim0, int Tensor_Dim1, class T, class L, class A>
749 
751  const std::string field_name,
752  boost::shared_ptr<ublas::matrix<T, L, A>> data_ptr,
753  const EntityType zero_type = MBVERTEX)
756  dataPtr(data_ptr), zeroType(zero_type) {
757  if (!dataPtr)
758  THROW_MESSAGE("Pointer is not set");
759  }
760 
761  MoFEMErrorCode doWork(int side, EntityType type,
763 
764 protected:
765  boost::shared_ptr<ublas::matrix<T, L, A>> dataPtr;
767 };
768 
769 template <int Tensor_Dim0, int Tensor_Dim1, class T, class L, class A>
772  doWork(int side, EntityType type, EntitiesFieldData::EntData &data) {
774  SETERRQ3(PETSC_COMM_SELF, MOFEM_NOT_IMPLEMENTED,
775  "Not implemented for T = %s, dim0 = %d and dim1 = %d",
776  typeid(T).name(), // boost::core::demangle(typeid(T).name()),
777  Tensor_Dim0, Tensor_Dim1);
779 }
780 
781 template <int Tensor_Dim0, int Tensor_Dim1>
782 struct OpCalculateTensor2FieldValues_General<Tensor_Dim0, Tensor_Dim1, double,
783  ublas::row_major, DoubleAllocator>
785 
787  const std::string field_name,
788  boost::shared_ptr<
789  ublas::matrix<double, ublas::row_major, DoubleAllocator>>
790  data_ptr,
791  const EntityType zero_type = MBVERTEX)
794  dataPtr(data_ptr), zeroType(zero_type) {
795  if (!dataPtr)
796  THROW_MESSAGE("Pointer is not set");
797  }
798 
800  const std::string field_name,
801  boost::shared_ptr<
802  ublas::matrix<double, ublas::row_major, DoubleAllocator>>
803  data_ptr,
804  SmartPetscObj<Vec> data_vec, const EntityType zero_type = MBVERTEX)
807  dataPtr(data_ptr), zeroType(zero_type), dataVec(data_vec) {
808  if (!dataPtr)
809  THROW_MESSAGE("Pointer is not set");
810  }
811 
812  MoFEMErrorCode doWork(int side, EntityType type,
814 
815 protected:
816  boost::shared_ptr<ublas::matrix<double, ublas::row_major, DoubleAllocator>>
821 };
822 
823 template <int Tensor_Dim0, int Tensor_Dim1>
825  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
826  DoubleAllocator>::doWork(int side, EntityType type,
829 
830  MatrixDouble &mat = *dataPtr;
831  const size_t nb_gauss_pts = data.getN().size1();
832  if (type == zeroType) {
833  mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts, false);
834  mat.clear();
835  }
836 
837  const size_t nb_dofs = data.getFieldData().size();
838 
839  if (dataVec.use_count()) {
840  dotVector.resize(nb_dofs, false);
841  const double *array;
842  CHKERR VecGetArrayRead(dataVec, &array);
843  const auto &local_indices = data.getLocalIndices();
844  for (int i = 0; i != local_indices.size(); ++i)
845  if (local_indices[i] != -1)
846  dotVector[i] = array[local_indices[i]];
847  else
848  dotVector[i] = 0;
849  CHKERR VecRestoreArrayRead(dataVec, &array);
850  data.getFieldData().swap(dotVector);
851  }
852 
853  if (nb_dofs) {
854  const size_t nb_base_functions = data.getN().size2();
855  auto base_function = data.getFTensor0N();
856  auto values_at_gauss_pts =
857  getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
860  const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
861  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
862  auto field_data = data.getFTensor2FieldData<Tensor_Dim0, Tensor_Dim1>();
863  size_t bb = 0;
864  for (; bb != size; ++bb) {
865  values_at_gauss_pts(i, j) += field_data(i, j) * base_function;
866  ++field_data;
867  ++base_function;
868  }
869  for (; bb < nb_base_functions; ++bb)
870  ++base_function;
871  ++values_at_gauss_pts;
872  }
873 
874  if (dataVec.use_count()) {
875  data.getFieldData().swap(dotVector);
876  }
877  }
879 }
880 
881 /** \brief Get values at integration pts for tensor filed rank 2, i.e. matrix
882  * field
883  *
884  * \ingroup mofem_forces_and_sources_user_data_operators
885  */
886 template <int Tensor_Dim0, int Tensor_Dim1>
889  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
890 
892  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
894 };
895 
896 /** \brief Get time direvarive values at integration pts for tensor filed rank
897  * 2, i.e. matrix field
898  *
899  * \ingroup mofem_forces_and_sources_user_data_operators
900  */
901 template <int Tensor_Dim0, int Tensor_Dim1>
904 
906  boost::shared_ptr<MatrixDouble> data_ptr,
907  const EntityType zero_at_type = MBVERTEX)
910  dataPtr(data_ptr), zeroAtType(zero_at_type) {
911  if (!dataPtr)
912  THROW_MESSAGE("Pointer is not set");
913  }
914 
915  MoFEMErrorCode doWork(int side, EntityType type,
918 
919  const size_t nb_gauss_pts = getGaussPts().size2();
920  MatrixDouble &mat = *dataPtr;
921  if (type == zeroAtType) {
922  mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts, false);
923  mat.clear();
924  }
925  const auto &local_indices = data.getLocalIndices();
926  const size_t nb_dofs = local_indices.size();
927  if (nb_dofs) {
928  dotVector.resize(nb_dofs, false);
929  const double *array;
930  CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
931  for (size_t i = 0; i != local_indices.size(); ++i)
932  if (local_indices[i] != -1)
933  dotVector[i] = array[local_indices[i]];
934  else
935  dotVector[i] = 0;
936  CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
937 
938  const size_t nb_base_functions = data.getN().size2();
939 
940  auto base_function = data.getFTensor0N();
941  auto values_at_gauss_pts =
942  getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
945  const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
946  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
947  auto field_data =
948  getFTensor2FromPtr<Tensor_Dim0, Tensor_Dim1>(&*dotVector.begin());
949  size_t bb = 0;
950  for (; bb != size; ++bb) {
951  values_at_gauss_pts(i, j) += field_data(i, j) * base_function;
952  ++field_data;
953  ++base_function;
954  }
955  for (; bb < nb_base_functions; ++bb)
956  ++base_function;
957  ++values_at_gauss_pts;
958  }
959  }
961  }
962 
963 protected:
964  boost::shared_ptr<MatrixDouble> dataPtr; ///< Data computed into this matrix
965  EntityType zeroAtType; ///< Zero values at Gauss point at this type
966  VectorDouble dotVector; ///< Keeps temporary values of time derivatives
967 };
968 
969 /**
970  * @brief Calculate symmetric tensor field values at integration pts.
971  *
972  * @tparam Tensor_Dim
973 
974  * \ingroup mofem_forces_and_sources_user_data_operators
975  */
976 template <int Tensor_Dim>
979 
981  const std::string field_name, boost::shared_ptr<MatrixDouble> data_ptr,
982  const EntityType zero_type = MBEDGE, const int zero_side = 0)
985  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
986  if (!dataPtr)
987  THROW_MESSAGE("Pointer is not set");
988  }
989 
991  const std::string field_name, boost::shared_ptr<MatrixDouble> data_ptr,
992  SmartPetscObj<Vec> data_vec, const EntityType zero_type = MBEDGE,
993  const int zero_side = 0)
996  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side),
997  dataVec(data_vec) {
998  if (!dataPtr)
999  THROW_MESSAGE("Pointer is not set");
1000  }
1001 
1002  MoFEMErrorCode doWork(int side, EntityType type,
1005  MatrixDouble &mat = *dataPtr;
1006  const int nb_gauss_pts = getGaussPts().size2();
1007  if (type == this->zeroType && side == zeroSide) {
1008  mat.resize((Tensor_Dim * (Tensor_Dim + 1)) / 2, nb_gauss_pts, false);
1009  mat.clear();
1010  }
1011  const int nb_dofs = data.getFieldData().size();
1012  if (!nb_dofs)
1014 
1015  if (dataVec.use_count()) {
1016  dotVector.resize(nb_dofs, false);
1017  const double *array;
1018  CHKERR VecGetArrayRead(dataVec, &array);
1019  const auto &local_indices = data.getLocalIndices();
1020  for (int i = 0; i != local_indices.size(); ++i)
1021  if (local_indices[i] != -1)
1022  dotVector[i] = array[local_indices[i]];
1023  else
1024  dotVector[i] = 0;
1025  CHKERR VecRestoreArrayRead(dataVec, &array);
1026  data.getFieldData().swap(dotVector);
1027  }
1028 
1029  const int nb_base_functions = data.getN().size2();
1030  auto base_function = data.getFTensor0N();
1031  auto values_at_gauss_pts = getFTensor2SymmetricFromMat<Tensor_Dim>(mat);
1034  const int size = nb_dofs / ((Tensor_Dim * (Tensor_Dim + 1)) / 2);
1035  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1036  auto field_data = data.getFTensor2SymmetricFieldData<Tensor_Dim>();
1037  int bb = 0;
1038  for (; bb != size; ++bb) {
1039  values_at_gauss_pts(i, j) += field_data(i, j) * base_function;
1040  ++field_data;
1041  ++base_function;
1042  }
1043  for (; bb < nb_base_functions; ++bb)
1044  ++base_function;
1045  ++values_at_gauss_pts;
1046  }
1047 
1048  if (dataVec.use_count()) {
1049  data.getFieldData().swap(dotVector);
1050  }
1051 
1053  }
1054 
1055 protected:
1056  boost::shared_ptr<MatrixDouble> dataPtr;
1058  const int zeroSide;
1061 };
1062 
1063 /**
1064  * @brief Calculate symmetric tensor field rates ant integratio pts.
1065  *
1066  * @tparam Tensor_Dim
1067  *
1068  * \ingroup mofem_forces_and_sources_user_data_operators
1069  */
1070 template <int Tensor_Dim>
1073 
1075  const std::string field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1076  const EntityType zero_type = MBEDGE, const int zero_side = 0)
1079  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
1080  if (!dataPtr)
1081  THROW_MESSAGE("Pointer is not set");
1082  }
1083 
1084  MoFEMErrorCode doWork(int side, EntityType type,
1087  const int nb_gauss_pts = getGaussPts().size2();
1088  MatrixDouble &mat = *dataPtr;
1089  constexpr auto symm_size = (Tensor_Dim * (Tensor_Dim + 1)) / 2;
1090  if (type == zeroType && side == zeroSide) {
1091  mat.resize(symm_size, nb_gauss_pts, false);
1092  mat.clear();
1093  }
1094  auto &local_indices = data.getLocalIndices();
1095  const int nb_dofs = local_indices.size();
1096  if (!nb_dofs)
1098 
1099 #ifndef NDEBUG
1100  if ((getFEMethod()->data_ctx & PetscData::CtxSetX_T).none()) {
1101  MOFEM_LOG_CHANNEL("SELF");
1102  MOFEM_LOG("SELF", Sev::error)
1103  << "In this case filed degrees of freedom are read from vector. "
1104  "That usually happens when time solver is used, and acces to "
1105  "first rates is needed. You probably not set "
1106  "ts_u_t and associated data structure data_ctx to CTX_SET_X_T "
1107  "respectively";
1108  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Vector not set!");
1109  }
1110 #endif
1111 
1112  dotVector.resize(nb_dofs, false);
1113  const double *array;
1114  CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
1115  for (int i = 0; i != local_indices.size(); ++i)
1116  if (local_indices[i] != -1)
1117  dotVector[i] = array[local_indices[i]];
1118  else
1119  dotVector[i] = 0;
1120  CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
1121 
1122  const int nb_base_functions = data.getN().size2();
1123 
1124  auto base_function = data.getFTensor0N();
1125  auto values_at_gauss_pts = getFTensor2SymmetricFromMat<Tensor_Dim>(mat);
1128  const int size = nb_dofs / symm_size;
1129  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1130  auto field_data = getFTensorDotData<Tensor_Dim>();
1131  int bb = 0;
1132  for (; bb != size; ++bb) {
1133  values_at_gauss_pts(i, j) += field_data(i, j) * base_function;
1134  ++field_data;
1135  ++base_function;
1136  }
1137  for (; bb < nb_base_functions; ++bb)
1138  ++base_function;
1139  ++values_at_gauss_pts;
1140  }
1141 
1143  }
1144 
1145 protected:
1146  boost::shared_ptr<MatrixDouble> dataPtr;
1148  const int zeroSide;
1150 
1151  template <int Dim> inline auto getFTensorDotData() {
1152  static_assert(Dim || !Dim, "not implemented");
1153  }
1154 };
1155 
1156 template <>
1157 template <>
1158 inline auto
1161  &dotVector[0], &dotVector[1], &dotVector[2], &dotVector[3], &dotVector[4],
1162  &dotVector[5]);
1163 }
1164 
1165 template <>
1166 template <>
1167 inline auto
1170  &dotVector[0], &dotVector[1], &dotVector[2]);
1171 }
1172 
1173 /**@}*/
1174 
1175 /** \name Gradients and Hessian of scalar fields at integration points */
1176 
1177 /**@{*/
1178 
1179 /**
1180  * \brief Evaluate field gradient values for scalar field, i.e. gradient is
1181  * tensor rank 1 (vector)
1182  *
1183  */
1184 template <int Tensor_Dim, class T, class L, class A>
1186  : public OpCalculateVectorFieldValues_General<Tensor_Dim, T, L, A> {
1187 
1189  Tensor_Dim, T, L, A>::OpCalculateVectorFieldValues_General;
1190 };
1191 
1192 /** \brief Evaluate field gradient values for scalar field, i.e. gradient is
1193  * tensor rank 1 (vector), specialization
1194  *
1195  */
1196 template <int Tensor_Dim>
1198  ublas::row_major, DoubleAllocator>
1200  Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
1201 
1203  Tensor_Dim, double, ublas::row_major,
1205 
1206  /**
1207  * \brief calculate gradient values of scalar field at integration points
1208  * @param side side entity number
1209  * @param type side entity type
1210  * @param data entity data
1211  * @return error code
1212  */
1213  MoFEMErrorCode doWork(int side, EntityType type,
1215 };
1216 
1217 /**
1218  * \brief Member function specialization calculating scalar field gradients for
1219  * tenor field rank 1
1220  *
1221  */
1222 template <int Tensor_Dim>
1224  Tensor_Dim, double, ublas::row_major,
1225  DoubleAllocator>::doWork(int side, EntityType type,
1228 
1229  const size_t nb_gauss_pts = this->getGaussPts().size2();
1230  auto &mat = *this->dataPtr;
1231  if (type == this->zeroType) {
1232  mat.resize(Tensor_Dim, nb_gauss_pts, false);
1233  mat.clear();
1234  }
1235 
1236  const int nb_dofs = data.getFieldData().size();
1237  if (nb_dofs) {
1238 
1239  if (nb_gauss_pts) {
1240  const int nb_base_functions = data.getN().size2();
1241  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim>();
1242  auto gradients_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
1243 
1244 #ifndef NDEBUG
1245  if (nb_dofs > nb_base_functions)
1246  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1247  "Number of base functions inconsistent with number of DOFs "
1248  "(%d > %d)",
1249  nb_dofs, nb_base_functions);
1250 
1251  if (data.getDiffN().size2() != nb_base_functions * Tensor_Dim)
1252  SETERRQ2(
1253  PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1254  "Number of base functions inconsistent with number of derivatives "
1255  "(%d != %d)",
1256  data.getDiffN().size2(), nb_base_functions);
1257 
1258  if (data.getDiffN().size1() != nb_gauss_pts)
1259  SETERRQ2(
1260  PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1261  "Number of base functions inconsistent with number of integration "
1262  "pts (%d != %d)",
1263  data.getDiffN().size2(), nb_gauss_pts);
1264 
1265 #endif
1266 
1268  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
1269  auto field_data = data.getFTensor0FieldData();
1270  int bb = 0;
1271  for (; bb != nb_dofs; ++bb) {
1272  gradients_at_gauss_pts(I) += field_data * diff_base_function(I);
1273  ++field_data;
1274  ++diff_base_function;
1275  }
1276  // Number of dofs can be smaller than number of base functions
1277  for (; bb < nb_base_functions; ++bb)
1278  ++diff_base_function;
1279  ++gradients_at_gauss_pts;
1280  }
1281  }
1282  }
1283 
1285 }
1286 
1287 /** \brief Get field gradients at integration pts for scalar filed rank 0, i.e.
1288  * vector field
1289  *
1290  * \ingroup mofem_forces_and_sources_user_data_operators
1291  */
1292 template <int Tensor_Dim>
1295  Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
1297  Tensor_Dim, double, ublas::row_major,
1299 };
1300 
1301 /** \brief Evaluate field gradient values for scalar field, i.e. gradient is
1302  * tensor rank 1 (vector), specialization
1303  *
1304  */
1305 template <int Tensor_Dim>
1308  Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
1309 
1311  Tensor_Dim, double, ublas::row_major,
1313 
1314  /**
1315  * \brief calculate gradient values of scalar field at integration points
1316  * @param side side entity number
1317  * @param type side entity type
1318  * @param data entity data
1319  * @return error code
1320  */
1321  MoFEMErrorCode doWork(int side, EntityType type,
1323 };
1324 
1325 template <int Tensor_Dim>
1327  int side, EntityType type, EntitiesFieldData::EntData &data) {
1329 
1330  const size_t nb_gauss_pts = this->getGaussPts().size2();
1331  auto &mat = *this->dataPtr;
1332  if (type == this->zeroType) {
1333  mat.resize(Tensor_Dim * Tensor_Dim, nb_gauss_pts, false);
1334  mat.clear();
1335  }
1336 
1337  const int nb_dofs = data.getFieldData().size();
1338  if (nb_dofs) {
1339 
1340  if (nb_gauss_pts) {
1341  const int nb_base_functions = data.getN().size2();
1342 
1343  auto &hessian_base = data.getN(BaseDerivatives::SecondDerivative);
1344 #ifndef NDEBUG
1345  if (hessian_base.size1() != nb_gauss_pts) {
1346  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1347  "Wrong number of integration pts (%d != %d)",
1348  hessian_base.size1(), nb_gauss_pts);
1349  }
1350  if (hessian_base.size2() != nb_base_functions * Tensor_Dim * Tensor_Dim) {
1351  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1352  "Wrong number of base functions (%d != %d)",
1353  hessian_base.size2() / (Tensor_Dim * Tensor_Dim),
1354  nb_base_functions);
1355  }
1356  if (hessian_base.size2() < nb_dofs * Tensor_Dim * Tensor_Dim) {
1357  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1358  "Wrong number of base functions (%d < %d)",
1359  hessian_base.size2(), nb_dofs * Tensor_Dim * Tensor_Dim);
1360  }
1361 #endif
1362 
1363  auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim, Tensor_Dim>(
1364  &*hessian_base.data().begin());
1365 
1366  auto hessian_at_gauss_pts =
1367  getFTensor2FromMat<Tensor_Dim, Tensor_Dim>(mat);
1368 
1371  for (int gg = 0; gg != nb_gauss_pts; ++gg) {
1372  auto field_data = data.getFTensor0FieldData();
1373  int bb = 0;
1374  for (; bb != nb_dofs; ++bb) {
1375  hessian_at_gauss_pts(I, J) +=
1376  field_data * t_diff2_base_function(I, J);
1377  ++field_data;
1378  ++t_diff2_base_function;
1379  }
1380  // Number of dofs can be smaller than number of base functions
1381  for (; bb < nb_base_functions; ++bb) {
1382  ++t_diff2_base_function;
1383  }
1384 
1385  ++hessian_at_gauss_pts;
1386  }
1387  }
1388  }
1389 
1391 }
1392 
1393 /**}*/
1394 
1395 /** \name Gradients and hessian of tensor fields at integration points */
1396 
1397 /**@{*/
1398 
1399 /**
1400  * \brief Evaluate field gradient values for vector field, i.e. gradient is
1401  * tensor rank 2
1402  *
1403  */
1404 template <int Tensor_Dim0, int Tensor_Dim1, class T, class L, class A>
1406  : public OpCalculateTensor2FieldValues_General<Tensor_Dim0, Tensor_Dim1, T,
1407  L, A> {
1408 
1410  Tensor_Dim0, Tensor_Dim1, T, L, A>::OpCalculateTensor2FieldValues_General;
1411 };
1412 
1413 template <int Tensor_Dim0, int Tensor_Dim1>
1414 struct OpCalculateVectorFieldGradient_General<Tensor_Dim0, Tensor_Dim1, double,
1415  ublas::row_major, DoubleAllocator>
1417  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1418 
1420  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
1422 
1423  /**
1424  * \brief calculate values of vector field at integration points
1425  * @param side side entity number
1426  * @param type side entity type
1427  * @param data entity data
1428  * @return error code
1429  */
1430  MoFEMErrorCode doWork(int side, EntityType type,
1432 };
1433 
1434 /**
1435  * \brief Member function specialization calculating vector field gradients for
1436  * tenor field rank 2
1437  *
1438  */
1439 template <int Tensor_Dim0, int Tensor_Dim1>
1441  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
1442  DoubleAllocator>::doWork(int side, EntityType type,
1445  if (!this->dataPtr)
1446  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1447  "Data pointer not allocated");
1448 
1449  const size_t nb_gauss_pts = this->getGaussPts().size2();
1450  auto &mat = *this->dataPtr;
1451  if (type == this->zeroType) {
1452  mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts, false);
1453  mat.clear();
1454  }
1455 
1456  if (nb_gauss_pts) {
1457  const size_t nb_dofs = data.getFieldData().size();
1458 
1459  if (nb_dofs) {
1460 
1461  if (this->dataVec.use_count()) {
1462  this->dotVector.resize(nb_dofs, false);
1463  const double *array;
1464  CHKERR VecGetArrayRead(this->dataVec, &array);
1465  const auto &local_indices = data.getLocalIndices();
1466  for (int i = 0; i != local_indices.size(); ++i)
1467  if (local_indices[i] != -1)
1468  this->dotVector[i] = array[local_indices[i]];
1469  else
1470  this->dotVector[i] = 0;
1471  CHKERR VecRestoreArrayRead(this->dataVec, &array);
1472  data.getFieldData().swap(this->dotVector);
1473  }
1474 
1475  const int nb_base_functions = data.getN().size2();
1476  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim1>();
1477  auto gradients_at_gauss_pts =
1478  getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1481  int size = nb_dofs / Tensor_Dim0;
1482  if (nb_dofs % Tensor_Dim0) {
1483  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1484  "Data inconsistency");
1485  }
1486  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
1487  auto field_data = data.getFTensor1FieldData<Tensor_Dim0>();
1488 
1489 #ifndef NDEBUG
1490  if (field_data.l2() != field_data.l2()) {
1491  MOFEM_LOG("SELF", Sev::error) << "field data " << field_data;
1492  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1493  "Wrong number in coefficients");
1494  }
1495 #endif
1496 
1497  int bb = 0;
1498  for (; bb < size; ++bb) {
1499 #ifndef SINGULARITY
1500 #ifndef NDEBUG
1501  if (diff_base_function.l2() != diff_base_function.l2()) {
1502  MOFEM_LOG("SELF", Sev::error)
1503  << "diff_base_function: " << diff_base_function;
1504  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1505  "Wrong number number in base functions");
1506  }
1507 #endif
1508 #endif
1509 
1510  gradients_at_gauss_pts(I, J) += field_data(I) * diff_base_function(J);
1511  ++field_data;
1512  ++diff_base_function;
1513  }
1514  // Number of dofs can be smaller than number of Tensor_Dim0 x base
1515  // functions
1516  for (; bb != nb_base_functions; ++bb)
1517  ++diff_base_function;
1518  ++gradients_at_gauss_pts;
1519  }
1520 
1521  if (this->dataVec.use_count()) {
1522  data.getFieldData().swap(this->dotVector);
1523  }
1524  }
1525  }
1527 }
1528 
1529 /** \brief Get field gradients at integration pts for scalar filed rank 0, i.e.
1530  * vector field
1531  *
1532  * \ingroup mofem_forces_and_sources_user_data_operators
1533  */
1534 template <int Tensor_Dim0, int Tensor_Dim1>
1537  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1538 
1540  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
1542 };
1543 
1544 /** \brief Get field gradients time derivative at integration pts for scalar
1545  * filed rank 0, i.e. vector field
1546  *
1547  * \ingroup mofem_forces_and_sources_user_data_operators
1548  */
1549 template <int Tensor_Dim0, int Tensor_Dim1>
1552 
1554  boost::shared_ptr<MatrixDouble> data_ptr,
1555  const EntityType zero_at_type = MBVERTEX)
1558  dataPtr(data_ptr), zeroAtType(zero_at_type) {
1559  if (!dataPtr)
1560  THROW_MESSAGE("Pointer is not set");
1561  }
1562 
1563  MoFEMErrorCode doWork(int side, EntityType type,
1566 
1567  const auto &local_indices = data.getLocalIndices();
1568  const int nb_dofs = local_indices.size();
1569  const int nb_gauss_pts = this->getGaussPts().size2();
1570 
1571  auto &mat = *this->dataPtr;
1572  if (type == this->zeroAtType) {
1573  mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts, false);
1574  mat.clear();
1575  }
1576  if (!nb_dofs)
1578 
1579  dotVector.resize(nb_dofs, false);
1580  const double *array;
1581  CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
1582  for (int i = 0; i != local_indices.size(); ++i)
1583  if (local_indices[i] != -1)
1584  dotVector[i] = array[local_indices[i]];
1585  else
1586  dotVector[i] = 0;
1587  CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
1588 
1589  const int nb_base_functions = data.getN().size2();
1590  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim1>();
1591  auto gradients_at_gauss_pts =
1592  getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1595  int size = nb_dofs / Tensor_Dim0;
1596  if (nb_dofs % Tensor_Dim0) {
1597  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "Data inconsistency");
1598  }
1599 
1600  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
1601  auto field_data = getFTensor1FromPtr<Tensor_Dim0>(&*dotVector.begin());
1602  int bb = 0;
1603  for (; bb < size; ++bb) {
1604  gradients_at_gauss_pts(I, J) += field_data(I) * diff_base_function(J);
1605  ++field_data;
1606  ++diff_base_function;
1607  }
1608  // Number of dofs can be smaller than number of Tensor_Dim0 x base
1609  // functions
1610  for (; bb != nb_base_functions; ++bb)
1611  ++diff_base_function;
1612  ++gradients_at_gauss_pts;
1613  }
1615  }
1616 
1617 private:
1618  boost::shared_ptr<MatrixDouble> dataPtr; ///< Data computed into this matrix
1619  EntityType zeroAtType; ///< Zero values at Gauss point at this type
1620  VectorDouble dotVector; ///< Keeps temporary values of time derivatives
1621 };
1622 
1623 /**
1624  * \brief Evaluate field gradient values for symmetric 2nd order tensor field,
1625  * i.e. gradient is tensor rank 3
1626  *
1627  */
1628 template <int Tensor_Dim0, int Tensor_Dim1, class T, class L, class A>
1630  : public OpCalculateTensor2FieldValues_General<Tensor_Dim0, Tensor_Dim1, T,
1631  L, A> {
1632 
1634  const std::string field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1635  const EntityType zero_type = MBVERTEX)
1636  : OpCalculateTensor2FieldValues_General<Tensor_Dim0, Tensor_Dim1, T, L,
1637  A>(field_name, data_ptr,
1638  zero_type) {}
1639 };
1640 
1641 template <int Tensor_Dim0, int Tensor_Dim1>
1643  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator>
1645  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1646 
1648  const std::string field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1649  const EntityType zero_type = MBVERTEX)
1650  : OpCalculateTensor2FieldValues_General<Tensor_Dim0, Tensor_Dim1, double,
1651  ublas::row_major,
1652  DoubleAllocator>(
1653  field_name, data_ptr, zero_type) {}
1654 
1655  /**
1656  * \brief calculate values of vector field at integration points
1657  * @param side side entity number
1658  * @param type side entity type
1659  * @param data entity data
1660  * @return error code
1661  */
1662  MoFEMErrorCode doWork(int side, EntityType type,
1664 };
1665 
1666 /**
1667  * \brief Member function specialization calculating tensor field gradients for
1668  * symmetric tensor field rank 2
1669  *
1670  */
1671 template <int Tensor_Dim0, int Tensor_Dim1>
1672 MoFEMErrorCode OpCalculateTensor2SymmetricFieldGradient_General<
1673  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
1674  DoubleAllocator>::doWork(int side, EntityType type,
1677  if (!this->dataPtr)
1678  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1679  "Data pointer not allocated");
1680 
1681  const size_t nb_gauss_pts = this->getGaussPts().size2();
1682  constexpr size_t msize = (Tensor_Dim0 * (Tensor_Dim0 + 1)) / 2;
1683  auto &mat = *this->dataPtr;
1684  if (type == this->zeroType) {
1685  mat.resize(msize * Tensor_Dim1, nb_gauss_pts, false);
1686  mat.clear();
1687  }
1688 
1689  if (nb_gauss_pts) {
1690  const size_t nb_dofs = data.getFieldData().size();
1691 
1692  if (nb_dofs) {
1693 
1694  const int nb_base_functions = data.getN().size2();
1695  auto diff_base_function = data.getFTensor1DiffN<Tensor_Dim1>();
1696  auto gradients_at_gauss_pts =
1697  getFTensor3DgFromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1701  int size = nb_dofs / msize;
1702  if (nb_dofs % msize) {
1703  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1704  "Data inconsistency");
1705  }
1706  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
1707  auto field_data = data.getFTensor2SymmetricFieldData<Tensor_Dim0>();
1708  int bb = 0;
1709  for (; bb < size; ++bb) {
1710  gradients_at_gauss_pts(I, J, K) +=
1711  field_data(I, J) * diff_base_function(K);
1712  ++field_data;
1713  ++diff_base_function;
1714  }
1715  // Number of dofs can be smaller than number of Tensor_Dim0 x base
1716  // functions
1717  for (; bb != nb_base_functions; ++bb)
1718  ++diff_base_function;
1719  ++gradients_at_gauss_pts;
1720  }
1721  }
1722  }
1724 }
1725 
1726 /** \brief Get field gradients at integration pts for symmetric tensorial field
1727  * rank 2
1728  *
1729  * \ingroup mofem_forces_and_sources_user_data_operators
1730  */
1731 template <int Tensor_Dim0, int Tensor_Dim1>
1734  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1735 
1737  const std::string field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1738  const EntityType zero_type = MBVERTEX)
1740  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
1741  DoubleAllocator>(field_name, data_ptr, zero_type) {}
1742 };
1743 
1744 template <int Tensor_Dim0, int Tensor_Dim1>
1747  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1748 
1750  Tensor_Dim0, Tensor_Dim1, double, ublas::row_major,
1752 
1753  /**
1754  * \brief calculate values of vector field at integration points
1755  * @param side side entity number
1756  * @param type side entity type
1757  * @param data entity data
1758  * @return error code
1759  */
1760  MoFEMErrorCode doWork(int side, EntityType type,
1762 };
1763 
1764 /**
1765  * \brief Member function specialization calculating vector field gradients for
1766  * tenor field rank 2
1767  *
1768  */
1769 template <int Tensor_Dim0, int Tensor_Dim1>
1771  int side, EntityType type, EntitiesFieldData::EntData &data) {
1773  if (!this->dataPtr)
1774  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1775  "Data pointer not allocated");
1776 
1777  const size_t nb_gauss_pts = this->getGaussPts().size2();
1778  auto &mat = *this->dataPtr;
1779  if (type == this->zeroType) {
1780  mat.resize(Tensor_Dim0 * Tensor_Dim1 * Tensor_Dim1, nb_gauss_pts, false);
1781  mat.clear();
1782  }
1783 
1784  if (nb_gauss_pts) {
1785  const size_t nb_dofs = data.getFieldData().size();
1786 
1787  if (nb_dofs) {
1788 
1789  if (this->dataVec.use_count()) {
1790  this->dotVector.resize(nb_dofs, false);
1791  const double *array;
1792  CHKERR VecGetArrayRead(this->dataVec, &array);
1793  const auto &local_indices = data.getLocalIndices();
1794  for (int i = 0; i != local_indices.size(); ++i)
1795  if (local_indices[i] != -1)
1796  this->dotVector[i] = array[local_indices[i]];
1797  else
1798  this->dotVector[i] = 0;
1799  CHKERR VecRestoreArrayRead(this->dataVec, &array);
1800  data.getFieldData().swap(this->dotVector);
1801  }
1802 
1803  const int nb_base_functions = data.getN().size2();
1804 
1805  auto &hessian_base = data.getN(BaseDerivatives::SecondDerivative);
1806 #ifndef NDEBUG
1807  if (hessian_base.size1() != nb_gauss_pts) {
1808  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1809  "Wrong number of integration pts (%d != %d)",
1810  hessian_base.size1(), nb_gauss_pts);
1811  }
1812  if (hessian_base.size2() !=
1813  nb_base_functions * Tensor_Dim1 * Tensor_Dim1) {
1814  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1815  "Wrong number of base functions (%d != %d)",
1816  hessian_base.size2() / (Tensor_Dim1 * Tensor_Dim1),
1817  nb_base_functions);
1818  }
1819  if (hessian_base.size2() < nb_dofs * Tensor_Dim1 * Tensor_Dim1) {
1820  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1821  "Wrong number of base functions (%d < %d)",
1822  hessian_base.size2(), nb_dofs * Tensor_Dim1 * Tensor_Dim1);
1823  }
1824 #endif
1825 
1826  auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim1, Tensor_Dim1>(
1827  &*hessian_base.data().begin());
1828 
1829  auto t_hessian_at_gauss_pts =
1830  getFTensor3FromMat<Tensor_Dim0, Tensor_Dim1, Tensor_Dim1>(mat);
1831 
1835 
1836  int size = nb_dofs / Tensor_Dim0;
1837 #ifndef NDEBUG
1838  if (nb_dofs % Tensor_Dim0) {
1839  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
1840  "Data inconsistency");
1841  }
1842 #endif
1843 
1844  for (int gg = 0; gg < nb_gauss_pts; ++gg) {
1845  auto field_data = data.getFTensor1FieldData<Tensor_Dim0>();
1846  int bb = 0;
1847  for (; bb < size; ++bb) {
1848  t_hessian_at_gauss_pts(I, J, K) +=
1849  field_data(I) * t_diff2_base_function(J, K);
1850  ++field_data;
1851  ++t_diff2_base_function;
1852  }
1853  // Number of dofs can be smaller than number of Tensor_Dim0 x base
1854  // functions
1855  for (; bb != nb_base_functions; ++bb)
1856  ++t_diff2_base_function;
1857  ++t_hessian_at_gauss_pts;
1858  }
1859 
1860  if (this->dataVec.use_count()) {
1861  data.getFieldData().swap(this->dotVector);
1862  }
1863  }
1864  }
1866 }
1867 
1868 /**@}*/
1869 
1870 /** \name Transform tensors and vectors */
1871 
1872 /**@{*/
1873 
1874 /**
1875  * @brief Calculate \f$ \pmb\sigma_{ij} = \mathbf{D}_{ijkl} \pmb\varepsilon_{kl}
1876  * \f$
1877  *
1878  * @tparam DIM
1879  *
1880  * \ingroup mofem_forces_and_sources_user_data_operators
1881  */
1882 template <int DIM_01, int DIM_23, int S = 0>
1885 
1888 
1889  /**
1890  * @deprecated Do not use this constructor
1891  */
1892  DEPRECATED
1894  boost::shared_ptr<MatrixDouble> in_mat,
1895  boost::shared_ptr<MatrixDouble> out_mat,
1896  boost::shared_ptr<MatrixDouble> d_mat)
1897  : UserOp(field_name, OPROW), inMat(in_mat), outMat(out_mat), dMat(d_mat) {
1898  // Only is run for vertices
1899  std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
1900  if (!inMat)
1901  THROW_MESSAGE("Pointer for in mat is null");
1902  if (!outMat)
1903  THROW_MESSAGE("Pointer for out mat is null");
1904  if (!dMat)
1905  THROW_MESSAGE("Pointer for tensor mat is null");
1906  }
1907 
1908  OpTensorTimesSymmetricTensor(boost::shared_ptr<MatrixDouble> in_mat,
1909  boost::shared_ptr<MatrixDouble> out_mat,
1910  boost::shared_ptr<MatrixDouble> d_mat)
1911  : UserOp(NOSPACE, OPSPACE), inMat(in_mat), outMat(out_mat), dMat(d_mat) {
1912  // Only is run for vertices
1913  if (!inMat)
1914  THROW_MESSAGE("Pointer for in mat is null");
1915  if (!outMat)
1916  THROW_MESSAGE("Pointer for out mat is null");
1917  if (!dMat)
1918  THROW_MESSAGE("Pointer for tensor mat is null");
1919  }
1920 
1921  MoFEMErrorCode doWork(int side, EntityType type, EntData &data) {
1923  const size_t nb_gauss_pts = getGaussPts().size2();
1924  auto t_D = getFTensor4DdgFromMat<DIM_01, DIM_23, S>(*(dMat));
1925  auto t_in = getFTensor2SymmetricFromMat<DIM_01>(*(inMat));
1926  outMat->resize((DIM_23 * (DIM_23 + 1)) / 2, nb_gauss_pts, false);
1927  auto t_out = getFTensor2SymmetricFromMat<DIM_23>(*(outMat));
1928  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1929  t_out(i, j) = t_D(i, j, k, l) * t_in(k, l);
1930  ++t_in;
1931  ++t_out;
1932  }
1934  }
1935 
1936 private:
1941 
1942  boost::shared_ptr<MatrixDouble> inMat;
1943  boost::shared_ptr<MatrixDouble> outMat;
1944  boost::shared_ptr<MatrixDouble> dMat;
1945 };
1946 
1947 template <int DIM>
1949 
1952 
1953  /**
1954  * @deprecated Do not use this constructor
1955  */
1957  boost::shared_ptr<MatrixDouble> in_mat,
1958  boost::shared_ptr<MatrixDouble> out_mat)
1959  : UserOp(field_name, OPROW), inMat(in_mat), outMat(out_mat) {
1960  // Only is run for vertices
1961  std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
1962  if (!inMat)
1963  THROW_MESSAGE("Pointer not set for in matrix");
1964  if (!outMat)
1965  THROW_MESSAGE("Pointer not set for in matrix");
1966  }
1967 
1968  OpSymmetrizeTensor(boost::shared_ptr<MatrixDouble> in_mat,
1969  boost::shared_ptr<MatrixDouble> out_mat)
1970  : UserOp(NOSPACE, OPSPACE), inMat(in_mat), outMat(out_mat) {
1971  // Only is run for vertices
1972  if (!inMat)
1973  THROW_MESSAGE("Pointer not set for in matrix");
1974  if (!outMat)
1975  THROW_MESSAGE("Pointer not set for in matrix");
1976  }
1977 
1978  MoFEMErrorCode doWork(int side, EntityType type, EntData &data) {
1980  const size_t nb_gauss_pts = getGaussPts().size2();
1981  auto t_in = getFTensor2FromMat<DIM, DIM>(*(inMat));
1982  outMat->resize((DIM * (DIM + 1)) / 2, nb_gauss_pts, false);
1983  auto t_out = getFTensor2SymmetricFromMat<DIM>(*(outMat));
1984  for (size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1985  t_out(i, j) = (t_in(i, j) || t_in(j, i)) / 2;
1986  ++t_in;
1987  ++t_out;
1988  }
1990  }
1991 
1992 private:
1995  boost::shared_ptr<MatrixDouble> inMat;
1996  boost::shared_ptr<MatrixDouble> outMat;
1997 };
1998 
2000 
2003 
2004  OpScaleMatrix(const std::string field_name, const double scale,
2005  boost::shared_ptr<MatrixDouble> in_mat,
2006  boost::shared_ptr<MatrixDouble> out_mat)
2007  : UserOp(field_name, OPROW), scale(scale), inMat(in_mat),
2008  outMat(out_mat) {
2009  // Only is run for vertices
2010  std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
2011  if (!inMat)
2012  THROW_MESSAGE("Pointer not set for in matrix");
2013  if (!outMat)
2014  THROW_MESSAGE("Pointer not set for in matrix");
2015  }
2016 
2017  MoFEMErrorCode doWork(int side, EntityType type, EntData &data) {
2019  outMat->resize(inMat->size1(), inMat->size2(), false);
2020  noalias(*outMat) = scale * (*inMat);
2022  }
2023 
2024 private:
2025  const double scale;
2026  boost::shared_ptr<MatrixDouble> inMat;
2027  boost::shared_ptr<MatrixDouble> outMat;
2028 };
2029 
2030 /**@}*/
2031 
2032 /** \name H-div/H-curls (Vectorial bases) values at integration points */
2033 
2034 /**@{*/
2035 
2036 /** \brief Get vector field for H-div approximation
2037  * \ingroup mofem_forces_and_sources_user_data_operators
2038  */
2039 template <int Base_Dim, int Field_Dim, class T, class L, class A>
2041 
2042 /** \brief Get vector field for H-div approximation
2043  * \ingroup mofem_forces_and_sources_user_data_operators
2044  */
2045 template <int Field_Dim>
2047  ublas::row_major, DoubleAllocator>
2049 
2051  boost::shared_ptr<MatrixDouble> data_ptr,
2052  const EntityType zero_type = MBEDGE,
2053  const int zero_side = 0)
2056  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2057  if (!dataPtr)
2058  THROW_MESSAGE("Pointer is not set");
2059  }
2060 
2061  /**
2062  * \brief Calculate values of vector field at integration points
2063  * @param side side entity number
2064  * @param type side entity type
2065  * @param data entity data
2066  * @return error code
2067  */
2068  MoFEMErrorCode doWork(int side, EntityType type,
2070 
2071 private:
2072  boost::shared_ptr<MatrixDouble> dataPtr;
2074  const int zeroSide;
2075 };
2076 
2077 template <int Field_Dim>
2079  3, Field_Dim, double, ublas::row_major,
2080  DoubleAllocator>::doWork(int side, EntityType type,
2083  const size_t nb_integration_points = this->getGaussPts().size2();
2084  if (type == zeroType && side == zeroSide) {
2085  dataPtr->resize(Field_Dim, nb_integration_points, false);
2086  dataPtr->clear();
2087  }
2088  const size_t nb_dofs = data.getFieldData().size();
2089  if (!nb_dofs)
2091  const size_t nb_base_functions = data.getN().size2() / 3;
2093  auto t_n_hdiv = data.getFTensor1N<3>();
2094  auto t_data = getFTensor1FromMat<Field_Dim>(*dataPtr);
2095  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2096  auto t_dof = data.getFTensor0FieldData();
2097  int bb = 0;
2098  for (; bb != nb_dofs; ++bb) {
2099  t_data(i) += t_n_hdiv(i) * t_dof;
2100  ++t_n_hdiv;
2101  ++t_dof;
2102  }
2103  for (; bb != nb_base_functions; ++bb)
2104  ++t_n_hdiv;
2105  ++t_data;
2106  }
2108 }
2109 
2110 /** \brief Get vector field for H-div approximation
2111  *
2112  * \ingroup mofem_forces_and_sources_user_data_operators
2113  */
2114 template <int Base_Dim, int Field_Dim = Base_Dim>
2117  Base_Dim, Field_Dim, double, ublas::row_major, DoubleAllocator> {
2119  Base_Dim, Field_Dim, double, ublas::row_major,
2121 };
2122 
2123 /** \brief Get vector field for H-div approximation
2124  * \ingroup mofem_forces_and_sources_user_data_operators
2125  */
2126 template <int Base_Dim, int Field_Dim = Base_Dim>
2128 
2129 template <int Field_Dim>
2130 struct OpCalculateHVecVectorFieldDot<3, Field_Dim>
2132 
2134  boost::shared_ptr<MatrixDouble> data_ptr,
2135  const EntityType zero_type = MBEDGE,
2136  const int zero_side = 0)
2139  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2140  if (!dataPtr)
2141  THROW_MESSAGE("Pointer is not set");
2142  }
2143 
2144  /**
2145  * \brief Calculate values of vector field at integration points
2146  * @param side side entity number
2147  * @param type side entity type
2148  * @param data entity data
2149  * @return error code
2150  */
2151  MoFEMErrorCode doWork(int side, EntityType type,
2153 
2154 private:
2155  boost::shared_ptr<MatrixDouble> dataPtr;
2157  const int zeroSide;
2158 };
2159 
2160 template <int Field_Dim>
2162  int side, EntityType type, EntitiesFieldData::EntData &data) {
2164 
2165  const size_t nb_integration_points = this->getGaussPts().size2();
2166  if (type == zeroType && side == zeroSide) {
2167  dataPtr->resize(Field_Dim, nb_integration_points, false);
2168  dataPtr->clear();
2169  }
2170 
2171  auto &local_indices = data.getIndices();
2172  const size_t nb_dofs = local_indices.size();
2173  if (nb_dofs) {
2174 
2175  std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2176  const double *array;
2177  CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
2178  for (size_t i = 0; i != nb_dofs; ++i)
2179  if (local_indices[i] != -1)
2180  dot_dofs_vector[i] = array[local_indices[i]];
2181  else
2182  dot_dofs_vector[i] = 0;
2183  CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
2184 
2185  const size_t nb_base_functions = data.getN().size2() / 3;
2187  auto t_n_hdiv = data.getFTensor1N<3>();
2188  auto t_data = getFTensor1FromMat<Field_Dim>(*dataPtr);
2189  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2190  int bb = 0;
2191  for (; bb != nb_dofs; ++bb) {
2192  t_data(i) += t_n_hdiv(i) * dot_dofs_vector[bb];
2193  ++t_n_hdiv;
2194  }
2195  for (; bb != nb_base_functions; ++bb)
2196  ++t_n_hdiv;
2197  ++t_data;
2198  }
2199  }
2200 
2202 }
2203 
2204 /**
2205  * @brief Calculate divergence of vector field
2206  * @ingroup mofem_forces_and_sources_user_data_operators
2207  *
2208  * @tparam BASE_DIM
2209  * @tparam SPACE_DIM
2210  */
2211 template <int BASE_DIM, int SPACE_DIM>
2214 
2216  boost::shared_ptr<VectorDouble> data_ptr,
2217  const EntityType zero_type = MBEDGE,
2218  const int zero_side = 0)
2221  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2222  if (!dataPtr)
2223  THROW_MESSAGE("Pointer is not set");
2224  }
2225 
2226  MoFEMErrorCode doWork(int side, EntityType type,
2229  const size_t nb_integration_points = getGaussPts().size2();
2230  if (type == zeroType && side == zeroSide) {
2231  dataPtr->resize(nb_integration_points, false);
2232  dataPtr->clear();
2233  }
2234  const size_t nb_dofs = data.getFieldData().size();
2235  if (!nb_dofs)
2237  const size_t nb_base_functions = data.getN().size2() / BASE_DIM;
2240  auto t_n_diff_hdiv = data.getFTensor2DiffN<BASE_DIM, SPACE_DIM>();
2241  auto t_data = getFTensor0FromVec(*dataPtr);
2242  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2243  auto t_dof = data.getFTensor0FieldData();
2244  int bb = 0;
2245  for (; bb != nb_dofs; ++bb) {
2246  t_data += t_dof * t_n_diff_hdiv(j, j);
2247  ++t_n_diff_hdiv;
2248  ++t_dof;
2249  }
2250  for (; bb != nb_base_functions; ++bb)
2251  ++t_n_diff_hdiv;
2252  ++t_data;
2253  }
2255  }
2256 
2257 private:
2258  boost::shared_ptr<VectorDouble> dataPtr;
2260  const int zeroSide;
2261 };
2262 
2263 /**
2264  * @brief Calculate gradient of vector field
2265  * @ingroup mofem_forces_and_sources_user_data_operators
2266  *
2267  * @tparam BASE_DIM
2268  * @tparam SPACE_DIM
2269  */
2270 template <int BASE_DIM, int SPACE_DIM>
2273 
2275  boost::shared_ptr<MatrixDouble> data_ptr,
2276  const EntityType zero_type = MBEDGE,
2277  const int zero_side = 0)
2280  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2281  if (!dataPtr)
2282  THROW_MESSAGE("Pointer is not set");
2283  }
2284 
2285  MoFEMErrorCode doWork(int side, EntityType type,
2288  const size_t nb_integration_points = getGaussPts().size2();
2289  if (type == zeroType && side == zeroSide) {
2290  dataPtr->resize(BASE_DIM * SPACE_DIM, nb_integration_points, false);
2291  dataPtr->clear();
2292  }
2293  const size_t nb_dofs = data.getFieldData().size();
2294  if (!nb_dofs)
2296  const size_t nb_base_functions = data.getN().size2() / BASE_DIM;
2299  auto t_base_diff = data.getFTensor2DiffN<BASE_DIM, SPACE_DIM>();
2300  auto t_data = getFTensor2FromMat<BASE_DIM, SPACE_DIM>(*dataPtr);
2301  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2302  auto t_dof = data.getFTensor0FieldData();
2303  int bb = 0;
2304  for (; bb != nb_dofs; ++bb) {
2305  t_data(i, j) += t_dof * t_base_diff(i, j);
2306  ++t_base_diff;
2307  ++t_dof;
2308  }
2309  for (; bb != nb_base_functions; ++bb)
2310  ++t_base_diff;
2311  ++t_data;
2312  }
2314  }
2315 
2316 private:
2317  boost::shared_ptr<MatrixDouble> dataPtr;
2319  const int zeroSide;
2320 };
2321 
2322 /**
2323  * @brief Calculate gradient of vector field
2324  * @ingroup mofem_forces_and_sources_user_data_operators
2325  *
2326  * @tparam BASE_DIM
2327  * @tparam SPACE_DIM
2328  */
2329 template <int BASE_DIM, int SPACE_DIM>
2332 
2334  boost::shared_ptr<MatrixDouble> data_ptr,
2335  const EntityType zero_type = MBEDGE,
2336  const int zero_side = 0)
2339  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2340  if (!dataPtr)
2341  THROW_MESSAGE("Pointer is not set");
2342  }
2343 
2344  MoFEMErrorCode doWork(int side, EntityType type,
2347  const size_t nb_integration_points = getGaussPts().size2();
2348  if (type == zeroType && side == zeroSide) {
2349  dataPtr->resize(BASE_DIM * SPACE_DIM * SPACE_DIM, nb_integration_points,
2350  false);
2351  dataPtr->clear();
2352  }
2353  const size_t nb_dofs = data.getFieldData().size();
2354  if (!nb_dofs)
2356 
2357  const int nb_base_functions = data.getN().size2() / BASE_DIM;
2358 
2359 #ifndef NDEBUG
2360  auto &hessian_base = data.getN(BaseDerivatives::SecondDerivative);
2361  if (hessian_base.size1() != nb_integration_points) {
2362  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2363  "Wrong number of integration pts (%d != %d)",
2364  hessian_base.size1(), nb_integration_points);
2365  }
2366  if (hessian_base.size2() !=
2367  BASE_DIM * nb_base_functions * SPACE_DIM * SPACE_DIM) {
2368  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2369  "Wrong number of base functions (%d != %d)",
2370  hessian_base.size2() / (BASE_DIM * SPACE_DIM * SPACE_DIM),
2371  nb_base_functions);
2372  }
2373  if (hessian_base.size2() < BASE_DIM * nb_dofs * SPACE_DIM * SPACE_DIM) {
2374  SETERRQ2(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2375  "Wrong number of base functions (%d < %d)", hessian_base.size2(),
2376  BASE_DIM * nb_dofs * SPACE_DIM * SPACE_DIM);
2377  }
2378 #endif
2379 
2383 
2384  auto t_base_diff2 =
2386  auto t_data = getFTensor3FromMat<BASE_DIM, SPACE_DIM, SPACE_DIM>(*dataPtr);
2387  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2388  auto t_dof = data.getFTensor0FieldData();
2389  int bb = 0;
2390  for (; bb != nb_dofs; ++bb) {
2391  t_data(i, j, k) += t_dof * t_base_diff2(i, j, k);
2392 
2393  ++t_base_diff2;
2394  ++t_dof;
2395  }
2396  for (; bb != nb_base_functions; ++bb)
2397  ++t_base_diff2;
2398  ++t_data;
2399  }
2401  }
2402 
2403 private:
2404  boost::shared_ptr<MatrixDouble> dataPtr;
2406  const int zeroSide;
2407 };
2408 
2409 /**
2410  * @brief Calculate divergence of vector field dot
2411  * @ingroup mofem_forces_and_sources_user_data_operators
2412  *
2413  * @tparam Tensor_Dim dimension of space
2414  */
2415 template <int Tensor_Dim1, int Tensor_Dim2>
2418 
2420  boost::shared_ptr<VectorDouble> data_ptr,
2421  const EntityType zero_type = MBEDGE,
2422  const int zero_side = 0)
2425  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2426  if (!dataPtr)
2427  THROW_MESSAGE("Pointer is not set");
2428  }
2429 
2430  MoFEMErrorCode doWork(int side, EntityType type,
2433  const size_t nb_integration_points = getGaussPts().size2();
2434  if (type == zeroType && side == zeroSide) {
2435  dataPtr->resize(nb_integration_points, false);
2436  dataPtr->clear();
2437  }
2438 
2439  const auto &local_indices = data.getLocalIndices();
2440  const int nb_dofs = local_indices.size();
2441  if (nb_dofs) {
2442 
2443  std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2444  const double *array;
2445  CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
2446  for (size_t i = 0; i != local_indices.size(); ++i)
2447  if (local_indices[i] != -1)
2448  dot_dofs_vector[i] = array[local_indices[i]];
2449  else
2450  dot_dofs_vector[i] = 0;
2451  CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
2452 
2453  const size_t nb_base_functions = data.getN().size2() / Tensor_Dim1;
2455  auto t_n_diff_hdiv = data.getFTensor2DiffN<Tensor_Dim1, Tensor_Dim2>();
2456  auto t_data = getFTensor0FromVec(*dataPtr);
2457  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2458  int bb = 0;
2459  for (; bb != nb_dofs; ++bb) {
2460  double div = 0;
2461  for (auto ii = 0; ii != Tensor_Dim2; ++ii)
2462  div += t_n_diff_hdiv(ii, ii);
2463  t_data += dot_dofs_vector[bb] * div;
2464  ++t_n_diff_hdiv;
2465  }
2466  for (; bb != nb_base_functions; ++bb)
2467  ++t_n_diff_hdiv;
2468  ++t_data;
2469  }
2470  }
2472  }
2473 
2474 private:
2475  boost::shared_ptr<VectorDouble> dataPtr;
2477  const int zeroSide;
2478 };
2479 
2480 /**
2481  * @brief Calculate curl of vector field
2482  * @ingroup mofem_forces_and_sources_user_data_operators
2483  *
2484  * @tparam Base_Dim base function dimension
2485  * @tparam Space_Dim dimension of space
2486  * @tparam Hcurl field dimension
2487  */
2488 template <int Base_Dim, int Space_Dim> struct OpCalculateHcurlVectorCurl;
2489 
2490 /**
2491  * @brief Calculate curl of vector field
2492  * @ingroup mofem_forces_and_sources_user_data_operators
2493  *
2494  * @tparam Base_Dim base function dimension
2495  * @tparam Space_Dim dimension of space
2496  * @tparam Hcurl field dimension
2497  */
2498 template <>
2501  OpCalculateHcurlVectorCurl(const std::string field_name,
2502  boost::shared_ptr<MatrixDouble> data_ptr,
2503  const EntityType zero_type = MBEDGE,
2504  const int zero_side = 0);
2505  MoFEMErrorCode doWork(int side, EntityType type,
2507 
2508 private:
2509  boost::shared_ptr<MatrixDouble> dataPtr;
2511  const int zeroSide;
2512 };
2513 
2514 /**
2515  * @brief Calculate curl of vector field
2516  * @ingroup mofem_forces_and_sources_user_data_operators
2517  *
2518  * @tparam Field_Dim dimension of field
2519  * @tparam Space_Dim dimension of space
2520  */
2521 template <>
2524 
2525  OpCalculateHcurlVectorCurl(const std::string field_name,
2526  boost::shared_ptr<MatrixDouble> data_ptr,
2527  const EntityType zero_type = MBVERTEX,
2528  const int zero_side = 0);
2529 
2530  MoFEMErrorCode doWork(int side, EntityType type,
2532 
2533 private:
2534  boost::shared_ptr<MatrixDouble> dataPtr;
2536  const int zeroSide;
2537 };
2538 
2539 /**
2540  * @brief Calculate curl of vector field
2541  * @ingroup mofem_forces_and_sources_user_data_operators
2542  *
2543  * @tparam Field_Dim dimension of field
2544  * @tparam Space_Dim dimension of space
2545  */
2546 template <>
2549 
2550  OpCalculateHcurlVectorCurl(const std::string field_name,
2551  boost::shared_ptr<MatrixDouble> data_ptr,
2552  const EntityType zero_type = MBVERTEX,
2553  const int zero_side = 0);
2554 
2555  MoFEMErrorCode doWork(int side, EntityType type,
2557 
2558 private:
2559  boost::shared_ptr<MatrixDouble> dataPtr;
2561  const int zeroSide;
2562 };
2563 
2564 /**
2565  * @brief Calculate tenor field using vectorial base, i.e. Hdiv/Hcurl
2566  * \ingroup mofem_forces_and_sources_user_data_operators
2567  *
2568  * @tparam Tensor_Dim0 rank of the filed
2569  * @tparam Tensor_Dim1 dimension of space
2570  */
2571 template <int Tensor_Dim0, int Tensor_Dim1>
2574 
2576  boost::shared_ptr<MatrixDouble> data_ptr,
2577  const EntityType zero_type = MBEDGE,
2578  const int zero_side = 0)
2581  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2582  if (!dataPtr)
2583  THROW_MESSAGE("Pointer is not set");
2584  }
2585 
2586  MoFEMErrorCode doWork(int side, EntityType type,
2589  const size_t nb_integration_points = getGaussPts().size2();
2590  if (type == zeroType && side == zeroSide) {
2591  dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points, false);
2592  dataPtr->clear();
2593  }
2594  const size_t nb_dofs = data.getFieldData().size();
2595  if (nb_dofs) {
2596  const size_t nb_base_functions = data.getN().size2() / 3;
2599  auto t_n_hvec = data.getFTensor1N<3>();
2600  auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*dataPtr);
2601  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2602  auto t_dof = data.getFTensor1FieldData<Tensor_Dim0>();
2603  size_t bb = 0;
2604  for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
2605  t_data(i, j) += t_dof(i) * t_n_hvec(j);
2606  ++t_n_hvec;
2607  ++t_dof;
2608  }
2609  for (; bb < nb_base_functions; ++bb)
2610  ++t_n_hvec;
2611  ++t_data;
2612  }
2613  }
2615  }
2616 
2617 private:
2618  boost::shared_ptr<MatrixDouble> dataPtr;
2620  const int zeroSide;
2621 };
2622 
2623 /**
2624  * @brief Calculate tenor field using tensor base, i.e. Hdiv/Hcurl
2625  * \ingroup mofem_forces_and_sources_user_data_operators
2626  *
2627  * @tparam Tensor_Dim0 rank of the filed
2628  * @tparam Tensor_Dim1 dimension of space
2629  */
2630 template <int Tensor_Dim0, int Tensor_Dim1>
2633 
2635  boost::shared_ptr<MatrixDouble> data_ptr,
2636  const EntityType zero_type = MBEDGE,
2637  const int zero_side = 0)
2640  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2641  if (!dataPtr)
2642  THROW_MESSAGE("Pointer is not set");
2643  }
2644 
2645  MoFEMErrorCode doWork(int side, EntityType type,
2648  const size_t nb_integration_points = getGaussPts().size2();
2649  if (type == zeroType && side == zeroSide) {
2650  dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points, false);
2651  dataPtr->clear();
2652  }
2653  const size_t nb_dofs = data.getFieldData().size();
2654  if (!nb_dofs)
2656  const size_t nb_base_functions =
2657  data.getN().size2() / (Tensor_Dim0 * Tensor_Dim1);
2660  auto t_n_hten = data.getFTensor2N<Tensor_Dim0, Tensor_Dim1>();
2661  auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*dataPtr);
2662  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2663  auto t_dof = data.getFTensor0FieldData();
2664  size_t bb = 0;
2665  for (; bb != nb_dofs; ++bb) {
2666  t_data(i, j) += t_dof * t_n_hten(i, j);
2667  ++t_n_hten;
2668  ++t_dof;
2669  }
2670  for (; bb < nb_base_functions; ++bb)
2671  ++t_n_hten;
2672  ++t_data;
2673  }
2675  }
2676 
2677 private:
2678  boost::shared_ptr<MatrixDouble> dataPtr;
2680  const int zeroSide;
2681 };
2682 
2683 /**
2684  * @brief Calculate divergence of tonsorial field using vectorial base
2685  * \ingroup mofem_forces_and_sources_user_data_operators
2686  *
2687  * @tparam Tensor_Dim0 rank of the field
2688  * @tparam Tensor_Dim1 dimension of space
2689  */
2690 template <int Tensor_Dim0, int Tensor_Dim1,
2691  CoordinateTypes CoordSys = CARTESIAN>
2694 
2696  boost::shared_ptr<MatrixDouble> data_ptr,
2697  const EntityType zero_type = MBEDGE,
2698  const int zero_side = 0)
2701  dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2702  if (!dataPtr)
2703  THROW_MESSAGE("Pointer is not set");
2704  }
2705 
2706  MoFEMErrorCode doWork(int side, EntityType type,
2709  const size_t nb_integration_points = getGaussPts().size2();
2710  if (type == zeroType && side == 0) {
2711  dataPtr->resize(Tensor_Dim0, nb_integration_points, false);
2712  dataPtr->clear();
2713  }
2714  const size_t nb_dofs = data.getFieldData().size();
2715  if (nb_dofs) {
2716  const size_t nb_base_functions = data.getN().size2() / 3;
2719  auto t_n_diff_hvec = data.getFTensor2DiffN<3, Tensor_Dim1>();
2720  auto t_data = getFTensor1FromMat<Tensor_Dim0>(*dataPtr);
2721  auto t_base = data.getFTensor1N<3>();
2722  auto t_coords = getFTensor1CoordsAtGaussPts();
2723  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2724  auto t_dof = data.getFTensor1FieldData<Tensor_Dim0>();
2725  size_t bb = 0;
2726  for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
2727  double div = t_n_diff_hvec(j, j);
2728  t_data(i) += t_dof(i) * div;
2729  if constexpr (CoordSys == CYLINDRICAL) {
2730  t_data(i) += t_base(0) * (t_dof(i) / t_coords(0));
2731  }
2732  ++t_n_diff_hvec;
2733  ++t_dof;
2734  ++t_base;
2735  }
2736  for (; bb < nb_base_functions; ++bb) {
2737  ++t_base;
2738  ++t_n_diff_hvec;
2739  }
2740  ++t_data;
2741  ++t_coords;
2742  }
2743  }
2745  }
2746 
2747 private:
2748  boost::shared_ptr<MatrixDouble> dataPtr;
2750  const int zeroSide;
2751 };
2752 
2753 /**
2754  * @brief Calculate trace of vector (Hdiv/Hcurl) space
2755  *
2756  * @tparam Tensor_Dim
2757  * @tparam OpBase
2758  */
2759 template <int Tensor_Dim, typename OpBase>
2761 
2763  boost::shared_ptr<MatrixDouble> data_ptr,
2764  const EntityType zero_type = MBEDGE,
2765  const int zero_side = 0)
2766  : OpBase(field_name, OpBase::OPROW), dataPtr(data_ptr),
2767  zeroType(zero_type), zeroSide(zero_side) {
2768  if (!dataPtr)
2769  THROW_MESSAGE("Pointer is not set");
2770  }
2771 
2772  MoFEMErrorCode doWork(int side, EntityType type,
2775  const size_t nb_integration_points = OpBase::getGaussPts().size2();
2776  if (type == zeroType && side == 0) {
2777  dataPtr->resize(Tensor_Dim, nb_integration_points, false);
2778  dataPtr->clear();
2779  }
2780  const size_t nb_dofs = data.getFieldData().size();
2781  if (nb_dofs) {
2782  auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
2783  const size_t nb_base_functions = data.getN().size2() / 3;
2784  auto t_base = data.getFTensor1N<3>();
2785  auto t_data = getFTensor1FromMat<Tensor_Dim>(*dataPtr);
2786  for (size_t gg = 0; gg != nb_integration_points; ++gg) {
2787  FTensor::Tensor1<double, Tensor_Dim> t_normalized_normal;
2788  t_normalized_normal(j) = t_normal(j);
2789  t_normalized_normal.normalize();
2790  auto t_dof = data.getFTensor1FieldData<Tensor_Dim>();
2791  size_t bb = 0;
2792  for (; bb != nb_dofs / Tensor_Dim; ++bb) {
2793  t_data(i) += t_dof(i) * (t_base(j) * t_normalized_normal(j));
2794  ++t_base;
2795  ++t_dof;
2796  }
2797  for (; bb < nb_base_functions; ++bb) {
2798  ++t_base;
2799  }
2800  ++t_data;
2801  ++t_normal;
2802  }
2803  }
2805  }
2806 
2807 private:
2808  boost::shared_ptr<MatrixDouble> dataPtr;
2810  const int zeroSide;
2813 };
2814 
2815 /**@}*/
2816 
2817 /** \name Other operators */
2818 
2819 /**@{*/
2820 
2821 /**@}*/
2822 
2823 /** \name Operators for faces */
2824 
2825 /**@{*/
2826 
2827 /** \brief Transform local reference derivatives of shape functions to global
2828 derivatives
2829 
2830 \ingroup mofem_forces_and_sources_tri_element
2831 
2832 */
2833 template <int DIM, int DERIVATIVE = 1> struct OpSetInvJacSpaceForFaceImpl;
2834 
2837 
2839  boost::shared_ptr<MatrixDouble> inv_jac_ptr);
2840 
2841 protected:
2842  template <int D1, int D2, int J1, int J2>
2845 
2846  static_assert(D2 == J2, "Dimension of jacobian and dimension of <out> "
2847  "directive does not match");
2848 
2849  size_t nb_functions = diff_n.size2() / D1;
2850  if (nb_functions) {
2851  size_t nb_gauss_pts = diff_n.size1();
2852 
2853 #ifndef NDEBUG
2854  if (nb_gauss_pts != getGaussPts().size2())
2855  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2856  "Wrong number of Gauss Pts");
2857  if (diff_n.size2() % D1)
2858  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
2859  "Number of direvatives of base functions and D1 dimension does "
2860  "not match");
2861 #endif
2862 
2863  diffNinvJac.resize(diff_n.size1(), D2 * nb_functions, false);
2864 
2867  auto t_diff_n = getFTensor1FromPtr<D2>(&*diffNinvJac.data().begin());
2868  auto t_diff_n_ref = getFTensor1FromPtr<D1>(&*diff_n.data().begin());
2869  auto t_inv_jac = getFTensor2FromMat<J1, J2>(*invJacPtr);
2870  for (size_t gg = 0; gg != nb_gauss_pts; ++gg, ++t_inv_jac) {
2871  for (size_t dd = 0; dd != nb_functions; ++dd) {
2872  t_diff_n(i) = t_inv_jac(k, i) * t_diff_n_ref(k);
2873  ++t_diff_n;
2874  ++t_diff_n_ref;
2875  }
2876  }
2877 
2878  diff_n.swap(diffNinvJac);
2879  }
2881  }
2882 
2883  boost::shared_ptr<MatrixDouble> invJacPtr;
2885 };
2886 
2887 template <>
2890 
2892 
2893  MoFEMErrorCode doWork(int side, EntityType type,
2895 };
2896 
2897 template <>
2899  : public OpSetInvJacSpaceForFaceImpl<2, 1> {
2900 
2902 
2903  MoFEMErrorCode doWork(int side, EntityType type,
2905 };
2906 
2907 template <>
2909  : public OpSetInvJacSpaceForFaceImpl<2, 1> {
2910 
2912 
2913  MoFEMErrorCode doWork(int side, EntityType type,
2915 };
2916 
2917 template <int DERIVARIVE = 1>
2919  : public OpSetInvJacSpaceForFaceImpl<2, DERIVARIVE> {
2920  OpSetInvJacH1ForFace(boost::shared_ptr<MatrixDouble> inv_jac_ptr)
2921  : OpSetInvJacSpaceForFaceImpl<2, DERIVARIVE>(H1, inv_jac_ptr) {}
2922 };
2923 
2924 template <int DERIVARIVE = 1>
2926  : public OpSetInvJacSpaceForFaceImpl<2, DERIVARIVE> {
2927  OpSetInvJacL2ForFace(boost::shared_ptr<MatrixDouble> inv_jac_ptr)
2928  : OpSetInvJacSpaceForFaceImpl<2, DERIVARIVE>(L2, inv_jac_ptr) {}
2929 };
2930 
2931 template <int DERIVARIVE = 1>
2933  : public OpSetInvJacSpaceForFaceImpl<3, DERIVARIVE> {
2935  boost::shared_ptr<MatrixDouble> inv_jac_ptr)
2936  : OpSetInvJacSpaceForFaceImpl<3, DERIVARIVE>(H1, inv_jac_ptr) {}
2937 };
2938 
2939 template <int DERIVARIVE = 1>
2941  : public OpSetInvJacSpaceForFaceImpl<3, DERIVARIVE> {
2943  boost::shared_ptr<MatrixDouble> inv_jac_ptr)
2944  : OpSetInvJacSpaceForFaceImpl<3, DERIVARIVE>(L2, inv_jac_ptr) {}
2945 };
2946 
2947 /**
2948  * \brief Transform local reference derivatives of shape function to
2949  global derivatives for face
2950 
2951  * \ingroup mofem_forces_and_sources_tri_element
2952  */
2953 template <int DIM> struct OpSetInvJacHcurlFaceImpl;
2954 
2955 template <>
2958 
2959  OpSetInvJacHcurlFaceImpl(boost::shared_ptr<MatrixDouble> inv_jac_ptr)
2961  invJacPtr(inv_jac_ptr) {}
2962 
2963  MoFEMErrorCode doWork(int side, EntityType type,
2965 
2966 protected:
2967  boost::shared_ptr<MatrixDouble> invJacPtr;
2969 };
2970 
2971 template <>
2974  MoFEMErrorCode doWork(int side, EntityType type,
2976 };
2977 
2980 
2981 /**
2982  * @brief Make Hdiv space from Hcurl space in 2d
2983  * @ingroup mofem_forces_and_sources_tri_element
2984  */
2987 
2990 
2991  MoFEMErrorCode doWork(int side, EntityType type,
2993 };
2994 
2995 /** \brief Transform Hcurl base fluxes from reference element to physical
2996  * triangle
2997  */
2999 
3000 /** \brief Apply contravariant (Piola) transfer to Hdiv space on face
3001  *
3002  * Covariant Piola transformation
3003  \f[
3004  \psi_i|_t = J^{-1}_{ij}\hat{\psi}_j\\
3005  \left.\frac{\partial \psi_i}{\partial \xi_j}\right|_t
3006  = J^{-1}_{ik}\frac{\partial \hat{\psi}_k}{\partial \xi_j}
3007  \f]
3008 
3009  */
3010 template <>
3013 
3015  boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3016 
3017  MoFEMErrorCode doWork(int side, EntityType type,
3019 
3020 private:
3021  boost::shared_ptr<MatrixDouble> invJacPtr;
3022 
3025 };
3026 
3029 
3030 /** \brief Apply contravariant (Piola) transfer to Hdiv space on face
3031  *
3032  * \note Hdiv space is generated by Hcurl space in 2d.
3033  *
3034  * Contravariant Piola transformation
3035  * \f[
3036  * \psi_i|_t = \frac{1}{\textrm{det}(J)}J_{ij}\hat{\psi}_j\\
3037  * \left.\frac{\partial \psi_i}{\partial \xi_j}\right|_t
3038  * =
3039  * \frac{1}{\textrm{det}(J)}J_{ik}\frac{\partial \hat{\psi}_k}{\partial \xi_j}
3040  * \f]
3041  *
3042  * \ingroup mofem_forces_and_sources
3043  *
3044  */
3046 
3047 template <>
3050 
3052  boost::shared_ptr<MatrixDouble> jac_ptr)
3054  jacPtr(jac_ptr) {}
3055 
3056  MoFEMErrorCode doWork(int side, EntityType type,
3058 
3059 protected:
3060  boost::shared_ptr<MatrixDouble> jacPtr;
3063 };
3064 
3065 template <>
3070 
3071  MoFEMErrorCode doWork(int side, EntityType type,
3073 };
3074 
3079 
3080 /**@}*/
3081 
3082 /** \name Operators for edges */
3083 
3084 /**@{*/
3085 
3088 
3091 
3092  MoFEMErrorCode doWork(int side, EntityType type,
3094 };
3095 
3096 /**
3097  * @deprecated Name is deprecated and this is added for back compatibility
3098  */
3101 
3102 /**@}*/
3103 
3104 /** \name Operator for fat prisms */
3105 
3106 /**@{*/
3107 
3108 /**
3109  * @brief Operator for fat prism element updating integration weights in the
3110  * volume.
3111  *
3112  * Jacobian on the distorted element is nonconstant. This operator updates
3113  * integration weight on prism to take into account nonconstat jacobian.
3114  *
3115  * \f[
3116  * W_i = w_i \left( \frac{1}{2V} \left\| \frac{\partial \mathbf{x}}{\partial
3117  * \pmb\xi} \right\| \right)
3118  * \f]
3119  * where \f$w_i\f$ is integration weight at integration point \f$i\f$,
3120  * \f$\mathbf{x}\f$ is physical coordinate, and \f$\pmb\xi\f$ is reference
3121  * element coordinate.
3122  *
3123  */
3126 
3129 
3130  MoFEMErrorCode doWork(int side, EntityType type,
3132 };
3133 
3134 /** \brief Calculate inverse of jacobian for face element
3135 
3136  It is assumed that face element is XY plane. Applied
3137  only for 2d problems.
3138 
3139  FIXME Generalize function for arbitrary face orientation in 3d space
3140  FIXME Calculate to Jacobins for two faces
3141 
3142  \ingroup mofem_forces_and_sources_prism_element
3143 
3144 */
3147 
3148  OpCalculateInvJacForFatPrism(boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3150  invJacPtr(inv_jac_ptr), invJac(*invJacPtr) {}
3151 
3154  invJac(inv_jac) {}
3155  MoFEMErrorCode doWork(int side, EntityType type,
3157 
3158 private:
3159  const boost::shared_ptr<MatrixDouble> invJacPtr;
3161 };
3162 
3163 /** \brief Transform local reference derivatives of shape functions to global
3164 derivatives
3165 
3166 FIXME Generalize to curved shapes
3167 FIXME Generalize to case that top and bottom face has different shape
3168 
3169 \ingroup mofem_forces_and_sources_prism_element
3170 
3171 */
3174 
3175  OpSetInvJacH1ForFatPrism(boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3177  invJacPtr(inv_jac_ptr), invJac(*invJacPtr) {}
3178 
3181  invJac(inv_jac) {}
3182 
3183  MoFEMErrorCode doWork(int side, EntityType type,
3185 
3186 private:
3187  const boost::shared_ptr<MatrixDouble> invJacPtr;
3190 };
3191 
3192 // Flat prism
3193 
3194 /** \brief Calculate inverse of jacobian for face element
3195 
3196  It is assumed that face element is XY plane. Applied
3197  only for 2d problems.
3198 
3199  FIXME Generalize function for arbitrary face orientation in 3d space
3200  FIXME Calculate to Jacobins for two faces
3201 
3202  \ingroup mofem_forces_and_sources_prism_element
3203 
3204 */
3207 
3210  invJacF3(inv_jac_f3) {}
3211  MoFEMErrorCode doWork(int side, EntityType type,
3213 
3214 private:
3216 };
3217 
3218 /** \brief Transform local reference derivatives of shape functions to global
3219 derivatives
3220 
3221 FIXME Generalize to curved shapes
3222 FIXME Generalize to case that top and bottom face has different shape
3223 
3224 \ingroup mofem_forces_and_sources_prism_element
3225 
3226 */
3229 
3232  invJacF3(inv_jac_f3) {}
3233 
3234  MoFEMErrorCode doWork(int side, EntityType type,
3236 
3237 private:
3240 };
3241 
3242 /**@}*/
3243 
3244 /** \name Operation on matrices at integration points */
3245 
3246 /**@{*/
3247 
3248 template <int DIM>
3250 
3251  OpInvertMatrix(boost::shared_ptr<MatrixDouble> in_ptr,
3252  boost::shared_ptr<VectorDouble> det_ptr,
3253  boost::shared_ptr<MatrixDouble> out_ptr)
3255  outPtr(out_ptr), detPtr(det_ptr) {}
3256 
3257  MoFEMErrorCode doWork(int side, EntityType type,
3259 
3260 private:
3261  boost::shared_ptr<MatrixDouble> inPtr;
3262  boost::shared_ptr<MatrixDouble> outPtr;
3263  boost::shared_ptr<VectorDouble> detPtr;
3264 };
3265 
3266 template <int DIM>
3270 
3271  if (!inPtr)
3272  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
3273  "Pointer for inPtr matrix not allocated");
3274  if (!detPtr)
3275  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
3276  "Pointer for detPtr matrix not allocated");
3277 
3278  const auto nb_rows = inPtr->size1();
3279  const auto nb_integration_pts = inPtr->size2();
3280 
3281  // Calculate determinant
3282  {
3283  detPtr->resize(nb_integration_pts, false);
3284  auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
3285  auto t_det = getFTensor0FromVec(*detPtr);
3286  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
3287  t_det = determinantTensor(t_in);
3288  ++t_in;
3289  ++t_det;
3290  }
3291  }
3292 
3293  // Invert jacobian
3294  if (outPtr) {
3295  outPtr->resize(nb_rows, nb_integration_pts, false);
3296  auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
3297  auto t_out = getFTensor2FromMat<DIM, DIM>(*outPtr);
3298  auto t_det = getFTensor0FromVec(*detPtr);
3299  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
3300  CHKERR invertTensor(t_in, t_det, t_out);
3301  ++t_in;
3302  ++t_out;
3303  ++t_det;
3304  }
3305  }
3306 
3308 }
3309 
3310 /**@}*/
3311 
3312 /** \brief Calculates the trace of an input matrix
3313 
3314 \ingroup mofem_forces_and_sources
3315 
3316 */
3317 
3318 template <int DIM>
3320 
3321  OpCalculateTraceFromMat(boost::shared_ptr<MatrixDouble> in_ptr,
3322  boost::shared_ptr<VectorDouble> out_ptr)
3324  outPtr(out_ptr) {}
3325 
3326  MoFEMErrorCode doWork(int side, EntityType type,
3328 
3329 private:
3331  boost::shared_ptr<MatrixDouble> inPtr;
3332  boost::shared_ptr<VectorDouble> outPtr;
3333 };
3334 
3335 template <int DIM>
3340 
3341  if (!inPtr)
3342  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
3343  "Pointer for inPtr matrix not allocated");
3344 
3345  const auto nb_integration_pts = inPtr->size2();
3346  // Invert jacobian
3347  if (outPtr) {
3348  outPtr->resize(nb_integration_pts, false);
3349  auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
3350  auto t_out = getFTensor0FromVec(*outPtr);
3351 
3352  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
3353  t_out = t_in(i, i);
3354  ++t_in;
3355  ++t_out;
3356  }
3357  }
3358 
3360 }
3361 
3362 /**@}*/
3363 
3364 /** \brief Calculates the trace of an input matrix
3365 
3366 \ingroup mofem_forces_and_sources
3367 
3368 */
3369 
3370 template <int DIM>
3373 
3374  OpCalculateTraceFromSymmMat(boost::shared_ptr<MatrixDouble> in_ptr,
3375  boost::shared_ptr<VectorDouble> out_ptr)
3377  outPtr(out_ptr) {}
3378 
3379  MoFEMErrorCode doWork(int side, EntityType type,
3381 
3382 private:
3384  boost::shared_ptr<MatrixDouble> inPtr;
3385  boost::shared_ptr<VectorDouble> outPtr;
3386 };
3387 
3388 template <int DIM>
3393 
3394  if (!inPtr)
3395  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
3396  "Pointer for inPtr matrix not allocated");
3397 
3398  const auto nb_integration_pts = inPtr->size2();
3399  // Invert jacobian
3400  if (outPtr) {
3401  outPtr->resize(nb_integration_pts, false);
3402  auto t_in = getFTensor2SymmetricFromMat<DIM>(*inPtr);
3403  auto t_out = getFTensor0FromVec(*outPtr);
3404 
3405  for (size_t gg = 0; gg != nb_integration_pts; ++gg) {
3406  t_out = t_in(i, i);
3407  ++t_in;
3408  ++t_out;
3409  }
3410  }
3411 
3413 }
3414 
3415 } // namespace MoFEM
3416 
3417 #endif // __USER_DATA_OPERATORS_HPP__
3418 
3419 /**
3420  * \defgroup mofem_forces_and_sources_user_data_operators Users Operators
3421  *
3422  * \brief Classes and functions used to evaluate fields at integration pts,
3423  *jacobians, etc..
3424  *
3425  * \ingroup mofem_forces_and_sources
3426  **/
UBlasMatrix< double >
NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::OpCalculateVectorFieldValues_General
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:343
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:460
MoFEM::OpCalculateVectorFieldGradientDot::dotVector
VectorDouble dotVector
Keeps temporary values of time derivatives.
Definition: UserDataOperators.hpp:1620
MoFEM::K
VectorDouble K
Definition: Projection10NodeCoordsOnField.cpp:125
MoFEM::OpInvertMatrix::OpInvertMatrix
OpInvertMatrix(boost::shared_ptr< MatrixDouble > in_ptr, boost::shared_ptr< VectorDouble > det_ptr, boost::shared_ptr< MatrixDouble > out_ptr)
Definition: UserDataOperators.hpp:3251
MoFEM::EdgeElementForcesAndSourcesCore
Edge finite element.
Definition: EdgeElementForcesAndSourcesCore.hpp:30
MoFEM::OpTensorTimesSymmetricTensor::i
FTensor::Index< 'i', DIM_01 > i
Definition: UserDataOperators.hpp:1937
MoFEM::OpTensorTimesSymmetricTensor::OpTensorTimesSymmetricTensor
DEPRECATED OpTensorTimesSymmetricTensor(const std::string field_name, boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat, boost::shared_ptr< MatrixDouble > d_mat)
Definition: UserDataOperators.hpp:1893
MoFEM::OpCalculateHVecTensorDivergence::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2749
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
MoFEM::OpCalculateInvJacForFatPrism::OpCalculateInvJacForFatPrism
OpCalculateInvJacForFatPrism(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.hpp:3148
MoFEM::OpSetContravariantPiolaTransformOnFace2DImpl< 2 >::piolaDiffN
MatrixDouble piolaDiffN
Definition: UserDataOperators.hpp:3062
MoFEM::OpCalculateHcurlVectorCurl< 1, 3 >::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2561
MoFEM::OpSymmetrizeTensor::i
FTensor::Index< 'i', DIM > i
Definition: UserDataOperators.hpp:1993
MoFEM::OpSymmetrizeTensor::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:1978
MoFEM::OpCalculateHcurlVectorCurl< 3, 3 >::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2510
MoFEM::OpCalculateVectorFieldValuesFromPetscVecImpl::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:608
MoFEM::OpSetCovariantPiolaTransformOnFace2DImpl
Transform Hcurl base fluxes from reference element to physical triangle.
Definition: UserDataOperators.hpp:2998
MoFEM::OpSetInvJacToScalarBasesBasic::diffNinvJac
MatrixDouble diffNinvJac
Definition: UserDataOperators.hpp:2884
MoFEM::OpTensorTimesSymmetricTensor::j
FTensor::Index< 'j', DIM_01 > j
Definition: UserDataOperators.hpp:1938
MoFEM::OpTensorTimesSymmetricTensor::inMat
boost::shared_ptr< MatrixDouble > inMat
Definition: UserDataOperators.hpp:1942
H1
@ H1
continuous field
Definition: definitions.h:85
MoFEM::OpCalculateHVecVectorFieldDot< 3, Field_Dim >::OpCalculateHVecVectorFieldDot
OpCalculateHVecVectorFieldDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2133
DEPRECATED
#define DEPRECATED
Definition: definitions.h:17
MoFEM::FatPrismElementForcesAndSourcesCore::UserDataOperator
default operator for Flat Prism element
Definition: FatPrismElementForcesAndSourcesCore.hpp:54
MoFEM::OpCalculateScalarFieldValues::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of scalar field at integration points
Definition: UserDataOperators.hpp:95
MoFEM::OpCalculateTensor2SymmetricFieldValues::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:1057
MoFEM::OpCalculateInvJacForFatPrism::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.cpp:633
MoFEM::OpCalculateVectorFieldValues_General::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:319
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
MoFEM::OpCalculateScalarFieldValuesFromPetscVecImpl::zeroAtType
const EntityHandle zeroAtType
Definition: UserDataOperators.hpp:269
CARTESIAN
@ CARTESIAN
Definition: definitions.h:128
MoFEM::OpSetContravariantPiolaTransformOnFace2DImpl< 3 >
Definition: UserDataOperators.hpp:3066
MOFEM_LOG_CHANNEL
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
Definition: LogManager.hpp:284
EntityHandle
MoFEM::OpMakeHdivFromHcurl::OpMakeHdivFromHcurl
OpMakeHdivFromHcurl()
Definition: UserDataOperators.hpp:2988
MoFEM::OpCalculateTensor2FieldValues
Get values at integration pts for tensor filed rank 2, i.e. matrix field.
Definition: UserDataOperators.hpp:887
MoFEM::OpCalculateVectorFieldValues_General::OpCalculateVectorFieldValues_General
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< ublas::matrix< T, L, A >> data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:296
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPSPACE
@ OPSPACE
operator do Work is execute on space data
Definition: ForcesAndSourcesCore.hpp:570
MoFEM::OpCalculateDivergenceVectorFieldValues
Calculate field values (template specialization) for tensor field rank 1, i.e. vector field.
Definition: UserDataOperators.hpp:486
MoFEM::OpCalculateTraceFromMat::OpCalculateTraceFromMat
OpCalculateTraceFromMat(boost::shared_ptr< MatrixDouble > in_ptr, boost::shared_ptr< VectorDouble > out_ptr)
Definition: UserDataOperators.hpp:3321
MoFEM::OpCalculateTraceFromMat::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:3337
MoFEM::OpCalculateTensor2SymmetricFieldValues::OpCalculateTensor2SymmetricFieldValues
OpCalculateTensor2SymmetricFieldValues(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:980
MoFEM::OpMultiplyDeterminantOfJacobianAndWeightsForFatPrisms::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.cpp:583
FTensor::row_major
@ row_major
Definition: Layout.hpp:13
MoFEM::OpCalculateVectorFieldValues_General
Calculate field values for tenor field rank 1, i.e. vector field.
Definition: UserDataOperators.hpp:293
MoFEM::OpCalculateHTensorTensorField::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2680
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot
Calculate symmetric tensor field rates ant integratio pts.
Definition: UserDataOperators.hpp:1071
MoFEM::OpSetContravariantPiolaTransformOnEdge2D::OpSetContravariantPiolaTransformOnEdge2D
OpSetContravariantPiolaTransformOnEdge2D(const FieldSpace space=HCURL)
Definition: UserDataOperators.hpp:3089
MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::OpCalculateTensor2FieldValues_General
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< ublas::matrix< double, ublas::row_major, DoubleAllocator >> data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:786
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot::dotVector
VectorDouble dotVector
Definition: UserDataOperators.hpp:1149
MoFEM::OpSetInvJacH1ForFlatPrism::OpSetInvJacH1ForFlatPrism
OpSetInvJacH1ForFlatPrism(MatrixDouble &inv_jac_f3)
Definition: UserDataOperators.hpp:3230
MoFEM::OpCalculateScalarFieldValuesFromPetscVecImpl::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:169
MoFEM::EntitiesFieldData::EntData::getFTensor3Diff2N
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.
MoFEM::EntitiesFieldData::EntData::getLocalIndices
const VectorInt & getLocalIndices() const
get local indices of dofs on entity
Definition: EntitiesFieldData.hpp:1229
MoFEM::OpSymmetrizeTensor::inMat
boost::shared_ptr< MatrixDouble > inMat
Definition: UserDataOperators.hpp:1995
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
MoFEM::OpCalculateHTensorTensorField
Calculate tenor field using tensor base, i.e. Hdiv/Hcurl.
Definition: UserDataOperators.hpp:2631
MoFEM::OpCalculateInvJacForFatPrism::invJacPtr
const boost::shared_ptr< MatrixDouble > invJacPtr
Definition: UserDataOperators.hpp:3159
MoFEM::OpSetInvJacHcurlFaceImpl< 2 >::OpSetInvJacHcurlFaceImpl
OpSetInvJacHcurlFaceImpl(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.hpp:2959
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:1148
MoFEM::OpCalculateHTensorTensorField::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2645
MoFEM::OpSetInvJacH1ForFatPrism::OpSetInvJacH1ForFatPrism
OpSetInvJacH1ForFatPrism(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.hpp:3175
MoFEM::OpCalculateHVecVectorGradient::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2318
MoFEM::OpCalculateVectorFieldValues_General::dataPtr
boost::shared_ptr< ublas::matrix< T, L, A > > dataPtr
Definition: UserDataOperators.hpp:318
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::OpCalculateHdivVectorDivergenceDot::OpCalculateHdivVectorDivergenceDot
OpCalculateHdivVectorDivergenceDot(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2419
MoFEM::OpCalculateVectorFieldValues
Get values at integration pts for tensor filed rank 1, i.e. vector field.
Definition: UserDataOperators.hpp:466
MoFEM::OpSetContravariantPiolaTransformOnFace2DImpl< 2 >::piolaN
MatrixDouble piolaN
Definition: UserDataOperators.hpp:3061
MoFEM::OpSetCovariantPiolaTransformOnFace2DImpl< 2 >::piolaN
MatrixDouble piolaN
Definition: UserDataOperators.hpp:3023
MoFEM::OpCalculateHVecTensorField::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2620
MoFEM::OpCalculateTensor2SymmetricFieldValues::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:1002
MoFEM::OpCalculateHVecVectorHessian::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2406
MoFEM::OpSetInvJacToScalarBasesBasic
Definition: UserDataOperators.hpp:2835
MoFEM::OpCalculateVectorFieldGradientDot::zeroAtType
EntityType zeroAtType
Zero values at Gauss point at this type.
Definition: UserDataOperators.hpp:1619
MoFEM::OpCalculateTensor2SymmetricFieldValues::dotVector
VectorDouble dotVector
Definition: UserDataOperators.hpp:1060
MoFEM::OpCalculateScalarFieldValuesDot
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
Definition: UserDataOperators.hpp:273
MoFEM::EntitiesFieldData::EntData::getFieldData
const VectorDouble & getFieldData() const
get dofs values
Definition: EntitiesFieldData.hpp:1254
MoFEM::OpCalculateScalarFieldHessian::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate gradient values of scalar field at integration points
Definition: UserDataOperators.hpp:1326
MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:370
MoFEM::OpCalculateTensor2SymmetricFieldGradient::OpCalculateTensor2SymmetricFieldGradient
OpCalculateTensor2SymmetricFieldGradient(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:1736
MoFEM::OpCalculateScalarFieldValues_General::dotVector
VectorDouble dotVector
Definition: UserDataOperators.hpp:60
MoFEM::OpCalculateHVecVectorGradient::OpCalculateHVecVectorGradient
OpCalculateHVecVectorGradient(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2274
MoFEM::OpCalculateVectorFieldGradientDot::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Data computed into this matrix.
Definition: UserDataOperators.hpp:1618
MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::dotVector
VectorDouble dotVector
Definition: UserDataOperators.hpp:820
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
MoFEM::OpCalculateTensor2FieldValues_General
Calculate field values for tenor field rank 2.
Definition: UserDataOperators.hpp:747
MoFEM::OpCalculateScalarFieldValues_General::dataVec
SmartPetscObj< Vec > dataVec
Definition: UserDataOperators.hpp:59
MoFEM::OpCalculateHcurlVectorCurl< 1, 3 >::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2559
MoFEM::EntitiesFieldData::EntData::getDiffN
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions
Definition: EntitiesFieldData.hpp:1329
MoFEM::OpCalculateScalarFieldValuesFromPetscVecImpl::dataPtr
boost::shared_ptr< VectorDouble > dataPtr
Definition: UserDataOperators.hpp:268
MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::OpCalculateVectorFieldValues_General
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:353
MoFEM::OpCalculateHVecTensorDivergence::OpCalculateHVecTensorDivergence
OpCalculateHVecTensorDivergence(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2695
J
FTensor::Index< 'J', DIM1 > J
Definition: level_set.cpp:30
MoFEM::OpCalculateVectorFieldHessian::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector field at integration points
Definition: UserDataOperators.hpp:1770
MoFEM::OpSetInvJacH1ForFatPrism::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.cpp:677
MoFEM::OpTensorTimesSymmetricTensor::dMat
boost::shared_ptr< MatrixDouble > dMat
Definition: UserDataOperators.hpp:1944
MoFEM::OpSetInvJacH1ForFatPrism::diffNinvJac
MatrixDouble diffNinvJac
Definition: UserDataOperators.hpp:3189
MoFEM::OpCalculateHVecVectorHessian::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2404
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
MoFEM::OpCalculateHdivVectorDivergence::dataPtr
boost::shared_ptr< VectorDouble > dataPtr
Definition: UserDataOperators.hpp:2258
MoFEM::OpSymmetrizeTensor::j
FTensor::Index< 'j', DIM > j
Definition: UserDataOperators.hpp:1994
MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::dataVec
SmartPetscObj< Vec > dataVec
Definition: UserDataOperators.hpp:819
BASE_DIM
constexpr int BASE_DIM
Definition: dg_projection.cpp:15
MoFEM::OpTensorTimesSymmetricTensor::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:1921
CoordinateTypes
CoordinateTypes
Coodinate system.
Definition: definitions.h:127
MoFEM::OpSetContrariantPiolaTransformOnEdge
OpSetContravariantPiolaTransformOnEdge2D OpSetContrariantPiolaTransformOnEdge
Definition: UserDataOperators.hpp:3100
MoFEM::OpCalculateHdivVectorDivergence::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2259
THROW_MESSAGE
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
MoFEM::OpCalculateHVecTensorTrace::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2810
MoFEM::OpCalculateHVecVectorGradient
Calculate gradient of vector field.
Definition: UserDataOperators.hpp:2271
MoFEM::OpCalculateTensor2SymmetricFieldValues::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:1056
MoFEM::OpCalculateInvJacForFatPrism
Calculate inverse of jacobian for face element.
Definition: UserDataOperators.hpp:3145
MoFEM::OpCalculateHVecTensorField::OpCalculateHVecTensorField
OpCalculateHVecTensorField(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2575
MoFEM::OpCalculateInvJacForFlatPrism::OpCalculateInvJacForFlatPrism
OpCalculateInvJacForFlatPrism(MatrixDouble &inv_jac_f3)
Definition: UserDataOperators.hpp:3208
MoFEM::OpCalculateScalarFieldGradient_General
Evaluate field gradient values for scalar field, i.e. gradient is tensor rank 1 (vector)
Definition: UserDataOperators.hpp:1185
MoFEM::OpSetInvJacToScalarBasesBasic::OpSetInvJacToScalarBasesBasic
OpSetInvJacToScalarBasesBasic(FieldSpace space, boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.cpp:10
MoFEM::OpCalculateScalarFieldGradient
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Definition: UserDataOperators.hpp:1293
I
constexpr IntegrationType I
Definition: operators_tests.cpp:31
MoFEM::OpSetContravariantPiolaTransformOnFace2DImpl< 2 >
Definition: UserDataOperators.hpp:3048
MoFEM::OpCalculateHVecTensorTrace::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2809
MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:818
MoFEM::ForcesAndSourcesCore::UserDataOperator::getGaussPts
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
Definition: ForcesAndSourcesCore.hpp:1236
MoFEM::OpCalculateTensor2FieldValuesDot::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Data computed into this matrix.
Definition: UserDataOperators.hpp:964
MoFEM::OpSetInvJacL2ForFace
Definition: UserDataOperators.hpp:2925
MoFEM::OpSetInvJacH1ForFatPrism::invJacPtr
const boost::shared_ptr< MatrixDouble > invJacPtr
Definition: UserDataOperators.hpp:3187
MoFEM::OpCalculateVectorFieldValuesFromPetscVecImpl
Approximate field values for given petsc vector.
Definition: UserDataOperators.hpp:595
MoFEM::PetscData::CTX_SET_X_TT
@ CTX_SET_X_TT
Definition: LoopMethods.hpp:29
MoFEM::EntitiesFieldData::EntData::getFTensor0N
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
Definition: EntitiesFieldData.hpp:1502
OpBase
MoFEM::OpCalculateScalarFieldValues_General
Scalar field values at integration points.
Definition: UserDataOperators.hpp:23
MoFEM::OpCalculateScalarFieldHessian
Evaluate field gradient values for scalar field, i.e. gradient is tensor rank 1 (vector),...
Definition: UserDataOperators.hpp:1306
MoFEM::OpSetInvJacL2ForFaceEmbeddedIn3DSpace::OpSetInvJacL2ForFaceEmbeddedIn3DSpace
OpSetInvJacL2ForFaceEmbeddedIn3DSpace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.hpp:2942
MoFEM::OpCalculateTraceFromSymmMat::OpCalculateTraceFromSymmMat
OpCalculateTraceFromSymmMat(boost::shared_ptr< MatrixDouble > in_ptr, boost::shared_ptr< VectorDouble > out_ptr)
Definition: UserDataOperators.hpp:3374
MoFEM::EntitiesFieldData::EntData::getFTensor2DiffN
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2DiffN(FieldApproximationBase base)
Get derivatives of base functions for Hdiv space.
Definition: EntitiesFieldData.cpp:660
FieldSpace
FieldSpace
approximation spaces
Definition: definitions.h:82
MoFEM::OpSetInvJacL2ForFace::OpSetInvJacL2ForFace
OpSetInvJacL2ForFace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.hpp:2927
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot::getFTensorDotData
auto getFTensorDotData()
Definition: UserDataOperators.hpp:1151
MoFEM::OpCalculateTraceFromSymmMat
Calculates the trace of an input matrix.
Definition: UserDataOperators.hpp:3371
MoFEM::OpCalculateVectorFieldValuesFromPetscVecImpl::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:712
CoordinateTypesNames
const static char *const CoordinateTypesNames[]
Coordinate system names.
Definition: definitions.h:121
MoFEM::OpCalculateHVecVectorHessian::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2344
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::OpSetInvJacL2ForFaceEmbeddedIn3DSpace
Definition: UserDataOperators.hpp:2940
MoFEM::OpCalculateHVecTensorField::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2619
MoFEM::OpCalculateHcurlVectorCurl< 3, 3 >::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2511
MoFEM::OpInvertMatrix::inPtr
boost::shared_ptr< MatrixDouble > inPtr
Definition: UserDataOperators.hpp:3261
MoFEM::OpCalculateHVecVectorField_General< 3, Field_Dim, double, ublas::row_major, DoubleAllocator >::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2072
MoFEM::OpCalculateScalarFieldValues_General::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:58
MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::dataPtr
boost::shared_ptr< ublas::matrix< double, ublas::row_major, DoubleAllocator > > dataPtr
Definition: UserDataOperators.hpp:817
MoFEM::OpCalculateTensor2SymmetricFieldGradient
Get field gradients at integration pts for symmetric tensorial field rank 2.
Definition: UserDataOperators.hpp:1732
MoFEM::OpCalculateHVecTensorTrace::i
FTensor::Index< 'i', Tensor_Dim > i
Definition: UserDataOperators.hpp:2811
MoFEM::OpSetInvJacH1ForFaceEmbeddedIn3DSpace::OpSetInvJacH1ForFaceEmbeddedIn3DSpace
OpSetInvJacH1ForFaceEmbeddedIn3DSpace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.hpp:2934
MoFEM::SmartPetscObj::use_count
int use_count() const
Definition: PetscSmartObj.hpp:109
MoFEM::OpCalculateHdivVectorDivergenceDot::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2476
MoFEM::OpCalculateVectorFieldValuesFromPetscVecImpl::dotVector
VectorDouble dotVector
Definition: UserDataOperators.hpp:714
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::OpCalculateHVecTensorDivergence::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2706
SPACE_DIM
constexpr int SPACE_DIM
Definition: child_and_parent.cpp:16
MoFEM::OpCalculateHVecVectorHessian
Calculate gradient of vector field.
Definition: UserDataOperators.hpp:2330
MoFEM::OpCalculateVectorFieldGradientDot::OpCalculateVectorFieldGradientDot
OpCalculateVectorFieldGradientDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_at_type=MBVERTEX)
Definition: UserDataOperators.hpp:1553
MoFEM::OpSetInvJacH1ForFatPrism
Transform local reference derivatives of shape functions to global derivatives.
Definition: UserDataOperators.hpp:3172
MoFEM::OpCalculateHVecVectorGradient::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2285
MoFEM::OpInvertMatrix::detPtr
boost::shared_ptr< VectorDouble > detPtr
Definition: UserDataOperators.hpp:3263
POLAR
@ POLAR
Definition: definitions.h:129
MoFEM::OpInvertMatrix::outPtr
boost::shared_ptr< MatrixDouble > outPtr
Definition: UserDataOperators.hpp:3262
MoFEM::OpCalculateHVecTensorTrace::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2808
MoFEM::OpCalculateTensor2FieldValues_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::OpCalculateTensor2FieldValues_General
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< ublas::matrix< double, ublas::row_major, DoubleAllocator >> data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:799
MoFEM::ForcesAndSourcesCore::UserDataOperator
Definition: ForcesAndSourcesCore.hpp:549
MoFEM::OpCalculateInvJacForFlatPrism::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.cpp:716
MoFEM::OpCalculateTraceFromMat::outPtr
boost::shared_ptr< VectorDouble > outPtr
Definition: UserDataOperators.hpp:3332
MoFEM::FaceElementForcesAndSourcesCore::UserDataOperator
default operator for TRI element
Definition: FaceElementForcesAndSourcesCore.hpp:94
MoFEM::OpCalculateHVecVectorField
Get vector field for H-div approximation.
Definition: UserDataOperators.hpp:2115
MoFEM::OpCalculateTraceFromMat::i
FTensor::Index< 'i', DIM > i
Definition: UserDataOperators.hpp:3330
MoFEM::OpCalculateTensor2FieldValues_General::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:772
MoFEM::OpCalculateTensor2SymmetricFieldValues::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:1058
MoFEM::OpSetCovariantPiolaTransformOnFace2DImpl< 2 >
Apply contravariant (Piola) transfer to Hdiv space on face.
Definition: UserDataOperators.hpp:3011
double
MoFEM::OpCalculateHTensorTensorField::OpCalculateHTensorTensorField
OpCalculateHTensorTensorField(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2634
MoFEM::OpScaleMatrix::outMat
boost::shared_ptr< MatrixDouble > outMat
Definition: UserDataOperators.hpp:2027
convert.type
type
Definition: convert.py:64
MoFEM::OpSetInvJacToScalarBasesBasic::applyTransform
MoFEMErrorCode applyTransform(MatrixDouble &diff_n)
Definition: UserDataOperators.hpp:2843
MoFEM::OpSetContravariantPiolaTransformOnFace2DImpl< 2 >::OpSetContravariantPiolaTransformOnFace2DImpl
OpSetContravariantPiolaTransformOnFace2DImpl(boost::shared_ptr< MatrixDouble > jac_ptr)
Definition: UserDataOperators.hpp:3051
MoFEM::OpCalculateTensor2FieldValuesDot::dotVector
VectorDouble dotVector
Keeps temporary values of time derivatives.
Definition: UserDataOperators.hpp:966
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
MoFEM::OpCalculateVectorFieldValues_General::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector field at integration points
Definition: UserDataOperators.hpp:324
MoFEM::OpCalculateHTensorTensorField::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2678
MoFEM::OpTensorTimesSymmetricTensor::OpTensorTimesSymmetricTensor
OpTensorTimesSymmetricTensor(boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat, boost::shared_ptr< MatrixDouble > d_mat)
Definition: UserDataOperators.hpp:1908
MoFEM::invertTensor
static MoFEMErrorCode invertTensor(FTensor::Tensor2< T1, DIM, DIM > &t, T2 &det, FTensor::Tensor2< T3, DIM, DIM > &inv_t)
Definition: Templates.hpp:1771
MoFEM::OpCalculateHVecVectorHessian::OpCalculateHVecVectorHessian
OpCalculateHVecVectorHessian(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2333
MoFEM::OpSetContravariantPiolaTransformOnEdge2D
Definition: UserDataOperators.hpp:3086
MoFEM::PetscData::CtxSetX_T
static constexpr Switches CtxSetX_T
Definition: LoopMethods.hpp:40
MoFEM::OpCalculateScalarFieldValues
Get value at integration points for scalar field.
Definition: UserDataOperators.hpp:82
MoFEM::OpSetInvJacH1ForFlatPrism::invJacF3
MatrixDouble & invJacF3
Definition: UserDataOperators.hpp:3238
MoFEM::OpCalculateTraceFromSymmMat::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:3390
MoFEM::determinantTensor
static auto determinantTensor(FTensor::Tensor2< T, DIM, DIM > &t)
Calculate the determinant of a tensor of rank DIM.
Definition: Templates.hpp:1571
MoFEM::EntitiesFieldData::EntData::getIndices
const VectorInt & getIndices() const
Get global indices of dofs on entity.
Definition: EntitiesFieldData.hpp:1214
MoFEM::FlatPrismElementForcesAndSourcesCore::UserDataOperator
default operator for Flat Prism element
Definition: FlatPrismElementForcesAndSourcesCore.hpp:34
MoFEM::OpCalculateHdivVectorDivergence::OpCalculateHdivVectorDivergence
OpCalculateHdivVectorDivergence(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2215
MoFEM::OpCalculateDivergenceVectorFieldValues::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:499
MoFEM::OpCalculateHVecTensorField
Calculate tenor field using vectorial base, i.e. Hdiv/Hcurl.
Definition: UserDataOperators.hpp:2572
MoFEM::OpCalculateTraceFromSymmMat::inPtr
boost::shared_ptr< MatrixDouble > inPtr
Definition: UserDataOperators.hpp:3384
MoFEM::OpCalculateTensor2SymmetricFieldGradient_General
Evaluate field gradient values for symmetric 2nd order tensor field, i.e. gradient is tensor rank 3.
Definition: UserDataOperators.hpp:1629
MoFEM::OpCalculateHdivVectorDivergenceDot
Calculate divergence of vector field dot.
Definition: UserDataOperators.hpp:2416
SPHERICAL
@ SPHERICAL
Definition: definitions.h:131
MoFEM::OpCalculateHVecVectorHessian::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2405
MoFEM::OpCalculateInvJacForFatPrism::OpCalculateInvJacForFatPrism
OpCalculateInvJacForFatPrism(MatrixDouble &inv_jac)
Definition: UserDataOperators.hpp:3152
MoFEM::OpCalculateTensor2SymmetricFieldValues::OpCalculateTensor2SymmetricFieldValues
OpCalculateTensor2SymmetricFieldValues(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:990
MoFEM::EntitiesFieldData::EntData::getFTensor2N
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
Definition: EntitiesFieldData.cpp:762
MoFEM::FaceElementForcesAndSourcesCore
Face finite element.
Definition: FaceElementForcesAndSourcesCore.hpp:23
MoFEM::OpCalculateTraceFromSymmMat::outPtr
boost::shared_ptr< VectorDouble > outPtr
Definition: UserDataOperators.hpp:3385
MoFEM::OpCalculateVectorFieldValuesFromPetscVecImpl::zeroAtType
const EntityHandle zeroAtType
Definition: UserDataOperators.hpp:713
MoFEM::OpCalculateTensor2FieldValuesDot::zeroAtType
EntityType zeroAtType
Zero values at Gauss point at this type.
Definition: UserDataOperators.hpp:965
MoFEM::OpTensorTimesSymmetricTensor::l
FTensor::Index< 'l', DIM_23 > l
Definition: UserDataOperators.hpp:1940
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:1147
MoFEM::L
VectorDouble L
Definition: Projection10NodeCoordsOnField.cpp:124
MoFEM::OpCalculateHVecTensorTrace::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Definition: UserDataOperators.hpp:2772
MoFEM::OpSetCovariantPiolaTransformOnFace2DImpl< 2 >::diffPiolaN
MatrixDouble diffPiolaN
Definition: UserDataOperators.hpp:3024
MoFEM::OpSetInvJacHcurlFaceImpl
Transform local reference derivatives of shape function to global derivatives for face.
Definition: UserDataOperators.hpp:2953
MoFEM::OpSetInvJacHcurlFaceImpl< 2 >::diffHcurlInvJac
MatrixDouble diffHcurlInvJac
Definition: UserDataOperators.hpp:2968
MoFEM::OpScaleMatrix
Definition: UserDataOperators.hpp:1999
MoFEM::OpCalculateHdivVectorDivergenceDot::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2430
MoFEM::OpCalculateHVecVectorGradient::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2319
MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:368
MoFEM::OpCalculateTraceFromMat::inPtr
boost::shared_ptr< MatrixDouble > inPtr
Definition: UserDataOperators.hpp:3331
MoFEM::FatPrismElementForcesAndSourcesCore
FatPrism finite element.
Definition: FatPrismElementForcesAndSourcesCore.hpp:31
MoFEM::ForcesAndSourcesCore::UserDataOperator
friend class UserDataOperator
Definition: ForcesAndSourcesCore.hpp:482
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
MoFEM::OpTensorTimesSymmetricTensor
Calculate .
Definition: UserDataOperators.hpp:1883
MoFEM::OpCalculateScalarFieldValuesFromPetscVecImpl
Get rate of scalar field at integration points.
Definition: UserDataOperators.hpp:156
MoFEM::OpSymmetrizeTensor::OpSymmetrizeTensor
OpSymmetrizeTensor(boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat)
Definition: UserDataOperators.hpp:1968
MoFEM::OpSetCovariantPiolaTransformOnFace2DImpl< 2 >::invJacPtr
boost::shared_ptr< MatrixDouble > invJacPtr
Definition: UserDataOperators.hpp:3021
MoFEM::OpCalculateHdivVectorDivergence::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2260
MoFEM::OpCalculateTensor2FieldValuesDot
Get time direvarive values at integration pts for tensor filed rank 2, i.e. matrix field.
Definition: UserDataOperators.hpp:902
EntData
EntitiesFieldData::EntData EntData
Definition: child_and_parent.cpp:37
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
MoFEM::Types::DoubleAllocator
VecAllocator< double > DoubleAllocator
Definition: Types.hpp:62
FTensor::Index
Definition: Index.hpp:23
MoFEM::OpTensorTimesSymmetricTensor::k
FTensor::Index< 'k', DIM_23 > k
Definition: UserDataOperators.hpp:1939
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFEMethod
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
Definition: ForcesAndSourcesCore.hpp:1042
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:1146
MoFEM::OpCalculateHVecTensorTrace
Calculate trace of vector (Hdiv/Hcurl) space.
Definition: UserDataOperators.hpp:2760
MoFEM::OpCalculateHVecVectorGradient::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2317
FTensor::Tensor1::normalize
Tensor1< T, Tensor_Dim > normalize()
Definition: Tensor1_value.hpp:77
MoFEM::OpCalculateTensor2SymmetricFieldValues::dataVec
SmartPetscObj< Vec > dataVec
Definition: UserDataOperators.hpp:1059
MoFEM::OpMultiplyDeterminantOfJacobianAndWeightsForFatPrisms
Operator for fat prism element updating integration weights in the volume.
Definition: UserDataOperators.hpp:3124
MoFEM::EdgeElementForcesAndSourcesCore::UserDataOperator
default operator for EDGE element
Definition: EdgeElementForcesAndSourcesCore.hpp:68
MoFEM::OpCalculateVectorFieldGradient
Get field gradients at integration pts for scalar filed rank 0, i.e. vector field.
Definition: UserDataOperators.hpp:1535
MoFEM::OpCalculateTensor2FieldValues_General::OpCalculateTensor2FieldValues_General
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< ublas::matrix< T, L, A >> data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:750
MoFEM::PetscData::CtxSetX_TT
static constexpr Switches CtxSetX_TT
Definition: LoopMethods.hpp:41
MoFEM::OpCalculateHVecTensorTrace::j
FTensor::Index< 'j', Tensor_Dim > j
Definition: UserDataOperators.hpp:2812
MoFEM::OpCalculateHTensorTensorField::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2679
MoFEM::OpCalculateHcurlVectorCurl< 3, 3 >::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2509
MoFEM::PetscData::CtxSetX
static constexpr Switches CtxSetX
Definition: LoopMethods.hpp:39
MoFEM::OpCalculateHcurlVectorCurl< 1, 2 >::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2535
MoFEM::ForcesAndSourcesCore
structure to get information form mofem into EntitiesFieldData
Definition: ForcesAndSourcesCore.hpp:22
MoFEM::OpCalculateTensor2FieldValuesDot::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:915
MoFEM::OpSetInvJacH1ForFace
Definition: UserDataOperators.hpp:2918
MoFEM::OpCalculateHcurlVectorCurl< 1, 2 >::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2536
MoFEM::OpCalculateHVecTensorDivergence
Calculate divergence of tonsorial field using vectorial base.
Definition: UserDataOperators.hpp:2692
MoFEM::EntitiesFieldData::EntData::getFTensor0FieldData
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FieldData()
Resturn scalar files as a FTensor of rank 0.
Definition: EntitiesFieldData.cpp:506
MoFEM::OpCalculateTensor2FieldValues_General::dataPtr
boost::shared_ptr< ublas::matrix< T, L, A > > dataPtr
Definition: UserDataOperators.hpp:765
MoFEM::OpCalculateHVecTensorTrace::OpCalculateHVecTensorTrace
OpCalculateHVecTensorTrace(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2762
MoFEM::DataOperator::doEntities
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
Definition: DataOperators.hpp:85
FTensor::dd
const Tensor2_symmetric_Expr< const ddTensor0< T, Dim, i, j >, typename promote< T, double >::V, Dim, i, j > dd(const Tensor0< T * > &a, const Index< i, Dim > index1, const Index< j, Dim > index2, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
Definition: ddTensor0.hpp:33
MoFEM::OpSetInvJacHcurlFaceImpl< 2 >::invJacPtr
boost::shared_ptr< MatrixDouble > invJacPtr
Definition: UserDataOperators.hpp:2967
MoFEM::OpCalculateScalarFieldValues_General::OpCalculateScalarFieldValues_General
OpCalculateScalarFieldValues_General(const std::string field_name, boost::shared_ptr< ublas::vector< T, A >> data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:26
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MoFEM::EntitiesFieldData::EntData::getFTensor1DiffN
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
Definition: EntitiesFieldData.cpp:526
MoFEM::FlatPrismElementForcesAndSourcesCore
FlatPrism finite element.
Definition: FlatPrismElementForcesAndSourcesCore.hpp:27
CYLINDRICAL
@ CYLINDRICAL
Definition: definitions.h:130
MoFEM::EntitiesFieldData::EntData::getFTensor1FieldData
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1FieldData()
Return FTensor of rank 1, i.e. vector from filed data coefficients.
Definition: EntitiesFieldData.hpp:1288
MoFEM::OpCalculateDivergenceVectorFieldValues::dataPtr
boost::shared_ptr< VectorDouble > dataPtr
Definition: UserDataOperators.hpp:583
MoFEM::OpSymmetrizeTensor
Definition: UserDataOperators.hpp:1948
MoFEM::OpCalculateHVecTensorField::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2586
MoFEM::EntitiesFieldData::EntData::getN
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
Definition: EntitiesFieldData.hpp:1318
MoFEM::OpCalculateHVecTensorDivergence::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2748
MoFEM::OpCalculateHdivVectorDivergence::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2226
MoFEM::OpCalculateHcurlVectorCurl< 1, 2 >::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2534
MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::dataVec
SmartPetscObj< Vec > dataVec
Definition: UserDataOperators.hpp:369
MoFEM::OpSetInvJacH1ForFatPrism::OpSetInvJacH1ForFatPrism
OpSetInvJacH1ForFatPrism(MatrixDouble &inv_jac)
Definition: UserDataOperators.hpp:3179
MoFEM::OpCalculateHVecTensorField::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2618
MoFEM::OpCalculateInvJacForFatPrism::invJac
MatrixDouble & invJac
Definition: UserDataOperators.hpp:3160
MoFEM::OpCalculateHVecVectorFieldDot< 3, Field_Dim >::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2157
MoFEM::OpCalculateScalarFieldValues_General::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of scalar field at integration points
Definition: UserDataOperators.hpp:68
MoFEM::OpInvertMatrix::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:3267
MoFEM::OpSymmetrizeTensor::OpSymmetrizeTensor
DEPRECATED OpSymmetrizeTensor(const std::string field_name, boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat)
Definition: UserDataOperators.hpp:1956
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::OpCalculateTensor2SymmetricFieldGradient_General< Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator >::OpCalculateTensor2SymmetricFieldGradient_General
OpCalculateTensor2SymmetricFieldGradient_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:1647
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:1084
MoFEM::EntitiesFieldData::EntData::getFTensor1N
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
Definition: EntitiesFieldData.cpp:640
MoFEM::OpSetInvJacHcurlFaceImpl< 2 >
Definition: UserDataOperators.hpp:2956
MoFEM::OpCalculateTensor2FieldValuesDot::OpCalculateTensor2FieldValuesDot
OpCalculateTensor2FieldValuesDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_at_type=MBVERTEX)
Definition: UserDataOperators.hpp:905
MoFEM::OpCalculateTraceFromMat
Calculates the trace of an input matrix.
Definition: UserDataOperators.hpp:3319
MoFEM::OpSetContravariantPiolaTransformOnFace2DImpl< 2 >::jacPtr
boost::shared_ptr< MatrixDouble > jacPtr
Definition: UserDataOperators.hpp:3060
UBlasVector< double >
MoFEM::OpSetInvJacH1ForFlatPrism::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.cpp:751
MoFEM::OpMakeHdivFromHcurl::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.cpp:275
MoFEM::OpCalculateHVecVectorField_General< 3, Field_Dim, double, ublas::row_major, DoubleAllocator >::OpCalculateHVecVectorField_General
OpCalculateHVecVectorField_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:2050
HCURL
@ HCURL
field with continuous tangents
Definition: definitions.h:86
MoFEM::OpCalculateTensor2SymmetricFieldValues
Calculate symmetric tensor field values at integration pts.
Definition: UserDataOperators.hpp:977
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::OpSetInvJacH1ForFace::OpSetInvJacH1ForFace
OpSetInvJacH1ForFace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Definition: UserDataOperators.hpp:2920
MoFEM::OpCalculateHdivVectorDivergence
Calculate divergence of vector field.
Definition: UserDataOperators.hpp:2212
MoFEM::OpInvertMatrix
Definition: UserDataOperators.hpp:3249
MoFEM::OpCalculateInvJacForFlatPrism::invJacF3
MatrixDouble & invJacF3
Definition: UserDataOperators.hpp:3215
MoFEM::OpSetInvJacHcurlFaceImpl< 3 >
Definition: UserDataOperators.hpp:2972
MoFEM::PetscData::CTX_SET_X_T
@ CTX_SET_X_T
Definition: LoopMethods.hpp:28
MoFEM::OpScaleMatrix::OpScaleMatrix
OpScaleMatrix(const std::string field_name, const double scale, boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat)
Definition: UserDataOperators.hpp:2004
MoFEM::OpCalculateVectorFieldValues_General< Tensor_Dim, double, ublas::row_major, DoubleAllocator >::dotVector
VectorDouble dotVector
Definition: UserDataOperators.hpp:371
MoFEM::OpCalculateHVecVectorField_General
Get vector field for H-div approximation.
Definition: UserDataOperators.hpp:2040
MoFEM::OpCalculateHcurlVectorCurl< 1, 3 >::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2560
MoFEM::OpCalculateDivergenceVectorFieldValues::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:584
MoFEM::OpCalculateHVecVectorField_General< 3, Field_Dim, double, ublas::row_major, DoubleAllocator >::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2073
MoFEM::OpCalculateHdivVectorDivergenceDot::dataPtr
boost::shared_ptr< VectorDouble > dataPtr
Definition: UserDataOperators.hpp:2475
MoFEM::OpCalculateVectorFieldGradientDot::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:1563
MoFEM::OpSetInvJacToScalarBasesBasic::invJacPtr
boost::shared_ptr< MatrixDouble > invJacPtr
Definition: UserDataOperators.hpp:2883
MoFEM::OpSetContravariantPiolaTransformOnEdge2D::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.cpp:532
MoFEM::EntitiesFieldData::EntData::getFTensor2SymmetricFieldData
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.
Definition: EntitiesFieldData.hpp:1307
MoFEM::OpScaleMatrix::scale
const double scale
Definition: UserDataOperators.hpp:2025
MoFEM::OpCalculateDivergenceVectorFieldValues::OpCalculateDivergenceVectorFieldValues
OpCalculateDivergenceVectorFieldValues(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:489
MoFEM::OpSetInvJacH1ForFatPrism::invJac
MatrixDouble & invJac
Definition: UserDataOperators.hpp:3188
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:453
MoFEM::OpCalculateVectorFieldGradient_General
Evaluate field gradient values for vector field, i.e. gradient is tensor rank 2.
Definition: UserDataOperators.hpp:1405
MoFEM::OpSetInvJacH1ForFlatPrism
Transform local reference derivatives of shape functions to global derivatives.
Definition: UserDataOperators.hpp:3227
MoFEM::OpCalculateScalarFieldValues_General::dataPtr
boost::shared_ptr< ublas::vector< T, A > > dataPtr
Definition: UserDataOperators.hpp:57
MoFEM::OpMakeHdivFromHcurl
Make Hdiv space from Hcurl space in 2d.
Definition: UserDataOperators.hpp:2985
MoFEM::OpCalculateTraceFromSymmMat::i
FTensor::Index< 'i', DIM > i
Definition: UserDataOperators.hpp:3383
MoFEM::OpCalculateHVecTensorDivergence::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2750
MoFEM::OpCalculateTensor2FieldValues_General::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:766
MoFEM::OpCalculateHVecVectorFieldDot< 3, Field_Dim >::zeroType
const EntityHandle zeroType
Definition: UserDataOperators.hpp:2156
MoFEM::SmartPetscObj< Vec >
MoFEM::PetscData::CTX_SET_X
@ CTX_SET_X
Definition: LoopMethods.hpp:27
MoFEM::OpCalculateVectorFieldValuesFromPetscVecImpl::OpCalculateVectorFieldValuesFromPetscVecImpl
OpCalculateVectorFieldValuesFromPetscVecImpl(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_at_type=MBVERTEX)
Definition: UserDataOperators.hpp:598
MoFEM::OpCalculateTensor2SymmetricFieldGradient_General::OpCalculateTensor2SymmetricFieldGradient_General
OpCalculateTensor2SymmetricFieldGradient_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:1633
MoFEM::OpTensorTimesSymmetricTensor::outMat
boost::shared_ptr< MatrixDouble > outMat
Definition: UserDataOperators.hpp:1943
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
MoFEM::OpSetInvJacH1ForFlatPrism::diffNinvJac
MatrixDouble diffNinvJac
Definition: UserDataOperators.hpp:3239
MoFEM::OpCalculateHVecVectorFieldDot
Get vector field for H-div approximation.
Definition: UserDataOperators.hpp:2127
MoFEM::OpSetInvJacH1ForFaceEmbeddedIn3DSpace
Definition: UserDataOperators.hpp:2932
MoFEM::OpCalculateScalarFieldValuesFromPetscVecImpl::OpCalculateScalarFieldValuesFromPetscVecImpl
OpCalculateScalarFieldValuesFromPetscVecImpl(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_at_type=MBVERTEX)
Definition: UserDataOperators.hpp:159
MoFEM::OpCalculateVectorFieldGradientDot
Get field gradients time derivative at integration pts for scalar filed rank 0, i....
Definition: UserDataOperators.hpp:1550
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::OpScaleMatrix::doWork
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Definition: UserDataOperators.hpp:2017
MoFEM::OpSetContravariantPiolaTransformOnFace2DImpl
Apply contravariant (Piola) transfer to Hdiv space on face.
Definition: UserDataOperators.hpp:3045
MoFEM::EntitiesFieldData::EntData::getFTensor2FieldData
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2FieldData()
Return FTensor rank 2, i.e. matrix from filed data coefficients.
Definition: EntitiesFieldData.hpp:1297
MoFEM::OpCalculateHcurlVectorCurl
Calculate curl of vector field.
Definition: UserDataOperators.hpp:2488
MoFEM::OpCalculateHVecVectorFieldDot< 3, Field_Dim >::dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
Definition: UserDataOperators.hpp:2155
MoFEM::OpCalculateInvJacForFlatPrism
Calculate inverse of jacobian for face element.
Definition: UserDataOperators.hpp:3205
MoFEM::OpSetInvJacSpaceForFaceImpl
Transform local reference derivatives of shape functions to global derivatives.
Definition: UserDataOperators.hpp:2833
MoFEM::OpCalculateTensor2SymmetricFieldValuesDot::OpCalculateTensor2SymmetricFieldValuesDot
OpCalculateTensor2SymmetricFieldValuesDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Definition: UserDataOperators.hpp:1074
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
MoFEM::ForcesAndSourcesCore::UserDataOperator::getFTensor1CoordsAtGaussPts
auto getFTensor1CoordsAtGaussPts()
Get coordinates at integration points assuming linear geometry.
Definition: ForcesAndSourcesCore.hpp:1269
MoFEM::OpMultiplyDeterminantOfJacobianAndWeightsForFatPrisms::OpMultiplyDeterminantOfJacobianAndWeightsForFatPrisms
OpMultiplyDeterminantOfJacobianAndWeightsForFatPrisms()
Definition: UserDataOperators.hpp:3127
MoFEM::OpCalculateHdivVectorDivergenceDot::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2477
MoFEM::OpScaleMatrix::inMat
boost::shared_ptr< MatrixDouble > inMat
Definition: UserDataOperators.hpp:2026
MoFEM::OpSymmetrizeTensor::outMat
boost::shared_ptr< MatrixDouble > outMat
Definition: UserDataOperators.hpp:1996
MoFEM::ForcesAndSourcesCore::UserDataOperator::OPROW
@ OPROW
operator doWork function is executed on FE rows
Definition: ForcesAndSourcesCore.hpp:567
MoFEM::OpCalculateHVecVectorField_General< 3, Field_Dim, double, ublas::row_major, DoubleAllocator >::zeroSide
const int zeroSide
Definition: UserDataOperators.hpp:2074
MoFEM::OpCalculateScalarFieldValues_General::OpCalculateScalarFieldValues_General
OpCalculateScalarFieldValues_General(const std::string field_name, boost::shared_ptr< ublas::vector< T, A >> data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBVERTEX)
Definition: UserDataOperators.hpp:36
MoFEM::OpCalculateVectorFieldHessian
Definition: UserDataOperators.hpp:1745