v0.14.0
Functions | Variables
delete_ho_nodes.cpp File Reference

Delete higher order nodes. More...

#include <MoFEM.hpp>

Go to the source code of this file.

Functions

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

Variables

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

Detailed Description

Delete higher order nodes.

Definition in file delete_ho_nodes.cpp.

Function Documentation

◆ main()

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

Definition at line 26 of file delete_ho_nodes.cpp.

26  {
27  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
28 
29  try {
30 
31  // global variables
32  char mesh_file_name[255];
33  PetscBool flg_file = PETSC_FALSE;
34  CHKERR PetscOptionsBegin(PETSC_COMM_WORLD, "", "Field to vertices options",
35  "none");
36  CHKERR PetscOptionsString("-my_file", "mesh file name", "", "mesh.h5m",
37  mesh_file_name, 255, &flg_file);
38  ierr = PetscOptionsEnd();
39  CHKERRG(ierr);
40 
41  moab::Core mb_instance;
42  moab::Interface &moab = mb_instance;
43  ParallelComm *pcomm = ParallelComm::get_pcomm(&moab, MYPCOMM_INDEX);
44  if (pcomm == NULL)
45  pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
46  const char *option;
47  option = "";
48  CHKERR moab.load_file(mesh_file_name, 0, option);
49 
50  // Create MoFEM database
51  MoFEM::Core core(moab);
52 
53  if (flg_file != PETSC_TRUE) {
54  SETERRQ(PETSC_COMM_SELF, MOFEM_INVALID_DATA,
55  "*** ERROR -my_file (MESH FILE NEEDED)");
56  }
57 
58  Range all_tets, topo_nodes, mid_nodes;
59  CHKERR moab.get_entities_by_type(0, MBTET, all_tets);
60  CHKERR moab.get_connectivity(all_tets, topo_nodes, true);
61  CHKERR moab.get_connectivity(all_tets, mid_nodes, false);
62  std::cout << "\n Mesh contains of " << mid_nodes.size()
63  << " nodes in total. ";
64  mid_nodes = subtract(mid_nodes, topo_nodes);
65  std::cout << mid_nodes.size() << " higher order nodes. \n";
66 
67  for (int dim : {1, 2, 3}) {
68  EntityHandle sub_meshset;
69  CHKERR moab.create_meshset(MESHSET_SET, sub_meshset);
70  Range edges;
71  CHKERR moab.get_entities_by_dimension(0, dim, edges, false);
72  CHKERR moab.add_entities(sub_meshset, edges);
73  CHKERR moab.convert_entities(sub_meshset, false, false,
74  false /*,&my_add_remove*/);
75  }
76 
77  Range new_nodes;
78  CHKERR moab.get_entities_by_type(0, MBVERTEX, new_nodes);
79  PetscPrintf(PETSC_COMM_WORLD, "New number of nodes: %d. \n",
80  new_nodes.size());
81  PetscPrintf(PETSC_COMM_WORLD, "Saving file out.h5m... \n");
82 
83  CHKERR moab.write_file("out.h5m");
84  }
86 
88 
89  return 0;
90 }

Variable Documentation

◆ help

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

Definition at line 24 of file delete_ho_nodes.cpp.

MYPCOMM_INDEX
#define MYPCOMM_INDEX
default communicator number PCOMM
Definition: definitions.h:215
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
EntityHandle
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
help
static char help[]
Definition: delete_ho_nodes.cpp:24
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
mesh_file_name
char mesh_file_name[255]
Definition: mesh_smoothing.cpp:23
Range
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
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
MOFEM_INVALID_DATA
@ MOFEM_INVALID_DATA
Definition: definitions.h:36