v0.14.0
MedInterface.cpp
Go to the documentation of this file.
1 /** \file MedInterface.cpp
2  * \brief Med file interface interface
3  *
4  * Interface loading mesh and data on mesh directly to mofem & moab
5  *
6  */
7 
8 #ifdef WITH_MED
9 
10 extern "C" {
11 #include <med.h>
12 }
13 
14 #if (MED_MAJOR_NUM >= 3)
15 // To avoid too many ifdefs below we use defines for the bits of the
16 // API that did not change too much between MED2 and MED3. If we
17 // remove MED2 support at some point, please remove these defines and
18 // replace the symbols accordingly.
19 #define med_geometrie_element med_geometry_type
20 #define med_entite_maillage med_entity_type
21 #define med_type_champ med_field_type
22 #define MED_LECTURE MED_ACC_RDONLY
23 #define MED_LECTURE_AJOUT MED_ACC_RDEXT
24 #define MED_NOEUD MED_NODE
25 #define MED_MAILLE MED_CELL
26 #define MED_NOEUD_MAILLE MED_NODE_ELEMENT
27 #define MED_NOPFL MED_NO_PROFILE
28 #define MEDouvrir MEDfileOpen
29 #define MEDfermer MEDfileClose
30 #define MEDnChamp MEDfieldnComponent
31 #define MEDnValProfil MEDprofileSizeByName
32 #else
33 #error "MED file is not MED_MAJOR_NUM == 3"
34 #endif
35 
36 #include <MedInterface.hpp>
37 
38 namespace MoFEM {
39 
41 MedInterface::query_interface(boost::typeindex::type_index type_index,
42  UnknownInterface **iface) const {
43  *iface = const_cast<MedInterface *>(this);
44  return 0;
45 }
46 
48  : cOre(const_cast<Core &>(core)), flgFile(PETSC_FALSE) {
49 
50  if (!LogManager::checkIfChannelExist("MEDWORLD")) {
51  auto core_log = logging::core::get();
52  core_log->add_sink(
54  LogManager::setLog("MEDWORLD");
55  MOFEM_LOG_TAG("MEDWORLD", "MED");
56  }
57 
58  MOFEM_LOG("MEDWORLD", Sev::noisy) << "Mashset manager created";
59 }
60 
62  Interface &m_field = cOre;
63  char mesh_file_name[255];
65  ierr = PetscOptionsBegin(m_field.get_comm(), "", "MED Interface", "none");
66  CHKERRG(ierr);
67  ierr = PetscOptionsString("-med_file", "med file name", "", "mesh.med",
68  mesh_file_name, 255, &flgFile);
69  CHKERRG(ierr);
70  ierr = PetscOptionsEnd();
71  CHKERRG(ierr);
72  if (flgFile == PETSC_TRUE) {
73  medFileName = std::string(mesh_file_name);
74  } else {
75  medFileName = std::string("mesh.med");
76  }
78 }
79 
80 MoFEMErrorCode MedInterface::medGetFieldNames(const string &file, int verb) {
81  Interface &m_field = cOre;
83  med_idt fid = MEDfileOpen(file.c_str(), MED_ACC_RDONLY);
84  if (fid < 0) {
85  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
86  "Unable to open file '%s'", file.c_str());
87  }
88  med_int num_fields = MEDnField(fid);
89  for (int index = 0; index < num_fields; index++) {
90 
91  med_int num_comp = MEDfieldnComponent(fid, index + 1);
92  if (num_comp <= 0) {
93  SETERRQ(m_field.get_comm(), MOFEM_IMPOSSIBLE_CASE,
94  "Could not get number of components for MED field");
95  }
96 
97  char name[MED_NAME_SIZE + 1], mesh_name[MED_NAME_SIZE + 1];
98  char dt_unit[MED_SNAME_SIZE + 1];
99  std::vector<char> comp_name(num_comp * MED_SNAME_SIZE + 1);
100  std::vector<char> comp_unit(num_comp * MED_SNAME_SIZE + 1);
101  med_int num_steps = 0;
102  med_type_champ type;
103  med_bool local_mesh;
104  if (MEDfieldInfo(fid, index + 1, name, mesh_name, &local_mesh, &type,
105  &comp_name[0], &comp_unit[0], dt_unit, &num_steps) < 0) {
106  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
107  "Could not get MED field info");
108  }
109 
110  std::string field_name = std::string(name);
112  fieldNames[field_name].fieldName = field_name;
113  fieldNames[field_name].meshName = std::string(mesh_name);
114  fieldNames[field_name].localMesh = (local_mesh == MED_TRUE);
115  for (int ff = 0; ff != num_comp; ff++) {
116  fieldNames[field_name].componentNames.push_back(
117  std::string(&comp_name[ff * MED_SNAME_SIZE], MED_SNAME_SIZE));
118  fieldNames[field_name].componentUnits.push_back(
119  std::string(&comp_unit[ff * MED_SNAME_SIZE], MED_SNAME_SIZE));
120  }
121  fieldNames[field_name].dtUnit = std::string(&dt_unit[0]);
122  fieldNames[field_name].ncSteps = num_steps;
123 
124  if (verb > 0)
125  MOFEM_LOG("MEDWORLD", Sev::inform) << fieldNames[name];
126  }
127  if (MEDfileClose(fid) < 0) {
128  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
129  "Unable to close file '%s'", file.c_str());
130  }
132 }
133 
136  if (medFileName.empty()) {
138  }
141 }
142 
143 MoFEMErrorCode MedInterface::readMed(const string &file, int verb) {
144  Interface &m_field = cOre;
146 
147  med_idt fid = MEDfileOpen(file.c_str(), MED_ACC_RDONLY);
148  if (fid < 0) {
149  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
150  "Unable to open file '%s'", file.c_str());
151  }
152 
153  med_int v[3], vf[3];
154  MEDlibraryNumVersion(&v[0], &v[1], &v[2]);
155  MEDfileNumVersionRd(fid, &vf[0], &vf[1], &vf[2]);
156 
157  if (verb > 0)
158  MOFEM_LOG_C("MEDWORLD", Sev::inform,
159  "Reading MED file V%d.%d.%d using MED library V%d.%d.%d", vf[0],
160  vf[1], vf[2], v[0], v[1], v[2]);
161 
162  if (vf[0] < 2 || (vf[0] == 2 && vf[1] < 2)) {
163  SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
164  "Cannot read MED file older than V2.2");
165  }
166 
167  for (int i = 0; i < MEDnMesh(fid); i++) {
168  char mesh_name[MED_NAME_SIZE + 1], mesh_desc[MED_COMMENT_SIZE + 1];
169  bzero(mesh_name, MED_NAME_SIZE);
170  bzero(mesh_desc, MED_COMMENT_SIZE);
171  med_int space_dim;
172  med_mesh_type mesh_type;
173  med_int mesh_dim, n_step;
174  char dt_unit[MED_SNAME_SIZE + 1];
175  char axis_name[3 * MED_SNAME_SIZE + 1], axis_unit[3 * MED_SNAME_SIZE + 1];
176  med_sorting_type sorting_type;
177  med_axis_type axis_type;
178  if (MEDmeshInfo(fid, i + 1, mesh_name, &space_dim, &mesh_dim, &mesh_type,
179  mesh_desc, dt_unit, &sorting_type, &n_step, &axis_type,
180  axis_name, axis_unit) < 0) {
181  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
182  "Unable to read mesh information");
183  }
184  meshNames.push_back(std::string(mesh_name));
185  if (verb > 0) {
186  MOFEM_LOG_C("MEDWORLD", Sev::inform, "Check mesh %s nsteps %d", mesh_name,
187  n_step);
188  }
189  }
190 
191  std::map<int, Range> family_elem_map;
192  std::map<string, Range> group_elem_map;
193 
194  for (unsigned int ii = 0; ii != meshNames.size(); ii++) {
195  CHKERR readMesh(file, ii, family_elem_map, verb);
196  CHKERR readFamily(file, ii, family_elem_map, group_elem_map, verb);
197  CHKERR makeBlockSets(group_elem_map, verb);
198  }
199 
200  if (MEDfileClose(fid) < 0) {
201  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
202  "Unable to close file '%s'", file.c_str());
203  }
204 
206 }
207 
208 static std::vector<med_geometrie_element>
209 moab2med_element_type(const EntityType type) {
210 
211  std::vector<med_geometrie_element> types;
212 
213  switch (type) {
214  case MBEDGE:
215  types.push_back(MED_SEG2);
216  types.push_back(MED_SEG3);
217  break;
218  case MBTRI:
219  types.push_back(MED_TRIA3);
220  types.push_back(MED_TRIA6);
221  break;
222  case MBQUAD:
223  types.push_back(MED_QUAD4);
224  break;
225  case MBTET:
226  types.push_back(MED_TETRA4);
227  types.push_back(MED_TETRA10);
228  break;
229  case MBHEX:
230  types.push_back(MED_HEXA8);
231  break;
232  case MBPRISM:
233  types.push_back(MED_PENTA6);
234  break;
235  case MBPYRAMID:
236  types.push_back(MED_PYRA5);
237  break;
238  case MBVERTEX:
239  types.push_back(MED_POINT1);
240  default:
241  break;
242  }
243 
244  return types;
245 }
246 
247 MoFEMErrorCode MedInterface::readMesh(const string &file, const int index,
248  std::map<int, Range> &family_elem_map,
249  int verb) {
250 
251  Interface &m_field = cOre;
253 
254  med_idt fid = MEDfileOpen(file.c_str(), MED_ACC_RDONLY);
255  if (fid < 0) {
256  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
257  "Unable to open file '%s'", file.c_str());
258  }
259  med_int v[3], vf[3];
260  MEDlibraryNumVersion(&v[0], &v[1], &v[2]);
261  MEDfileNumVersionRd(fid, &vf[0], &vf[1], &vf[2]);
262  if (verb > 1)
263  MOFEM_LOG_C("MEDWORLD", Sev::noisy,
264  "Reading MED file V%d.%d.%d using MED library V%d.%d.%d", vf[0],
265  vf[1], vf[2], v[0], v[1], v[2]);
266 
267  if (vf[0] < 2 || (vf[0] == 2 && vf[1] < 2)) {
268  SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
269  "Cannot read MED file older than V2.2");
270  }
271 
272  char mesh_name[MED_NAME_SIZE + 1], mesh_desc[MED_COMMENT_SIZE + 1];
273  bzero(mesh_name, MED_NAME_SIZE + 1);
274  bzero(mesh_desc, MED_COMMENT_SIZE + 1);
275  med_int space_dim;
276  med_mesh_type mesh_type;
277  med_int mesh_dim, n_step;
278  char dt_unit[MED_SNAME_SIZE + 1];
279  char axis_name[3 * MED_SNAME_SIZE + 1], axis_unit[3 * MED_SNAME_SIZE + 1];
280  med_sorting_type sorting_type;
281  med_axis_type axis_type;
282  if (MEDmeshInfo(fid, index + 1, mesh_name, &space_dim, &mesh_dim, &mesh_type,
283  mesh_desc, dt_unit, &sorting_type, &n_step, &axis_type,
284  axis_name, axis_unit) < 0) {
285  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
286  "Unable to read mesh information");
287  }
288  if (verb > 0)
289  MOFEM_LOG_C("MEDWORLD", Sev::inform, "Reading mesh %s nsteps %d", mesh_name,
290  n_step);
291 
292  switch (axis_type) {
293  case MED_CARTESIAN:
294  break;
295  case MED_SPHERICAL:
296  case MED_CYLINDRICAL:
297  default:
298  SETERRQ(m_field.get_comm(), MOFEM_NOT_IMPLEMENTED,
299  "Curvilinear coordinate system implemented");
300  }
301  if (space_dim < 2) {
302  SETERRQ1(m_field.get_comm(), MOFEM_NOT_IMPLEMENTED,
303  "Not implemented for space dim %d", space_dim);
304  }
305 
306  EntityHandle mesh_meshset;
307  {
308  MeshsetsManager *meshsets_manager_ptr;
309  CHKERR m_field.getInterface(meshsets_manager_ptr);
310  int max_id = 0;
312  max_id = (max_id < cit->getMeshsetId()) ? cit->getMeshsetId() : max_id;
313  }
314  max_id++;
315  CHKERR meshsets_manager_ptr->addMeshset(BLOCKSET, max_id,
316  std::string(mesh_name));
317  CubitMeshSet_multiIndex::index<
318  Composite_Cubit_msId_And_MeshsetType_mi_tag>::type::iterator cit;
319  cit =
320  meshsets_manager_ptr->getMeshsetsMultindex()
322  .find(boost::make_tuple(max_id, CubitBCType(BLOCKSET).to_ulong()));
323  max_id++;
324  mesh_meshset = cit->getMeshset();
325  meshMeshsets.push_back(mesh_meshset);
326  }
327 
328  med_bool change_of_coord, geo_transform;
329  med_int num_nodes = MEDmeshnEntity(
330  fid, mesh_name, MED_NO_DT, MED_NO_IT, MED_NODE, MED_NO_GEOTYPE,
331  MED_COORDINATE, MED_NO_CMODE, &change_of_coord, &geo_transform);
332  if (num_nodes < 0) {
333  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
334  "Could not read number of MED nodes");
335  }
336  if (num_nodes == 0) {
337  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
338  "No nodes in MED mesh");
339  }
340  if (verb > 0)
341  MOFEM_LOG_C("MEDWORLD", Sev::inform, "Read number of nodes %d", num_nodes);
342 
343  std::vector<med_float> coord_med(space_dim * num_nodes);
344  if (MEDmeshNodeCoordinateRd(fid, mesh_name, MED_NO_DT, MED_NO_IT,
345  MED_NO_INTERLACE, &coord_med[0]) < 0) {
346  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
347  "Could not read MED node coordinates");
348  }
349 
350  // Add vertices to moab
351  ReadUtilIface *iface;
352  vector<double *> arrays_coord;
353  EntityHandle startv;
354  CHKERR m_field.get_moab().query_interface(iface);
355  CHKERR iface->get_node_coords(3, num_nodes, 0, startv, arrays_coord);
356  Range verts(startv, startv + num_nodes - 1);
357  std::copy(&coord_med[0 * num_nodes], &coord_med[1 * num_nodes],
358  arrays_coord[0]);
359  std::copy(&coord_med[1 * num_nodes], &coord_med[2 * num_nodes],
360  arrays_coord[1]);
361  if (space_dim == 2) {
362  std::fill(arrays_coord[2], &arrays_coord[2][num_nodes], 0.);
363  } else {
364  std::copy(&coord_med[2 * num_nodes], &coord_med[3 * num_nodes],
365  arrays_coord[2]);
366  }
367  CHKERR m_field.get_moab().add_entities(mesh_meshset, verts);
368  family_elem_map.clear();
369 
370  // get family for vertices
371  {
372  std::vector<med_int> nodes_tags(num_nodes, 0);
373  if (MEDmeshEntityFamilyNumberRd(fid, mesh_name, MED_NO_DT, MED_NO_IT,
374  MED_NODE, MED_NO_GEOTYPE,
375  &nodes_tags[0]) < 0) {
376  nodes_tags.clear();
377  // SETERRQ(
378  // m_field.get_comm(),
379  // MOFEM_OPERATION_UNSUCCESSFUL,
380  // "No family number for elements: using 0 as default family number"
381  // );
382  }
383  for (int i = 0; i < num_nodes; i++) {
384  // cerr << verts[i] << " " /*<< ele_tags[j] << " "*/ << nodes_tags[i] <<
385  // endl;
386  family_elem_map[nodes_tags.empty() ? i : nodes_tags[i]].insert(verts[i]);
387  }
388  }
389 
390  // read elements (loop over all possible MSH element types)
391  for (EntityType ent_type = MBVERTEX; ent_type < MBMAXTYPE; ent_type++) {
392 
393  auto types = moab2med_element_type(ent_type);
394 
395  for (auto type : types) {
396 
397  // get number of cells
398  med_bool change_of_coord;
399  med_bool geo_transform;
400  med_int num_ele = MEDmeshnEntity(
401  fid, mesh_name, MED_NO_DT, MED_NO_IT, MED_CELL, type,
402  MED_CONNECTIVITY, MED_NODAL, &change_of_coord, &geo_transform);
403 
404  // get connectivity
405  if (num_ele <= 0)
406  continue;
407 
408  int num_nod_per_ele = type % 100;
409  if (verb > 0)
410  MOFEM_LOG("MEDWORLD", Sev::inform)
411  << "Reading elements " << num_ele << " of type "
412  << moab::CN::EntityTypeName(ent_type) << " number of nodes "
413  << num_nod_per_ele;
414 
415  std::vector<med_int> conn_med(num_ele * num_nod_per_ele);
416  if (MEDmeshElementConnectivityRd(fid, mesh_name, MED_NO_DT, MED_NO_IT,
417  MED_CELL, type, MED_NODAL,
418  MED_FULL_INTERLACE, &conn_med[0]) < 0) {
419  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
420  "Could not read MED elements");
421  }
422 
423  // cerr << "type " << ent_type << " ";
424  // cerr << "num_ele " << num_ele << " " << num_nod_per_ele << endl;;
425 
426  Range ents;
427 
428  if (ent_type != MBVERTEX) {
429  EntityHandle *conn_moab;
430  EntityHandle starte;
431  CHKERR iface->get_element_connect(num_ele, num_nod_per_ele, ent_type, 0,
432  starte, conn_moab);
433  switch (ent_type) {
434  // FIXME: Some connectivity could not work, need to run and test
435  case MBTET: {
436  int ii = 0;
437  for (int ee = 0; ee != num_ele; ee++) {
438  EntityHandle n[4];
439  for (int nn = 0; nn != num_nod_per_ele; nn++) {
440  // conn_moab[ii] = verts[conn_med[ii]-1];
441  n[nn] = verts[conn_med[ii + nn] - 1];
442  }
443 
444  std::array<int, 10> nodes_map{
445 
446  1, 0, 2, 3,
447 
448  4, 6, 5, 8,
449  7, 9
450 
451  };
452 
453  for (int nn = 0; nn != num_nod_per_ele; nn++, ii++) {
454  conn_moab[ii] = n[nodes_map[nn]];
455  }
456  }
457  } break;
458  default: {
459  int ii = 0;
460  for (int ee = 0; ee != num_ele; ee++) {
461  for (int nn = 0; nn != num_nod_per_ele; nn++, ii++) {
462  // cerr << conn_med[ii] << " ";
463  conn_moab[ii] = verts[conn_med[ii] - 1];
464  }
465  // cerr << endl;
466  }
467  }
468  }
469  CHKERR iface->update_adjacencies(starte, num_ele, num_nod_per_ele,
470  conn_moab);
471  ents = Range(starte, starte + num_ele - 1);
472  } else {
473  // This is special case when in med vertices are defined as elements
474  int ii = 0;
475  std::vector<EntityHandle> conn_moab(num_ele * num_nod_per_ele);
476  for (int ee = 0; ee != num_ele; ++ee)
477  for (int nn = 0; nn != num_nod_per_ele; ++nn, ++ii)
478  conn_moab[ii] = verts[conn_med[ii] - 1];
479  ents.insert_list(conn_moab.begin(), conn_moab.end());
480  }
481 
482  // Add elements to family meshset
483  CHKERR m_field.get_moab().add_entities(mesh_meshset, ents);
484 
485  // get family for cells
486  {
487  std::vector<med_int> fam(num_ele, 0);
488  if (MEDmeshEntityFamilyNumberRd(fid, mesh_name, MED_NO_DT, MED_NO_IT,
489  MED_CELL, type, &fam[0]) < 0) {
490  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
491  "No family number for elements: using 0 as default family "
492  "number");
493  }
494  // std::vector<med_int> ele_tags(num_ele);
495  // if(MEDmeshEntityNumberRd(
496  // fid, mesh_name,MED_NO_DT,MED_NO_IT,MED_CELL,type,&ele_tags[0]) < 0
497  // ) {
498  // ele_tags.clear();
499  // }
500  for (int j = 0; j < num_ele; j++) {
501  // cerr << ents[j] << " " /*<< ele_tags[j] << " "*/ << fam[j] << endl;
502  family_elem_map[fam[j]].insert(ents[j]);
503  }
504  }
505  }
506  }
507 
508  if (MEDfileClose(fid) < 0) {
509  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
510  "Unable to close file '%s'", file.c_str());
511  }
512 
514 }
515 
517 MedInterface::readFamily(const string &file, const int index,
518  const std::map<int, Range> &family_elem_map,
519  std::map<string, Range> &group_elem_map, int verb) {
520  //
521  Interface &m_field = cOre;
523 
524  med_idt fid = MEDfileOpen(file.c_str(), MED_ACC_RDONLY);
525  if (fid < 0) {
526  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
527  "Unable to open file '%s'", file.c_str());
528  }
529  med_int v[3], vf[3];
530  MEDlibraryNumVersion(&v[0], &v[1], &v[2]);
531  MEDfileNumVersionRd(fid, &vf[0], &vf[1], &vf[2]);
532 
533  if (verb > 1) {
534  MOFEM_LOG_C("MEDWORLD", Sev::noisy,
535  "Reading MED file V%d.%d.%d using MED library V%d.%d.%d", vf[0],
536  vf[1], vf[2], v[0], v[1], v[2]);
537  }
538  if (vf[0] < 2 || (vf[0] == 2 && vf[1] < 2)) {
539  SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
540  "Cannot read MED file older than V2.2");
541  }
542 
543  // clear groups
544  group_elem_map.clear();
545 
546  med_int num_families = MEDnFamily(fid, meshNames[index].c_str());
547  if (num_families < 0) {
548  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
549  "Could not read MED families");
550  }
551  for (int i = 0; i < num_families; i++) {
552  med_int num_attrib =
553  (vf[0] == 2)
554  ? MEDnFamily23Attribute(fid, meshNames[index].c_str(), i + 1)
555  : 0;
556  med_int num_groups = MEDnFamilyGroup(fid, meshNames[index].c_str(), i + 1);
557  if (num_attrib < 0 || num_groups < 0) {
558  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
559  "Could not read MED groups or attributes");
560  }
561 
562  std::vector<med_int> attribId(num_attrib + 1);
563  std::vector<med_int> attrib_val(num_attrib + 1);
564  std::vector<char> attrib_des(MED_COMMENT_SIZE * num_attrib + 1);
565  std::vector<char> group_names(MED_LNAME_SIZE * num_groups + 1);
566  char family_name[MED_NAME_SIZE + 1];
567  med_int family_num;
568 
569  if (vf[0] == 2) { // MED2 file
570  if (MEDfamily23Info(fid, meshNames[index].c_str(), i + 1, family_name,
571  &attribId[0], &attrib_val[0], &attrib_des[0],
572  &family_num, &group_names[0]) < 0) {
573  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
574  "Could not read info for MED2 family %d", i + 1);
575  }
576  } else {
577  if (MEDfamilyInfo(fid, meshNames[index].c_str(), i + 1, family_name,
578  &family_num, &group_names[0]) < 0) {
579  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
580  "Could not read info for MED3 family %d", i + 1);
581  }
582  }
583 
584  // cerr << family_name << " " << family_num << " " << num_groups << endl;
585  for (int g = 0; g != num_groups; g++) {
586  std::string name =
587  std::string(&group_names[MED_LNAME_SIZE * g], MED_LNAME_SIZE - 1);
588  name.resize(NAME_TAG_SIZE - 1);
589  if (family_elem_map.find(family_num) == family_elem_map.end()) {
590  MOFEM_LOG_C(
591  "MEDWORLD", Sev::warning,
592  "Family %d not read, likely type of element is not added "
593  "to moab database. Currently only triangle, quad, tetrahedral and "
594  "hexahedral elements are read to moab database",
595  family_num);
596  } else {
597  group_elem_map[name].merge(family_elem_map.at(family_num));
598  // cerr << string(&group_names[MED_LNAME_SIZE*g]) << endl;
599  }
600  }
601  }
602 
603  if (MEDfileClose(fid) < 0) {
604  SETERRQ1(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
605  "Unable to close file '%s'", file.c_str());
606  }
607 
609 }
610 
612 MedInterface::makeBlockSets(const std::map<string, Range> &group_elem_map,
613  int verb) {
614 
615  Interface &m_field = cOre;
617  MeshsetsManager *meshsets_manager_ptr;
618  CHKERR m_field.getInterface(meshsets_manager_ptr);
619 
620  int max_id = 0;
622  max_id = (max_id < cit->getMeshsetId()) ? cit->getMeshsetId() : max_id;
623  }
624  max_id++;
625 
626  for (std::map<string, Range>::const_iterator git = group_elem_map.begin();
627  git != group_elem_map.end(); git++) {
628  CHKERR meshsets_manager_ptr->addMeshset(BLOCKSET, max_id, git->first);
629  CubitMeshSet_multiIndex::index<
630  Composite_Cubit_msId_And_MeshsetType_mi_tag>::type::iterator cit;
631  cit =
632  meshsets_manager_ptr->getMeshsetsMultindex()
634  .find(boost::make_tuple(max_id, CubitBCType(BLOCKSET).to_ulong()));
635  EntityHandle meshsets = cit->getMeshset();
636  if (!git->second.empty()) {
637  CHKERR m_field.get_moab().add_entities(meshsets, git->second);
638  }
639  max_id++;
640  }
641 
643  MOFEM_LOG("MEDWORLD", Sev::verbose) << *cit;
644 
646 }
647 
650  if (medFileName.empty()) {
652  }
653  CHKERR readMed(medFileName, verb);
655 }
656 
657 MoFEMErrorCode MedInterface::writeMed(const string &file, int verb) {
658  Interface &m_field = cOre;
660  SETERRQ(m_field.get_comm(), MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
662 }
663 
664 MoFEMErrorCode MedInterface::readFields(const std::string &file_name,
665  const std::string &field_name,
666  const bool load_series,
667  const int only_step, int verb) {
668 
669  Interface &m_field = cOre;
671  med_idt fid = MEDfileOpen((char *)file_name.c_str(), MED_LECTURE);
672  if (fid < 0) {
673  SETERRQ1(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
674  "Unable to open file '%s'", file_name.c_str());
675  }
676 
677  med_int num_comp = MEDfieldnComponentByName(fid, field_name.c_str());
678  if (num_comp <= 0) {
679  SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
680  "Could not get number of components for MED field");
681  }
682 
683  char meshName[MED_NAME_SIZE + 1];
684  char dtUnit[MED_SNAME_SIZE + 1];
685  std::vector<char> compName(num_comp * MED_SNAME_SIZE + 1);
686  std::vector<char> compUnit(num_comp * MED_SNAME_SIZE + 1);
687  med_int numSteps = 0;
688  med_type_champ type;
689  med_bool localMesh;
690  if (MEDfieldInfoByName(fid, field_name.c_str(), meshName, &localMesh, &type,
691  &compName[0], &compUnit[0], dtUnit, &numSteps) < 0) {
692  SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
693  "Could not get MED field info");
694  }
695 
696  // Get meshset
697  MeshsetsManager *meshsets_manager_ptr;
698  CHKERR m_field.getInterface(meshsets_manager_ptr);
699  const CubitMeshSets *cubit_meshset_ptr;
700  CHKERR meshsets_manager_ptr->getCubitMeshsetPtr(meshName, &cubit_meshset_ptr);
701  EntityHandle meshset = cubit_meshset_ptr->getMeshset();
702 
703  // Paraview can only plot field which have 1, 3, or 9 components. If field has
704  // more that 9 comonents, it is stored on MOAB mesh but not viable in
705  // ParaView.
706  int num_comp_msh = (num_comp <= 1) ? 1
707  : (num_comp <= 3) ? 3
708  : (num_comp <= 9) ? 9
709  : num_comp;
710 
711  // Create tag to store nodal or cell values read form med file. Note that tag
712  // has prefix MED to avoid collision with other tags.
713  Tag th;
714  std::string tag_name = "MED_" + field_name;
715  {
716  std::vector<double> def_val(num_comp_msh, 0);
717  CHKERR m_field.get_moab().tag_get_handle(
718  tag_name.c_str(), num_comp_msh, MB_TYPE_DOUBLE, th,
719  MB_TAG_CREAT | MB_TAG_SPARSE, &def_val[0]);
720  }
721 
722  // Warning! The ordering of the elements in the last two lists is
723  // important: it should match the ordering of the MSH element types
724  // (when elements are saved without tags, this governs the order
725  // with which we implicitly index them in GModel::readMED)
726  const med_entity_type entType[] = {MED_NODE, MED_CELL, MED_NODE_ELEMENT};
727  const med_geometrie_element eleType[] = {
728  MED_NONE, MED_SEG2, MED_TRIA3, MED_QUAD4, MED_TETRA4, MED_HEXA8,
729  MED_PENTA6, MED_PYRA5, MED_SEG3, MED_TRIA6, MED_QUAD9, MED_TETRA10,
730  MED_HEXA27, MED_POINT1, MED_QUAD8, MED_HEXA20, MED_PENTA15, MED_PYRA13};
731  // const int nodesPerEle[] = {0, 2, 3, 4, 4, 8, 6, 5, 3, 6, 9, 10, 27, 1, 8,
732  // 20, 15, 13};
733 
734  std::vector<std::pair<int, int>> pairs;
735  for (unsigned int i = 0; i < sizeof(entType) / sizeof(entType[0]); i++) {
736  for (unsigned int j = 0; j < sizeof(eleType) / sizeof(eleType[0]); j++) {
737  if ((!i && !j) || j) {
738  med_int n = numSteps;
739  if (n > 0) {
740  pairs.push_back(std::pair<int, int>(i, j));
741  numSteps = std::max(numSteps, n);
742  }
743  if (!i && !j)
744  break; // MED_NOEUD does not care about eleType
745  }
746  }
747  }
748 
749  if (numSteps < 1 || pairs.empty()) {
750  SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
751  "Nothing to import from MED file");
752  }
753 
754  if (load_series) {
755  SETERRQ(m_field.get_comm(), MOFEM_NOT_IMPLEMENTED, "Not yet implemented");
756  }
757 
758  for (int step = (only_step == -1) ? 0 : only_step; step < numSteps; step++) {
759 
760  if (!load_series && only_step != step)
761  continue;
762 
763  // cerr << only_step << " " << step << endl;
764 
765  // FIXME: in MED3 we might want to loop over all profiles instead
766  // of relying of the default one
767 
768  // FIXME: MED3 allows to store multi-step meshes; we should
769 
770  for (unsigned int pair = 0; pair < pairs.size(); pair++) {
771 
772  // get step info
773  med_entite_maillage ent = entType[pairs[pair].first];
774  med_geometrie_element ele = eleType[pairs[pair].second];
775  med_int numdt, numit, ngauss;
776  med_float dt;
777  if (MEDfieldComputingStepInfo(fid, field_name.c_str(), step + 1, &numdt,
778  &numit, &dt) < 0) {
779  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
780  "Could not read step info");
781  }
782 
783  char locName[MED_NAME_SIZE + 1], profileName[MED_NAME_SIZE + 1];
784 
785  // get number of values in the field (numVal takes the number of
786  // Gauss points or the number of nodes per element into account,
787  // but not the number of components)
788  med_int profileSize;
789  med_int numVal = MEDfieldnValueWithProfile(
790  fid, field_name.c_str(), numdt, numit, ent, ele, 1,
791  MED_COMPACT_STMODE, profileName, &profileSize, locName, &ngauss);
792  numVal *= ngauss;
793 
794  if (numVal <= 0)
795  continue;
796 
797  // int mult = 1;
798  // if(ent == MED_NODE_ELEMENT) {
799  // mult = nodesPerEle[pairs[pair].second];
800  //}
801  // else if(ngauss != 1){
802  // mult = ngauss;
803  //}
804 
805  // read field data
806  std::vector<double> val(numVal * num_comp);
807  if (MEDfieldValueWithProfileRd(fid, field_name.c_str(), numdt, numit, ent,
808  ele, MED_COMPACT_STMODE, profileName,
809  MED_FULL_INTERLACE, MED_ALL_CONSTITUENT,
810  (unsigned char *)&val[0]) < 0) {
811  SETERRQ(m_field.get_comm(), MOFEM_OPERATION_UNSUCCESSFUL,
812  "Could not read field values");
813  }
814 
815  // if (verb > 2) {
816  // // FIXME: This not looks ok for me
817  // cerr << ent << " " << ele << endl;
818  // cerr << string(meshName) << " : " << string(profileName) << " : "
819  // << string(locName) << " : " << profileSize << " : " << ngauss
820  // << endl;
821  // }
822 
823  switch (ent) {
824  case MED_CELL: {
825  EntityType ent_type = MBMAXTYPE;
826  switch (ele) {
827  case MED_TETRA4:
828  case MED_TETRA10:
829  ent_type = MBTET;
830  break;
831  case MED_HEXA8:
832  ent_type = MBHEX;
833  break;
834  default:
835  MOFEM_LOG_C("MEDWORLD", Sev::warning,
836  "Not yet implemented for this cell %d", ele);
837  }
838  if (ent_type != MBMAXTYPE) {
839  if (ngauss == 1) {
840  Range ents;
841  CHKERR m_field.get_moab().get_entities_by_type(meshset, ent_type,
842  ents, true);
843  double e_vals[num_comp_msh];
844  bzero(e_vals, sizeof(double) * num_comp_msh);
845  std::vector<double>::iterator vit = val.begin();
846  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
847  for (int ii = 0; ii != num_comp; ii++, vit++) {
848  e_vals[ii] = *vit;
849  }
850  CHKERR m_field.get_moab().tag_set_data(th, &*eit, 1, e_vals);
851  }
852  } else {
853  Range ents;
854  CHKERR m_field.get_moab().get_entities_by_type(meshset, ent_type,
855  ents, true);
856  if (ents.size() * ngauss * num_comp != val.size()) {
857  SETERRQ(m_field.get_comm(), MOFEM_DATA_INCONSISTENCY,
858  "data inconsistency");
859  }
860  // FIXME simply average gauss values, far from perfect need fix
861  double e_vals[num_comp_msh];
862  std::vector<double>::iterator vit = val.begin();
863  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
864  bzero(e_vals, sizeof(double) * num_comp_msh);
865  for (int gg = 0; gg != ngauss; gg++) {
866  for (int ii = 0; ii != num_comp; ii++, vit++) {
867  e_vals[ii] += *vit / ngauss;
868  }
869  }
870  CHKERR m_field.get_moab().tag_set_data(th, &*eit, 1, e_vals);
871  }
872  }
873  }
874  // SETERRQ1(
875  // m_field.get_comm(),
876  // MOFEM_NOT_IMPLEMENTED,
877  // "Not implemented for more gauss pts ngauss = %d",
878  // ngauss
879  // );
880  } break;
881  case MED_NODE:
882  case MED_NODE_ELEMENT: {
883  EntityType ent_type = MBVERTEX;
884  Range ents;
885  CHKERR m_field.get_moab().get_entities_by_type(meshset, ent_type, ents,
886  true);
887  double e_vals[num_comp_msh];
888  bzero(e_vals, sizeof(double) * num_comp_msh);
889  std::vector<double>::iterator vit = val.begin();
890  for (Range::iterator eit = ents.begin(); eit != ents.end(); eit++) {
891  for (int ii = 0; ii != num_comp; ii++, vit++) {
892  e_vals[ii] = *vit;
893  }
894  CHKERR m_field.get_moab().tag_set_data(th, &*eit, 1, e_vals);
895  }
896  } break;
897  default:
898  MOFEM_LOG_C("MEDWORLD", Sev::inform, "Entity type %d not implemented",
899  ent);
900  }
901  }
902  }
903 
905 }
906 
907 std::ostream &operator<<(std::ostream &os,
908  const MedInterface::FieldData &field_data) {
909  os << "field name: " << field_data.fieldName;
910  os << " mesh name: " << field_data.meshName;
911  os << " local mesh: " << ((field_data.localMesh) ? "true" : "false");
912  os << std::endl;
913  // os << " field type: ";
914  // switch (field_data.fieldType) {
915  // case MED_FLOAT64: os << "MED_FLOAT64"; break;
916  // case MED_INT32: os << "MED_INT32"; break;
917  // case MED_INT64: os << "MED_INT64"; break;
918  // case MED_INT: os << "MED_INT"; break;
919  // };
920  os << " componentNames:";
921  for (unsigned int ff = 0; ff != field_data.componentNames.size(); ff++) {
922  os << " " << field_data.componentNames[ff];
923  }
924  os << std::endl;
925  os << " componentUnits:";
926  for (unsigned int ff = 0; ff != field_data.componentUnits.size(); ff++) {
927  os << " " << field_data.componentUnits[ff];
928  }
929  os << std::endl;
930  os << " dtUnit: " << field_data.dtUnit << endl;
931  os << " number of steps: " << field_data.ncSteps;
932  return os;
933 }
934 
935 } // namespace MoFEM
936 
937 #endif // WITH_MED
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::MedInterface::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: MedInterface.cpp:41
MoFEM::operator<<
std::ostream & operator<<(std::ostream &os, const EntitiesFieldData::EntData &e)
Definition: EntitiesFieldData.cpp:240
g
constexpr double g
Definition: shallow_wave.cpp:63
MoFEM::LogManager::checkIfChannelExist
static bool checkIfChannelExist(const std::string channel)
Check if channel exist.
Definition: LogManager.cpp:404
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
EntityHandle
MoFEM::MedInterface
Interface for load MED files.
Definition: MedInterface.hpp:23
MoFEM::MedInterface::makeBlockSets
MoFEMErrorCode makeBlockSets(const std::map< string, Range > &group_elem_map, int verb=1)
make from groups meshsets
Definition: MedInterface.cpp:612
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
MoFEM::MedInterface::medFileName
std::string medFileName
MED file name.
Definition: MedInterface.hpp:112
MoFEM::MedInterface::meshNames
std::vector< std::string > meshNames
list of meshes in MED file
Definition: MedInterface.hpp:109
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::CubitMeshSets
this struct keeps basic methods for moab meshset about material and boundary conditions
Definition: BCMultiIndices.hpp:19
MoFEM::MedInterface::FieldData::ncSteps
int ncSteps
Definition: MedInterface.hpp:106
MoFEM::MedInterface::readFamily
MoFEMErrorCode readFamily(const string &file, const int index, const std::map< int, Range > &family_elem_mapint, std::map< string, Range > &group_elem_map, int verb=1)
read family and groups
Definition: MedInterface.cpp:517
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
MoFEM::MedInterface::readMed
MoFEMErrorCode readMed(const string &file, int verb=1)
read MED file
Definition: MedInterface.cpp:143
MoFEM::MedInterface::fieldNames
std::map< std::string, FieldData > fieldNames
Definition: MedInterface.hpp:111
MoFEM::LogManager::createSink
static boost::shared_ptr< SinkType > createSink(boost::shared_ptr< std::ostream > stream_ptr, std::string comm_filter)
Create a sink object.
Definition: LogManager.cpp:298
MOFEM_IMPOSSIBLE_CASE
@ MOFEM_IMPOSSIBLE_CASE
Definition: definitions.h:35
MoFEM::MedInterface::FieldData::localMesh
bool localMesh
Definition: MedInterface.hpp:101
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::MedInterface::FieldData
Definition: MedInterface.hpp:98
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::moab2med_element_type
static std::vector< med_geometrie_element > moab2med_element_type(const EntityType type)
Definition: MedInterface.cpp:209
MoFEM::CoreInterface::get_moab
virtual moab::Interface & get_moab()=0
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::MedInterface::FieldData::dtUnit
std::string dtUnit
Definition: MedInterface.hpp:105
MoFEM::MedInterface::flgFile
PetscBool flgFile
true if file name given in command line
Definition: MedInterface.hpp:117
MOFEM_LOG_C
#define MOFEM_LOG_C(channel, severity, format,...)
Definition: LogManager.hpp:311
MoFEM::MedInterface::medGetFieldNames
MoFEMErrorCode medGetFieldNames(const string &file, int verb=1)
Get field names in MED file.
Definition: MedInterface.cpp:80
MoFEM::MedInterface::getFileNameFromCommandLine
MoFEMErrorCode getFileNameFromCommandLine(int verb=1)
Get MED file name from command line.
Definition: MedInterface.cpp:61
convert.type
type
Definition: convert.py:64
MoFEM::MeshsetsManager::addMeshset
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
add cubit meshset
Definition: MeshsetsManager.cpp:382
MoFEM::MedInterface::readFields
MoFEMErrorCode readFields(const std::string &file_name, const std::string &field_name, const bool load_series=false, const int only_step=-1, int verb=1)
Definition: MedInterface.cpp:664
MoFEM::LogManager::getStrmWorld
static boost::shared_ptr< std::ostream > getStrmWorld()
Get the strm world object.
Definition: LogManager.cpp:344
MoFEM::Composite_Cubit_msId_And_MeshsetType_mi_tag
Definition: TagMultiIndices.hpp:15
MoFEM::MedInterface::meshMeshsets
std::vector< EntityHandle > meshMeshsets
meshset for each mesh
Definition: MedInterface.hpp:110
MOFEM_OPERATION_UNSUCCESSFUL
@ MOFEM_OPERATION_UNSUCCESSFUL
Definition: definitions.h:34
MOFEM_LOG_TAG
#define MOFEM_LOG_TAG(channel, tag)
Tag channel.
Definition: LogManager.hpp:339
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
MoFEM::MedInterface::FieldData::fieldName
std::string fieldName
Definition: MedInterface.hpp:99
field_name
constexpr auto field_name
Definition: poisson_2d_homogeneous.cpp:13
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:23
convert.n
n
Definition: convert.py:82
MoFEM::UnknownInterface
base class for all interface classes
Definition: UnknownInterface.hpp:34
MedInterface.hpp
Med file interface interface.
v
const double v
phase velocity of light in medium (cm/ns)
Definition: initial_diffusion.cpp:40
Range
MoFEM::MeshsetsManager::getMeshsetsMultindex
CubitMeshSet_multiIndex & getMeshsetsMultindex()
Definition: MeshsetsManager.hpp:229
MoFEM::Types::CubitBCType
std::bitset< 32 > CubitBCType
Definition: Types.hpp:52
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
MoFEM::MedInterface::writeMed
MoFEMErrorCode writeMed(const string &file, int verb=1)
write MED file
Definition: MedInterface.cpp:657
MoFEM::MedInterface::readMesh
MoFEMErrorCode readMesh(const string &file, const int index, std::map< int, Range > &family_elem_map, int verb=1)
read mesh from MED file
Definition: MedInterface.cpp:247
_IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
Definition: MeshsetsManager.hpp:71
MoFEM::CubitMeshSets::getMeshset
EntityHandle getMeshset() const
get bc meshset
Definition: BCMultiIndices.hpp:62
MoFEM::MedInterface::MedInterface
MedInterface(const MoFEM::Core &core)
Definition: MedInterface.cpp:47
BLOCKSET
@ BLOCKSET
Definition: definitions.h:148
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MoFEM::Types::FieldData
double FieldData
Field data type.
Definition: Types.hpp:25
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::MedInterface::FieldData::componentNames
std::vector< std::string > componentNames
Definition: MedInterface.hpp:103
MoFEM::MeshsetsManager
Interface for managing meshsets containing materials and boundary conditions.
Definition: MeshsetsManager.hpp:104
MoFEM::MedInterface::FieldData::componentUnits
std::vector< std::string > componentUnits
Definition: MedInterface.hpp:104
MoFEM::MedInterface::cOre
MoFEM::Core & cOre
core database
Definition: MedInterface.hpp:115
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MoFEM::MeshsetsManager::getCubitMeshsetPtr
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
Definition: MeshsetsManager.cpp:575
dt
double dt
Definition: heat_method.cpp:26
MoFEM::LogManager::setLog
static LoggerType & setLog(const std::string channel)
Set ans resset chanel logger.
Definition: LogManager.cpp:389
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MOFEM_NOT_IMPLEMENTED
@ MOFEM_NOT_IMPLEMENTED
Definition: definitions.h:32
MoFEM::MedInterface::FieldData::meshName
std::string meshName
Definition: MedInterface.hpp:100
CHKERRG
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346