42#ifndef __USER_DATA_OPERATORS_HPP__
43 #define __USER_DATA_OPERATORS_HPP__
69template <
class T,
class A>
84 boost::shared_ptr<ublas::vector<T, A>> data_ptr,
94 boost::shared_ptr<ublas::vector<T, A>> data_ptr,
98 data_vec, zero_type) {}
109 boost::shared_ptr<ublas::vector<T, A>> data_ptr,
110 const EntityType zero_type = MBVERTEX)
126 boost::shared_ptr<ublas::vector<T, A>>
dataPtr;
136template <
class T,
class A>
175 vec.resize(nb_gauss_pts,
false);
188 for (
size_t i = 0;
i != local_indices.size(); ++
i)
189 if (local_indices[
i] != -1)
197 const size_t nb_base_functions = data.
getN().size2();
200 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
203 for (; bb != nb_dofs; ++bb) {
204 values_at_gauss_pts += field_data * base_function;
209 for (; bb < nb_base_functions; ++bb)
211 ++values_at_gauss_pts;
234template <PetscData::DataContext CTX>
246 const std::string
field_name, boost::shared_ptr<VectorDouble> data_ptr,
247 const EntityType zero_at_type = MBVERTEX)
263 vec.resize(nb_gauss_pts,
false);
268 const size_t nb_dofs = local_indices.size();
273 auto get_array = [&](
const auto ctx,
auto vec) {
279 <<
"In this case field degrees of freedom are read from vector. "
280 "That usually happens when time solver is used, and acces to "
281 "first or second rates is needed. You probably not set ts_u, "
282 "ts_u_t, or ts_u_tt and associated data structure, i.e. "
283 "data_ctx to CTX_SET_X, CTX_SET_X_T, or CTX_SET_X_TT "
288 CHKERR VecGetArrayRead(vec, &array);
292 auto restore_array = [&](
auto vec) {
293 return VecRestoreArrayRead(vec, &array);
308 "That case is not implemented");
311 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
312 for (
int i = 0;
i != local_indices.size(); ++
i)
313 if (local_indices[
i] != -1)
314 dot_dofs_vector[
i] = array[local_indices[
i]];
316 dot_dofs_vector[
i] = 0;
330 "That case is not implemented");
333 const size_t nb_base_functions = data.
getN().size2();
337 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
339 for (; bb != nb_dofs; ++bb) {
340 values_at_gauss_pts += dot_dofs_vector[bb] * base_function;
345 for (; bb < nb_base_functions; ++bb)
347 ++values_at_gauss_pts;
385template <
int Tensor_Dim,
typename M = MatrixDouble>
398 boost::shared_ptr<M> data_ptr,
399 const EntityType zero_type = MBVERTEX)
422template <
int Tensor_Dim,
typename M>
428 "Not implemented for matrix type = %s and dim = %d",
438template <
int Tensor_Dim>
443 boost::shared_ptr<MatrixDouble> data_ptr,
444 const EntityType zero_type = MBVERTEX,
445 const int max_order = -1)
454 boost::shared_ptr<MatrixDouble> data_ptr,
456 const EntityType zero_type = MBVERTEX,
457 const int max_order = -1)
461 maxOrder(max_order) {
481template <
int Tensor_Dim>
487 const size_t nb_gauss_pts = getGaussPts().size2();
488 auto &mat = *dataPtr;
491 auto get_values_at_gauss_pts =
494 if (
type == zeroType) {
503 const auto max_size =
507 if (dataVec.use_count()) {
508 dotVector.resize(nb_dofs,
false);
510 CHKERR VecGetArrayRead(dataVec, &array);
512 for (
size_t i = 0;
i != local_indices.size(); ++
i)
513 if (local_indices[
i] != -1)
514 dotVector[
i] = array[local_indices[
i]];
517 CHKERR VecRestoreArrayRead(dataVec, &array);
522 const size_t nb_base_functions = data.
getN().size2();
524 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
526 const size_t size = nb_dofs / Tensor_Dim;
527 if (nb_dofs % Tensor_Dim) {
529 "Nb. of DOFs is inconsistent with Tensor_Dim");
531 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
535 if (field_data.l2() != field_data.l2()) {
536 MOFEM_LOG(
"SELF", Sev::error) <<
"field data: " << field_data;
538 "Wrong number in coefficients");
543 for (; bb != size; ++bb) {
547 if (base_function != base_function) {
548 MOFEM_LOG(
"SELF", Sev::error) <<
"base function: " << base_function;
550 "Wrong number number in base functions");
555 if (bb <= max_size) {
556 t_values_at_gauss_pts(
I) += field_data(
I) * base_function;
563 for (; bb < nb_base_functions; ++bb)
565 ++t_values_at_gauss_pts;
569 if (dataVec.use_count()) {
587template <
int Tensor_Dim>
592 Tensor_Dim>::OpCalculateVectorFieldValues_General;
611template <
int Tensor_Dim, CoordinateTypes COORDINATE_SYSTEM = CARTESIAN>
623 const std::string
field_name, boost::shared_ptr<VectorDouble> data_ptr,
624 const EntityType zero_type = MBVERTEX)
637 if constexpr (COORDINATE_SYSTEM ==
POLAR || COORDINATE_SYSTEM ==
SPHERICAL)
639 "%s coordiante not implemented",
645 vec.resize(nb_gauss_pts,
false);
653 const size_t nb_base_functions = data.
getN().size2();
656 const size_t size = nb_dofs / Tensor_Dim;
658 if (nb_dofs % Tensor_Dim) {
660 "Number of dofs should multiple of dimensions");
665 if constexpr (COORDINATE_SYSTEM ==
CARTESIAN) {
667 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
670 for (; bb != size; ++bb) {
671 values_at_gauss_pts += field_data(
I) * diff_base_function(
I);
673 ++diff_base_function;
677 for (; bb < nb_base_functions; ++bb)
678 ++diff_base_function;
679 ++values_at_gauss_pts;
689 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
692 for (; bb != size; ++bb) {
693 values_at_gauss_pts += field_data(
I) * diff_base_function(
I);
694 values_at_gauss_pts +=
695 base_function * (field_data(0) / t_coords(0));
698 ++diff_base_function;
702 for (; bb < nb_base_functions; ++bb) {
704 ++diff_base_function;
706 ++values_at_gauss_pts;
727template <
int Tensor_Dim, PetscData::DataContext CTX>
732 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
733 const EntityType zero_at_type = MBVERTEX,
bool throw_error =
true)
746 const size_t nb_dofs = local_indices.size();
751 auto get_values_at_gauss_pts =
753 DL>::size(mat, nb_gauss_pts);
768 auto get_array = [&](
const auto ctx,
auto vec) {
774 <<
"In this case field degrees of freedom are read from vector. "
775 "That usually happens when time solver is used, and access to "
776 "first or second rates is needed. You probably not set ts_u, "
777 "ts_u_t, or ts_u_tt and associated data structure, i.e. "
778 "data_ctx to CTX_SET_X, CTX_SET_DX, CTX_SET_X_T, or "
779 "CTX_SET_X_TT respectively";
783 CHKERR VecGetArrayRead(vec, &array);
787 auto restore_array = [&](
auto vec) {
788 return VecRestoreArrayRead(vec, &array);
806 "That case is not implemented");
810 for (
int i = 0;
i != local_indices.size(); ++
i)
811 if (local_indices[
i] != -1)
831 "That case is not implemented");
834 const size_t nb_base_functions = data.
getN().size2();
836 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
839 const size_t size = nb_dofs / Tensor_Dim;
840 if (nb_dofs % Tensor_Dim) {
843 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
844 auto field_data = getFTensor1FromArray<Tensor_Dim, Tensor_Dim>(
dotVector);
846 for (; bb != size; ++bb) {
847 t_values_at_gauss_pts(
I) += field_data(
I) * base_function;
853 for (; bb < nb_base_functions; ++bb)
855 ++t_values_at_gauss_pts;
872template <
int Tensor_Dim>
882template <
int Tensor_Dim>
892template <
int Tensor_Dim>
906template <
int Tensor_Dim0,
int Tensor_Dim1,
typename M = MatrixDouble>
912 boost::shared_ptr<M> data_ptr,
913 const EntityType zero_type = MBVERTEX)
929template <
int Tensor_Dim0,
int Tensor_Dim1,
typename M>
935 "Not implemented for matrix type = %s, dim0 = %d and dim1 = %d",
937 Tensor_Dim0, Tensor_Dim1);
941template <
int Tensor_Dim0,
int Tensor_Dim1>
948 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
957 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
958 const EntityType zero_type = MBVERTEX)
964 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
968 data_vec, zero_type) {}
980template <
int Tensor_Dim0,
int Tensor_Dim1>
988 const size_t nb_gauss_pts = data.
getN().size1();
989 auto get_values_at_gauss_pts =
991 DL>::size(mat, nb_gauss_pts);
992 if (
type == zeroType)
997 if (dataVec.use_count()) {
998 dotVector.resize(nb_dofs,
false);
1000 CHKERR VecGetArrayRead(dataVec, &array);
1002 for (
int i = 0;
i != local_indices.size(); ++
i)
1003 if (local_indices[
i] != -1)
1004 dotVector[
i] = array[local_indices[
i]];
1007 CHKERR VecRestoreArrayRead(dataVec, &array);
1012 const size_t nb_base_functions = data.
getN().size2();
1014 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1017 const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
1018 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1021 for (; bb != size; ++bb) {
1022 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1026 for (; bb < nb_base_functions; ++bb)
1028 ++t_values_at_gauss_pts;
1031 if (dataVec.use_count()) {
1043template <
int Tensor_Dim0,
int Tensor_Dim1>
1049 Tensor_Dim0, Tensor_Dim1>::OpCalculateTensor2FieldValues_General;
1057template <
int Tensor_Dim0,
int Tensor_Dim1>
1062 boost::shared_ptr<MatrixDouble> data_ptr,
1063 const EntityType zero_at_type = MBVERTEX)
1076 const size_t nb_gauss_pts =
getGaussPts().size2();
1078 auto get_values_at_gauss_pts =
1081 DL>::size(mat, nb_gauss_pts);
1085 const size_t nb_dofs = local_indices.size();
1088 const double *array;
1090 for (
size_t i = 0;
i != local_indices.size(); ++
i)
1091 if (local_indices[
i] != -1)
1097 const size_t nb_base_functions = data.
getN().size2();
1100 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1103 const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
1104 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1106 getFTensor2FromPtr<Tensor_Dim0, Tensor_Dim1>(&*
dotVector.begin());
1108 for (; bb != size; ++bb) {
1109 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1113 for (; bb < nb_base_functions; ++bb)
1115 ++t_values_at_gauss_pts;
1134template <
int Tensor_Dim>
1139 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1140 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
1149 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1151 const int zero_side = 0)
1166 auto get_values_at_gauss_pts =
1168 DL>::size(mat, nb_gauss_pts);
1178 const double *array;
1181 for (
int i = 0;
i != local_indices.size(); ++
i)
1182 if (local_indices[
i] != -1)
1190 const int nb_base_functions = data.
getN().size2();
1192 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1195 const int size = nb_dofs / ((Tensor_Dim * (Tensor_Dim + 1)) / 2);
1196 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1199 for (; bb != size; ++bb) {
1200 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1204 for (; bb < nb_base_functions; ++bb)
1206 ++t_values_at_gauss_pts;
1231template <
int Tensor_Dim>
1236 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1237 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
1250 constexpr auto symm_size = (Tensor_Dim * (Tensor_Dim + 1)) / 2;
1252 auto get_values_at_gauss_pts =
1254 DL>::size(mat, nb_gauss_pts);
1259 const int nb_dofs = local_indices.size();
1267 <<
"In this case field degrees of freedom are read from vector. "
1268 "That usually happens when time solver is used, and acces to "
1269 "first rates is needed. You probably not set "
1270 "ts_u_t and associated data structure data_ctx to CTX_SET_X_T "
1277 const double *array;
1279 for (
int i = 0;
i != local_indices.size(); ++
i)
1280 if (local_indices[
i] != -1)
1286 const int nb_base_functions = data.
getN().size2();
1289 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1292 const int size = nb_dofs / symm_size;
1293 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1294 auto field_data = getFTensorDotData<Tensor_Dim>();
1296 for (; bb != size; ++bb) {
1297 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1301 for (; bb < nb_base_functions; ++bb)
1303 ++t_values_at_gauss_pts;
1316 static_assert(Dim || !Dim,
"not implemented");
1325 &dotVector[0], &dotVector[1], &dotVector[2], &dotVector[3], &dotVector[4],
1334 &dotVector[0], &dotVector[1], &dotVector[2]);
1348template <
int Tensor_Dim,
typename M = MatrixDouble>
1353 Tensor_Dim,
M>::OpCalculateVectorFieldValues_General;
1360template <
int Tensor_Dim>
1365 Tensor_Dim,
MatrixDouble>::OpCalculateVectorFieldValues_General;
1383template <
int Tensor_Dim>
1389 const size_t nb_gauss_pts = this->getGaussPts().size2();
1390 auto &mat = *this->dataPtr;
1392 auto get_gradients_at_pts =
1394 DL>::size(mat, nb_gauss_pts);
1395 if (
type == this->zeroType) {
1403 const int nb_base_functions = data.
getN().size2();
1405 auto t_gradients_at_pts = get_gradients_at_pts();
1408 if (nb_dofs > nb_base_functions)
1410 "Number of base functions inconsistent with number of DOFs "
1412 nb_dofs, nb_base_functions);
1414 if (data.
getDiffN().size2() != nb_base_functions * Tensor_Dim)
1417 "Number of base functions inconsistent with number of derivatives "
1419 data.
getDiffN().size2(), nb_base_functions);
1421 if (data.
getDiffN().size1() != nb_gauss_pts)
1424 "Number of base functions inconsistent with number of integration "
1426 data.
getDiffN().size1(), nb_gauss_pts);
1431 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1434 for (; bb != nb_dofs; ++bb) {
1435 t_gradients_at_pts(
I) += field_data * diff_base_function(
I);
1437 ++diff_base_function;
1440 for (; bb < nb_base_functions; ++bb)
1441 ++diff_base_function;
1442 ++t_gradients_at_pts;
1455template <
int Tensor_Dim>
1459 Tensor_Dim>::OpCalculateScalarFieldGradient_General;
1466template <
int Tensor_Dim>
1471 Tensor_Dim>::OpCalculateVectorFieldValues_General;
1484template <
int Tensor_Dim>
1489 const size_t nb_gauss_pts = this->getGaussPts().size2();
1491 auto &mat = *this->dataPtr;
1492 auto get_hessian_at_gauss_pts =
1494 DL>::size(mat, nb_gauss_pts);
1495 if (
type == this->zeroType)
1502 const int nb_base_functions = data.
getN().size2();
1504 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
1506 if (hessian_base.size1() != nb_gauss_pts) {
1508 "Wrong number of integration pts (%ld != %ld)",
1509 static_cast<long>(hessian_base.size1()),
1510 static_cast<long>(nb_gauss_pts));
1512 if (hessian_base.size2() != nb_base_functions * Tensor_Dim * Tensor_Dim) {
1514 "Wrong number of base functions (%ld != %ld)",
1515 static_cast<long>(hessian_base.size2() /
1516 (Tensor_Dim * Tensor_Dim)),
1517 static_cast<long>(nb_base_functions));
1519 if (hessian_base.size2() < nb_dofs * Tensor_Dim * Tensor_Dim) {
1521 "Wrong number of base functions (%ld < %ld)",
1522 static_cast<long>(hessian_base.size2()),
1523 static_cast<long>(nb_dofs * Tensor_Dim * Tensor_Dim));
1527 auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim, Tensor_Dim>(
1528 &*hessian_base.data().begin());
1530 auto t_hessian_at_gauss_pts = get_hessian_at_gauss_pts();
1534 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1537 for (; bb != nb_dofs; ++bb) {
1538 t_hessian_at_gauss_pts(
I,
J) +=
1539 field_data * t_diff2_base_function(
I,
J);
1541 ++t_diff2_base_function;
1544 for (; bb < nb_base_functions; ++bb) {
1545 ++t_diff2_base_function;
1548 ++t_hessian_at_gauss_pts;
1572template <
int Tensor_Dim0,
int Tensor_Dim1,
int S,
1579 Tensor_Dim0, Tensor_Dim1,
M>::OpCalculateTensor2FieldValues_General;
1582template <
int Tensor_Dim0,
int Tensor_Dim1,
int S>
1586 Tensor_Dim0, Tensor_Dim1, MatrixDouble> {
1589 Tensor_Dim0, Tensor_Dim1,
MatrixDouble>::OpCalculateTensor2FieldValues_General;
1607template <
int Tensor_Dim0,
int Tensor_Dim1,
int S>
1614 "Data pointer not allocated");
1616 const size_t nb_gauss_pts = this->getGaussPts().size2();
1618 auto &mat = *this->dataPtr;
1619 auto get_gradients_at_pts =
1622 DL>::size(mat, nb_gauss_pts);
1623 if (
type == this->zeroType)
1631 if (this->dataVec.use_count()) {
1632 this->dotVector.resize(nb_dofs,
false);
1633 const double *array;
1634 CHKERR VecGetArrayRead(this->dataVec, &array);
1636 for (
int i = 0;
i != local_indices.size(); ++
i)
1637 if (local_indices[
i] != -1)
1638 this->dotVector[
i] = array[local_indices[
i]];
1640 this->dotVector[
i] = 0;
1641 CHKERR VecRestoreArrayRead(this->dataVec, &array);
1645 const int nb_base_functions = data.
getN().size2();
1647 auto t_gradients_at_pts = get_gradients_at_pts();
1650 int size = nb_dofs / Tensor_Dim0;
1651 if (nb_dofs % Tensor_Dim0) {
1653 "Data inconsistency");
1655 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1656 auto field_data = getFTensor1FromPtr<Tensor_Dim0, S>(
1660 if (field_data.l2() != field_data.l2()) {
1661 MOFEM_LOG(
"SELF", Sev::error) <<
"field data " << field_data;
1663 "Wrong number in coefficients");
1668 for (; bb < size; ++bb) {
1671 if (diff_base_function.l2() != diff_base_function.l2()) {
1673 <<
"diff_base_function: " << diff_base_function;
1675 "Wrong number number in base functions");
1680 t_gradients_at_pts(
I,
J) += field_data(
I) * diff_base_function(
J);
1682 ++diff_base_function;
1686 for (; bb != nb_base_functions; ++bb)
1687 ++diff_base_function;
1688 ++t_gradients_at_pts;
1691 if (this->dataVec.use_count()) {
1708template <
int Tensor_Dim0,
int Tensor_Dim1,
int S = Tensor_Dim0>
1714 Tensor_Dim0, Tensor_Dim1, S>::OpCalculateVectorFieldGradient_General;
1722template <
int Tensor_Dim0,
int Tensor_Dim1>
1727 boost::shared_ptr<MatrixDouble> data_ptr,
1728 const EntityType zero_at_type = MBVERTEX)
1741 const int nb_dofs = local_indices.size();
1742 const int nb_gauss_pts = this->
getGaussPts().size2();
1746 auto get_gradients_at_pts =
1749 DL>::size(mat, nb_gauss_pts);
1756 const double *array;
1758 for (
int i = 0;
i != local_indices.size(); ++
i)
1759 if (local_indices[
i] != -1)
1765 const int nb_base_functions = data.
getN().size2();
1767 auto t_gradients_at_pts = get_gradients_at_pts();
1770 int size = nb_dofs / Tensor_Dim0;
1771 if (nb_dofs % Tensor_Dim0) {
1775 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1776 auto field_data = getFTensor1FromPtr<Tensor_Dim0>(&*
dotVector.begin());
1778 for (; bb < size; ++bb) {
1779 t_gradients_at_pts(
I,
J) += field_data(
I) * diff_base_function(
J);
1781 ++diff_base_function;
1785 for (; bb != nb_base_functions; ++bb)
1786 ++diff_base_function;
1787 ++t_gradients_at_pts;
1803template <
int Tensor_Dim0,
int Tensor_Dim1,
typename M = MatrixDouble>
1809 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1810 const EntityType zero_type = MBVERTEX)
1815template <
int Tensor_Dim0,
int Tensor_Dim1>
1820 Tensor_Dim0, Tensor_Dim1, MatrixDouble> {
1823 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1824 const EntityType zero_type = MBVERTEX)
1845template <
int Tensor_Dim0,
int Tensor_Dim1>
1852 "Data pointer not allocated");
1854 const size_t nb_gauss_pts = this->getGaussPts().size2();
1855 constexpr size_t msize = (Tensor_Dim0 * (Tensor_Dim0 + 1)) / 2;
1856 auto &mat = *this->dataPtr;
1857 if (
type == this->zeroType) {
1858 mat.resize(msize * Tensor_Dim1, nb_gauss_pts,
false);
1867 const int nb_base_functions = data.
getN().size2();
1869 auto gradients_at_pts =
1875 int size = nb_dofs / msize;
1876 if (nb_dofs % msize) {
1878 "Data inconsistency");
1880 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1883 for (; bb < size; ++bb) {
1884 gradients_at_pts(
I,
J,
K) +=
1885 field_data(
I,
J) * diff_base_function(
K);
1887 ++diff_base_function;
1891 for (; bb != nb_base_functions; ++bb)
1892 ++diff_base_function;
1905template <
int Tensor_Dim0,
int Tensor_Dim1>
1908 Tensor_Dim0, Tensor_Dim1> {
1911 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1912 const EntityType zero_type = MBVERTEX)
1914 Tensor_Dim0, Tensor_Dim1>(
field_name, data_ptr, zero_type) {}
1917template <
int Tensor_Dim0,
int Tensor_Dim1>
1923 Tensor_Dim0, Tensor_Dim1>::OpCalculateTensor2FieldValues_General;
1941template <
int Tensor_Dim0,
int Tensor_Dim1>
1947 "Data pointer not allocated");
1949 const size_t nb_gauss_pts = this->getGaussPts().size2();
1950 auto &mat = *this->dataPtr;
1954 DL>::size(mat, nb_gauss_pts);
1955 if (
type == this->zeroType) {
1964 if (this->dataVec.use_count()) {
1965 this->dotVector.resize(nb_dofs,
false);
1966 const double *array;
1967 CHKERR VecGetArrayRead(this->dataVec, &array);
1969 for (
int i = 0;
i != local_indices.size(); ++
i)
1970 if (local_indices[
i] != -1)
1971 this->dotVector[
i] = array[local_indices[
i]];
1973 this->dotVector[
i] = 0;
1974 CHKERR VecRestoreArrayRead(this->dataVec, &array);
1978 const int nb_base_functions = data.
getN().size2();
1980 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
1982 if (hessian_base.size1() != nb_gauss_pts) {
1984 "Wrong number of integration pts (%ld != %ld)",
1985 static_cast<long>(hessian_base.size1()),
1986 static_cast<long>(nb_gauss_pts));
1988 if (hessian_base.size2() !=
1989 nb_base_functions * Tensor_Dim1 * Tensor_Dim1) {
1991 "Wrong number of base functions (%ld != %ld)",
1992 static_cast<long>(hessian_base.size2() /
1993 (Tensor_Dim1 * Tensor_Dim1)),
1994 static_cast<long>(nb_base_functions));
1996 if (hessian_base.size2() <
1997 (nb_dofs / Tensor_Dim0) * Tensor_Dim1 * Tensor_Dim1) {
1999 "Wrong number of base functions (%ld < %ld)",
2000 static_cast<long>(hessian_base.size2()),
2001 static_cast<long>((nb_dofs / Tensor_Dim0) * Tensor_Dim1 *
2006 auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim1, Tensor_Dim1>(
2007 &*hessian_base.data().begin());
2009 auto t_hessian_at_gauss_pts = get_hessian_at_gauss_pts();
2015 int size = nb_dofs / Tensor_Dim0;
2017 if (nb_dofs % Tensor_Dim0) {
2019 "Data inconsistency");
2023 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
2026 for (; bb < size; ++bb) {
2027 t_hessian_at_gauss_pts(
I,
J,
K) +=
2028 field_data(
I) * t_diff2_base_function(
J,
K);
2030 ++t_diff2_base_function;
2034 for (; bb != nb_base_functions; ++bb)
2035 ++t_diff2_base_function;
2036 ++t_hessian_at_gauss_pts;
2039 if (this->dataVec.use_count()) {
2061template <
int DIM_01,
int DIM_23,
int S = 0>
2073 boost::shared_ptr<MatrixDouble> in_mat,
2074 boost::shared_ptr<MatrixDouble> out_mat,
2075 boost::shared_ptr<MatrixDouble> d_mat)
2088 boost::shared_ptr<MatrixDouble> out_mat,
2089 boost::shared_ptr<MatrixDouble> d_mat)
2102 const size_t nb_gauss_pts =
getGaussPts().size2();
2106 DL>::get(*
dMat, nb_gauss_pts);
2107 auto get_in_at_pts =
2109 DL>::get(*
inMat, nb_gauss_pts);
2110 auto get_out_at_pts =
2112 DL>::size(*
outMat, nb_gauss_pts);
2113 auto t_D_at_pts = get_D_at_pts();
2114 auto t_in_at_pts = get_in_at_pts();
2115 auto t_out_at_pts = get_out_at_pts();
2116 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2117 t_out_at_pts(
i,
j) = t_D_at_pts(
i,
j,
k,
l) * t_in_at_pts(
k,
l);
2133 boost::shared_ptr<MatrixDouble>
dMat;
2156 boost::shared_ptr<MatrixDouble> in_mat,
2157 boost::shared_ptr<MatrixDouble> out_mat)
2174 boost::shared_ptr<MatrixDouble> out_mat)
2185 const size_t nb_gauss_pts =
getGaussPts().size2();
2187 auto get_in_at_pts =
2189 *
inMat, nb_gauss_pts);
2190 auto t_in_at_pts = get_in_at_pts();
2191 auto get_out_at_pts =
2193 DL>::size(*
outMat, nb_gauss_pts);
2194 auto t_out_at_pts = get_out_at_pts();
2195 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2196 t_out_at_pts(
i,
j) = (t_in_at_pts(
i,
j) || t_in_at_pts(
j,
i)) / 2;
2227 boost::shared_ptr<MatrixDouble> in_mat,
2228 boost::shared_ptr<MatrixDouble> out_mat)
2247 boost::shared_ptr<MatrixDouble> in_mat,
2248 boost::shared_ptr<MatrixDouble> out_mat)
2262 noalias(*
outMat) = (*scalePtr) * (*inMat);
2281template <
int Base_Dim,
int Field_Dim,
typename M = MatrixDouble>
2287template <
int Field_Dim>
2292 boost::shared_ptr<MatrixDouble> data_ptr,
2294 const EntityType zero_type = MBEDGE,
2295 const int zero_side = 0)
2298 dataPtr(data_ptr), dataVec(data_vec), zeroType(zero_type),
2299 zeroSide(zero_side) {
2305 boost::shared_ptr<MatrixDouble> data_ptr,
2306 const EntityType zero_type = MBEDGE,
2307 const int zero_side = 0)
2329template <
int Field_Dim>
2334 const size_t nb_integration_points = this->getGaussPts().size2();
2335 auto &mat = *dataPtr;
2337 auto get_data_at_pts =
2339 DL>::size(mat, nb_integration_points);
2340 if (
type == zeroType && side == zeroSide) {
2347 if (dataVec.use_count()) {
2348 dotVector.resize(nb_dofs,
false);
2349 const double *array;
2350 CHKERR VecGetArrayRead(dataVec, &array);
2352 for (
int i = 0;
i != local_indices.size(); ++
i)
2353 if (local_indices[
i] != -1)
2354 dotVector[
i] = array[local_indices[
i]];
2357 CHKERR VecRestoreArrayRead(dataVec, &array);
2361 const size_t nb_base_functions = data.
getN().size2() / 3;
2364 auto t_data_at_pts = get_data_at_pts();
2365 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2368 for (; bb != nb_dofs; ++bb) {
2369 t_data_at_pts(
i) += t_n_hdiv(
i) * t_dof;
2373 for (; bb != nb_base_functions; ++bb)
2378 if (dataVec.use_count()) {
2388template <
int Base_Dim,
int Field_Dim = Base_Dim>
2392 Base_Dim, Field_Dim>::OpCalculateHVecVectorField_General;
2398template <
int Base_Dim,
int Field_Dim = Base_Dim>
2401template <
int Field_Dim>
2406 boost::shared_ptr<MatrixDouble> data_ptr,
2407 const EntityType zero_type = MBEDGE,
2408 const int zero_side = 0)
2411 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2432template <
int Field_Dim>
2437 const size_t nb_integration_points = this->getGaussPts().size2();
2438 auto &mat = *dataPtr;
2440 auto get_data_at_pts =
2442 DL>::size(mat, nb_integration_points);
2443 if (
type == zeroType && side == zeroSide) {
2448 const size_t nb_dofs = local_indices.size();
2451 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2452 const double *array;
2453 CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
2454 for (
size_t i = 0;
i != nb_dofs; ++
i)
2455 if (local_indices[
i] != -1)
2456 dot_dofs_vector[
i] = array[local_indices[
i]];
2458 dot_dofs_vector[
i] = 0;
2459 CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
2461 const size_t nb_base_functions = data.
getN().size2() / 3;
2464 auto t_data_at_pts = get_data_at_pts();
2465 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2467 for (; bb != nb_dofs; ++bb) {
2468 t_data_at_pts(
i) += t_n_hdiv(
i) * dot_dofs_vector[bb];
2471 for (; bb != nb_base_functions; ++bb)
2487template <
int BASE_DIM,
int SPACE_DIM>
2492 boost::shared_ptr<VectorDouble> data_ptr,
2493 const EntityType zero_type = MBEDGE,
2494 const int zero_side = 0)
2505 const size_t nb_integration_points =
getGaussPts().size2();
2507 dataPtr->resize(nb_integration_points,
false);
2513 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2518 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2521 for (; bb != nb_dofs; ++bb) {
2522 t_data += t_dof * t_n_diff_hdiv(
j,
j);
2526 for (; bb != nb_base_functions; ++bb)
2546template <
int BASE_DIM,
int SPACE_DIM>
2551 boost::shared_ptr<MatrixDouble> data_ptr,
2552 const EntityType zero_type = MBEDGE,
2553 const int zero_side = 0)
2564 const size_t nb_integration_points =
getGaussPts().size2();
2566 auto get_data_at_pts =
2569 DL>::size(*
dataPtr, nb_integration_points);
2575 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2579 auto t_data_at_pts = get_data_at_pts();
2580 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2583 for (; bb != nb_dofs; ++bb) {
2584 t_data_at_pts(
i,
j) += t_dof * t_base_diff(
i,
j);
2588 for (; bb != nb_base_functions; ++bb)
2609template <
int BASE_DIM,
int FIELD_DIM,
int SPACE_DIM>
2622 boost::shared_ptr<MatrixDouble> data_ptr,
2623 const EntityType zero_type = MBEDGE,
2624 const int zero_side = 0)
2627 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2636 const size_t nb_integration_points = getGaussPts().size2();
2638 auto get_data_at_pts =
2640 DL>::size(*dataPtr, nb_integration_points);
2641 if (
type == zeroType && side == zeroSide) {
2649 "Data inconsistency, nb_dofs %% COEFF_DIM != 0, that is %ld %% %d "
2659 const size_t nb_base_functions = data.
getN().size2() / 3;
2665 auto t_data_at_pts = get_data_at_pts();
2666 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2669 for (; bb != nb_dofs; ++bb) {
2670 t_data_at_pts(
k,
i,
j) += t_base_diff(
i,
j) * t_dof(
k);
2674 for (; bb != nb_base_functions; ++bb)
2692 boost::shared_ptr<MatrixDouble> data_ptr,
2693 const EntityType zero_type = MBEDGE,
2694 const int zero_side = 0)
2697 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2706 const size_t nb_integration_points = getGaussPts().size2();
2708 auto get_data_at_pts =
2710 DL>::size(*dataPtr, nb_integration_points);
2711 if (
type == zeroType && side == zeroSide) {
2719 const size_t nb_base_functions = data.
getN().size2() / 9;
2722 if (data.
getDiffN().size1() != nb_integration_points) {
2724 "Wrong number of integration pts (%ld != %ld)",
2725 static_cast<long>(data.
getDiffN().size1()),
2726 static_cast<long>(nb_integration_points));
2728 if (data.
getDiffN().size2() != nb_base_functions * 27) {
2730 "Wrong number of base functions (%ld != %ld)",
2731 static_cast<long>(data.
getDiffN().size2() / 27),
2732 static_cast<long>(nb_base_functions));
2734 if (nb_base_functions < nb_dofs) {
2736 "Wrong number of base functions (%ld < %ld)",
2737 static_cast<long>(nb_base_functions),
2738 static_cast<long>(nb_dofs));
2747 auto t_data_at_pts = get_data_at_pts();
2748 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2751 for (; bb != nb_dofs; ++bb) {
2752 t_data_at_pts(
k,
i,
j) += t_base_diff(
k,
i,
j) * t_dof;
2756 for (; bb != nb_base_functions; ++bb)
2777template <
int BASE_DIM,
int SPACE_DIM>
2782 boost::shared_ptr<MatrixDouble> data_ptr,
2783 const EntityType zero_type = MBEDGE,
2784 const int zero_side = 0)
2795 const size_t nb_integration_points =
getGaussPts().size2();
2799 DL>::size(*
dataPtr, nb_integration_points);
2807 const int nb_base_functions = data.
getN().size2() /
BASE_DIM;
2810 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
2811 if (hessian_base.size1() != nb_integration_points) {
2813 "Wrong number of integration pts (%ld != %ld)",
2814 static_cast<long>(hessian_base.size1()),
2815 static_cast<long>(nb_integration_points));
2817 if (hessian_base.size2() !=
2820 "Wrong number of base functions (%ld != %ld)",
2821 static_cast<long>(hessian_base.size2() /
2823 static_cast<long>(nb_base_functions));
2827 "Wrong number of base functions (%ld < %ld)",
2828 static_cast<long>(hessian_base.size2()),
2839 auto t_data_at_pts = get_data_at_pts();
2840 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2843 for (; bb != nb_dofs; ++bb) {
2844 t_data_at_pts(
i,
j,
k) += t_dof * t_base_diff2(
i,
j,
k);
2849 for (; bb != nb_base_functions; ++bb)
2868template <
int Tensor_Dim1,
int Tensor_Dim2>
2873 boost::shared_ptr<VectorDouble> data_ptr,
2874 const EntityType zero_type = MBEDGE,
2875 const int zero_side = 0)
2886 const size_t nb_integration_points =
getGaussPts().size2();
2888 dataPtr->resize(nb_integration_points,
false);
2893 const int nb_dofs = local_indices.size();
2896 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2897 const double *array;
2899 for (
size_t i = 0;
i != local_indices.size(); ++
i)
2900 if (local_indices[
i] != -1)
2901 dot_dofs_vector[
i] = array[local_indices[
i]];
2903 dot_dofs_vector[
i] = 0;
2906 const size_t nb_base_functions = data.
getN().size2() / Tensor_Dim1;
2910 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2912 for (; bb != nb_dofs; ++bb) {
2914 for (
auto ii = 0; ii != Tensor_Dim2; ++ii)
2915 div += t_n_diff_hdiv(ii, ii);
2916 t_data += dot_dofs_vector[bb] * div;
2919 for (; bb != nb_base_functions; ++bb)
2955 boost::shared_ptr<MatrixDouble> data_ptr,
2956 const EntityType zero_type = MBEDGE,
2957 const int zero_side = 0);
2979 boost::shared_ptr<MatrixDouble> data_ptr,
2980 const EntityType zero_type = MBVERTEX,
2981 const int zero_side = 0);
3004 boost::shared_ptr<MatrixDouble> data_ptr,
3005 const EntityType zero_type = MBVERTEX,
3006 const int zero_side = 0);
3024template <
int Tensor_Dim0,
int Tensor_Dim1>
3029 boost::shared_ptr<MatrixDouble> data_ptr,
3030 boost::shared_ptr<double> scale_ptr,
3032 const EntityType zero_type = MBEDGE,
3033 const int zero_side = 0)
3043 boost::shared_ptr<MatrixDouble> data_ptr,
3044 const EntityType zero_type = MBEDGE,
3045 const int zero_side = 0)
3053 const size_t nb_integration_points =
getGaussPts().size2();
3055 auto get_data_at_pts =
3058 DL>::size(*
dataPtr, nb_integration_points);
3066 const double *array;
3069 for (
int i = 0;
i != local_indices.size(); ++
i)
3070 if (local_indices[
i] != -1)
3079 const size_t nb_base_functions = data.
getN().size2() / 3;
3083 auto t_data_at_pts = get_data_at_pts();
3084 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3087 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3088 t_data_at_pts(
i,
j) += (
scale * t_dof(
i)) * t_n_hvec(
j);
3092 for (; bb < nb_base_functions; ++bb)
3120template <
int Tensor_Dim0,
int Tensor_Dim1, PetscData::DataContext CTX>
3125 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3126 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3138 const size_t nb_integration_points =
getGaussPts().size2();
3140 auto get_data_at_pts =
3143 DL>::size(*
dataPtr, nb_integration_points);
3148 const size_t nb_dofs = local_indices.size();
3152 const double *array;
3154 auto get_array = [&](
const auto ctx,
auto vec) {
3160 <<
"In this case field degrees of freedom are read from vector. "
3161 "That usually happens when time solver is used, and access to "
3162 "first or second rates is needed. You probably not set ts_u, "
3163 "ts_u_t, or ts_u_tt and associated data structure, i.e. "
3164 "data_ctx to CTX_SET_X, CTX_SET_DX, CTX_SET_X_T, or "
3165 "CTX_SET_X_TT respectively";
3169 CHKERR VecGetArrayRead(vec, &array);
3173 auto restore_array = [&](
auto vec) {
3174 return VecRestoreArrayRead(vec, &array);
3192 "That case is not implemented");
3195 dotVector.resize(local_indices.size(),
false);
3196 for (
int i = 0;
i != local_indices.size(); ++
i)
3197 if (local_indices[
i] != -1)
3217 "That case is not implemented");
3220 const size_t nb_base_functions = data.
getN().size2() / 3;
3224 auto t_data_at_pts = get_data_at_pts();
3225 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3226 auto t_dof = getFTensor1FromArray<Tensor_Dim0, Tensor_Dim0>(
dotVector);
3228 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3229 t_data_at_pts(
i,
j) += t_dof(
i) * t_n_hvec(
j);
3233 for (; bb < nb_base_functions; ++bb)
3249template <
int Tensor_Dim0,
int Tensor_Dim1>
3262template <
int Tensor_Dim0,
int Tensor_Dim1, PetscData::DataContext CTX>
3267 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3268 const EntityType zero_type = MBEDGE,
const int zero_side = 0,
3269 bool throw_error =
true)
3282 const size_t nb_integration_points =
getGaussPts().size2();
3284 auto get_data_at_pts =
3287 DL>::size(*
dataPtr, nb_integration_points);
3292 const size_t nb_dofs = local_indices.size();
3302 const double *array;
3304 auto get_array = [&](
const auto ctx,
auto vec) {
3310 <<
"In this case field degrees of freedom are read from vector. "
3311 "That usually happens when time solver is used, and access to "
3312 "first or second rates is needed. You probably not set ts_u, "
3313 "ts_u_t, or ts_u_tt and associated data structure, i.e. "
3314 "data_ctx to CTX_SET_X, CTX_SET_DX, CTX_SET_X_T, or "
3315 "CTX_SET_X_TT respectively";
3319 CHKERR VecGetArrayRead(vec, &array);
3323 auto restore_array = [&](
auto vec) {
3324 return VecRestoreArrayRead(vec, &array);
3342 "That case is not implemented");
3345 dotVector.resize(local_indices.size(),
false);
3346 for (
int i = 0;
i != local_indices.size(); ++
i)
3347 if (local_indices[
i] != -1)
3367 "That case is not implemented");
3370 const size_t nb_base_functions =
3371 data.
getN().size2() / (Tensor_Dim0 * Tensor_Dim1);
3374 auto t_n_hten = data.
getFTensor2N<Tensor_Dim0, Tensor_Dim1>();
3375 auto t_data_at_pts = get_data_at_pts();
3376 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3379 for (; bb != nb_dofs; ++bb) {
3380 t_data_at_pts(
i,
j) += t_dof * t_n_hten(
i,
j);
3384 for (; bb < nb_base_functions; ++bb)
3400template <
int Tensor_Dim0,
int Tensor_Dim1>
3410template <
int Tensor_Dim0,
int Tensor_Dim1>
3417 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3419 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3420 boost::shared_ptr<double> scale_ptr =
nullptr,
3421 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3449template <
int Tensor_Dim0,
int Tensor_Dim1>
3454 const size_t nb_integration_points = OP::getGaussPts().size2();
3456 auto get_data_at_pts =
3459 DL>::size(*dataPtr, nb_integration_points);
3460 if (
type == zeroType)
3466 if (dataVec.use_count()) {
3467 dotVector.resize(nb_dofs,
false);
3468 const double *array;
3469 CHKERR VecGetArrayRead(dataVec, &array);
3471 for (
int i = 0;
i != local_indices.size(); ++
i)
3472 if (local_indices[
i] != -1)
3473 dotVector[
i] = array[local_indices[
i]];
3476 CHKERR VecRestoreArrayRead(dataVec, &array);
3487 auto get_get_side_face_dofs = [&]() {
3488 auto fe_type = OP::getFEType();
3492 std::vector<int> side_face_dofs;
3493 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3497 auto it = side_dof_map.get<1>().begin();
3498 it != side_dof_map.get<1>().end(); ++it
3501 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3504 if (it->type == brokenType) {
3505 if (brokenRangePtr) {
3506 auto ent = OP::getSideEntity(it->side, brokenType);
3507 if (brokenRangePtr->find(ent) != brokenRangePtr->end()) {
3508 side_face_dofs.push_back(it->dof);
3511 side_face_dofs.push_back(it->dof);
3516 return side_face_dofs;
3519 auto side_face_dofs = get_get_side_face_dofs();
3523 auto t_data_at_pts = get_data_at_pts();
3524 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3525 for (
auto b : side_face_dofs) {
3527 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(data.
getFieldData().data() +
3529 t_data_at_pts(
i,
j) += t_dof(
i) * t_row_base(
j);
3533 *dataPtr *= (scalePtr) ? *scalePtr : 1.0;
3535 if (dataVec.use_count()) {
3549template <
int Tensor_Dim0,
int Tensor_Dim1>
3554 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3555 boost::shared_ptr<double> scale_ptr,
3557 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3567 boost::shared_ptr<MatrixDouble> data_ptr,
3568 const EntityType zero_type = MBEDGE,
3569 const int zero_side = 0)
3577 const size_t nb_integration_points =
getGaussPts().size2();
3579 auto get_data_at_pts =
3582 DL>::size(*
dataPtr, nb_integration_points);
3591 const double *array;
3594 for (
int i = 0;
i != local_indices.size(); ++
i)
3595 if (local_indices[
i] != -1)
3604 const size_t nb_base_functions =
3605 data.
getN().size2() / (Tensor_Dim0 * Tensor_Dim1);
3608 auto t_n_hten = data.
getFTensor2N<Tensor_Dim0, Tensor_Dim1>();
3609 auto t_data_at_pts = get_data_at_pts();
3610 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3613 for (; bb != nb_dofs; ++bb) {
3614 t_data_at_pts(
i,
j) += (
scale * t_dof) * t_n_hten(
i,
j);
3618 for (; bb < nb_base_functions; ++bb)
3646template <
int Tensor_Dim0,
int Tensor_Dim1,
3652 boost::shared_ptr<MatrixDouble> data_ptr,
3654 const EntityType zero_type = MBEDGE,
3655 const int zero_side = 0)
3665 boost::shared_ptr<MatrixDouble> data_ptr,
3666 const EntityType zero_type = MBEDGE,
3667 const int zero_side = 0)
3674 const size_t nb_integration_points =
getGaussPts().size2();
3677 auto get_data_at_pts =
3679 DL>::size(mat, nb_integration_points);
3688 const double *array;
3691 for (
int i = 0;
i != local_indices.size(); ++
i)
3692 if (local_indices[
i] != -1)
3700 const size_t nb_base_functions = data.
getN().size2() / 3;
3704 auto t_data_at_pts = get_data_at_pts();
3707 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3710 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3711 double div = t_n_diff_hvec(
j,
j);
3712 t_data_at_pts(
i) += t_dof(
i) * div;
3714 t_data_at_pts(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3720 for (; bb < nb_base_functions; ++bb) {
3753template <
int Tensor_Dim0,
int Tensor_Dim1,
3761 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3763 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3764 boost::shared_ptr<double> scale_ptr =
nullptr,
3765 const EntityType zero_type = MBEDGE)
3777 const size_t nb_integration_points =
getGaussPts().size2();
3780 auto get_data_at_pts =
3782 DL>::size(mat, nb_integration_points);
3792 const double *array;
3795 for (
int i = 0;
i != local_indices.size(); ++
i)
3796 if (local_indices[
i] != -1)
3811 auto get_get_side_face_dofs = [&]() {
3816 std::vector<int> side_face_dofs;
3817 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3821 auto it = side_dof_map.get<1>().begin();
3822 it != side_dof_map.get<1>().end(); ++it
3825 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3832 side_face_dofs.push_back(it->dof);
3835 side_face_dofs.push_back(it->dof);
3840 return side_face_dofs;
3843 auto side_face_dofs = get_get_side_face_dofs();
3847 auto t_data_at_pts = get_data_at_pts();
3849 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3850 for (
auto b : side_face_dofs) {
3851 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(
3855 double div = t_diff_base(
j,
j);
3856 t_data_at_pts(
i) += t_dof(
i) * div;
3858 t_data_at_pts(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3889template <
int Tensor_Dim,
typename OpBase>
3893 boost::shared_ptr<MatrixDouble> data_ptr,
3894 boost::shared_ptr<double> scale_ptr,
3895 const EntityType zero_type = MBEDGE,
3896 const int zero_side = 0)
3904 boost::shared_ptr<MatrixDouble> data_ptr,
3905 const EntityType zero_type = MBEDGE,
3906 const int zero_side = 0)
3913 const size_t nb_integration_points = OpBase::getGaussPts().size2();
3916 auto get_data_at_pts =
3918 DL>::size(mat, nb_integration_points);
3925 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
3926 const size_t nb_base_functions = data.
getN().size2() / 3;
3928 auto t_data_at_pts = get_data_at_pts();
3929 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3931 t_normalized_normal(
j) = t_normal(
j);
3935 for (; bb != nb_dofs / Tensor_Dim; ++bb) {
3937 (scale_val * t_dof(
i)) * (t_base(
j) * t_normalized_normal(
j));
3941 for (; bb < nb_base_functions; ++bb) {
3984 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3997 template <
int D1,
int D2,
int J1,
int J2>
4001 static_assert(D2 == J2,
"Dimension of jacobian and dimension of <out> "
4002 "directive does not match");
4004 size_t nb_functions = diff_n.size2() / D1;
4006 size_t nb_gauss_pts = diff_n.size1();
4011 "Wrong number of Gauss Pts");
4012 if (diff_n.size2() % D1)
4014 "Number of directives of base functions and D1 dimension does "
4018 diffNinvJac.resize(diff_n.size1(), D2 * nb_functions,
false);
4022 auto t_diff_n = getFTensor1FromPtr<D2>(&*
diffNinvJac.data().begin());
4023 auto t_diff_n_ref = getFTensor1FromPtr<D1>(&*diff_n.data().begin());
4025 auto get_inv_jac_at_pts =
4028 auto t_inv_jac_at_pts = get_inv_jac_at_pts();
4029 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg, ++t_inv_jac_at_pts) {
4030 for (
size_t dd = 0; dd != nb_functions; ++dd) {
4031 t_diff_n(
i) = t_inv_jac_at_pts(
k,
i) * t_diff_n_ref(
k);
4076template <
int DERIVARIVE = 1>
4083template <
int DERIVARIVE = 1>
4090template <
int DERIVARIVE = 1>
4094 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
4098template <
int DERIVARIVE = 1>
4102 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
4120 invJacPtr(inv_jac_ptr) {}
4174 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
4211 boost::shared_ptr<MatrixDouble> jac_ptr)
4228 2>::OpSetContravariantPiolaTransformOnFace2DImpl;
4427 template <
typename T>
4429 boost::shared_ptr<T> det_ptr,
4430 boost::shared_ptr<MatrixDouble> out_ptr)
4440 std::variant<boost::shared_ptr<VectorDouble>, boost::shared_ptr<MatrixDouble>>
4452 "Pointer for inPtr matrix not allocated");
4454 if (!std::holds_alternative<boost::shared_ptr<VectorDouble>>(detPtrVariant) &&
4455 !std::holds_alternative<boost::shared_ptr<MatrixDouble>>(detPtrVariant)) {
4457 "detPtrVariant must hold either VectorDouble or MatrixDouble");
4460 const auto nb_integration_pts = inPtr->size1();
4463 const auto nb_rows = inPtr->size2();
4464 if (nb_rows != DIM * DIM)
4466 "Wrong number of matrix coefficients");
4471 using T = std::decay_t<
decltype(ptr)>;
4473 if constexpr (std::is_same_v<T, boost::shared_ptr<VectorDouble>>) {
4474 ptr->resize(nb_integration_pts,
false);
4475 }
else if constexpr (std::is_same_v<T, boost::shared_ptr<MatrixDouble>>) {
4476 ptr->resize(nb_integration_pts, 1,
false);
4482 auto get_in_at_pts =
4484 *inPtr, nb_integration_pts);
4488 auto t_in_at_pts = get_in_at_pts();
4489 auto det_it = std::visit(
4490 [](
auto p) -> std::vector<double>::iterator {
4491 return p->data().begin();
4494 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4503 auto get_out_at_pts =
4505 *outPtr, nb_integration_pts);
4506 auto t_in_at_pts = get_in_at_pts();
4507 auto t_out_at_pts = get_out_at_pts();
4508 auto det_it = std::visit(
4509 [](
auto p) -> std::vector<double>::iterator {
4510 return p->data().begin();
4513 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4548 boost::shared_ptr<VectorDouble> out_ptr)
4569 "Pointer for inPtr matrix not allocated");
4571 const auto nb_integration_pts = inPtr->size1();
4575 auto get_in_at_pts =
4577 *inPtr, nb_integration_pts);
4578 outPtr->resize(nb_integration_pts,
false);
4579 auto t_in_at_pts = get_in_at_pts();
4582 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4583 t_out = t_in_at_pts(
i,
i);
4605 boost::shared_ptr<VectorDouble> out_ptr)
4626 "Pointer for inPtr matrix not allocated");
4628 const auto nb_integration_pts = inPtr->size1();
4631 outPtr->resize(nb_integration_pts,
false);
4633 auto get_in_at_pts =
4635 DL>::get(*inPtr, nb_integration_pts);
4636 auto t_in_at_pts = get_in_at_pts();
4639 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4640 t_out = t_in_at_pts(
i,
i);
Tensor1< T, Tensor_Dim > normalize()
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
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.
UBlasMatrix< double > MatrixDouble
VecAllocator< double > DoubleAllocator
implementation of Data Operators for Forces and Sources
decltype(GetFTensor2SymmetricFromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2SymmetricFromMatType
static auto getFTensor3DgFromMat(M &data)
Get symmetric tensor rank 3 on the first two indices from form data matrix.
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.
OpCalculateScalarFieldValuesFromPetscVecImpl< PetscData::CTX_SET_X_T > OpCalculateScalarFieldValuesDot
decltype(GetFTensor1FromMatImpl< Tensor_Dim, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor1FromMatType
static auto getFTensor0FromVec(V &data)
Get tensor rank 0 (scalar) form data vector.
decltype(GetFTensor3FromMatImpl< Tensor_Dim0, Tensor_Dim1, Tensor_Dim2, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor3FromMatType
decltype(GetFTensor2FromMatImpl< Tensor_Dim0, Tensor_Dim1, S, DL, M >::get(std::declval< M & >(), 0, 0)) GetFTensor2FromMatType
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.
auto getFTensor2SymmetricFieldData()
Return symmetric FTensor rank 2, i.e. matrix from field data coefficients.
auto getFTensor2FieldData()
Return FTensor rank 2, i.e. matrix from field data coefficients.
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)
auto getFTensor1FieldData()
Return FTensor of rank 1, i.e. vector from field data coefficients.
auto getFTensor2N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
auto getFTensor1DiffN(const FieldApproximationBase base)
Get derivatives of base functions.
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.
auto getFTensor1N(FieldApproximationBase base)
Get base functions for Hdiv/Hcurl spaces.
FTensor::Tensor0< FTensor::PackPtr< double *, 1 > > getFTensor0FieldData()
Return scalar files as a FTensor of rank 0.
const VectorDofs & getFieldDofs() const
Get DOF data structures (const version)
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.
OpType
Controls loop over entities on element.
@ 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
Approximate tensor field values for a given PETSc vector on a tensor basis.
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
OpCalculateHTensorTensorFieldFromPetscVecImpl(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBEDGE, const int zero_side=0, bool throw_error=true)
boost::shared_ptr< MatrixDouble > dataPtr
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)
Approximate Hdiv/Hcurl tensor field values for a given PETSc vector.
boost::shared_ptr< MatrixDouble > dataPtr
OpCalculateHVecTensorFieldFromPetscVecImpl(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.
const EntityHandle zeroType
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, const EntityType zero_type=MBEDGE, const int zero_side=0)
SmartPetscObj< Vec > dataVec
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)
const EntityHandle zeroType
boost::shared_ptr< MatrixDouble > dataPtr
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)
boost::shared_ptr< ublas::vector< T, A > > dataPtr
OpCalculateScalarFieldValues_General(const ForcesAndSourcesCore::UserDataOperator::OpType op_type, 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.
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, 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.
const EntityHandle zeroType
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX)
OpCalculateTensor2FieldValues_General(ForcesAndSourcesCore::UserDataOperator::OpType op_type, const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBVERTEX)
SmartPetscObj< Vec > dataVec
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBVERTEX)
boost::shared_ptr< MatrixDouble > dataPtr
Calculate field values for tenor field rank 2.
const EntityHandle zeroType
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
boost::shared_ptr< M > dataPtr
OpCalculateTensor2FieldValues_General(const std::string field_name, boost::shared_ptr< M > data_ptr, const EntityType zero_type=MBVERTEX)
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.
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, SmartPetscObj< Vec > data_vec, const EntityType zero_type=MBVERTEX, const int max_order=-1)
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< MatrixDouble > data_ptr, const EntityType zero_type=MBVERTEX, const int max_order=-1)
const EntityHandle zeroType
SmartPetscObj< Vec > dataVec
boost::shared_ptr< MatrixDouble > dataPtr
Calculate field values for tensor field rank 1, i.e. vector field.
OpCalculateVectorFieldValues_General(const std::string field_name, boost::shared_ptr< M > data_ptr, const EntityType zero_type=MBVERTEX)
Constructor for vector field values calculation operator.
boost::shared_ptr< M > dataPtr
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
calculate values of vector field at integration points
const EntityHandle zeroType
Specialization for MatrixDouble vector field values calculation.
Operator for inverting matrices at integration points.
OpInvertMatrix(boost::shared_ptr< MatrixDouble > in_ptr, boost::shared_ptr< T > det_ptr, boost::shared_ptr< MatrixDouble > out_ptr)
Constructor for matrix inversion operator.
boost::shared_ptr< MatrixDouble > outPtr
boost::shared_ptr< MatrixDouble > inPtr
std::variant< boost::shared_ptr< VectorDouble >, boost::shared_ptr< MatrixDouble > > detPtrVariant
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.
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
MoFEMErrorCode doWork(int, EntityType, EntData &)
Operator for linear form, usually to calculate values on right hand side.
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, EntityType, EntData &)
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
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
MoFEMErrorCode doWork(int, EntityType, EntData &)
Operator for linear form, usually to calculate values on right hand side.
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