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 (%ld != %ld)",
1964 static_cast<long>(hessian_base.size1()),
1965 static_cast<long>(nb_gauss_pts));
1967 if (hessian_base.size2() !=
1968 nb_base_functions * Tensor_Dim1 * Tensor_Dim1) {
1970 "Wrong number of base functions (%ld != %ld)",
1971 static_cast<long>(hessian_base.size2() /
1972 (Tensor_Dim1 * Tensor_Dim1)),
1973 static_cast<long>(nb_base_functions));
1975 if (hessian_base.size2() <
1976 (nb_dofs / Tensor_Dim0) * Tensor_Dim1 * Tensor_Dim1) {
1978 "Wrong number of base functions (%ld < %ld)",
1979 static_cast<long>(hessian_base.size2()),
1980 static_cast<long>((nb_dofs / Tensor_Dim0) * Tensor_Dim1 *
1985 auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim1, Tensor_Dim1>(
1986 &*hessian_base.data().begin());
1988 auto t_hessian_at_gauss_pts =
1989 getFTensor3FromMat<Tensor_Dim0, Tensor_Dim1, Tensor_Dim1>(mat);
1995 int size = nb_dofs / Tensor_Dim0;
1997 if (nb_dofs % Tensor_Dim0) {
1999 "Data inconsistency");
2003 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
2006 for (; bb < size; ++bb) {
2007 t_hessian_at_gauss_pts(
I,
J,
K) +=
2008 field_data(
I) * t_diff2_base_function(
J,
K);
2010 ++t_diff2_base_function;
2014 for (; bb != nb_base_functions; ++bb)
2015 ++t_diff2_base_function;
2016 ++t_hessian_at_gauss_pts;
2019 if (this->dataVec.use_count()) {
2041template <
int DIM_01,
int DIM_23,
int S = 0>
2053 boost::shared_ptr<MatrixDouble> in_mat,
2054 boost::shared_ptr<MatrixDouble> out_mat,
2055 boost::shared_ptr<MatrixDouble> d_mat)
2068 boost::shared_ptr<MatrixDouble> out_mat,
2069 boost::shared_ptr<MatrixDouble> d_mat)
2082 const size_t nb_gauss_pts =
getGaussPts().size2();
2083 auto t_D = getFTensor4DdgFromMat<DIM_01, DIM_23, S>(*(
dMat));
2084 auto t_in = getFTensor2SymmetricFromMat<DIM_01>(*(
inMat));
2085 outMat->resize((DIM_23 * (DIM_23 + 1)) / 2, nb_gauss_pts,
false);
2086 auto t_out = getFTensor2SymmetricFromMat<DIM_23>(*(
outMat));
2087 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2088 t_out(
i,
j) = t_D(
i,
j,
k,
l) * t_in(
k,
l);
2103 boost::shared_ptr<MatrixDouble>
dMat;
2126 boost::shared_ptr<MatrixDouble> in_mat,
2127 boost::shared_ptr<MatrixDouble> out_mat)
2144 boost::shared_ptr<MatrixDouble> out_mat)
2155 const size_t nb_gauss_pts =
getGaussPts().size2();
2156 auto t_in = getFTensor2FromMat<DIM, DIM>(*(
inMat));
2157 outMat->resize((DIM * (DIM + 1)) / 2, nb_gauss_pts,
false);
2158 auto t_out = getFTensor2SymmetricFromMat<DIM>(*(
outMat));
2159 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2160 t_out(
i,
j) = (t_in(
i,
j) || t_in(
j,
i)) / 2;
2191 boost::shared_ptr<MatrixDouble> in_mat,
2192 boost::shared_ptr<MatrixDouble> out_mat)
2211 boost::shared_ptr<MatrixDouble> in_mat,
2212 boost::shared_ptr<MatrixDouble> out_mat)
2226 noalias(*
outMat) = (*scalePtr) * (*inMat);
2245template <
int Base_Dim,
int Field_Dim,
class T,
class L,
class A>
2251template <
int Field_Dim>
2257 boost::shared_ptr<MatrixDouble> data_ptr,
2259 const EntityType zero_type = MBEDGE,
2260 const int zero_side = 0)
2263 dataPtr(data_ptr), dataVec(data_vec), zeroType(zero_type),
2264 zeroSide(zero_side) {
2270 boost::shared_ptr<MatrixDouble> data_ptr,
2271 const EntityType zero_type = MBEDGE,
2272 const int zero_side = 0)
2294template <
int Field_Dim>
2296 3, Field_Dim,
double, ublas::row_major,
2300 const size_t nb_integration_points = this->getGaussPts().size2();
2301 if (type == zeroType && side == zeroSide) {
2302 dataPtr->resize(Field_Dim, nb_integration_points,
false);
2309 if (dataVec.use_count()) {
2310 dotVector.resize(nb_dofs,
false);
2311 const double *array;
2312 CHKERR VecGetArrayRead(dataVec, &array);
2314 for (
int i = 0;
i != local_indices.size(); ++
i)
2315 if (local_indices[
i] != -1)
2316 dotVector[
i] = array[local_indices[
i]];
2319 CHKERR VecRestoreArrayRead(dataVec, &array);
2323 const size_t nb_base_functions = data.
getN().size2() / 3;
2326 auto t_data = getFTensor1FromMat<Field_Dim>(*dataPtr);
2327 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2330 for (; bb != nb_dofs; ++bb) {
2331 t_data(
i) += t_n_hdiv(
i) * t_dof;
2335 for (; bb != nb_base_functions; ++bb)
2340 if (dataVec.use_count()) {
2350template <
int Base_Dim,
int Field_Dim = Base_Dim>
2353 Base_Dim, Field_Dim, double, ublas::row_major, DoubleAllocator> {
2355 Base_Dim, Field_Dim,
double, ublas::row_major,
2362template <
int Base_Dim,
int Field_Dim = Base_Dim>
2365template <
int Field_Dim>
2370 boost::shared_ptr<MatrixDouble> data_ptr,
2371 const EntityType zero_type = MBEDGE,
2372 const int zero_side = 0)
2375 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2396template <
int Field_Dim>
2401 const size_t nb_integration_points = this->getGaussPts().size2();
2402 if (type == zeroType && side == zeroSide) {
2403 dataPtr->resize(Field_Dim, nb_integration_points,
false);
2408 const size_t nb_dofs = local_indices.size();
2411 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2412 const double *array;
2413 CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
2414 for (
size_t i = 0;
i != nb_dofs; ++
i)
2415 if (local_indices[
i] != -1)
2416 dot_dofs_vector[
i] = array[local_indices[
i]];
2418 dot_dofs_vector[
i] = 0;
2419 CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
2421 const size_t nb_base_functions = data.
getN().size2() / 3;
2424 auto t_data = getFTensor1FromMat<Field_Dim>(*dataPtr);
2425 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2427 for (; bb != nb_dofs; ++bb) {
2428 t_data(
i) += t_n_hdiv(
i) * dot_dofs_vector[bb];
2431 for (; bb != nb_base_functions; ++bb)
2447template <
int BASE_DIM,
int SPACE_DIM>
2452 boost::shared_ptr<VectorDouble> data_ptr,
2453 const EntityType zero_type = MBEDGE,
2454 const int zero_side = 0)
2465 const size_t nb_integration_points =
getGaussPts().size2();
2467 dataPtr->resize(nb_integration_points,
false);
2473 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2478 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2481 for (; bb != nb_dofs; ++bb) {
2482 t_data += t_dof * t_n_diff_hdiv(
j,
j);
2486 for (; bb != nb_base_functions; ++bb)
2506template <
int BASE_DIM,
int SPACE_DIM>
2511 boost::shared_ptr<MatrixDouble> data_ptr,
2512 const EntityType zero_type = MBEDGE,
2513 const int zero_side = 0)
2524 const size_t nb_integration_points =
getGaussPts().size2();
2532 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2536 auto t_data = getFTensor2FromMat<BASE_DIM, SPACE_DIM>(*
dataPtr);
2537 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2540 for (; bb != nb_dofs; ++bb) {
2541 t_data(
i,
j) += t_dof * t_base_diff(
i,
j);
2545 for (; bb != nb_base_functions; ++bb)
2566template <
int BASE_DIM,
int FIELD_DIM,
int SPACE_DIM>
2579 boost::shared_ptr<MatrixDouble> data_ptr,
2580 const EntityType zero_type = MBEDGE,
2581 const int zero_side = 0)
2584 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2593 const size_t nb_integration_points = getGaussPts().size2();
2594 if (type == zeroType && side == zeroSide) {
2595 dataPtr->resize(27, nb_integration_points,
false);
2603 "Data inconsistency, nb_dofs %% COEFF_DIM != 0, that is %ld %% %d "
2613 const size_t nb_base_functions = data.
getN().size2() / 3;
2619 auto t_data = getFTensor3FromMat<3, 3, 3>(*dataPtr);
2620 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2623 for (; bb != nb_dofs; ++bb) {
2624 t_data(
k,
i,
j) += t_base_diff(
i,
j) * t_dof(
k);
2628 for (; bb != nb_base_functions; ++bb)
2646 boost::shared_ptr<MatrixDouble> data_ptr,
2647 const EntityType zero_type = MBEDGE,
2648 const int zero_side = 0)
2651 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2660 const size_t nb_integration_points = getGaussPts().size2();
2661 if (type == zeroType && side == zeroSide) {
2662 dataPtr->resize(27, nb_integration_points,
false);
2670 const size_t nb_base_functions = data.
getN().size2() / 9;
2673 if (data.
getDiffN().size1() != nb_integration_points) {
2675 "Wrong number of integration pts (%ld != %ld)",
2676 data.
getDiffN().size1(), nb_integration_points);
2678 if (data.
getDiffN().size2() != nb_base_functions * 27) {
2680 "Wrong number of base functions (%ld != %ld)",
2681 data.
getDiffN().size2() / 27, nb_base_functions);
2683 if (nb_base_functions < nb_dofs) {
2685 "Wrong number of base functions (%ld < %ld)", nb_base_functions,
2695 auto t_data = getFTensor3FromMat<3, 3, 3>(*dataPtr);
2696 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2699 for (; bb != nb_dofs; ++bb) {
2700 t_data(
k,
i,
j) += t_base_diff(
k,
i,
j) * t_dof;
2704 for (; bb != nb_base_functions; ++bb)
2725template <
int BASE_DIM,
int SPACE_DIM>
2730 boost::shared_ptr<MatrixDouble> data_ptr,
2731 const EntityType zero_type = MBEDGE,
2732 const int zero_side = 0)
2743 const size_t nb_integration_points =
getGaussPts().size2();
2753 const int nb_base_functions = data.
getN().size2() /
BASE_DIM;
2756 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
2757 if (hessian_base.size1() != nb_integration_points) {
2759 "Wrong number of integration pts (%ld != %ld)",
2760 static_cast<long>(hessian_base.size1()),
2761 static_cast<long>(nb_integration_points));
2763 if (hessian_base.size2() !=
2766 "Wrong number of base functions (%ld != %ld)",
2767 static_cast<long>(hessian_base.size2() /
2769 static_cast<long>(nb_base_functions));
2773 "Wrong number of base functions (%ld < %ld)",
2774 static_cast<long>(hessian_base.size2()),
2785 auto t_data = getFTensor3FromMat<BASE_DIM, SPACE_DIM, SPACE_DIM>(*
dataPtr);
2786 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2789 for (; bb != nb_dofs; ++bb) {
2790 t_data(
i,
j,
k) += t_dof * t_base_diff2(
i,
j,
k);
2795 for (; bb != nb_base_functions; ++bb)
2814template <
int Tensor_Dim1,
int Tensor_Dim2>
2819 boost::shared_ptr<VectorDouble> data_ptr,
2820 const EntityType zero_type = MBEDGE,
2821 const int zero_side = 0)
2832 const size_t nb_integration_points =
getGaussPts().size2();
2834 dataPtr->resize(nb_integration_points,
false);
2839 const int nb_dofs = local_indices.size();
2842 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2843 const double *array;
2845 for (
size_t i = 0;
i != local_indices.size(); ++
i)
2846 if (local_indices[
i] != -1)
2847 dot_dofs_vector[
i] = array[local_indices[
i]];
2849 dot_dofs_vector[
i] = 0;
2852 const size_t nb_base_functions = data.
getN().size2() / Tensor_Dim1;
2856 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2858 for (; bb != nb_dofs; ++bb) {
2860 for (
auto ii = 0; ii != Tensor_Dim2; ++ii)
2861 div += t_n_diff_hdiv(ii, ii);
2862 t_data += dot_dofs_vector[bb] * div;
2865 for (; bb != nb_base_functions; ++bb)
2901 boost::shared_ptr<MatrixDouble> data_ptr,
2902 const EntityType zero_type = MBEDGE,
2903 const int zero_side = 0);
2925 boost::shared_ptr<MatrixDouble> data_ptr,
2926 const EntityType zero_type = MBVERTEX,
2927 const int zero_side = 0);
2950 boost::shared_ptr<MatrixDouble> data_ptr,
2951 const EntityType zero_type = MBVERTEX,
2952 const int zero_side = 0);
2970template <
int Tensor_Dim0,
int Tensor_Dim1>
2975 boost::shared_ptr<MatrixDouble> data_ptr,
2976 boost::shared_ptr<double> scale_ptr,
2978 const EntityType zero_type = MBEDGE,
2979 const int zero_side = 0)
2989 boost::shared_ptr<MatrixDouble> data_ptr,
2990 const EntityType zero_type = MBEDGE,
2991 const int zero_side = 0)
2999 const size_t nb_integration_points =
getGaussPts().size2();
3001 dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points,
false);
3009 const double *array;
3012 for (
int i = 0;
i != local_indices.size(); ++
i)
3013 if (local_indices[
i] != -1)
3022 const size_t nb_base_functions = data.
getN().size2() / 3;
3026 auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*
dataPtr);
3027 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3030 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3031 t_data(
i,
j) += (
scale * t_dof(
i)) * t_n_hvec(
j);
3035 for (; bb < nb_base_functions; ++bb)
3061template <
int Tensor_Dim0,
int Tensor_Dim1>
3068 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3070 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3071 boost::shared_ptr<double> scale_ptr =
nullptr,
3072 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3100template <
int Tensor_Dim0,
int Tensor_Dim1>
3105 const size_t nb_integration_points = OP::getGaussPts().size2();
3106 if (type == zeroType) {
3107 dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points,
false);
3114 if (dataVec.use_count()) {
3115 dotVector.resize(nb_dofs,
false);
3116 const double *array;
3117 CHKERR VecGetArrayRead(dataVec, &array);
3119 for (
int i = 0;
i != local_indices.size(); ++
i)
3120 if (local_indices[
i] != -1)
3121 dotVector[
i] = array[local_indices[
i]];
3124 CHKERR VecRestoreArrayRead(dataVec, &array);
3135 auto get_get_side_face_dofs = [&]() {
3136 auto fe_type = OP::getFEType();
3140 std::vector<int> side_face_dofs;
3141 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3145 auto it = side_dof_map.get<1>().begin();
3146 it != side_dof_map.get<1>().end(); ++it
3149 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3152 if (it->type == brokenType) {
3153 if (brokenRangePtr) {
3154 auto ent = OP::getSideEntity(it->side, brokenType);
3155 if (brokenRangePtr->find(ent) != brokenRangePtr->end()) {
3156 side_face_dofs.push_back(it->dof);
3159 side_face_dofs.push_back(it->dof);
3164 return side_face_dofs;
3167 auto side_face_dofs = get_get_side_face_dofs();
3171 auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*dataPtr);
3172 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3173 for (
auto b : side_face_dofs) {
3175 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(data.
getFieldData().data() +
3177 t_data(
i,
j) += t_dof(
i) * t_row_base(
j);
3181 *dataPtr *= (scalePtr) ? *scalePtr : 1.0;
3183 if (dataVec.use_count()) {
3197template <
int Tensor_Dim0,
int Tensor_Dim1>
3202 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3203 boost::shared_ptr<double> scale_ptr,
3205 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3215 boost::shared_ptr<MatrixDouble> data_ptr,
3216 const EntityType zero_type = MBEDGE,
3217 const int zero_side = 0)
3225 const size_t nb_integration_points =
getGaussPts().size2();
3227 dataPtr->resize(Tensor_Dim0 * Tensor_Dim1, nb_integration_points,
false);
3236 const double *array;
3239 for (
int i = 0;
i != local_indices.size(); ++
i)
3240 if (local_indices[
i] != -1)
3249 const size_t nb_base_functions =
3250 data.
getN().size2() / (Tensor_Dim0 * Tensor_Dim1);
3253 auto t_n_hten = data.
getFTensor2N<Tensor_Dim0, Tensor_Dim1>();
3254 auto t_data = getFTensor2FromMat<Tensor_Dim0, Tensor_Dim1>(*
dataPtr);
3255 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3258 for (; bb != nb_dofs; ++bb) {
3259 t_data(
i,
j) += (
scale * t_dof) * t_n_hten(
i,
j);
3263 for (; bb < nb_base_functions; ++bb)
3291template <
int Tensor_Dim0,
int Tensor_Dim1,
3297 boost::shared_ptr<MatrixDouble> data_ptr,
3299 const EntityType zero_type = MBEDGE,
3300 const int zero_side = 0)
3310 boost::shared_ptr<MatrixDouble> data_ptr,
3311 const EntityType zero_type = MBEDGE,
3312 const int zero_side = 0)
3319 const size_t nb_integration_points =
getGaussPts().size2();
3321 dataPtr->resize(Tensor_Dim0, nb_integration_points,
false);
3329 const double *array;
3332 for (
int i = 0;
i != local_indices.size(); ++
i)
3333 if (local_indices[
i] != -1)
3341 const size_t nb_base_functions = data.
getN().size2() / 3;
3345 auto t_data = getFTensor1FromMat<Tensor_Dim0>(*
dataPtr);
3348 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3351 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3352 double div = t_n_diff_hvec(
j,
j);
3353 t_data(
i) += t_dof(
i) * div;
3355 t_data(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3361 for (; bb < nb_base_functions; ++bb) {
3394template <
int Tensor_Dim0,
int Tensor_Dim1,
3402 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3404 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3405 boost::shared_ptr<double> scale_ptr =
nullptr,
3406 const EntityType zero_type = MBEDGE)
3418 const size_t nb_integration_points =
getGaussPts().size2();
3419 if (type ==
zeroType && side == 0) {
3420 dataPtr->resize(Tensor_Dim0, nb_integration_points,
false);
3429 const double *array;
3432 for (
int i = 0;
i != local_indices.size(); ++
i)
3433 if (local_indices[
i] != -1)
3448 auto get_get_side_face_dofs = [&]() {
3453 std::vector<int> side_face_dofs;
3454 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3458 auto it = side_dof_map.get<1>().begin();
3459 it != side_dof_map.get<1>().end(); ++it
3462 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3469 side_face_dofs.push_back(it->dof);
3472 side_face_dofs.push_back(it->dof);
3477 return side_face_dofs;
3480 auto side_face_dofs = get_get_side_face_dofs();
3484 auto t_data = getFTensor1FromMat<Tensor_Dim0>(*
dataPtr);
3486 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3487 for (
auto b : side_face_dofs) {
3488 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(
3492 double div = t_diff_base(
j,
j);
3493 t_data(
i) += t_dof(
i) * div;
3495 t_data(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3526template <
int Tensor_Dim,
typename OpBase>
3530 boost::shared_ptr<MatrixDouble> data_ptr,
3531 boost::shared_ptr<double> scale_ptr,
3532 const EntityType zero_type = MBEDGE,
3533 const int zero_side = 0)
3541 boost::shared_ptr<MatrixDouble> data_ptr,
3542 const EntityType zero_type = MBEDGE,
3543 const int zero_side = 0)
3550 const size_t nb_integration_points = OpBase::getGaussPts().size2();
3551 if (type ==
zeroType && side == 0) {
3552 dataPtr->resize(Tensor_Dim, nb_integration_points,
false);
3558 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
3559 const size_t nb_base_functions = data.
getN().size2() / 3;
3561 auto t_data = getFTensor1FromMat<Tensor_Dim>(*
dataPtr);
3562 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3564 t_normalized_normal(
j) = t_normal(
j);
3568 for (; bb != nb_dofs / Tensor_Dim; ++bb) {
3570 (scale_val * t_dof(
i)) * (t_base(
j) * t_normalized_normal(
j));
3574 for (; bb < nb_base_functions; ++bb) {
3617 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3630 template <
int D1,
int D2,
int J1,
int J2>
3634 static_assert(D2 == J2,
"Dimension of jacobian and dimension of <out> "
3635 "directive does not match");
3637 size_t nb_functions = diff_n.size2() / D1;
3639 size_t nb_gauss_pts = diff_n.size1();
3644 "Wrong number of Gauss Pts");
3645 if (diff_n.size2() % D1)
3647 "Number of directives of base functions and D1 dimension does "
3651 diffNinvJac.resize(diff_n.size1(), D2 * nb_functions,
false);
3655 auto t_diff_n = getFTensor1FromPtr<D2>(&*
diffNinvJac.data().begin());
3656 auto t_diff_n_ref = getFTensor1FromPtr<D1>(&*diff_n.data().begin());
3657 auto t_inv_jac = getFTensor2FromMat<J1, J2>(*
invJacPtr);
3658 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg, ++t_inv_jac) {
3659 for (
size_t dd = 0; dd != nb_functions; ++dd) {
3660 t_diff_n(
i) = t_inv_jac(
k,
i) * t_diff_n_ref(
k);
3705template <
int DERIVARIVE = 1>
3712template <
int DERIVARIVE = 1>
3719template <
int DERIVARIVE = 1>
3723 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3727template <
int DERIVARIVE = 1>
3731 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3749 invJacPtr(inv_jac_ptr) {}
3803 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3840 boost::shared_ptr<MatrixDouble> jac_ptr)
3857 2>::OpSetContravariantPiolaTransformOnFace2DImpl;
4057 boost::shared_ptr<VectorDouble> det_ptr,
4058 boost::shared_ptr<MatrixDouble> out_ptr)
4078 "Pointer for inPtr matrix not allocated");
4081 "Pointer for detPtr matrix not allocated");
4083 const auto nb_rows = inPtr->size1();
4084 const auto nb_integration_pts = inPtr->size2();
4088 detPtr->resize(nb_integration_pts,
false);
4089 auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
4091 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4100 outPtr->resize(nb_rows, nb_integration_pts,
false);
4101 auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
4102 auto t_out = getFTensor2FromMat<DIM, DIM>(*outPtr);
4104 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4139 boost::shared_ptr<VectorDouble> out_ptr)
4160 "Pointer for inPtr matrix not allocated");
4162 const auto nb_integration_pts = inPtr->size2();
4165 outPtr->resize(nb_integration_pts,
false);
4166 auto t_in = getFTensor2FromMat<DIM, DIM>(*inPtr);
4169 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4192 boost::shared_ptr<VectorDouble> out_ptr)
4213 "Pointer for inPtr matrix not allocated");
4215 const auto nb_integration_pts = inPtr->size2();
4218 outPtr->resize(nb_integration_pts,
false);
4219 auto t_in = getFTensor2SymmetricFromMat<DIM>(*inPtr);
4222 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.
@ OPCOL
operator doWork function is executed on FE columns
@ 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