v0.14.0
Functions | Variables
meshset_to_vtk.cpp File Reference
#include <MoFEM.hpp>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Variables

static char help [] = "...\n\n"
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
Examples
meshset_to_vtk.cpp.

Definition at line 14 of file meshset_to_vtk.cpp.

14  {
15 
16  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
17 
18  try {
19 
20  // global variables
21  char mesh_file_name[255];
22  PetscBool flg_file = PETSC_FALSE;
23 
24  ierr = PetscOptionsBegin(PETSC_COMM_WORLD, "", "none", "none");
25  CHKERRQ(ierr);
26 
27  CHKERR PetscOptionsString("-my_file", "mesh file name", "", "mesh.h5m",
28  mesh_file_name, 255, &flg_file);
29 
30  ierr = PetscOptionsEnd();
31  CHKERRQ(ierr);
32 
33  moab::Core mb_instance;
34  moab::Interface &moab = mb_instance;
35  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
36  if (pcomm == NULL)
37  pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
38 
39  const char *option;
40  option = "";
41  CHKERR moab.load_file(mesh_file_name, 0, option);
42 
43  // Create MoFEM database
44  MoFEM::Core core(moab);
45  MoFEM::Interface &m_field = core;
46 
47  if (flg_file != PETSC_TRUE) {
48  SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
49  }
50 
51  MeshsetsManager *meshsets_manager;
52  CHKERR m_field.getInterface(meshsets_manager);
53  CHKERR meshsets_manager->setMeshsetFromFile();
54 
56 
57  for (auto &cit : meshsets_manager->getMeshsetsMultindex()) {
58 
59  std::string type = "_";
60  if((cit.getBcType() & CubitBCType(BLOCKSET)).any())
61  type += "BLOCKSET_";
62  if((cit.getBcType() & CubitBCType(SIDESET)).any())
63  type += "SIDESET_";
64  if((cit.getBcType() & CubitBCType(NODESET)).any())
65  type += "NODESET_";
66 
67  std::string name = "meshset" + type +
68  boost::lexical_cast<std::string>(cit.getMeshsetId()) +
69  ".vtk";
70  std::cout << "Writting file: " << name << endl;
71 
72  CHKERR meshsets_manager->saveMeshsetToFile(
73  cit.getMeshsetId(), (cit.getBcType() & mask).to_ulong(), name);
74  }
75  }
77 
79  CHKERRQ(ierr);
80 
81  return 0;
82 }

Variable Documentation

◆ help

char help[] = "...\n\n"
static
Examples
meshset_to_vtk.cpp.

Definition at line 12 of file meshset_to_vtk.cpp.

MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
SIDESET
@ SIDESET
Definition: definitions.h:160
MYPCOMM_INDEX
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:228
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
help
static char help[]
Definition: meshset_to_vtk.cpp:12
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
NODESET
@ NODESET
Definition: definitions.h:159
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::MeshsetsManager::saveMeshsetToFile
MoFEMErrorCode saveMeshsetToFile(const int ms_id, const unsigned int cubit_bc_type, const std::string file_name="out_meshset.vtk", const std::string file_type="VTK", const std::string options="") const
save cubit meshset entities on the moab mesh
Definition: MeshsetsManager.cpp:1399
MoFEM::MeshsetsManager::setMeshsetFromFile
MoFEMErrorCode setMeshsetFromFile(const string file_name, const bool clean_file_options=true)
add blocksets reading config file
Definition: MeshsetsManager.cpp:791
convert.type
type
Definition: convert.py:64
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:22
MoFEM::MeshsetsManager::getMeshsetsMultindex
CubitMeshSet_multiIndex & getMeshsetsMultindex()
Definition: MeshsetsManager.hpp:229
MoFEM::CoreTmp< 0 >::Initialize
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:72
MoFEM::Types::CubitBCType
std::bitset< 32 > CubitBCType
Definition: Types.hpp:52
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
BLOCKSET
@ BLOCKSET
Definition: definitions.h:161
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MoFEM::MeshsetsManager
Interface for managing meshsets containing materials and boundary conditions.
Definition: MeshsetsManager.hpp:104