1228 {
1230
1231 std::array<double, 9> def;
1232 std::fill(def.begin(), def.end(), 0);
1233
1234 auto get_tag = [&](const std::string name, size_t size) {
1237 MB_TAG_CREAT | MB_TAG_SPARSE,
1238 def.data());
1240 };
1241
1243
1244 auto set_vector_3d = [&](
auto &
t) -> MatrixDouble3by3 & {
1245 mat.clear();
1246 for (
size_t r = 0;
r != DIM1; ++
r)
1248 return mat;
1249 };
1250
1251 auto set_matrix_3d = [&](
auto &
t) -> MatrixDouble3by3 & {
1252 mat.clear();
1253 for (
size_t r = 0;
r != DIM1; ++
r)
1254 for (
size_t c = 0;
c != DIM2; ++
c)
1255 mat(r,
c) =
t(r,
c);
1256 return mat;
1257 };
1258
1259 auto set_matrix_symm_3d = [&](
auto &
t) -> MatrixDouble3by3 & {
1260 mat.clear();
1261 for (
size_t r = 0;
r != DIM1; ++
r)
1262 for (
size_t c = 0;
c != DIM1; ++
c)
1263 mat(r,
c) =
t(r,
c);
1264 return mat;
1265 };
1266
1267 auto set_scalar = [&](
auto t) -> MatrixDouble3by3 & {
1268 mat.clear();
1270 return mat;
1271 };
1272
1273 auto set_float_precision = [](const double x) {
1274 if (std::abs(x) < std::numeric_limits<float>::epsilon())
1275 return 0.;
1276 else
1277 return x;
1278 };
1279
1281 for (
auto &
v : mat.data())
1282 v = set_float_precision(
v);
1284 &*mat.data().begin());
1285 };
1286
1288 auto th = get_tag(
m.first, 1);
1289 auto t_scl = getFTensor0FromVec(*
m.second);
1290 auto nb_integration_pts = getGaussPts().size2();
1291 size_t gg = 0;
1292 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1293 CHKERR set_tag(th, gg, set_scalar(t_scl));
1294 ++t_scl;
1295 }
1296 }
1297
1299 auto th = get_tag(
m.first, 3);
1300 auto t_vec = getFTensor1FromMat<DIM1>(*
m.second);
1301 auto nb_integration_pts = getGaussPts().size2();
1302 size_t gg = 0;
1303 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1304 CHKERR set_tag(th, gg, set_vector_3d(t_vec));
1305 ++t_vec;
1306 }
1307 }
1308
1310 auto th = get_tag(
m.first, 9);
1311 auto t_mat = getFTensor2FromMat<DIM1, DIM2>(*
m.second);
1312 auto nb_integration_pts = getGaussPts().size2();
1313 size_t gg = 0;
1314 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1315 CHKERR set_tag(th, gg, set_matrix_3d(t_mat));
1316 ++t_mat;
1317 }
1318 }
1319
1321 auto th = get_tag(
m.first, 9);
1322 auto t_mat = getFTensor2SymmetricFromMat<DIM1>(*
m.second);
1323 auto nb_integration_pts = getGaussPts().size2();
1324 size_t gg = 0;
1325 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1326 CHKERR set_tag(th, gg, set_matrix_symm_3d(t_mat));
1327 ++t_mat;
1328 }
1329 }
1330
1332}
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'm', SPACE_DIM > m
const double c
speed of light (cm/ns)
const double v
phase velocity of light in medium (cm/ns)
MatrixBoundedArray< double, 9 > MatrixDouble3by3
constexpr double t
plate stiffness