v0.14.0
fix_file.cpp
Go to the documentation of this file.
1 /** \file fix_file.cpp
2  \brief Load and save file
3 */
4 
5 #include <MoFEM.hpp>
6 using namespace MoFEM;
7 
8 static char help[] = "...\n\n";
9 
10 int main(int argc, char *argv[]) {
11 
12  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
13 
14  try {
15  char mesh_file_name[255] = "in.h5m";
16  char out_file_name[255] = "out.h5m";
17  PetscBool in_flg_file = PETSC_FALSE;
18  PetscBool out_flg_file = PETSC_FALSE;
19  CHKERR PetscOptionsBegin(PETSC_COMM_WORLD, "", "Fix file options", "none");
20  CHKERR PetscOptionsString("-file_name", "mesh file name", "", "mesh.h5m",
21  mesh_file_name, 255, &out_flg_file);
22  CHKERR PetscOptionsString("-out_file_name", "mesh file name", "",
23  "mesh.h5m", out_file_name, 255, &out_flg_file);
24  ierr = PetscOptionsEnd();
25  CHKERRG(ierr);
26 
27  moab::Core mb_instance;
28  moab::Interface &moab = mb_instance;
29  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
30  const char *option;
31  option = "";
32 
33  MOFEM_LOG("WORLD", Sev::inform)
34  << "In " << mesh_file_name << " out " << out_file_name;
35 
36  CHKERR moab.load_file(mesh_file_name, 0, option);
37  bool changes = false;
38  CHKERR BitRefManager::fixTagSize(moab, &changes);
39  if (changes)
40  CHKERR moab.write_file(out_file_name);
41  }
42 
44 
46 }
help
static char help[]
Definition: fix_file.cpp:8
MYPCOMM_INDEX
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:215
MoFEM.hpp
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
out_file_name
char out_file_name[255]
Definition: initial_diffusion.cpp:53
MoFEM::BitRefManager::fixTagSize
static MoFEMErrorCode fixTagSize(moab::Interface &moab, bool *changed=nullptr)
Fix tag size when BITREFLEVEL_SIZE of core library is different than file BITREFLEVEL_SIZE.
Definition: BitRefManager.cpp:1232
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
main
int main(int argc, char *argv[])
Definition: fix_file.cpp:10
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:23
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_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1094
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
CHKERRG
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483