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 (
int 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)
453 boost::shared_ptr<MatrixDouble> data_ptr,
455 const EntityType zero_type = MBVERTEX)
477template <
int Tensor_Dim>
483 const size_t nb_gauss_pts = getGaussPts().size2();
484 auto &mat = *dataPtr;
487 auto get_values_at_gauss_pts =
490 if (
type == zeroType) {
497 if (dataVec.use_count()) {
498 dotVector.resize(nb_dofs,
false);
500 CHKERR VecGetArrayRead(dataVec, &array);
502 for (
int i = 0;
i != local_indices.size(); ++
i)
503 if (local_indices[
i] != -1)
504 dotVector[
i] = array[local_indices[
i]];
507 CHKERR VecRestoreArrayRead(dataVec, &array);
512 const size_t nb_base_functions = data.
getN().size2();
514 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
516 const size_t size = nb_dofs / Tensor_Dim;
517 if (nb_dofs % Tensor_Dim) {
519 "Nb. of DOFs is inconsistent with Tensor_Dim");
521 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
525 if (field_data.l2() != field_data.l2()) {
526 MOFEM_LOG(
"SELF", Sev::error) <<
"field data: " << field_data;
528 "Wrong number in coefficients");
533 for (; bb != size; ++bb) {
537 if (base_function != base_function) {
538 MOFEM_LOG(
"SELF", Sev::error) <<
"base function: " << base_function;
540 "Wrong number number in base functions");
545 t_values_at_gauss_pts(
I) += field_data(
I) * base_function;
551 for (; bb < nb_base_functions; ++bb)
553 ++t_values_at_gauss_pts;
557 if (dataVec.use_count()) {
575template <
int Tensor_Dim>
580 Tensor_Dim>::OpCalculateVectorFieldValues_General;
599template <
int Tensor_Dim, CoordinateTypes COORDINATE_SYSTEM = CARTESIAN>
611 const std::string
field_name, boost::shared_ptr<VectorDouble> data_ptr,
612 const EntityType zero_type = MBVERTEX)
625 if constexpr (COORDINATE_SYSTEM ==
POLAR || COORDINATE_SYSTEM ==
SPHERICAL)
627 "%s coordiante not implemented",
633 vec.resize(nb_gauss_pts,
false);
641 const size_t nb_base_functions = data.
getN().size2();
644 const size_t size = nb_dofs / Tensor_Dim;
646 if (nb_dofs % Tensor_Dim) {
648 "Number of dofs should multiple of dimensions");
653 if constexpr (COORDINATE_SYSTEM ==
CARTESIAN) {
655 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
658 for (; bb != size; ++bb) {
659 values_at_gauss_pts += field_data(
I) * diff_base_function(
I);
661 ++diff_base_function;
665 for (; bb < nb_base_functions; ++bb)
666 ++diff_base_function;
667 ++values_at_gauss_pts;
677 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
680 for (; bb != size; ++bb) {
681 values_at_gauss_pts += field_data(
I) * diff_base_function(
I);
682 values_at_gauss_pts +=
683 base_function * (field_data(0) / t_coords(0));
686 ++diff_base_function;
690 for (; bb < nb_base_functions; ++bb) {
692 ++diff_base_function;
694 ++values_at_gauss_pts;
715template <
int Tensor_Dim, PetscData::DataContext CTX>
720 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
721 const EntityType zero_at_type = MBVERTEX,
bool throw_error =
true)
734 const size_t nb_dofs = local_indices.size();
739 auto get_values_at_gauss_pts =
741 DL>::size(mat, nb_gauss_pts);
756 auto get_array = [&](
const auto ctx,
auto vec) {
762 <<
"In this case field degrees of freedom are read from vector. "
763 "That usually happens when time solver is used, and access to "
764 "first or second rates is needed. You probably not set ts_u, "
765 "ts_u_t, or ts_u_tt and associated data structure, i.e. "
766 "data_ctx to CTX_SET_X, CTX_SET_DX, CTX_SET_X_T, or "
767 "CTX_SET_X_TT respectively";
771 CHKERR VecGetArrayRead(vec, &array);
775 auto restore_array = [&](
auto vec) {
776 return VecRestoreArrayRead(vec, &array);
794 "That case is not implemented");
798 for (
int i = 0;
i != local_indices.size(); ++
i)
799 if (local_indices[
i] != -1)
819 "That case is not implemented");
822 const size_t nb_base_functions = data.
getN().size2();
824 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
827 const size_t size = nb_dofs / Tensor_Dim;
828 if (nb_dofs % Tensor_Dim) {
831 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
832 auto field_data = getFTensor1FromArray<Tensor_Dim, Tensor_Dim>(
dotVector);
834 for (; bb != size; ++bb) {
835 t_values_at_gauss_pts(
I) += field_data(
I) * base_function;
841 for (; bb < nb_base_functions; ++bb)
843 ++t_values_at_gauss_pts;
860template <
int Tensor_Dim>
870template <
int Tensor_Dim>
880template <
int Tensor_Dim>
894template <
int Tensor_Dim0,
int Tensor_Dim1,
typename M = MatrixDouble>
900 boost::shared_ptr<M> data_ptr,
901 const EntityType zero_type = MBVERTEX)
917template <
int Tensor_Dim0,
int Tensor_Dim1,
typename M>
923 "Not implemented for matrix type = %s, dim0 = %d and dim1 = %d",
925 Tensor_Dim0, Tensor_Dim1);
929template <
int Tensor_Dim0,
int Tensor_Dim1>
936 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
945 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
946 const EntityType zero_type = MBVERTEX)
952 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
956 data_vec, zero_type) {}
968template <
int Tensor_Dim0,
int Tensor_Dim1>
976 const size_t nb_gauss_pts = data.
getN().size1();
977 auto get_values_at_gauss_pts =
979 DL>::size(mat, nb_gauss_pts);
980 if (
type == zeroType)
985 if (dataVec.use_count()) {
986 dotVector.resize(nb_dofs,
false);
988 CHKERR VecGetArrayRead(dataVec, &array);
990 for (
int i = 0;
i != local_indices.size(); ++
i)
991 if (local_indices[
i] != -1)
992 dotVector[
i] = array[local_indices[
i]];
995 CHKERR VecRestoreArrayRead(dataVec, &array);
1000 const size_t nb_base_functions = data.
getN().size2();
1002 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1005 const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
1006 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1009 for (; bb != size; ++bb) {
1010 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1014 for (; bb < nb_base_functions; ++bb)
1016 ++t_values_at_gauss_pts;
1019 if (dataVec.use_count()) {
1031template <
int Tensor_Dim0,
int Tensor_Dim1>
1037 Tensor_Dim0, Tensor_Dim1>::OpCalculateTensor2FieldValues_General;
1045template <
int Tensor_Dim0,
int Tensor_Dim1>
1050 boost::shared_ptr<MatrixDouble> data_ptr,
1051 const EntityType zero_at_type = MBVERTEX)
1064 const size_t nb_gauss_pts =
getGaussPts().size2();
1066 auto get_values_at_gauss_pts =
1069 DL>::size(mat, nb_gauss_pts);
1073 const size_t nb_dofs = local_indices.size();
1076 const double *array;
1078 for (
size_t i = 0;
i != local_indices.size(); ++
i)
1079 if (local_indices[
i] != -1)
1085 const size_t nb_base_functions = data.
getN().size2();
1088 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1091 const size_t size = nb_dofs / (Tensor_Dim0 * Tensor_Dim1);
1092 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
1094 getFTensor2FromPtr<Tensor_Dim0, Tensor_Dim1>(&*
dotVector.begin());
1096 for (; bb != size; ++bb) {
1097 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1101 for (; bb < nb_base_functions; ++bb)
1103 ++t_values_at_gauss_pts;
1122template <
int Tensor_Dim>
1127 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1128 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
1137 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1139 const int zero_side = 0)
1154 auto get_values_at_gauss_pts =
1156 DL>::size(mat, nb_gauss_pts);
1166 const double *array;
1169 for (
int i = 0;
i != local_indices.size(); ++
i)
1170 if (local_indices[
i] != -1)
1178 const int nb_base_functions = data.
getN().size2();
1180 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1183 const int size = nb_dofs / ((Tensor_Dim * (Tensor_Dim + 1)) / 2);
1184 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1187 for (; bb != size; ++bb) {
1188 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1192 for (; bb < nb_base_functions; ++bb)
1194 ++t_values_at_gauss_pts;
1219template <
int Tensor_Dim>
1224 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1225 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
1238 constexpr auto symm_size = (Tensor_Dim * (Tensor_Dim + 1)) / 2;
1240 auto get_values_at_gauss_pts =
1242 DL>::size(mat, nb_gauss_pts);
1247 const int nb_dofs = local_indices.size();
1255 <<
"In this case field degrees of freedom are read from vector. "
1256 "That usually happens when time solver is used, and acces to "
1257 "first rates is needed. You probably not set "
1258 "ts_u_t and associated data structure data_ctx to CTX_SET_X_T "
1265 const double *array;
1267 for (
int i = 0;
i != local_indices.size(); ++
i)
1268 if (local_indices[
i] != -1)
1274 const int nb_base_functions = data.
getN().size2();
1277 auto t_values_at_gauss_pts = get_values_at_gauss_pts();
1280 const int size = nb_dofs / symm_size;
1281 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1282 auto field_data = getFTensorDotData<Tensor_Dim>();
1284 for (; bb != size; ++bb) {
1285 t_values_at_gauss_pts(
i,
j) += field_data(
i,
j) * base_function;
1289 for (; bb < nb_base_functions; ++bb)
1291 ++t_values_at_gauss_pts;
1304 static_assert(Dim || !Dim,
"not implemented");
1313 &dotVector[0], &dotVector[1], &dotVector[2], &dotVector[3], &dotVector[4],
1322 &dotVector[0], &dotVector[1], &dotVector[2]);
1336template <
int Tensor_Dim,
typename M = MatrixDouble>
1341 Tensor_Dim,
M>::OpCalculateVectorFieldValues_General;
1348template <
int Tensor_Dim>
1353 Tensor_Dim,
MatrixDouble>::OpCalculateVectorFieldValues_General;
1371template <
int Tensor_Dim>
1377 const size_t nb_gauss_pts = this->getGaussPts().size2();
1378 auto &mat = *this->dataPtr;
1380 auto get_gradients_at_pts =
1382 DL>::size(mat, nb_gauss_pts);
1383 if (
type == this->zeroType) {
1391 const int nb_base_functions = data.
getN().size2();
1393 auto t_gradients_at_pts = get_gradients_at_pts();
1396 if (nb_dofs > nb_base_functions)
1398 "Number of base functions inconsistent with number of DOFs "
1400 nb_dofs, nb_base_functions);
1402 if (data.
getDiffN().size2() != nb_base_functions * Tensor_Dim)
1405 "Number of base functions inconsistent with number of derivatives "
1407 data.
getDiffN().size2(), nb_base_functions);
1409 if (data.
getDiffN().size1() != nb_gauss_pts)
1412 "Number of base functions inconsistent with number of integration "
1414 data.
getDiffN().size1(), nb_gauss_pts);
1419 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1422 for (; bb != nb_dofs; ++bb) {
1423 t_gradients_at_pts(
I) += field_data * diff_base_function(
I);
1425 ++diff_base_function;
1428 for (; bb < nb_base_functions; ++bb)
1429 ++diff_base_function;
1430 ++t_gradients_at_pts;
1443template <
int Tensor_Dim>
1447 Tensor_Dim>::OpCalculateScalarFieldGradient_General;
1454template <
int Tensor_Dim>
1459 Tensor_Dim>::OpCalculateVectorFieldValues_General;
1472template <
int Tensor_Dim>
1477 const size_t nb_gauss_pts = this->getGaussPts().size2();
1479 auto &mat = *this->dataPtr;
1480 auto get_hessian_at_gauss_pts =
1482 DL>::size(mat, nb_gauss_pts);
1483 if (
type == this->zeroType)
1490 const int nb_base_functions = data.
getN().size2();
1492 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
1494 if (hessian_base.size1() != nb_gauss_pts) {
1496 "Wrong number of integration pts (%ld != %ld)",
1497 static_cast<long>(hessian_base.size1()),
1498 static_cast<long>(nb_gauss_pts));
1500 if (hessian_base.size2() != nb_base_functions * Tensor_Dim * Tensor_Dim) {
1502 "Wrong number of base functions (%ld != %ld)",
1503 static_cast<long>(hessian_base.size2() /
1504 (Tensor_Dim * Tensor_Dim)),
1505 static_cast<long>(nb_base_functions));
1507 if (hessian_base.size2() < nb_dofs * Tensor_Dim * Tensor_Dim) {
1509 "Wrong number of base functions (%ld < %ld)",
1510 static_cast<long>(hessian_base.size2()),
1511 static_cast<long>(nb_dofs * Tensor_Dim * Tensor_Dim));
1515 auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim, Tensor_Dim>(
1516 &*hessian_base.data().begin());
1518 auto t_hessian_at_gauss_pts = get_hessian_at_gauss_pts();
1522 for (
int gg = 0; gg != nb_gauss_pts; ++gg) {
1525 for (; bb != nb_dofs; ++bb) {
1526 t_hessian_at_gauss_pts(
I,
J) +=
1527 field_data * t_diff2_base_function(
I,
J);
1529 ++t_diff2_base_function;
1532 for (; bb < nb_base_functions; ++bb) {
1533 ++t_diff2_base_function;
1536 ++t_hessian_at_gauss_pts;
1560template <
int Tensor_Dim0,
int Tensor_Dim1,
int S,
1567 Tensor_Dim0, Tensor_Dim1,
M>::OpCalculateTensor2FieldValues_General;
1570template <
int Tensor_Dim0,
int Tensor_Dim1,
int S>
1574 Tensor_Dim0, Tensor_Dim1, MatrixDouble> {
1577 Tensor_Dim0, Tensor_Dim1,
MatrixDouble>::OpCalculateTensor2FieldValues_General;
1595template <
int Tensor_Dim0,
int Tensor_Dim1,
int S>
1602 "Data pointer not allocated");
1604 const size_t nb_gauss_pts = this->getGaussPts().size2();
1606 auto &mat = *this->dataPtr;
1607 auto get_gradients_at_pts =
1610 DL>::size(mat, nb_gauss_pts);
1611 if (
type == this->zeroType)
1619 if (this->dataVec.use_count()) {
1620 this->dotVector.resize(nb_dofs,
false);
1621 const double *array;
1622 CHKERR VecGetArrayRead(this->dataVec, &array);
1624 for (
int i = 0;
i != local_indices.size(); ++
i)
1625 if (local_indices[
i] != -1)
1626 this->dotVector[
i] = array[local_indices[
i]];
1628 this->dotVector[
i] = 0;
1629 CHKERR VecRestoreArrayRead(this->dataVec, &array);
1633 const int nb_base_functions = data.
getN().size2();
1635 auto t_gradients_at_pts = get_gradients_at_pts();
1638 int size = nb_dofs / Tensor_Dim0;
1639 if (nb_dofs % Tensor_Dim0) {
1641 "Data inconsistency");
1643 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1644 auto field_data = getFTensor1FromPtr<Tensor_Dim0, S>(
1648 if (field_data.l2() != field_data.l2()) {
1649 MOFEM_LOG(
"SELF", Sev::error) <<
"field data " << field_data;
1651 "Wrong number in coefficients");
1656 for (; bb < size; ++bb) {
1659 if (diff_base_function.l2() != diff_base_function.l2()) {
1661 <<
"diff_base_function: " << diff_base_function;
1663 "Wrong number number in base functions");
1668 t_gradients_at_pts(
I,
J) += field_data(
I) * diff_base_function(
J);
1670 ++diff_base_function;
1674 for (; bb != nb_base_functions; ++bb)
1675 ++diff_base_function;
1676 ++t_gradients_at_pts;
1679 if (this->dataVec.use_count()) {
1696template <
int Tensor_Dim0,
int Tensor_Dim1,
int S = Tensor_Dim0>
1702 Tensor_Dim0, Tensor_Dim1, S>::OpCalculateVectorFieldGradient_General;
1710template <
int Tensor_Dim0,
int Tensor_Dim1>
1715 boost::shared_ptr<MatrixDouble> data_ptr,
1716 const EntityType zero_at_type = MBVERTEX)
1729 const int nb_dofs = local_indices.size();
1730 const int nb_gauss_pts = this->
getGaussPts().size2();
1734 auto get_gradients_at_pts =
1737 DL>::size(mat, nb_gauss_pts);
1744 const double *array;
1746 for (
int i = 0;
i != local_indices.size(); ++
i)
1747 if (local_indices[
i] != -1)
1753 const int nb_base_functions = data.
getN().size2();
1755 auto t_gradients_at_pts = get_gradients_at_pts();
1758 int size = nb_dofs / Tensor_Dim0;
1759 if (nb_dofs % Tensor_Dim0) {
1763 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1764 auto field_data = getFTensor1FromPtr<Tensor_Dim0>(&*
dotVector.begin());
1766 for (; bb < size; ++bb) {
1767 t_gradients_at_pts(
I,
J) += field_data(
I) * diff_base_function(
J);
1769 ++diff_base_function;
1773 for (; bb != nb_base_functions; ++bb)
1774 ++diff_base_function;
1775 ++t_gradients_at_pts;
1791template <
int Tensor_Dim0,
int Tensor_Dim1,
typename M = MatrixDouble>
1797 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1798 const EntityType zero_type = MBVERTEX)
1803template <
int Tensor_Dim0,
int Tensor_Dim1>
1808 Tensor_Dim0, Tensor_Dim1, MatrixDouble> {
1811 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1812 const EntityType zero_type = MBVERTEX)
1833template <
int Tensor_Dim0,
int Tensor_Dim1>
1840 "Data pointer not allocated");
1842 const size_t nb_gauss_pts = this->getGaussPts().size2();
1843 constexpr size_t msize = (Tensor_Dim0 * (Tensor_Dim0 + 1)) / 2;
1844 auto &mat = *this->dataPtr;
1845 if (
type == this->zeroType) {
1846 mat.resize(msize * Tensor_Dim1, nb_gauss_pts,
false);
1855 const int nb_base_functions = data.
getN().size2();
1857 auto gradients_at_pts =
1863 int size = nb_dofs / msize;
1864 if (nb_dofs % msize) {
1866 "Data inconsistency");
1868 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
1871 for (; bb < size; ++bb) {
1872 gradients_at_pts(
I,
J,
K) +=
1873 field_data(
I,
J) * diff_base_function(
K);
1875 ++diff_base_function;
1879 for (; bb != nb_base_functions; ++bb)
1880 ++diff_base_function;
1893template <
int Tensor_Dim0,
int Tensor_Dim1>
1896 Tensor_Dim0, Tensor_Dim1> {
1899 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
1900 const EntityType zero_type = MBVERTEX)
1902 Tensor_Dim0, Tensor_Dim1>(
field_name, data_ptr, zero_type) {}
1905template <
int Tensor_Dim0,
int Tensor_Dim1>
1911 Tensor_Dim0, Tensor_Dim1>::OpCalculateTensor2FieldValues_General;
1929template <
int Tensor_Dim0,
int Tensor_Dim1>
1935 "Data pointer not allocated");
1937 const size_t nb_gauss_pts = this->getGaussPts().size2();
1938 auto &mat = *this->dataPtr;
1942 DL>::size(mat, nb_gauss_pts);
1943 if (
type == this->zeroType) {
1952 if (this->dataVec.use_count()) {
1953 this->dotVector.resize(nb_dofs,
false);
1954 const double *array;
1955 CHKERR VecGetArrayRead(this->dataVec, &array);
1957 for (
int i = 0;
i != local_indices.size(); ++
i)
1958 if (local_indices[
i] != -1)
1959 this->dotVector[
i] = array[local_indices[
i]];
1961 this->dotVector[
i] = 0;
1962 CHKERR VecRestoreArrayRead(this->dataVec, &array);
1966 const int nb_base_functions = data.
getN().size2();
1968 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
1970 if (hessian_base.size1() != nb_gauss_pts) {
1972 "Wrong number of integration pts (%ld != %ld)",
1973 static_cast<long>(hessian_base.size1()),
1974 static_cast<long>(nb_gauss_pts));
1976 if (hessian_base.size2() !=
1977 nb_base_functions * Tensor_Dim1 * Tensor_Dim1) {
1979 "Wrong number of base functions (%ld != %ld)",
1980 static_cast<long>(hessian_base.size2() /
1981 (Tensor_Dim1 * Tensor_Dim1)),
1982 static_cast<long>(nb_base_functions));
1984 if (hessian_base.size2() <
1985 (nb_dofs / Tensor_Dim0) * Tensor_Dim1 * Tensor_Dim1) {
1987 "Wrong number of base functions (%ld < %ld)",
1988 static_cast<long>(hessian_base.size2()),
1989 static_cast<long>((nb_dofs / Tensor_Dim0) * Tensor_Dim1 *
1994 auto t_diff2_base_function = getFTensor2FromPtr<Tensor_Dim1, Tensor_Dim1>(
1995 &*hessian_base.data().begin());
1997 auto t_hessian_at_gauss_pts = get_hessian_at_gauss_pts();
2003 int size = nb_dofs / Tensor_Dim0;
2005 if (nb_dofs % Tensor_Dim0) {
2007 "Data inconsistency");
2011 for (
int gg = 0; gg < nb_gauss_pts; ++gg) {
2014 for (; bb < size; ++bb) {
2015 t_hessian_at_gauss_pts(
I,
J,
K) +=
2016 field_data(
I) * t_diff2_base_function(
J,
K);
2018 ++t_diff2_base_function;
2022 for (; bb != nb_base_functions; ++bb)
2023 ++t_diff2_base_function;
2024 ++t_hessian_at_gauss_pts;
2027 if (this->dataVec.use_count()) {
2049template <
int DIM_01,
int DIM_23,
int S = 0>
2061 boost::shared_ptr<MatrixDouble> in_mat,
2062 boost::shared_ptr<MatrixDouble> out_mat,
2063 boost::shared_ptr<MatrixDouble> d_mat)
2076 boost::shared_ptr<MatrixDouble> out_mat,
2077 boost::shared_ptr<MatrixDouble> d_mat)
2090 const size_t nb_gauss_pts =
getGaussPts().size2();
2094 DL>::get(*
dMat, nb_gauss_pts);
2095 auto get_in_at_pts =
2097 DL>::get(*
inMat, nb_gauss_pts);
2098 auto get_out_at_pts =
2100 DL>::size(*
outMat, nb_gauss_pts);
2101 auto t_D_at_pts = get_D_at_pts();
2102 auto t_in_at_pts = get_in_at_pts();
2103 auto t_out_at_pts = get_out_at_pts();
2104 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2105 t_out_at_pts(
i,
j) = t_D_at_pts(
i,
j,
k,
l) * t_in_at_pts(
k,
l);
2121 boost::shared_ptr<MatrixDouble>
dMat;
2144 boost::shared_ptr<MatrixDouble> in_mat,
2145 boost::shared_ptr<MatrixDouble> out_mat)
2162 boost::shared_ptr<MatrixDouble> out_mat)
2173 const size_t nb_gauss_pts =
getGaussPts().size2();
2175 auto get_in_at_pts =
2177 *
inMat, nb_gauss_pts);
2178 auto t_in_at_pts = get_in_at_pts();
2179 auto get_out_at_pts =
2181 DL>::size(*
outMat, nb_gauss_pts);
2182 auto t_out_at_pts = get_out_at_pts();
2183 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg) {
2184 t_out_at_pts(
i,
j) = (t_in_at_pts(
i,
j) || t_in_at_pts(
j,
i)) / 2;
2215 boost::shared_ptr<MatrixDouble> in_mat,
2216 boost::shared_ptr<MatrixDouble> out_mat)
2235 boost::shared_ptr<MatrixDouble> in_mat,
2236 boost::shared_ptr<MatrixDouble> out_mat)
2250 noalias(*
outMat) = (*scalePtr) * (*inMat);
2269template <
int Base_Dim,
int Field_Dim,
typename M = MatrixDouble>
2275template <
int Field_Dim>
2280 boost::shared_ptr<MatrixDouble> data_ptr,
2282 const EntityType zero_type = MBEDGE,
2283 const int zero_side = 0)
2286 dataPtr(data_ptr), dataVec(data_vec), zeroType(zero_type),
2287 zeroSide(zero_side) {
2293 boost::shared_ptr<MatrixDouble> data_ptr,
2294 const EntityType zero_type = MBEDGE,
2295 const int zero_side = 0)
2317template <
int Field_Dim>
2322 const size_t nb_integration_points = this->getGaussPts().size2();
2323 auto &mat = *dataPtr;
2325 auto get_data_at_pts =
2327 DL>::size(mat, nb_integration_points);
2328 if (
type == zeroType && side == zeroSide) {
2335 if (dataVec.use_count()) {
2336 dotVector.resize(nb_dofs,
false);
2337 const double *array;
2338 CHKERR VecGetArrayRead(dataVec, &array);
2340 for (
int i = 0;
i != local_indices.size(); ++
i)
2341 if (local_indices[
i] != -1)
2342 dotVector[
i] = array[local_indices[
i]];
2345 CHKERR VecRestoreArrayRead(dataVec, &array);
2349 const size_t nb_base_functions = data.
getN().size2() / 3;
2352 auto t_data_at_pts = get_data_at_pts();
2353 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2356 for (; bb != nb_dofs; ++bb) {
2357 t_data_at_pts(
i) += t_n_hdiv(
i) * t_dof;
2361 for (; bb != nb_base_functions; ++bb)
2366 if (dataVec.use_count()) {
2376template <
int Base_Dim,
int Field_Dim = Base_Dim>
2380 Base_Dim, Field_Dim>::OpCalculateHVecVectorField_General;
2386template <
int Base_Dim,
int Field_Dim = Base_Dim>
2389template <
int Field_Dim>
2394 boost::shared_ptr<MatrixDouble> data_ptr,
2395 const EntityType zero_type = MBEDGE,
2396 const int zero_side = 0)
2399 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2420template <
int Field_Dim>
2425 const size_t nb_integration_points = this->getGaussPts().size2();
2426 auto &mat = *dataPtr;
2428 auto get_data_at_pts =
2430 DL>::size(mat, nb_integration_points);
2431 if (
type == zeroType && side == zeroSide) {
2436 const size_t nb_dofs = local_indices.size();
2439 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2440 const double *array;
2441 CHKERR VecGetArrayRead(getFEMethod()->ts_u_t, &array);
2442 for (
size_t i = 0;
i != nb_dofs; ++
i)
2443 if (local_indices[
i] != -1)
2444 dot_dofs_vector[
i] = array[local_indices[
i]];
2446 dot_dofs_vector[
i] = 0;
2447 CHKERR VecRestoreArrayRead(getFEMethod()->ts_u_t, &array);
2449 const size_t nb_base_functions = data.
getN().size2() / 3;
2452 auto t_data_at_pts = get_data_at_pts();
2453 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2455 for (; bb != nb_dofs; ++bb) {
2456 t_data_at_pts(
i) += t_n_hdiv(
i) * dot_dofs_vector[bb];
2459 for (; bb != nb_base_functions; ++bb)
2475template <
int BASE_DIM,
int SPACE_DIM>
2480 boost::shared_ptr<VectorDouble> data_ptr,
2481 const EntityType zero_type = MBEDGE,
2482 const int zero_side = 0)
2493 const size_t nb_integration_points =
getGaussPts().size2();
2495 dataPtr->resize(nb_integration_points,
false);
2501 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2506 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2509 for (; bb != nb_dofs; ++bb) {
2510 t_data += t_dof * t_n_diff_hdiv(
j,
j);
2514 for (; bb != nb_base_functions; ++bb)
2534template <
int BASE_DIM,
int SPACE_DIM>
2539 boost::shared_ptr<MatrixDouble> data_ptr,
2540 const EntityType zero_type = MBEDGE,
2541 const int zero_side = 0)
2552 const size_t nb_integration_points =
getGaussPts().size2();
2554 auto get_data_at_pts =
2557 DL>::size(*
dataPtr, nb_integration_points);
2563 const size_t nb_base_functions = data.
getN().size2() /
BASE_DIM;
2567 auto t_data_at_pts = get_data_at_pts();
2568 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2571 for (; bb != nb_dofs; ++bb) {
2572 t_data_at_pts(
i,
j) += t_dof * t_base_diff(
i,
j);
2576 for (; bb != nb_base_functions; ++bb)
2597template <
int BASE_DIM,
int FIELD_DIM,
int SPACE_DIM>
2610 boost::shared_ptr<MatrixDouble> data_ptr,
2611 const EntityType zero_type = MBEDGE,
2612 const int zero_side = 0)
2615 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2624 const size_t nb_integration_points = getGaussPts().size2();
2626 auto get_data_at_pts =
2628 DL>::size(*dataPtr, nb_integration_points);
2629 if (
type == zeroType && side == zeroSide) {
2637 "Data inconsistency, nb_dofs %% COEFF_DIM != 0, that is %ld %% %d "
2647 const size_t nb_base_functions = data.
getN().size2() / 3;
2653 auto t_data_at_pts = get_data_at_pts();
2654 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2657 for (; bb != nb_dofs; ++bb) {
2658 t_data_at_pts(
k,
i,
j) += t_base_diff(
i,
j) * t_dof(
k);
2662 for (; bb != nb_base_functions; ++bb)
2680 boost::shared_ptr<MatrixDouble> data_ptr,
2681 const EntityType zero_type = MBEDGE,
2682 const int zero_side = 0)
2685 dataPtr(data_ptr), zeroType(zero_type), zeroSide(zero_side) {
2694 const size_t nb_integration_points = getGaussPts().size2();
2696 auto get_data_at_pts =
2698 DL>::size(*dataPtr, nb_integration_points);
2699 if (
type == zeroType && side == zeroSide) {
2707 const size_t nb_base_functions = data.
getN().size2() / 9;
2710 if (data.
getDiffN().size1() != nb_integration_points) {
2712 "Wrong number of integration pts (%ld != %ld)",
2713 static_cast<long>(data.
getDiffN().size1()),
2714 static_cast<long>(nb_integration_points));
2716 if (data.
getDiffN().size2() != nb_base_functions * 27) {
2718 "Wrong number of base functions (%ld != %ld)",
2719 static_cast<long>(data.
getDiffN().size2() / 27),
2720 static_cast<long>(nb_base_functions));
2722 if (nb_base_functions < nb_dofs) {
2724 "Wrong number of base functions (%ld < %ld)",
2725 static_cast<long>(nb_base_functions),
2726 static_cast<long>(nb_dofs));
2735 auto t_data_at_pts = get_data_at_pts();
2736 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2739 for (; bb != nb_dofs; ++bb) {
2740 t_data_at_pts(
k,
i,
j) += t_base_diff(
k,
i,
j) * t_dof;
2744 for (; bb != nb_base_functions; ++bb)
2765template <
int BASE_DIM,
int SPACE_DIM>
2770 boost::shared_ptr<MatrixDouble> data_ptr,
2771 const EntityType zero_type = MBEDGE,
2772 const int zero_side = 0)
2783 const size_t nb_integration_points =
getGaussPts().size2();
2787 DL>::size(*
dataPtr, nb_integration_points);
2795 const int nb_base_functions = data.
getN().size2() /
BASE_DIM;
2798 auto &hessian_base = data.
getN(BaseDerivatives::SecondDerivative);
2799 if (hessian_base.size1() != nb_integration_points) {
2801 "Wrong number of integration pts (%ld != %ld)",
2802 static_cast<long>(hessian_base.size1()),
2803 static_cast<long>(nb_integration_points));
2805 if (hessian_base.size2() !=
2808 "Wrong number of base functions (%ld != %ld)",
2809 static_cast<long>(hessian_base.size2() /
2811 static_cast<long>(nb_base_functions));
2815 "Wrong number of base functions (%ld < %ld)",
2816 static_cast<long>(hessian_base.size2()),
2827 auto t_data_at_pts = get_data_at_pts();
2828 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2831 for (; bb != nb_dofs; ++bb) {
2832 t_data_at_pts(
i,
j,
k) += t_dof * t_base_diff2(
i,
j,
k);
2837 for (; bb != nb_base_functions; ++bb)
2856template <
int Tensor_Dim1,
int Tensor_Dim2>
2861 boost::shared_ptr<VectorDouble> data_ptr,
2862 const EntityType zero_type = MBEDGE,
2863 const int zero_side = 0)
2874 const size_t nb_integration_points =
getGaussPts().size2();
2876 dataPtr->resize(nb_integration_points,
false);
2881 const int nb_dofs = local_indices.size();
2884 std::array<double, MAX_DOFS_ON_ENTITY> dot_dofs_vector;
2885 const double *array;
2887 for (
size_t i = 0;
i != local_indices.size(); ++
i)
2888 if (local_indices[
i] != -1)
2889 dot_dofs_vector[
i] = array[local_indices[
i]];
2891 dot_dofs_vector[
i] = 0;
2894 const size_t nb_base_functions = data.
getN().size2() / Tensor_Dim1;
2898 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
2900 for (; bb != nb_dofs; ++bb) {
2902 for (
auto ii = 0; ii != Tensor_Dim2; ++ii)
2903 div += t_n_diff_hdiv(ii, ii);
2904 t_data += dot_dofs_vector[bb] * div;
2907 for (; bb != nb_base_functions; ++bb)
2943 boost::shared_ptr<MatrixDouble> data_ptr,
2944 const EntityType zero_type = MBEDGE,
2945 const int zero_side = 0);
2967 boost::shared_ptr<MatrixDouble> data_ptr,
2968 const EntityType zero_type = MBVERTEX,
2969 const int zero_side = 0);
2992 boost::shared_ptr<MatrixDouble> data_ptr,
2993 const EntityType zero_type = MBVERTEX,
2994 const int zero_side = 0);
3012template <
int Tensor_Dim0,
int Tensor_Dim1>
3017 boost::shared_ptr<MatrixDouble> data_ptr,
3018 boost::shared_ptr<double> scale_ptr,
3020 const EntityType zero_type = MBEDGE,
3021 const int zero_side = 0)
3031 boost::shared_ptr<MatrixDouble> data_ptr,
3032 const EntityType zero_type = MBEDGE,
3033 const int zero_side = 0)
3041 const size_t nb_integration_points =
getGaussPts().size2();
3043 auto get_data_at_pts =
3046 DL>::size(*
dataPtr, nb_integration_points);
3054 const double *array;
3057 for (
int i = 0;
i != local_indices.size(); ++
i)
3058 if (local_indices[
i] != -1)
3067 const size_t nb_base_functions = data.
getN().size2() / 3;
3071 auto t_data_at_pts = get_data_at_pts();
3072 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3075 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3076 t_data_at_pts(
i,
j) += (
scale * t_dof(
i)) * t_n_hvec(
j);
3080 for (; bb < nb_base_functions; ++bb)
3106template <
int Tensor_Dim0,
int Tensor_Dim1>
3113 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3115 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3116 boost::shared_ptr<double> scale_ptr =
nullptr,
3117 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3145template <
int Tensor_Dim0,
int Tensor_Dim1>
3150 const size_t nb_integration_points = OP::getGaussPts().size2();
3152 auto get_data_at_pts =
3155 DL>::size(*dataPtr, nb_integration_points);
3156 if (
type == zeroType)
3162 if (dataVec.use_count()) {
3163 dotVector.resize(nb_dofs,
false);
3164 const double *array;
3165 CHKERR VecGetArrayRead(dataVec, &array);
3167 for (
int i = 0;
i != local_indices.size(); ++
i)
3168 if (local_indices[
i] != -1)
3169 dotVector[
i] = array[local_indices[
i]];
3172 CHKERR VecRestoreArrayRead(dataVec, &array);
3183 auto get_get_side_face_dofs = [&]() {
3184 auto fe_type = OP::getFEType();
3188 std::vector<int> side_face_dofs;
3189 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3193 auto it = side_dof_map.get<1>().begin();
3194 it != side_dof_map.get<1>().end(); ++it
3197 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3200 if (it->type == brokenType) {
3201 if (brokenRangePtr) {
3202 auto ent = OP::getSideEntity(it->side, brokenType);
3203 if (brokenRangePtr->find(ent) != brokenRangePtr->end()) {
3204 side_face_dofs.push_back(it->dof);
3207 side_face_dofs.push_back(it->dof);
3212 return side_face_dofs;
3215 auto side_face_dofs = get_get_side_face_dofs();
3219 auto t_data_at_pts = get_data_at_pts();
3220 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3221 for (
auto b : side_face_dofs) {
3223 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(data.
getFieldData().data() +
3225 t_data_at_pts(
i,
j) += t_dof(
i) * t_row_base(
j);
3229 *dataPtr *= (scalePtr) ? *scalePtr : 1.0;
3231 if (dataVec.use_count()) {
3245template <
int Tensor_Dim0,
int Tensor_Dim1>
3250 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3251 boost::shared_ptr<double> scale_ptr,
3253 const EntityType zero_type = MBEDGE,
const int zero_side = 0)
3263 boost::shared_ptr<MatrixDouble> data_ptr,
3264 const EntityType zero_type = MBEDGE,
3265 const int zero_side = 0)
3273 const size_t nb_integration_points =
getGaussPts().size2();
3275 auto get_data_at_pts =
3278 DL>::size(*
dataPtr, nb_integration_points);
3287 const double *array;
3290 for (
int i = 0;
i != local_indices.size(); ++
i)
3291 if (local_indices[
i] != -1)
3300 const size_t nb_base_functions =
3301 data.
getN().size2() / (Tensor_Dim0 * Tensor_Dim1);
3304 auto t_n_hten = data.
getFTensor2N<Tensor_Dim0, Tensor_Dim1>();
3305 auto t_data_at_pts = get_data_at_pts();
3306 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3309 for (; bb != nb_dofs; ++bb) {
3310 t_data_at_pts(
i,
j) += (
scale * t_dof) * t_n_hten(
i,
j);
3314 for (; bb < nb_base_functions; ++bb)
3342template <
int Tensor_Dim0,
int Tensor_Dim1,
3348 boost::shared_ptr<MatrixDouble> data_ptr,
3350 const EntityType zero_type = MBEDGE,
3351 const int zero_side = 0)
3361 boost::shared_ptr<MatrixDouble> data_ptr,
3362 const EntityType zero_type = MBEDGE,
3363 const int zero_side = 0)
3370 const size_t nb_integration_points =
getGaussPts().size2();
3373 auto get_data_at_pts =
3375 DL>::size(mat, nb_integration_points);
3384 const double *array;
3387 for (
int i = 0;
i != local_indices.size(); ++
i)
3388 if (local_indices[
i] != -1)
3396 const size_t nb_base_functions = data.
getN().size2() / 3;
3400 auto t_data_at_pts = get_data_at_pts();
3403 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3406 for (; bb != nb_dofs / Tensor_Dim0; ++bb) {
3407 double div = t_n_diff_hvec(
j,
j);
3408 t_data_at_pts(
i) += t_dof(
i) * div;
3410 t_data_at_pts(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3416 for (; bb < nb_base_functions; ++bb) {
3449template <
int Tensor_Dim0,
int Tensor_Dim1,
3457 const std::string
field_name, boost::shared_ptr<MatrixDouble> data_ptr,
3459 boost::shared_ptr<Range> broken_range_ptr =
nullptr,
3460 boost::shared_ptr<double> scale_ptr =
nullptr,
3461 const EntityType zero_type = MBEDGE)
3473 const size_t nb_integration_points =
getGaussPts().size2();
3476 auto get_data_at_pts =
3478 DL>::size(mat, nb_integration_points);
3488 const double *array;
3491 for (
int i = 0;
i != local_indices.size(); ++
i)
3492 if (local_indices[
i] != -1)
3507 auto get_get_side_face_dofs = [&]() {
3512 std::vector<int> side_face_dofs;
3513 side_face_dofs.reserve(data.
getIndices().size() / Tensor_Dim0);
3517 auto it = side_dof_map.get<1>().begin();
3518 it != side_dof_map.get<1>().end(); ++it
3521 if ((Tensor_Dim0 * it->dof) >= data.
getIndices().size()) {
3528 side_face_dofs.push_back(it->dof);
3531 side_face_dofs.push_back(it->dof);
3536 return side_face_dofs;
3539 auto side_face_dofs = get_get_side_face_dofs();
3543 auto t_data_at_pts = get_data_at_pts();
3545 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3546 for (
auto b : side_face_dofs) {
3547 auto t_dof = getFTensor1FromPtr<Tensor_Dim0>(
3551 double div = t_diff_base(
j,
j);
3552 t_data_at_pts(
i) += t_dof(
i) * div;
3554 t_data_at_pts(
i) += t_base(0) * (t_dof(
i) / t_coords(0));
3585template <
int Tensor_Dim,
typename OpBase>
3589 boost::shared_ptr<MatrixDouble> data_ptr,
3590 boost::shared_ptr<double> scale_ptr,
3591 const EntityType zero_type = MBEDGE,
3592 const int zero_side = 0)
3600 boost::shared_ptr<MatrixDouble> data_ptr,
3601 const EntityType zero_type = MBEDGE,
3602 const int zero_side = 0)
3609 const size_t nb_integration_points = OpBase::getGaussPts().size2();
3612 auto get_data_at_pts =
3614 DL>::size(mat, nb_integration_points);
3621 auto t_normal = OpBase::getFTensor1NormalsAtGaussPts();
3622 const size_t nb_base_functions = data.
getN().size2() / 3;
3624 auto t_data_at_pts = get_data_at_pts();
3625 for (
size_t gg = 0; gg != nb_integration_points; ++gg) {
3627 t_normalized_normal(
j) = t_normal(
j);
3631 for (; bb != nb_dofs / Tensor_Dim; ++bb) {
3633 (scale_val * t_dof(
i)) * (t_base(
j) * t_normalized_normal(
j));
3637 for (; bb < nb_base_functions; ++bb) {
3680 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3693 template <
int D1,
int D2,
int J1,
int J2>
3697 static_assert(D2 == J2,
"Dimension of jacobian and dimension of <out> "
3698 "directive does not match");
3700 size_t nb_functions = diff_n.size2() / D1;
3702 size_t nb_gauss_pts = diff_n.size1();
3707 "Wrong number of Gauss Pts");
3708 if (diff_n.size2() % D1)
3710 "Number of directives of base functions and D1 dimension does "
3714 diffNinvJac.resize(diff_n.size1(), D2 * nb_functions,
false);
3718 auto t_diff_n = getFTensor1FromPtr<D2>(&*
diffNinvJac.data().begin());
3719 auto t_diff_n_ref = getFTensor1FromPtr<D1>(&*diff_n.data().begin());
3721 auto get_inv_jac_at_pts =
3724 auto t_inv_jac_at_pts = get_inv_jac_at_pts();
3725 for (
size_t gg = 0; gg != nb_gauss_pts; ++gg, ++t_inv_jac_at_pts) {
3726 for (
size_t dd = 0; dd != nb_functions; ++dd) {
3727 t_diff_n(
i) = t_inv_jac_at_pts(
k,
i) * t_diff_n_ref(
k);
3772template <
int DERIVARIVE = 1>
3779template <
int DERIVARIVE = 1>
3786template <
int DERIVARIVE = 1>
3790 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3794template <
int DERIVARIVE = 1>
3798 boost::shared_ptr<MatrixDouble> inv_jac_ptr)
3816 invJacPtr(inv_jac_ptr) {}
3870 boost::shared_ptr<MatrixDouble> inv_jac_ptr);
3907 boost::shared_ptr<MatrixDouble> jac_ptr)
3924 2>::OpSetContravariantPiolaTransformOnFace2DImpl;
4123 template <
typename T>
4125 boost::shared_ptr<T> det_ptr,
4126 boost::shared_ptr<MatrixDouble> out_ptr)
4136 std::variant<boost::shared_ptr<VectorDouble>, boost::shared_ptr<MatrixDouble>>
4148 "Pointer for inPtr matrix not allocated");
4150 if (!std::holds_alternative<boost::shared_ptr<VectorDouble>>(detPtrVariant) &&
4151 !std::holds_alternative<boost::shared_ptr<MatrixDouble>>(detPtrVariant)) {
4153 "detPtrVariant must hold either VectorDouble or MatrixDouble");
4156 const auto nb_integration_pts = inPtr->size1();
4159 const auto nb_rows = inPtr->size2();
4160 if (nb_rows != DIM * DIM)
4162 "Wrong number of matrix coefficients");
4167 using T = std::decay_t<
decltype(ptr)>;
4169 if constexpr (std::is_same_v<T, boost::shared_ptr<VectorDouble>>) {
4170 ptr->resize(nb_integration_pts,
false);
4171 }
else if constexpr (std::is_same_v<T, boost::shared_ptr<MatrixDouble>>) {
4172 ptr->resize(nb_integration_pts, 1,
false);
4178 auto get_in_at_pts =
4180 *inPtr, nb_integration_pts);
4184 auto t_in_at_pts = get_in_at_pts();
4185 auto det_it = std::visit(
4186 [](
auto p) -> std::vector<double>::iterator {
4187 return p->data().begin();
4190 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4199 auto get_out_at_pts =
4201 *outPtr, nb_integration_pts);
4202 auto t_in_at_pts = get_in_at_pts();
4203 auto t_out_at_pts = get_out_at_pts();
4204 auto det_it = std::visit(
4205 [](
auto p) -> std::vector<double>::iterator {
4206 return p->data().begin();
4209 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4244 boost::shared_ptr<VectorDouble> out_ptr)
4265 "Pointer for inPtr matrix not allocated");
4267 const auto nb_integration_pts = inPtr->size1();
4271 auto get_in_at_pts =
4273 *inPtr, nb_integration_pts);
4274 outPtr->resize(nb_integration_pts,
false);
4275 auto t_in_at_pts = get_in_at_pts();
4278 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4279 t_out = t_in_at_pts(
i,
i);
4301 boost::shared_ptr<VectorDouble> out_ptr)
4322 "Pointer for inPtr matrix not allocated");
4324 const auto nb_integration_pts = inPtr->size1();
4327 outPtr->resize(nb_integration_pts,
false);
4329 auto get_in_at_pts =
4331 DL>::get(*inPtr, nb_integration_pts);
4332 auto t_in_at_pts = get_in_at_pts();
4335 for (
size_t gg = 0; gg != nb_integration_pts; ++gg) {
4336 t_out = t_in_at_pts(
i,
i);
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.
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 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
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, 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 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.
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.
const EntityHandle zeroType
SmartPetscObj< Vec > dataVec
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)
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.
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