v0.14.0
Public Types | Public Member Functions | Private Attributes | List of all members
OpPostProcMap< DIM1, DIM2 > Struct Template Reference

Post post-proc data at points from hash maps. More...

#include <users_modules/basic_finite_elements/src/PostProcOnRefMesh.hpp>

Inheritance diagram for OpPostProcMap< DIM1, DIM2 >:
[legend]
Collaboration diagram for OpPostProcMap< DIM1, DIM2 >:
[legend]

Public Types

using DataMapVec = std::map< std::string, boost::shared_ptr< VectorDouble > >
 
using DataMapMat = std::map< std::string, boost::shared_ptr< MatrixDouble > >
 

Public Member Functions

 OpPostProcMap (moab::Interface &post_proc_mesh, std::vector< EntityHandle > &map_gauss_pts, DataMapVec data_map_scalar, DataMapMat data_map_vec, DataMapMat data_map_mat, DataMapMat data_symm_map_mat)
 Construct a new OpPostProcMap object. More...
 
MoFEMErrorCode doWork (int side, EntityType type, EntitiesFieldData::EntData &data)
 

Private Attributes

moab::Interface & postProcMesh
 
std::vector< EntityHandle > & mapGaussPts
 
DataMapVec dataMapScalar
 
DataMapMat dataMapVec
 
DataMapMat dataMapMat
 
DataMapMat dataMapSymmMat
 

Detailed Description

template<int DIM1, int DIM2>
struct OpPostProcMap< DIM1, DIM2 >

Post post-proc data at points from hash maps.

Template Parameters
DIM1dimension of vector in data_map_vec and first column of data_map_may
DIM2dimension of second column in data_map_mat

Definition at line 1185 of file PostProcOnRefMesh.hpp.

Member Typedef Documentation

◆ DataMapMat

template<int DIM1, int DIM2>
using OpPostProcMap< DIM1, DIM2 >::DataMapMat = std::map<std::string, boost::shared_ptr<MatrixDouble> >

Definition at line 1188 of file PostProcOnRefMesh.hpp.

◆ DataMapVec

template<int DIM1, int DIM2>
using OpPostProcMap< DIM1, DIM2 >::DataMapVec = std::map<std::string, boost::shared_ptr<VectorDouble> >

Definition at line 1187 of file PostProcOnRefMesh.hpp.

Constructor & Destructor Documentation

◆ OpPostProcMap()

template<int DIM1, int DIM2>
OpPostProcMap< DIM1, DIM2 >::OpPostProcMap ( moab::Interface &  post_proc_mesh,
std::vector< EntityHandle > &  map_gauss_pts,
DataMapVec  data_map_scalar,
DataMapMat  data_map_vec,
DataMapMat  data_map_mat,
DataMapMat  data_symm_map_mat 
)
inline

Construct a new OpPostProcMap object.

Parameters
post_proc_meshpostprocessing mesh
map_gauss_ptsmap of gauss points to nodes of postprocessing mesh
data_map_scalarhash map of scalar values (string is name of the tag)
data_map_vechash map of vector values
data_map_mathash map of second order tensor values
data_symm_map_mathash map of symmetric second order tensor values

Definition at line 1201 of file PostProcOnRefMesh.hpp.

1206  NOSPACE, ForcesAndSourcesCore::UserDataOperator::OPSPACE),
1207  postProcMesh(post_proc_mesh), mapGaussPts(map_gauss_pts),
1208  dataMapScalar(data_map_scalar), dataMapVec(data_map_vec),
1209  dataMapMat(data_map_mat), dataMapSymmMat(data_symm_map_mat) {
1210  // Operator is only executed for vertices
1211  std::fill(&doEntities[MBEDGE], &doEntities[MBMAXTYPE], false);
1212  }

Member Function Documentation

◆ doWork()

template<int DIM1, int DIM2>
MoFEMErrorCode OpPostProcMap< DIM1, DIM2 >::doWork ( int  side,
EntityType  type,
EntitiesFieldData::EntData data 
)

Definition at line 1227 of file PostProcOnRefMesh.hpp.

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) {
1235  Tag th;
1236  CHKERR postProcMesh.tag_get_handle(name.c_str(), size, MB_TYPE_DOUBLE, th,
1237  MB_TAG_CREAT | MB_TAG_SPARSE,
1238  def.data());
1239  return th;
1240  };
1241 
1242  MatrixDouble3by3 mat(3, 3);
1243 
1244  auto set_vector_3d = [&](auto &t) -> MatrixDouble3by3 & {
1245  mat.clear();
1246  for (size_t r = 0; r != DIM1; ++r)
1247  mat(0, r) = t(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();
1269  mat(0, 0) = t;
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 
1280  auto set_tag = [&](auto th, auto gg, MatrixDouble3by3 &mat) {
1281  for (auto &v : mat.data())
1282  v = set_float_precision(v);
1283  return postProcMesh.tag_set_data(th, &mapGaussPts[gg], 1,
1284  &*mat.data().begin());
1285  };
1286 
1287  for (auto &m : dataMapScalar) {
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 
1298  for (auto &m : dataMapVec) {
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 
1309  for (auto &m : dataMapMat) {
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 
1320  for (auto &m : dataMapSymmMat) {
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 }

Member Data Documentation

◆ dataMapMat

template<int DIM1, int DIM2>
DataMapMat OpPostProcMap< DIM1, DIM2 >::dataMapMat
private

Definition at line 1221 of file PostProcOnRefMesh.hpp.

◆ dataMapScalar

template<int DIM1, int DIM2>
DataMapVec OpPostProcMap< DIM1, DIM2 >::dataMapScalar
private

Definition at line 1219 of file PostProcOnRefMesh.hpp.

◆ dataMapSymmMat

template<int DIM1, int DIM2>
DataMapMat OpPostProcMap< DIM1, DIM2 >::dataMapSymmMat
private

Definition at line 1222 of file PostProcOnRefMesh.hpp.

◆ dataMapVec

template<int DIM1, int DIM2>
DataMapMat OpPostProcMap< DIM1, DIM2 >::dataMapVec
private

Definition at line 1220 of file PostProcOnRefMesh.hpp.

◆ mapGaussPts

template<int DIM1, int DIM2>
std::vector<EntityHandle>& OpPostProcMap< DIM1, DIM2 >::mapGaussPts
private

Definition at line 1218 of file PostProcOnRefMesh.hpp.

◆ postProcMesh

template<int DIM1, int DIM2>
moab::Interface& OpPostProcMap< DIM1, DIM2 >::postProcMesh
private

Definition at line 1217 of file PostProcOnRefMesh.hpp.


The documentation for this struct was generated from the following file:
NOSPACE
@ NOSPACE
Definition: definitions.h:83
OpPostProcMap::postProcMesh
moab::Interface & postProcMesh
Definition: PostProcOnRefMesh.hpp:1217
OpPostProcMap::dataMapVec
DataMapMat dataMapVec
Definition: PostProcOnRefMesh.hpp:1220
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
sdf.r
int r
Definition: sdf.py:8
c
const double c
speed of light (cm/ns)
Definition: initial_diffusion.cpp:39
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
DIM1
constexpr int DIM1
Definition: level_set.cpp:21
MoFEM::getFTensor0FromVec
static auto getFTensor0FromVec(ublas::vector< T, A > &data)
Get tensor rank 0 (scalar) form data vector.
Definition: Templates.hpp:135
t
constexpr double t
plate stiffness
Definition: plate.cpp:58
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
OpPostProcMap::dataMapSymmMat
DataMapMat dataMapSymmMat
Definition: PostProcOnRefMesh.hpp:1222
OpPostProcMap::mapGaussPts
std::vector< EntityHandle > & mapGaussPts
Definition: PostProcOnRefMesh.hpp:1218
UserDataOperator
ForcesAndSourcesCore::UserDataOperator UserDataOperator
Definition: HookeElement.hpp:75
MoFEM::Types::MatrixDouble3by3
MatrixBoundedArray< double, 9 > MatrixDouble3by3
Definition: Types.hpp:105
DIM2
constexpr int DIM2
Definition: level_set.cpp:22
OpPostProcMap::dataMapScalar
DataMapVec dataMapScalar
Definition: PostProcOnRefMesh.hpp:1219
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
OpPostProcMap::dataMapMat
DataMapMat dataMapMat
Definition: PostProcOnRefMesh.hpp:1221
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359