42#ifndef __USER_DATA_OPERATORS_HPP__
43 #define __USER_DATA_OPERATORS_HPP__
69template <
class T,
class A>
82 boost::shared_ptr<ublas::vector<T, A>> data_ptr,
83 const EntityType zero_type = MBVERTEX)
100 boost::shared_ptr<ublas::vector<T, A>> data_ptr,
119 boost::shared_ptr<ublas::vector<T, A>>
dataPtr;
129template <
class T,
class A>
167 if (type ==
zeroType || vec.size() != nb_gauss_pts) {
168 vec.resize(nb_gauss_pts,
false);
181 for (
int i = 0;
i != local_indices.size(); ++
i)
182 if (local_indices[
i] != -1)
190 const size_t nb_base_functions = data.
getN().size2();
193 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
196 for (; bb != nb_dofs; ++bb) {
197 values_at_gauss_pts += field_data * base_function;
202 for (; bb < nb_base_functions; ++bb)
204 ++values_at_gauss_pts;
227template <PetscData::DataContext CTX>
239 const std::string
field_name, boost::shared_ptr<VectorDouble> data_ptr,
240 const EntityType zero_at_type = MBVERTEX)
255 if (type ==
zeroAtType || vec.size() != nb_gauss_pts) {
256 vec.resize(nb_gauss_pts,
false);
261 const size_t nb_dofs = local_indices.size();
266 auto get_array = [&](
const auto ctx,
auto vec) {
272 <<
"In this case field degrees of freedom are read from vector. "
273 "That usually happens when time solver is used, and acces to "
274 "first or second rates is needed. You probably not set ts_u, "
275 "ts_u_t, or ts_u_tt and associated data structure, i.e. "
276 "data_ctx to CTX_SET_X, CTX_SET_X_T, or CTX_SET_X_TT "
281 CHKERR VecGetArrayRead(vec, &array);
285 auto restore_array = [&](
auto vec) {
286 return VecRestoreArrayRead(vec, &array);
301 "That case is not implemented");
304 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
305 for (
int i = 0;
i != local_indices.size(); ++
i)
306 if (local_indices[
i] != -1)
307 dot_dofs_vector[
i] = array[local_indices[
i]];
309 dot_dofs_vector[
i] = 0;
323 "That case is not implemented");
326 const size_t nb_base_functions = data.
getN().size2();
330 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
332 for (; bb != nb_dofs; ++bb) {
333 values_at_gauss_pts += dot_dofs_vector[bb] * base_function;
338 for (; bb < nb_base_functions; ++bb)
340 ++values_at_gauss_pts;
380template <
int Tensor_Dim,
class T,
class L,
class A>
393 boost::shared_ptr<ublas::matrix<T, L, A>> data_ptr,
394 const EntityType zero_type = MBVERTEX)
413 boost::shared_ptr<ublas::matrix<T, L, A>>
dataPtr;
417template <
int Tensor_Dim,
class T,
class L,
class A>
423 "Not implemented for T = %s and dim = %d",
433template <
int Tensor_Dim>
439 boost::shared_ptr<MatrixDouble> data_ptr,
440 const EntityType zero_type = MBVERTEX)
449 boost::shared_ptr<MatrixDouble> data_ptr,
451 const EntityType zero_type = MBVERTEX)
473template <
int Tensor_Dim>
475 Tensor_Dim,
double, ublas::row_major,
480 const size_t nb_gauss_pts = getGaussPts().size2();
481 auto &mat = *dataPtr;
482 if (type == zeroType || mat.size2() != nb_gauss_pts) {
483 mat.resize(Tensor_Dim, nb_gauss_pts,
false);
490 if (dataVec.use_count()) {
491 dotVector.resize(nb_dofs,
false);
493 CHKERR VecGetArrayRead(dataVec, &array);
495 for (
int i = 0;
i != local_indices.size(); ++
i)
496 if (local_indices[
i] != -1)
497 dotVector[
i] = array[local_indices[
i]];
500 CHKERR VecRestoreArrayRead(dataVec, &array);
505 const size_t nb_base_functions = data.
getN().size2();
507 auto values_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
509 const size_t size = nb_dofs / Tensor_Dim;
510 if (nb_dofs % Tensor_Dim) {
512 "Nb. of DOFs is inconsistent with Tensor_Dim");
514 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
518 if (field_data.l2() != field_data.l2()) {
519 MOFEM_LOG(
"SELF", Sev::error) <<
"field data: " << field_data;
521 "Wrong number in coefficients");
526 for (; bb != size; ++bb) {
530 if (base_function != base_function) {
531 MOFEM_LOG(
"SELF", Sev::error) <<
"base function: " << base_function;
533 "Wrong number number in base functions");
538 values_at_gauss_pts(
I) += field_data(
I) * base_function;
544 for (; bb < nb_base_functions; ++bb)
546 ++values_at_gauss_pts;
550 if (dataVec.use_count()) {
569template <
int Tensor_Dim>
572 Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
575 Tensor_Dim,
double, ublas::row_major,
595template <
int Tensor_Dim, CoordinateTypes COORDINATE_SYSTEM = CARTESIAN>
607 const std::string
field_name, boost::shared_ptr<VectorDouble> data_ptr,
608 const EntityType zero_type = MBVERTEX)
621 if constexpr (COORDINATE_SYSTEM ==
POLAR || COORDINATE_SYSTEM ==
SPHERICAL)
623 "%s coordiante not implemented",
629 vec.resize(nb_gauss_pts,
false);
637 const size_t nb_base_functions = data.
getN().size2();
640 const size_t size = nb_dofs / Tensor_Dim;
642 if (nb_dofs % Tensor_Dim) {
644 "Number of dofs should multiple of dimensions");
649 if constexpr (COORDINATE_SYSTEM ==
CARTESIAN) {
651 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
654 for (; bb != size; ++bb) {
655 values_at_gauss_pts += field_data(
I) * diff_base_function(
I);
657 ++diff_base_function;
661 for (; bb < nb_base_functions; ++bb)
662 ++diff_base_function;
663 ++values_at_gauss_pts;
673 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
676 for (; bb != size; ++bb) {
677 values_at_gauss_pts += field_data(
I) * diff_base_function(
I);
678 values_at_gauss_pts +=
679 base_function * (field_data(0) / t_coords(0));
682 ++diff_base_function;
686 for (; bb < nb_base_functions; ++bb) {
688 ++diff_base_function;
690 ++values_at_gauss_pts;
711template <
int Tensor_Dim, PetscData::DataContext CTX>
716 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
717 const EntityType zero_at_type = MBVERTEX,
bool throw_error =
true)
730 const size_t nb_dofs = local_indices.size();
735 mat.resize(Tensor_Dim, nb_gauss_pts,
false);
749 auto get_array = [&](
const auto ctx,
auto vec) {
755 <<
"In this case field degrees of freedom are read from vector. "
756 "That usually happens when time solver is used, and access to "
757 "first or second rates is needed. You probably not set ts_u, "
758 "ts_u_t, or ts_u_tt and associated data structure, i.e. "
759 "data_ctx to CTX_SET_X, CTX_SET_DX, CTX_SET_X_T, or "
760 "CTX_SET_X_TT respectively";
764 CHKERR VecGetArrayRead(vec, &array);
768 auto restore_array = [&](
auto vec) {
769 return VecRestoreArrayRead(vec, &array);
787 "That case is not implemented");
791 for (
int i = 0;
i != local_indices.size(); ++
i)
792 if (local_indices[
i] != -1)
812 "That case is not implemented");
815 const size_t nb_base_functions = data.
getN().size2();
817 auto values_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
820 const size_t size = nb_dofs / Tensor_Dim;
821 if (nb_dofs % Tensor_Dim) {
824 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
825 auto field_data = getFTensor1FromArray<Tensor_Dim, Tensor_Dim>(
dotVector);
827 for (; bb != size; ++bb) {
828 values_at_gauss_pts(
I) += field_data(
I) * base_function;
834 for (; bb < nb_base_functions; ++bb)
836 ++values_at_gauss_pts;
853template <
int Tensor_Dim>
863template <
int Tensor_Dim>
873template <
int Tensor_Dim>
887template <
int Tensor_Dim0,
int Tensor_Dim1,
class T,
class L,
class A>
893 boost::shared_ptr<ublas::matrix<T, L, A>> data_ptr,
894 const EntityType zero_type = MBVERTEX)
906 boost::shared_ptr<ublas::matrix<T, L, A>>
dataPtr;
910template <
int Tensor_Dim0,
int Tensor_Dim1,
class T,
class L,
class A>
916 "Not implemented for T = %s, dim0 = %d and dim1 = %d",
918 Tensor_Dim0, Tensor_Dim1);
922template <
int Tensor_Dim0,
int Tensor_Dim1>
930 ublas::matrix<double, ublas::row_major, DoubleAllocator>>
932 const EntityType zero_type = MBVERTEX)
943 ublas::matrix<double, ublas::row_major, DoubleAllocator>>
957 boost::shared_ptr<ublas::matrix<double, ublas::row_major, DoubleAllocator>>
964template <
int Tensor_Dim0,
int Tensor_Dim1>
966 Tensor_Dim0, Tensor_Dim1,
double, ublas::row_major,
972 const size_t nb_gauss_pts = data.
getN().size1();
973 if (type == zeroType) {
974 mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts,
false);
980 if (dataVec.use_count()) {
981 dotVector.resize(nb_dofs,
false);
983 CHKERR VecGetArrayRead(dataVec, &array);
985 for (
int i = 0;
i != local_indices.size(); ++
i)
986 if (local_indices[
i] != -1)
987 dotVector[
i] = array[local_indices[
i]];
990 CHKERR VecRestoreArrayRead(dataVec, &array);
995 const size_t nb_base_functions = data.
getN().size2();
997 auto values_at_gauss_pts =
998 getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1001 const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
1002 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1005 for (; bb != size; ++bb) {
1006 values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1010 for (; bb < nb_base_functions; ++bb)
1012 ++values_at_gauss_pts;
1015 if (dataVec.use_count()) {
1027template <
int Tensor_Dim0,
int Tensor_Dim1>
1030 Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1033 Tensor_Dim0, Tensor_Dim1,
double, ublas::row_major,
1042template <
int Tensor_Dim0,
int Tensor_Dim1>
1047 boost::shared_ptr<MatrixDouble> data_ptr,
1048 const EntityType zero_at_type = MBVERTEX)
1060 const size_t nb_gauss_pts =
getGaussPts().size2();
1063 mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts,
false);
1067 const size_t nb_dofs = local_indices.size();
1070 const double *array;
1072 for (
size_t i = 0;
i != local_indices.size(); ++
i)
1073 if (local_indices[
i] != -1)
1079 const size_t nb_base_functions = data.
getN().size2();
1082 auto values_at_gauss_pts =
1083 getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1086 const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
1087 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1089 getFTensor2FromPtr<Tensor_Dim0, Tensor_Dim1>(&*
dotVector.begin());
1091 for (; bb != size; ++bb) {
1092 values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1096 for (; bb < nb_base_functions; ++bb)
1098 ++values_at_gauss_pts;
1117template <
int Tensor_Dim>
1122 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1123 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
1132 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1134 const int zero_side = 0)
1149 mat.resize((Tensor_Dim * (Tensor_Dim + 1)) / 2, nb_gauss_pts,
false);
1158 const double *array;
1161 for (
int i = 0;
i != local_indices.size(); ++
i)
1162 if (local_indices[
i] != -1)
1170 const int nb_base_functions = data.
getN().size2();
1172 auto values_at_gauss_pts = getFTensor2SymmetricFromMat<Tensor_Dim>(mat);
1175 const int size = nb_dofs / ((Tensor_Dim * (Tensor_Dim + 1)) / 2);
1176 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1179 for (; bb != size; ++bb) {
1180 values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1184 for (; bb < nb_base_functions; ++bb)
1186 ++values_at_gauss_pts;
1211template <
int Tensor_Dim>
1216 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1217 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
1230 constexpr auto symm_size = (Tensor_Dim * (Tensor_Dim + 1)) / 2;
1232 mat.resize(symm_size, nb_gauss_pts,
false);
1236 const int nb_dofs = local_indices.size();
1244 <<
"In this case field degrees of freedom are read from vector. "
1245 "That usually happens when time solver is used, and acces to "
1246 "first rates is needed. You probably not set "
1247 "ts_u_t and associated data structure data_ctx to CTX_SET_X_T "
1254 const double *array;
1256 for (
int i = 0;
i != local_indices.size(); ++
i)
1257 if (local_indices[
i] != -1)
1263 const int nb_base_functions = data.
getN().size2();
1266 auto values_at_gauss_pts = getFTensor2SymmetricFromMat<Tensor_Dim>(mat);
1269 const int size = nb_dofs / symm_size;
1270 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1271 auto field_data = getFTensorDotData<Tensor_Dim>();
1273 for (; bb != size; ++bb) {
1274 values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1278 for (; bb < nb_base_functions; ++bb)
1280 ++values_at_gauss_pts;
1293 static_assert(Dim || !Dim,
"not implemented");
1302 &dotVector[0], &dotVector[1], &dotVector[2], &dotVector[3], &dotVector[4],
1311 &dotVector[0], &dotVector[1], &dotVector[2]);
1325template <
int Tensor_Dim,
class T,
class L,
class A>
1330 Tensor_Dim, T,
L,
A>::OpCalculateVectorFieldValues_General;
1337template <
int Tensor_Dim>
1341 Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
1344 Tensor_Dim,
double, ublas::row_major,
1363template <
int Tensor_Dim>
1365 Tensor_Dim,
double, ublas::row_major,
1370 const size_t nb_gauss_pts = this->getGaussPts().size2();
1371 auto &mat = *this->dataPtr;
1372 if (type == this->zeroType) {
1373 mat.resize(Tensor_Dim, nb_gauss_pts,
false);
1381 const int nb_base_functions = data.
getN().size2();
1383 auto gradients_at_gauss_pts = getFTensor1FromMat<Tensor_Dim>(mat);
1386 if (nb_dofs > nb_base_functions)
1388 "Number of base functions inconsistent with number of DOFs "
1390 nb_dofs, nb_base_functions);
1392 if (data.
getDiffN().size2() != nb_base_functions * Tensor_Dim)
1395 "Number of base functions inconsistent with number of derivatives "
1397 data.
getDiffN().size2(), nb_base_functions);
1399 if (data.
getDiffN().size1() != nb_gauss_pts)
1402 "Number of base functions inconsistent with number of integration "
1404 data.
getDiffN().size2(), nb_gauss_pts);
1409 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1412 for (; bb != nb_dofs; ++bb) {
1413 gradients_at_gauss_pts(
I) += field_data * diff_base_function(
I);
1415 ++diff_base_function;
1418 for (; bb < nb_base_functions; ++bb)
1419 ++diff_base_function;
1420 ++gradients_at_gauss_pts;
1433template <
int Tensor_Dim>
1436 Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
1438 Tensor_Dim,
double, ublas::row_major,
1446template <
int Tensor_Dim>
1449 Tensor_Dim, double, ublas::row_major, DoubleAllocator> {
1452 Tensor_Dim,
double, ublas::row_major,
1466template <
int Tensor_Dim>
1471 const size_t nb_gauss_pts = this->getGaussPts().size2();
1472 auto &mat = *this->dataPtr;
1473 if (type == this->zeroType) {
1474 mat.resize(Tensor_Dim * Tensor_Dim, nb_gauss_pts,
false);
1482 const int nb_base_functions = data.
getN().size2();
1484 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
1486 if (hessian_base.size1() != nb_gauss_pts) {
1488 "Wrong number of integration pts (%ld != %d)",
1489 hessian_base.size1(), nb_gauss_pts);
1491 if (hessian_base.size2() != nb_base_functions * Tensor_Dim * Tensor_Dim) {
1493 "Wrong number of base functions (%ld != %d)",
1494 hessian_base.size2() / (Tensor_Dim * Tensor_Dim),
1497 if (hessian_base.size2() < nb_dofs * Tensor_Dim * Tensor_Dim) {
1499 "Wrong number of base functions (%ld < %d)",
1500 hessian_base.size2(), nb_dofs * Tensor_Dim * Tensor_Dim);
1504 auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim, Tensor_Dim>(
1505 &*hessian_base.data().begin());
1507 auto hessian_at_gauss_pts =
1508 getFTensor2FromMat<Tensor_Dim, Tensor_Dim>(mat);
1512 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1515 for (; bb != nb_dofs; ++bb) {
1516 hessian_at_gauss_pts(
I,
J) +=
1517 field_data * t_diff2_base_function(
I,
J);
1519 ++t_diff2_base_function;
1522 for (; bb < nb_base_functions; ++bb) {
1523 ++t_diff2_base_function;
1526 ++hessian_at_gauss_pts;
1552template <
int Tensor_Dim0,
int Tensor_Dim1,
int S,
class T,
class L,
class A>
1558 Tensor_Dim0, Tensor_Dim1, T,
L,
A>::OpCalculateTensor2FieldValues_General;
1561template <
int Tensor_Dim0,
int Tensor_Dim1,
int S>
1565 Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1568 Tensor_Dim0, Tensor_Dim1,
double, ublas::row_major,
1587template <
int Tensor_Dim0,
int Tensor_Dim1,
int S>
1589 Tensor_Dim0, Tensor_Dim1, S,
double, ublas::row_major,
1595 "Data pointer not allocated");
1597 const size_t nb_gauss_pts = this->getGaussPts().size2();
1598 auto &mat = *this->dataPtr;
1599 if (type == this->zeroType) {
1600 mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts,
false);
1609 if (this->dataVec.use_count()) {
1610 this->dotVector.resize(nb_dofs,
false);
1611 const double *array;
1612 CHKERR VecGetArrayRead(this->dataVec, &array);
1614 for (
int i = 0;
i != local_indices.size(); ++
i)
1615 if (local_indices[
i] != -1)
1616 this->dotVector[
i] = array[local_indices[
i]];
1618 this->dotVector[
i] = 0;
1619 CHKERR VecRestoreArrayRead(this->dataVec, &array);
1623 const int nb_base_functions = data.
getN().size2();
1625 auto gradients_at_gauss_pts =
1626 getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1629 int size = nb_dofs / Tensor_Dim0;
1630 if (nb_dofs % Tensor_Dim0) {
1632 "Data inconsistency");
1634 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1635 auto field_data = getFTensor1FromPtr<Tensor_Dim0, S>(
1639 if (field_data.l2() != field_data.l2()) {
1640 MOFEM_LOG(
"SELF", Sev::error) <<
"field data " << field_data;
1642 "Wrong number in coefficients");
1647 for (; bb < size; ++bb) {
1650 if (diff_base_function.l2() != diff_base_function.l2()) {
1652 <<
"diff_base_function: " << diff_base_function;
1654 "Wrong number number in base functions");
1659 gradients_at_gauss_pts(
I,
J) += field_data(
I) * diff_base_function(
J);
1661 ++diff_base_function;
1665 for (; bb != nb_base_functions; ++bb)
1666 ++diff_base_function;
1667 ++gradients_at_gauss_pts;
1670 if (this->dataVec.use_count()) {
1687template <
int Tensor_Dim0,
int Tensor_Dim1,
int S = Tensor_Dim0>
1690 double, ublas::row_major,
1694 Tensor_Dim0, Tensor_Dim1, S,
double, ublas::row_major,
1703template <
int Tensor_Dim0,
int Tensor_Dim1>
1708 boost::shared_ptr<MatrixDouble> data_ptr,
1709 const EntityType zero_at_type = MBVERTEX)
1722 const int nb_dofs = local_indices.size();
1723 const int nb_gauss_pts = this->
getGaussPts().size2();
1727 mat.resize(Tensor_Dim0 * Tensor_Dim1, nb_gauss_pts,
false);
1734 const double *array;
1736 for (
int i = 0;
i != local_indices.size(); ++
i)
1737 if (local_indices[
i] != -1)
1743 const int nb_base_functions = data.
getN().size2();
1745 auto gradients_at_gauss_pts =
1746 getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1749 int size = nb_dofs / Tensor_Dim0;
1750 if (nb_dofs % Tensor_Dim0) {
1754 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1755 auto field_data = getFTensor1FromPtr<Tensor_Dim0>(&*
dotVector.begin());
1757 for (; bb < size; ++bb) {
1758 gradients_at_gauss_pts(
I,
J) += field_data(
I) * diff_base_function(
J);
1760 ++diff_base_function;
1764 for (; bb != nb_base_functions; ++bb)
1765 ++diff_base_function;
1766 ++gradients_at_gauss_pts;
1782template <
int Tensor_Dim0,
int Tensor_Dim1,
class T,
class L,
class A>
1788 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1789 const EntityType zero_type = MBVERTEX)
1795template <
int Tensor_Dim0,
int Tensor_Dim1>
1799 Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1802 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1803 const EntityType zero_type = MBVERTEX)
1825template <
int Tensor_Dim0,
int Tensor_Dim1>
1827 Tensor_Dim0, Tensor_Dim1,
double, ublas::row_major,
1833 "Data pointer not allocated");
1835 const size_t nb_gauss_pts = this->getGaussPts().size2();
1836 constexpr size_t msize = (Tensor_Dim0 * (Tensor_Dim0 + 1)) / 2;
1837 auto &mat = *this->dataPtr;
1838 if (type == this->zeroType) {
1839 mat.resize(msize * Tensor_Dim1, nb_gauss_pts,
false);
1848 const int nb_base_functions = data.
getN().size2();
1850 auto gradients_at_gauss_pts =
1851 getFTensor3DgFromMat<Tensor_Dim0, Tensor_Dim1>(mat);
1855 int size = nb_dofs / msize;
1856 if (nb_dofs % msize) {
1858 "Data inconsistency");
1860 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1863 for (; bb < size; ++bb) {
1864 gradients_at_gauss_pts(
I,
J,
K) +=
1865 field_data(
I,
J) * diff_base_function(
K);
1867 ++diff_base_function;
1871 for (; bb != nb_base_functions; ++bb)
1872 ++diff_base_function;
1873 ++gradients_at_gauss_pts;
1885template <
int Tensor_Dim0,
int Tensor_Dim1>
1888 Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1891 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1892 const EntityType zero_type = MBVERTEX)
1894 Tensor_Dim0, Tensor_Dim1,
double, ublas::row_major,
1898template <
int Tensor_Dim0,
int Tensor_Dim1>
1901 Tensor_Dim0, Tensor_Dim1, double, ublas::row_major, DoubleAllocator> {
1904 Tensor_Dim0, Tensor_Dim1,
double, ublas::row_major,
1923template <
int Tensor_Dim0,
int Tensor_Dim1>
1929 "Data pointer not allocated");
1931 const size_t nb_gauss_pts = this->getGaussPts().size2();
1932 auto &mat = *this->dataPtr;
1933 if (type == this->zeroType) {
1934 mat.resize(Tensor_Dim0 * Tensor_Dim1 * Tensor_Dim1, nb_gauss_pts,
false);
1943 if (this->dataVec.use_count()) {
1944 this->dotVector.resize(nb_dofs,
false);
1945 const double *array;
1946 CHKERR VecGetArrayRead(this->dataVec, &array);
1948 for (
int i = 0;
i != local_indices.size(); ++
i)
1949 if (local_indices[
i] != -1)
1950 this->dotVector[
i] = array[local_indices[
i]];
1952 this->dotVector[
i] = 0;
1953 CHKERR VecRestoreArrayRead(this->dataVec, &array);
1957 const int nb_base_functions = data.
getN().size2();
1959 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
1961 if (hessian_base.size1() != nb_gauss_pts) {
1963 "Wrong number of integration pts (%d != %d)",
1964 hessian_base.size1(), nb_gauss_pts);
1966 if (hessian_base.size2() !=
1967 nb_base_functions * Tensor_Dim1 * Tensor_Dim1) {
1969 "Wrong number of base functions (%d != %d)",
1970 hessian_base.size2() / (Tensor_Dim1 * Tensor_Dim1),
1973 if (hessian_base.size2() < nb_dofs * Tensor_Dim1 * Tensor_Dim1) {
1975 "Wrong number of base functions (%d < %d)",
1976 hessian_base.size2(), nb_dofs * Tensor_Dim1 * Tensor_Dim1);
1980 auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim1, Tensor_Dim1>(
1981 &*hessian_base.data().begin());
1983 auto t_hessian_at_gauss_pts =
1984 getFTensor3FromMat<Tensor_Dim0, Tensor_Dim1, Tensor_Dim1>(mat);
1990 int size = nb_dofs / Tensor_Dim0;
1992 if (nb_dofs % Tensor_Dim0) {
1994 "Data inconsistency");
1998 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
2001 for (; bb < size; ++bb) {
2002 t_hessian_at_gauss_pts(
I,
J,
K) +=
2003 field_data(
I) * t_diff2_base_function(
J,
K);
2005 ++t_diff2_base_function;
2009 for (; bb != nb_base_functions; ++bb)
2010 ++t_diff2_base_function;
2011 ++t_hessian_at_gauss_pts;
2014 if (this->dataVec.use_count()) {
2036template <
int DIM_01,
int DIM_23,
int S = 0>
2048 boost::shared_ptr<MatrixDouble> in_mat,
2049 boost::shared_ptr<MatrixDouble> out_mat,
2050 boost::shared_ptr<MatrixDouble> d_mat)
2063 boost::shared_ptr<MatrixDouble> out_mat,
2064 boost::shared_ptr<MatrixDouble> d_mat)
2077 const size_t nb_gauss_pts =
getGaussPts().size2();
2078 auto t_D = getFTensor4DdgFromMat<DIM_01, DIM_23, S>(*(
dMat));
2079 auto t_in = getFTensor2SymmetricFromMat<DIM_01>(*(
inMat));
2080 outMat->resize((DIM_23 * (DIM_23 + 1)) / 2, nb_gauss_pts,
false);
2081 auto t_out = getFTensor2SymmetricFromMat<DIM_23>(*(
outMat));
2082 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2083 t_out(
i,
j) = t_D(
i,
j,
k,
l) * t_in(
k,
l);
2098 boost::shared_ptr<MatrixDouble>
dMat;
2121 boost::shared_ptr<MatrixDouble> in_mat,
2122 boost::shared_ptr<MatrixDouble> out_mat)
2139 boost::shared_ptr<MatrixDouble> out_mat)
2150 const size_t nb_gauss_pts =
getGaussPts().size2();
2151 auto t_in = getFTensor2FromMat<DIM, DIM>(*(
inMat));
2152 outMat->resize((DIM * (DIM + 1)) / 2, nb_gauss_pts,
false);
2153 auto t_out = getFTensor2SymmetricFromMat<DIM>(*(
outMat));
2154 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2155 t_out(
i,
j) = (t_in(
i,
j) || t_in(
j,
i)) / 2;
2186 boost::shared_ptr<MatrixDouble> in_mat,
2187 boost::shared_ptr<MatrixDouble> out_mat)
2206 boost::shared_ptr<MatrixDouble> in_mat,
2207 boost::shared_ptr<MatrixDouble> out_mat)
2221 noalias(*
outMat) = (*scalePtr) * (*inMat);
2240template <
int Base_Dim,
int Field_Dim,
class T,
class L,
class A>
2246template <
int Field_Dim>
2252 boost::shared_ptr<MatrixDouble> data_ptr,
2254 const EntityType zero_type = MBEDGE,
2255 const int zero_side = 0)
2258 dataPtr(data_ptr), dataVec(data_vec), zeroType(zero_type),
2259 zeroSide(zero_side) {
2265 boost::shared_ptr<MatrixDouble> data_ptr,
2266 const EntityType zero_type = MBEDGE,
2267 const int zero_side = 0)
2289template <
int Field_Dim>
2291 3, Field_Dim,
double, ublas::row_major,
2295 const size_t nb_integration_points = this->getGaussPts().size2();
2296 if (type == zeroType && side == zeroSide) {
2297 dataPtr->resize(Field_Dim, nb_integration_points,
false);
2304 if (dataVec.use_count()) {
2305 dotVector.resize(nb_dofs,
false);
2306 const double *array;
2307 CHKERR VecGetArrayRead(dataVec, &array);
2309 for (
int i = 0;
i != local_indices.size(); ++
i)
2310 if (local_indices[
i] != -1)
2311 dotVector[
i] = array[local_indices[
i]];
2314 CHKERR VecRestoreArrayRead(dataVec, &array);
2318 const size_t nb_base_functions = data.
getN().size2() / 3;
2321 auto t_data = getFTensor1FromMat<Field_Dim>(*dataPtr);
2322 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2325 for (; bb != nb_dofs; ++bb) {
2326 t_data(
i) += t_n_hdiv(
i) * t_dof;
2330 for (; bb != nb_base_functions; ++bb)
2335 if (dataVec.use_count()) {
2345template <
int Base_Dim,
int Field_Dim = Base_Dim>
2348 Base_Dim, Field_Dim, double, ublas::row_major, DoubleAllocator> {
2350 Base_Dim, Field_Dim,
double, ublas::row_major,
2357template <
int Base_Dim,
int Field_Dim = Base_Dim>
2360template <
int Field_Dim>
2365 boost::shared_ptr<MatrixDouble> data_ptr,
2366 const EntityType zero_type = MBEDGE,
2367 const int zero_side = 0)
2370 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2391template <
int Field_Dim>
2396 const size_t nb_integration_points = this->getGaussPts().size2();
2397 if (type == zeroType && side == zeroSide) {
2398 dataPtr->resize(Field_Dim, nb_integration_points,
false);
2403 const size_t nb_dofs = local_indices.size();
2406 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2407 const double *array;
2408 CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
2409 for (
size_t i = 0;
i != nb_dofs; ++
i)
2410 if (local_indices[
i] != -1)
2411 dot_dofs_vector[
i] = array[local_indices[
i]];
2413 dot_dofs_vector[
i] = 0;
2414 CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
2416 const size_t nb_base_functions = data.
getN().size2() / 3;
2419 auto t_data = getFTensor1FromMat<Field_Dim>(*dataPtr);
2420 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2422 for (; bb != nb_dofs; ++bb) {
2423 t_data(
i) += t_n_hdiv(
i) * dot_dofs_vector[bb];
2426 for (; bb != nb_base_functions; ++bb)
2442template <
int BASE_DIM,
int SPACE_DIM>
2447 boost::shared_ptr<VectorDouble> data_ptr,
2448 const EntityType zero_type = MBEDGE,
2449 const int zero_side = 0)
2460 const size_t nb_integration_points =
getGaussPts().size2();
2462 dataPtr->resize(nb_integration_points,
false);
2468 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2473 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2476 for (; bb != nb_dofs; ++bb) {
2477 t_data += t_dof * t_n_diff_hdiv(
j,
j);
2481 for (; bb != nb_base_functions; ++bb)
2501template <
int BASE_DIM,
int SPACE_DIM>
2506 boost::shared_ptr<MatrixDouble> data_ptr,
2507 const EntityType zero_type = MBEDGE,
2508 const int zero_side = 0)
2519 const size_t nb_integration_points =
getGaussPts().size2();
2527 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2531 auto t_data = getFTensor2FromMat<BASE_DIM, SPACE_DIM>(*
dataPtr);
2532 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2535 for (; bb != nb_dofs; ++bb) {
2536 t_data(
i,
j) += t_dof * t_base_diff(
i,
j);
2540 for (; bb != nb_base_functions; ++bb)
2561template <
int BASE_DIM,
int FIELD_DIM,
int SPACE_DIM>
2574 boost::shared_ptr<MatrixDouble> data_ptr,
2575 const EntityType zero_type = MBEDGE,
2576 const int zero_side = 0)
2579 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2588 const size_t nb_integration_points = getGaussPts().size2();
2589 if (type == zeroType && side == zeroSide) {
2590 dataPtr->resize(27, nb_integration_points,
2599 "Data inconsistency, nb_dofs %% COEFF_DIM != 0, that is %ld %% %d "
2609 const size_t nb_base_functions = data.
getN().size2() / 3;
2615 auto t_data = getFTensor3FromMat<3, 3, 3>(*dataPtr);
2616 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2619 for (; bb != nb_dofs; ++bb) {
2620 t_data(
k,
i,
j) += t_base_diff(
i,
j) * t_dof(
k);
2624 for (; bb != nb_base_functions; ++bb)
2642 boost::shared_ptr<MatrixDouble> data_ptr,
2643 const EntityType zero_type = MBEDGE,
2644 const int zero_side = 0)
2647 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2656 const size_t nb_integration_points = getGaussPts().size2();
2657 if (type == zeroType && side == zeroSide) {
2658 dataPtr->resize(27, nb_integration_points,
false);
2666 const size_t nb_base_functions = data.
getN().size2() / 9;
2669 if (data.
getDiffN().size1() != nb_integration_points) {
2671 "Wrong number of integration pts (%ld != %ld)",
2672 data.
getDiffN().size1(), nb_integration_points);
2674 if (data.
getDiffN().size2() != nb_base_functions * 27) {
2676 "Wrong number of base functions (%ld != %ld)",
2677 data.
getDiffN().size2() / 27, nb_base_functions);
2679 if (nb_base_functions < nb_dofs) {
2681 "Wrong number of base functions (%ld < %ld)", nb_base_functions,
2691 auto t_data = getFTensor3FromMat<3, 3, 3>(*dataPtr);
2692 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2695 for (; bb != nb_dofs; ++bb) {
2696 t_data(
k,
i,
j) += t_base_diff(
k,
i,
j) * t_dof;
2700 for (; bb != nb_base_functions; ++bb)
2722template <
int BASE_DIM,
int SPACE_DIM>
2727 boost::shared_ptr<MatrixDouble> data_ptr,
2728 const EntityType zero_type = MBEDGE,
2729 const int zero_side = 0)
2740 const size_t nb_integration_points =
getGaussPts().size2();
2750 const int nb_base_functions = data.
getN().size2() /
BASE_DIM;
2753 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
2754 if (hessian_base.size1() != nb_integration_points) {
2756 "Wrong number of integration pts (%d != %d)",
2757 hessian_base.size1(), nb_integration_points);
2759 if (hessian_base.size2() !=
2762 "Wrong number of base functions (%d != %d)",
2768 "Wrong number of base functions (%d < %d)", hessian_base.size2(),
2779 auto t_data = getFTensor3FromMat<BASE_DIM, SPACE_DIM, SPACE_DIM>(*
dataPtr);
2780 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2783 for (; bb != nb_dofs; ++bb) {
2784 t_data(
i,
j,
k) += t_dof * t_base_diff2(
i,
j,
k);
2789 for (; bb != nb_base_functions; ++bb)
2808template <
int Tensor_Dim1,
int Tensor_Dim2>
2813 boost::shared_ptr<VectorDouble> data_ptr,
2814 const EntityType zero_type = MBEDGE,
2815 const int zero_side = 0)
2826 const size_t nb_integration_points =
getGaussPts().size2();
2828 dataPtr->resize(nb_integration_points,
false);
2833 const int nb_dofs = local_indices.size();
2836 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2837 const double *array;
2839 for (
size_t i = 0;
i != local_indices.size(); ++
i)
2840 if (local_indices[
i] != -1)
2841 dot_dofs_vector[
i] = array[local_indices[
i]];
2843 dot_dofs_vector[
i] = 0;
2846 const size_t nb_base_functions = data.
getN().size2() / Tensor_Dim1;
2850 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2852 for (; bb != nb_dofs; ++bb) {
2854 for (
auto ii = 0; ii != Tensor_Dim2; ++ii)
2855 div += t_n_diff_hdiv(ii, ii);
2856 t_data += dot_dofs_vector[bb] * div;
2859 for (; bb != nb_base_functions; ++bb)
2895 boost::shared_ptr<MatrixDouble> data_ptr,
2896 const EntityType zero_type = MBEDGE,
2897 const int zero_side = 0);
2919 boost::shared_ptr<MatrixDouble> data_ptr,
2920 const EntityType zero_type = MBVERTEX,
2921 const int zero_side = 0);
2944 boost::shared_ptr<MatrixDouble> data_ptr,
2945 const EntityType zero_type = MBVERTEX,
2946 const int zero_side = 0);
2964template <
int Tensor_Dim0,
int Tensor_Dim1>
2969 boost::shared_ptr<MatrixDouble> data_ptr,
2970 boost::shared_ptr<double> scale_ptr,
2972 const EntityType zero_type = MBEDGE,
2973 const int zero_side = 0)
2983 boost::shared_ptr<MatrixDouble> data_ptr,
2984 const EntityType zero_type = MBEDGE,
2985 const int zero_side = 0)
2993 const size_t nb_integration_points =
getGaussPts().size2();
2995 dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points,
false);
3003 const double *array;
3006 for (
int i = 0;
i != local_indices.size(); ++
i)
3007 if (local_indices[
i] != -1)
3016 const size_t nb_base_functions = data.
getN().size2() / 3;
3020 auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*
dataPtr);
3021 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3024 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3025 t_data(
i,
j) += (
scale * t_dof(
i)) * t_n_hvec(
j);
3029 for (; bb < nb_base_functions; ++bb)
3055template <
int Tensor_Dim0,
int Tensor_Dim1>
3062 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3064 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3065 boost::shared_ptr<double> scale_ptr =
nullptr,
3066 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3094template <
int Tensor_Dim0,
int Tensor_Dim1>
3099 const size_t nb_integration_points = OP::getGaussPts().size2();
3100 if (type == zeroType) {
3101 dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points,
false);
3108 if (dataVec.use_count()) {
3109 dotVector.resize(nb_dofs,
false);
3110 const double *array;
3111 CHKERR VecGetArrayRead(dataVec, &array);
3113 for (
int i = 0;
i != local_indices.size(); ++
i)
3114 if (local_indices[
i] != -1)
3115 dotVector[
i] = array[local_indices[
i]];
3118 CHKERR VecRestoreArrayRead(dataVec, &array);
3129 auto get_get_side_face_dofs = [&]() {
3130 auto fe_type = OP::getFEType();
3134 std::vector<int> side_face_dofs;
3135 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3139 auto it = side_dof_map.get<1>().begin();
3140 it != side_dof_map.get<1>().end(); ++it
3143 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3146 if (it->type == brokenType) {
3147 if (brokenRangePtr) {
3148 auto ent = OP::getSideEntity(it->side, brokenType);
3149 if (brokenRangePtr->find(ent) != brokenRangePtr->end()) {
3150 side_face_dofs.push_back(it->dof);
3153 side_face_dofs.push_back(it->dof);
3158 return side_face_dofs;
3161 auto side_face_dofs = get_get_side_face_dofs();
3165 auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*dataPtr);
3166 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3167 for (
auto b : side_face_dofs) {
3169 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(data.
getFieldData().data() +
3171 t_data(
i,
j) += t_dof(
i) * t_row_base(
j);
3175 *dataPtr *= (scalePtr) ? *scalePtr : 1.0;
3177 if (dataVec.use_count()) {
3191template <
int Tensor_Dim0,
int Tensor_Dim1>
3196 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3197 boost::shared_ptr<double> scale_ptr,
3199 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3209 boost::shared_ptr<MatrixDouble> data_ptr,
3210 const EntityType zero_type = MBEDGE,
3211 const int zero_side = 0)
3219 const size_t nb_integration_points =
getGaussPts().size2();
3221 dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points,
false);
3230 const double *array;
3233 for (
int i = 0;
i != local_indices.size(); ++
i)
3234 if (local_indices[
i] != -1)
3243 const size_t nb_base_functions =
3244 data.
getN().size2() / (Tensor_Dim0 * Tensor_Dim1);
3247 auto t_n_hten = data.
getFTensor2N<Tensor_Dim0, Tensor_Dim1>();
3248 auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*
dataPtr);
3249 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3252 for (; bb != nb_dofs; ++bb) {
3253 t_data(
i,
j) += (
scale * t_dof) * t_n_hten(
i,
j);
3257 for (; bb < nb_base_functions; ++bb)
3285template <
int Tensor_Dim0,
int Tensor_Dim1,
3291 boost::shared_ptr<MatrixDouble> data_ptr,
3293 const EntityType zero_type = MBEDGE,
3294 const int zero_side = 0)
3304 boost::shared_ptr<MatrixDouble> data_ptr,
3305 const EntityType zero_type = MBEDGE,
3306 const int zero_side = 0)
3313 const size_t nb_integration_points =
getGaussPts().size2();
3315 dataPtr->resize(Tensor_Dim0, nb_integration_points,
false);
3323 const double *array;
3326 for (
int i = 0;
i != local_indices.size(); ++
i)
3327 if (local_indices[
i] != -1)
3335 const size_t nb_base_functions = data.
getN().size2() / 3;
3339 auto t_data = getFTensor1FromMat<Tensor_Dim0>(*
dataPtr);
3342 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3345 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3346 double div = t_n_diff_hvec(
j,
j);
3347 t_data(
i) += t_dof(
i) * div;
3349 t_data(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3355 for (; bb < nb_base_functions; ++bb) {
3388template <
int Tensor_Dim0,
int Tensor_Dim1,
3396 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3398 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3399 boost::shared_ptr<double> scale_ptr =
nullptr,
3400 const EntityType zero_type = MBEDGE)
3412 const size_t nb_integration_points =
getGaussPts().size2();
3413 if (type ==
zeroType && side == 0) {
3414 dataPtr->resize(Tensor_Dim0, nb_integration_points,
false);
3423 const double *array;
3426 for (
int i = 0;
i != local_indices.size(); ++
i)
3427 if (local_indices[
i] != -1)
3442 auto get_get_side_face_dofs = [&]() {
3447 std::vector<int> side_face_dofs;
3448 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3452 auto it = side_dof_map.get<1>().begin();
3453 it != side_dof_map.get<1>().end(); ++it
3456 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3463 side_face_dofs.push_back(it->dof);
3466 side_face_dofs.push_back(it->dof);
3471 return side_face_dofs;
3474 auto side_face_dofs = get_get_side_face_dofs();
3478 auto t_data = getFTensor1FromMat<Tensor_Dim0>(*
dataPtr);
3480 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3481 for (
auto b : side_face_dofs) {
3482 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(
3486 double div = t_diff_base(
j,
j);
3487 t_data(
i) += t_dof(
i) * div;
3489 t_data(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3520template <
int Tensor_Dim,
typename OpBase>
3524 boost::shared_ptr<MatrixDouble> data_ptr,
3525 boost::shared_ptr<double> scale_ptr,
3526 const EntityType zero_type = MBEDGE,
3527 const int zero_side = 0)
3535 boost::shared_ptr<MatrixDouble> data_ptr,
3536 const EntityType zero_type = MBEDGE,
3537 const int zero_side = 0)
3544 const size_t nb_integration_points = OpBase::getGaussPts().size2();
3545 if (type ==
zeroType && side == 0) {
3546 dataPtr->resize(Tensor_Dim, nb_integration_points,
false);
3552 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
3553 const size_t nb_base_functions = data.
getN().size2() / 3;
3555 auto t_data = getFTensor1FromMat<Tensor_Dim>(*
dataPtr);
3556 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3558 t_normalized_normal(
j) = t_normal(
j);
3562 for (; bb != nb_dofs / Tensor_Dim; ++bb) {
3564 (scale_val * t_dof(
i)) * (t_base(
j) * t_normalized_normal(
j));
3568 for (; bb < nb_base_functions; ++bb) {
3611 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3625 template <
int D1,
int D2,
int J1,
int J2>
3629 static_assert(D2 == J2,
"Dimension of jacobian and dimension of <out> "
3630 "directive does not match");
3632 size_t nb_functions = diff_n.size2() / D1;
3634 size_t nb_gauss_pts = diff_n.size1();
3639 "Wrong number of Gauss Pts");
3640 if (diff_n.size2() % D1)
3642 "Number of directives of base functions and D1 dimension does "
3646 diffNinvJac.resize(diff_n.size1(), D2 * nb_functions,
false);
3650 auto t_diff_n = getFTensor1FromPtr<D2>(&*
diffNinvJac.data().begin());
3651 auto t_diff_n_ref = getFTensor1FromPtr<D1>(&*diff_n.data().begin());
3652 auto t_inv_jac = getFTensor2FromMat<J1, J2>(*
invJacPtr);
3653 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg, ++t_inv_jac) {
3654 for (
size_t dd = 0; dd != nb_functions; ++dd) {
3655 t_diff_n(
i) = t_inv_jac(
k,
i) * t_diff_n_ref(
k);
3700template <
int DERIVARIVE = 1>
3707template <
int DERIVARIVE = 1>
3714template <
int DERIVARIVE = 1>
3718 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3722template <
int DERIVARIVE = 1>
3726 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3744 invJacPtr(inv_jac_ptr) {}
3798 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3835 boost::shared_ptr<MatrixDouble> jac_ptr)
3852 2>::OpSetContravariantPiolaTransformOnFace2DImpl;
4052 boost::shared_ptr<VectorDouble> det_ptr,
4053 boost::shared_ptr<MatrixDouble> out_ptr)
4073 "Pointer for inPtr matrix not allocated");
4076 "Pointer for detPtr matrix not allocated");
4078 const auto nb_rows = inPtr->size1();
4079 const auto nb_integration_pts = inPtr->size2();
4083 detPtr->resize(nb_integration_pts,
false);
4084 auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
4086 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4095 outPtr->resize(nb_rows, nb_integration_pts,
false);
4096 auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
4097 auto t_out = getFTensor2FromMat<DIM, DIM>(*outPtr);
4099 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4134 boost::shared_ptr<VectorDouble> out_ptr)
4155 "Pointer for inPtr matrix not allocated");
4157 const auto nb_integration_pts = inPtr->size2();
4160 outPtr->resize(nb_integration_pts,
false);
4161 auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
4164 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4187 boost::shared_ptr<VectorDouble> out_ptr)
4208 "Pointer for inPtr matrix not allocated");
4210 const auto nb_integration_pts = inPtr->size2();
4213 outPtr->resize(nb_integration_pts,
false);
4214 auto t_in = getFTensor2SymmetricFromMat<DIM>(*inPtr);
4217 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
Tensor1< T, Tensor_Dim > normalize()
static const char *const CoordinateTypesNames[]
Coordinate system names.
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FieldSpace
approximation spaces
@ L2
field with C-1 continuity
@ HCURL
field with continuous tangents
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_DATA_INCONSISTENCY
CoordinateTypes
Coodinate system.
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'J', DIM1 > J
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
VecAllocator< double > DoubleAllocator
implementation of Data Operators for Forces and Sources
static MoFEMErrorCode invertTensor(FTensor::Tensor2< T1, DIM, DIM > &t, T2 &det, FTensor::Tensor2< T3, DIM, DIM > &inv_t)
static auto determinantTensor(FTensor::Tensor2< T, DIM, DIM > &t)
Calculate the determinant of a tensor of rank DIM.
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
constexpr IntegrationType I
constexpr auto field_name
multi_index_container< DofsSideMapData, indexed_by< ordered_non_unique< tag< TypeSide_mi_tag >, composite_key< DofsSideMapData, member< DofsSideMapData, EntityType, &DofsSideMapData::type >, member< DofsSideMapData, int, &DofsSideMapData::side > > >, ordered_unique< tag< EntDofIdx_mi_tag >, member< DofsSideMapData, int, &DofsSideMapData::dof > > > > DofsSideMap
Map entity stype and side to element/entity dof index.
std::array< bool, MBMAXTYPE > doEntities
If true operator is executed for entity.
default operator for EDGE element
Data on single entity (This is passed as argument to DataOperator::doWork)
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2DiffN(FieldApproximationBase base)
Get derivatives of base functions for Hdiv space.
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0N(const FieldApproximationBase base)
Get base function as Tensor0.
MatrixDouble & getDiffN(const FieldApproximationBase base)
get derivatives of base functions
const VectorFieldEntities & getFieldEntities() const
Get field entities (const version)
MatrixDouble & getN(const FieldApproximationBase base)
get base functions this return matrix (nb. of rows is equal to nb. of Gauss pts, nb....
const VectorDouble & getFieldData() const
Get DOF values on entity.
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.
const VectorInt & getLocalIndices() const
Get local indices of degrees of freedom on entity.
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1FieldData()
Return FTensor of rank 1, i.e. vector from field data coefficients.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FieldData()
Return scalar files as a FTensor of rank 0.
FTensor::Tensor1< FTensor::PackPtr< double *, Tensor_Dim >, Tensor_Dim > getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
FTensor::Tensor2_symmetric< FTensor::PackPtr< double *,(Tensor_Dim *(Tensor_Dim+1))/2 >, Tensor_Dim > getFTensor2SymmetricFieldData()
Return symmetric FTensor rank 2, i.e. matrix from field data coefficients.
FTensor::Tensor2< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 >, Tensor_Dim0, Tensor_Dim1 > getFTensor2FieldData()
Return FTensor rank 2, i.e. matrix from field data coefficients.
const VectorInt & getIndices() const
Get global indices of degrees of freedom on entity.
FTensor::Tensor3< FTensor::PackPtr< double *, Tensor_Dim0 *Tensor_Dim1 *Tensor_Dim2 >, Tensor_Dim0, Tensor_Dim1, Tensor_Dim2 > getFTensor3DiffN(FieldApproximationBase base)
Get derivatives of base functions for tonsorial Hdiv space.
default operator for TRI element
default operator for Flat Prism element
default operator for Flat Prism element
FlatPrism finite element.
EntityType getFEType() const
Get dimension of finite element.
auto getFTensor1CoordsAtGaussPts()
Get coordinates at integration points assuming linear geometry.
EntityHandle getSideEntity(const int side_number, const EntityType type)
Get the side entity.
@ OPROW
operator doWork function is executed on FE rows
@ OPSPACE
operator do Work is execute on space data
const FEMethod * getFEMethod() const
Return raw pointer to Finite Element Method object.
MatrixDouble & getGaussPts()
matrix of integration (Gauss) points for Volume Element
structure to get information from mofem into EntitiesFieldData
Calculate divergence of tonsorial field using vectorial base.
boost::shared_ptr< double > scalePtr
boost::shared_ptr< Range > brokenRangePtr
SmartPetscObj< Vec > dataVec
OpCalculateBrokenHVecTensorDivergence(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, EntityType broken_type, boost::shared_ptr< Range > broken_range_ptr=nullptr, boost::shared_ptr< double > scale_ptr=nullptr, const EntityType zero_type=MBEDGE)
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
const EntityHandle zeroType
Get tensor field for H-div approximation.
boost::shared_ptr< MatrixDouble > dataPtr
boost::shared_ptr< Range > brokenRangePtr
boost::shared_ptr< double > scalePtr
OpCalculateBrokenHVecTensorField(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, EntityType broken_type, boost::shared_ptr< Range > broken_range_ptr=nullptr, boost::shared_ptr< double > scale_ptr=nullptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Calculate values of vector field at integration points.
const EntityHandle zeroType
SmartPetscObj< Vec > dataVec
Calculate divergence of vector field at integration points.
boost::shared_ptr< VectorDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpCalculateDivergenceVectorFieldValues(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Constructor for vector field divergence calculation operator.
const EntityHandle zeroType
Calculate tenor field using tensor base, i.e. Hdiv/Hcurl.
VectorDouble dotVector
Keeps temporary values of time derivatives.
OpCalculateHTensorTensorField(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, boost::shared_ptr< double > scale_ptr, SmartPetscObj< Vec > data_vec=SmartPetscObj< Vec >(), const EntityType zero_type=MBEDGE, const int zero_side=0)
SmartPetscObj< Vec > dataVec
boost::shared_ptr< MatrixDouble > dataPtr
const EntityHandle zeroType
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpCalculateHTensorTensorField(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
boost::shared_ptr< double > scalePtr
Calculate divergence of tonsorial field using vectorial base.
boost::shared_ptr< MatrixDouble > dataPtr
SmartPetscObj< Vec > dataVec
VectorDouble dotVector
Keeps temporary values of time derivatives.
const EntityHandle zeroType
OpCalculateHVecTensorDivergence(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)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpCalculateHVecTensorDivergence(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Calculate tenor field using vectorial base, i.e. Hdiv/Hcurl.
OpCalculateHVecTensorField(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, boost::shared_ptr< double > scale_ptr, SmartPetscObj< Vec > data_vec=SmartPetscObj< Vec >(), const EntityType zero_type=MBEDGE, const int zero_side=0)
const EntityHandle zeroType
boost::shared_ptr< MatrixDouble > dataPtr
OpCalculateHVecTensorField(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
SmartPetscObj< Vec > dataVec
VectorDouble dotVector
Keeps temporary values of time derivatives.
boost::shared_ptr< double > scalePtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
const EntityHandle zeroType
OpCalculateHVecTensorGradient(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
const EntityHandle zeroType
OpCalculateHVecTensorGradient(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Calculate gradient of tensor field.
Calculate trace of vector (Hdiv/Hcurl) space.
const EntityHandle zeroType
boost::shared_ptr< MatrixDouble > dataPtr
boost::shared_ptr< double > scalePtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
OpCalculateHVecTensorTrace(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
FTensor::Index< 'j', Tensor_Dim > j
FTensor::Index< 'i', Tensor_Dim > i
OpCalculateHVecTensorTrace(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, boost::shared_ptr< double > scale_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
const EntityHandle zeroType
boost::shared_ptr< MatrixDouble > dataPtr
OpCalculateHVecVectorFieldDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Get vector field for H-div approximation.
OpCalculateHVecVectorField_General(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)
boost::shared_ptr< MatrixDouble > dataPtr
OpCalculateHVecVectorField_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
SmartPetscObj< Vec > dataVec
const EntityHandle zeroType
Get vector field for H-div approximation.
Get vector field for H-div approximation.
Calculate gradient of vector field.
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
const EntityHandle zeroType
OpCalculateHVecVectorGradient(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Calculate gradient of vector field.
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
const EntityHandle zeroType
OpCalculateHVecVectorHessian(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
boost::shared_ptr< MatrixDouble > dataPtr
const EntityHandle zeroType
const EntityHandle zeroType
boost::shared_ptr< MatrixDouble > dataPtr
boost::shared_ptr< MatrixDouble > dataPtr
const EntityHandle zeroType
Calculate curl of vector field.
Calculate divergence of vector field dot.
boost::shared_ptr< VectorDouble > dataPtr
OpCalculateHdivVectorDivergenceDot(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
const EntityHandle zeroType
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Calculate divergence of vector field.
boost::shared_ptr< VectorDouble > dataPtr
OpCalculateHdivVectorDivergence(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
const EntityHandle zeroType
Calculate inverse of jacobian for face element.
OpCalculateInvJacForFatPrism(MatrixDouble &inv_jac)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpCalculateInvJacForFatPrism(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
const boost::shared_ptr< MatrixDouble > invJacPtr
Calculate inverse of jacobian for face element.
OpCalculateInvJacForFlatPrism(MatrixDouble &inv_jac_f3)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Evaluate field gradient values for scalar field, i.e. gradient is tensor rank 1 (vector)
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
Evaluate field gradient values for scalar field, i.e. gradient is tensor rank 1 (vector),...
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate gradient values of scalar field at integration points
Calculate scalar field values from PETSc vector at integration points.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< VectorDouble > dataPtr
OpCalculateScalarFieldValuesFromPetscVecImpl(const std::string field_name, boost::shared_ptr< VectorDouble > data_ptr, const EntityType zero_at_type=MBVERTEX)
Constructor for PETSc vector-based scalar field calculation.
const EntityHandle zeroAtType
Scalar field values at integration points.
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)
Constructor with PETSc vector support.
boost::shared_ptr< ublas::vector< T, A > > dataPtr
SmartPetscObj< Vec > dataVec
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of scalar field at integration points
const EntityHandle zeroType
OpCalculateScalarFieldValues_General(const std::string field_name, boost::shared_ptr< ublas::vector< T, A > > data_ptr, const EntityType zero_type=MBVERTEX)
Constructor for scalar field values calculation operator.
Specialization for double precision scalar field values calculation.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of scalar field at integration points
Get time direvarive values at integration pts for tensor field rank 2, i.e. matrix field.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpCalculateTensor2FieldValuesDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_at_type=MBVERTEX)
EntityType zeroAtType
Zero values at Gauss point at this type.
VectorDouble dotVector
Keeps temporary values of time derivatives.
boost::shared_ptr< MatrixDouble > dataPtr
Data computed into this matrix.
SmartPetscObj< Vec > dataVec
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)
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< ublas::matrix< double, ublas::row_major, DoubleAllocator > > data_ptr, const EntityType zero_type=MBVERTEX)
boost::shared_ptr< ublas::matrix< double, ublas::row_major, DoubleAllocator > > dataPtr
const EntityHandle zeroType
Calculate field values for tenor field rank 2.
const EntityHandle zeroType
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< ublas::matrix< T, L, A > > data_ptr, const EntityType zero_type=MBVERTEX)
boost::shared_ptr< ublas::matrix< T, L, A > > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Get values at integration pts for tensor field rank 2, i.e. matrix field.
OpCalculateTensor2SymmetricFieldGradient_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Evaluate field gradient values for symmetric 2nd order tensor field, i.e. gradient is tensor rank 3.
OpCalculateTensor2SymmetricFieldGradient_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Get field gradients at integration pts for symmetric tensorial field rank 2.
OpCalculateTensor2SymmetricFieldGradient(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
Calculate symmetric tensor field rates ant integratio pts.
const EntityHandle zeroType
boost::shared_ptr< MatrixDouble > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpCalculateTensor2SymmetricFieldValuesDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
Calculate symmetric tensor field values at integration pts.
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)
OpCalculateTensor2SymmetricFieldValues(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
SmartPetscObj< Vec > dataVec
boost::shared_ptr< MatrixDouble > dataPtr
const EntityHandle zeroType
Operator for calculating the trace of matrices at integration points.
boost::shared_ptr< MatrixDouble > inPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
FTensor::Index< 'i', DIM > i
boost::shared_ptr< VectorDouble > outPtr
OpCalculateTraceFromMat(boost::shared_ptr< MatrixDouble > in_ptr, boost::shared_ptr< VectorDouble > out_ptr)
Constructor for matrix trace calculation operator.
Calculates the trace of an input matrix.
FTensor::Index< 'i', DIM > i
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< VectorDouble > outPtr
boost::shared_ptr< MatrixDouble > inPtr
OpCalculateTraceFromSymmMat(boost::shared_ptr< MatrixDouble > in_ptr, boost::shared_ptr< VectorDouble > out_ptr)
Get field gradients time derivative at integration pts for scalar field rank 0, i....
boost::shared_ptr< MatrixDouble > dataPtr
Data computed into this matrix.
OpCalculateVectorFieldGradientDot(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_at_type=MBVERTEX)
EntityType zeroAtType
Zero values at Gauss point at this type.
VectorDouble dotVector
Keeps temporary values of time derivatives.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Evaluate field gradient values for vector field, i.e. gradient is tensor rank 2.
Get field gradients at integration pts for scalar field rank 0, i.e. vector field.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector field at integration points
Approximate field values for given petsc vector.
boost::shared_ptr< MatrixDouble > dataPtr
OpCalculateVectorFieldValuesFromPetscVecImpl(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_at_type=MBVERTEX, bool throw_error=true)
const EntityHandle zeroAtType
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< MatrixDouble > dataPtr
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBVERTEX)
SmartPetscObj< Vec > dataVec
const EntityHandle zeroType
Calculate field values for tensor field rank 1, i.e. vector field.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector field at integration points
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< ublas::matrix< T, L, A > > data_ptr, const EntityType zero_type=MBVERTEX)
Constructor for vector field values calculation operator.
const EntityHandle zeroType
boost::shared_ptr< ublas::matrix< T, L, A > > dataPtr
Specialization for double precision vector field values calculation.
Operator for inverting matrices at integration points.
boost::shared_ptr< VectorDouble > detPtr
OpInvertMatrix(boost::shared_ptr< MatrixDouble > in_ptr, boost::shared_ptr< VectorDouble > det_ptr, boost::shared_ptr< MatrixDouble > out_ptr)
Constructor for matrix inversion operator.
boost::shared_ptr< MatrixDouble > outPtr
boost::shared_ptr< MatrixDouble > inPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Make Hdiv space from Hcurl space in 2d.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
Operator for fat prism element updating integration weights in the volume.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpMultiplyDeterminantOfJacobianAndWeightsForFatPrisms()
Operator for scaling matrix values by a scalar factor.
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< MatrixDouble > outMat
DEPRECATED OpScaleMatrix(const std::string field_name, const double scale, boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat)
boost::shared_ptr< double > scalePtr
OpScaleMatrix(boost::shared_ptr< double > scale_ptr, boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat)
Constructor for matrix scaling operator.
boost::shared_ptr< MatrixDouble > inMat
OpSetInvJacH1ForFaceEmbeddedIn3DSpace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
OpSetInvJacH1ForFace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Transform local reference derivatives of shape functions to global derivatives.
const boost::shared_ptr< MatrixDouble > invJacPtr
OpSetInvJacH1ForFatPrism(MatrixDouble &inv_jac)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpSetInvJacH1ForFatPrism(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Transform local reference derivatives of shape functions to global derivatives.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpSetInvJacH1ForFlatPrism(MatrixDouble &inv_jac_f3)
boost::shared_ptr< MatrixDouble > invJacPtr
MatrixDouble diffHcurlInvJac
OpSetInvJacHcurlFaceImpl(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Transform local reference derivatives of shape function to global derivatives for face.
OpSetInvJacL2ForFaceEmbeddedIn3DSpace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
OpSetInvJacL2ForFace(boost::shared_ptr< MatrixDouble > inv_jac_ptr)
Transform local reference derivatives of shape functions to global derivatives.
MoFEMErrorCode applyTransform(MatrixDouble &diff_n)
Apply transformation to the input matrix.
OpSetInvJacToScalarBasesBasic(FieldSpace space, boost::shared_ptr< MatrixDouble > inv_jac_ptr)
boost::shared_ptr< MatrixDouble > invJacPtr
Operator for symmetrizing tensor fields.
FTensor::Index< 'i', DIM > i
boost::shared_ptr< MatrixDouble > outMat
OpSymmetrizeTensor(boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat)
Constructor for tensor symmetrization operator.
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Operator for linear form, usually to calculate values on right hand side.
FTensor::Index< 'j', DIM > j
DEPRECATED OpSymmetrizeTensor(const std::string field_name, boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat)
boost::shared_ptr< MatrixDouble > inMat
FTensor::Index< 'i', DIM_01 > i
MoFEMErrorCode doWork(int side, EntityType type, EntData &data)
Operator for linear form, usually to calculate values on right hand side.
FTensor::Index< 'k', DIM_23 > k
boost::shared_ptr< MatrixDouble > dMat
OpTensorTimesSymmetricTensor(boost::shared_ptr< MatrixDouble > in_mat, boost::shared_ptr< MatrixDouble > out_mat, boost::shared_ptr< MatrixDouble > d_mat)
FTensor::Index< 'j', DIM_01 > j
boost::shared_ptr< MatrixDouble > inMat
FTensor::Index< 'l', DIM_23 > l
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)
boost::shared_ptr< MatrixDouble > outMat
static constexpr Switches CtxSetX
Solution vector switch.
static constexpr Switches CtxSetX_TT
Second time derivative switch.
std::bitset< 8 > Switches
Bitset type for context switches.
static constexpr Switches CtxSetX_T
First time derivative switch.
@ CTX_SET_X_T
Time derivative X_t is set.
@ CTX_SET_DX
Solution increment DX is set.
@ CTX_SET_X
Solution vector X is set.
@ CTX_SET_X_TT
Second time derivative X_tt is set.
intrusive_ptr for managing petsc objects