1230 {
1232
1233 std::array<double, 9> def;
1234 std::fill(def.begin(), def.end(), 0);
1235
1236 auto get_tag = [&](const std::string name, size_t size) {
1239 MB_TAG_CREAT | MB_TAG_SPARSE,
1240 def.data());
1242 };
1243
1245
1246 auto set_vector_3d = [&](
auto &
t) -> MatrixDouble3by3 & {
1247 mat.clear();
1248 for (
size_t r = 0;
r !=
DIM1; ++
r)
1250 return mat;
1251 };
1252
1253 auto set_matrix_3d = [&](
auto &
t) -> MatrixDouble3by3 & {
1254 mat.clear();
1255 for (
size_t r = 0;
r !=
DIM1; ++
r)
1256 for (
size_t c = 0;
c !=
DIM2; ++
c)
1257 mat(r,
c) =
t(r,
c);
1258 return mat;
1259 };
1260
1261 auto set_matrix_symm_3d = [&](
auto &
t) -> MatrixDouble3by3 & {
1262 mat.clear();
1263 for (
size_t r = 0;
r !=
DIM1; ++
r)
1264 for (
size_t c = 0;
c !=
DIM1; ++
c)
1265 mat(r,
c) =
t(r,
c);
1266 return mat;
1267 };
1268
1269 auto set_scalar = [&](
auto t) -> MatrixDouble3by3 & {
1270 mat.clear();
1272 return mat;
1273 };
1274
1275 auto set_float_precision = [](const double x) {
1276 if (std::abs(x) < std::numeric_limits<float>::epsilon())
1277 return 0.;
1278 else
1279 return x;
1280 };
1281
1283 for (
auto &
v : mat.data())
1284 v = set_float_precision(
v);
1286 &*mat.data().begin());
1287 };
1288
1290 auto th = get_tag(
m.first, 1);
1291 auto t_scl = getFTensor0FromVec(*
m.second);
1292 auto nb_integration_pts = getGaussPts().size2();
1293 size_t gg = 0;
1294 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1295 CHKERR set_tag(th, gg, set_scalar(t_scl));
1296 ++t_scl;
1297 }
1298 }
1299
1301 auto th = get_tag(
m.first, 3);
1302 auto t_vec = getFTensor1FromMat<DIM1>(*
m.second);
1303 auto nb_integration_pts = getGaussPts().size2();
1304 size_t gg = 0;
1305 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1306 CHKERR set_tag(th, gg, set_vector_3d(t_vec));
1307 ++t_vec;
1308 }
1309 }
1310
1312 auto th = get_tag(
m.first, 9);
1313 auto t_mat = getFTensor2FromMat<DIM1, DIM2>(*
m.second);
1314 auto nb_integration_pts = getGaussPts().size2();
1315 size_t gg = 0;
1316 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1317 CHKERR set_tag(th, gg, set_matrix_3d(t_mat));
1318 ++t_mat;
1319 }
1320 }
1321
1323 auto th = get_tag(
m.first, 9);
1324 auto t_mat = getFTensor2SymmetricFromMat<DIM1>(*
m.second);
1325 auto nb_integration_pts = getGaussPts().size2();
1326 size_t gg = 0;
1327 for (int gg = 0; gg != nb_integration_pts; ++gg) {
1328 CHKERR set_tag(th, gg, set_matrix_symm_3d(t_mat));
1329 ++t_mat;
1330 }
1331 }
1332
1334}
#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.
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
FTensor::Index< 'm', 3 > m