v0.13.2
Loading...
Searching...
No Matches
loops_test.cpp
Go to the documentation of this file.
1
2
3#include <MoFEM.hpp>
4
5using namespace MoFEM;
6
7static char help[] = "...\n\n";
8
9int main(int argc, char *argv[]) {
10
11 MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
12
13 try {
14
15 moab::Core mb_instance;
16 moab::Interface &moab = mb_instance;
17
18 // Read parameters from line command
19 PetscBool flg = PETSC_TRUE;
20 char mesh_file_name[255];
21#if PETSC_VERSION_GE(3, 6, 4)
22 ierr = PetscOptionsGetString(PETSC_NULL, "", "-my_file", mesh_file_name,
23 255, &flg);
25#else
26 ierr = PetscOptionsGetString(PETSC_NULL, PETSC_NULL, "-my_file",
27 mesh_file_name, 255, &flg);
29#endif
30 if (flg != PETSC_TRUE) {
31 SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
32 }
33
34 // Read mesh to MOAB
35 const char *option;
36 option = "";
37 CHKERR moab.load_file(mesh_file_name, 0, option);
38
39 // Create MoFEM (Joseph) database
40 MoFEM::Core core(moab);
41 MoFEM::Interface &m_field = core;
42
43 // Open mesh_file_name.txt for writing
44 std::ofstream myfile;
45 myfile.open((std::string(mesh_file_name) + ".txt").c_str());
46
47 std::cout << "<<<< All BLOCKSETs, SIDESETs and NODESETs >>>>>" << std::endl;
48 for (_IT_CUBITMESHSETS_FOR_LOOP_(m_field, it)) {
49 std::cout << it->getName() << std::endl;
50 myfile << it->getName() << std::endl;
51 }
52 std::cout << "<<<< BLOCKSETs >>>>>" << std::endl;
54 std::cout << it->getName() << std::endl;
55 myfile << it->getName() << std::endl;
56 }
57 std::cout << "<<<< NODESETs >>>>>" << std::endl;
59 std::cout << it->getName() << std::endl;
60 myfile << it->getName() << std::endl;
61 }
62 std::cout << "<<<< SIDESETs >>>>>" << std::endl;
64 std::cout << it->getName() << std::endl;
65 myfile << it->getName() << std::endl;
66 }
67 std::cout << "<<<< MeshSet of Name Moon >>>>" << std::endl;
68 for (_IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(m_field, "Moon", it)) {
69 std::cout << it->getName() << std::endl;
70 myfile << it->getName() << std::endl;
71 if (it->getBcTypeULong() & BLOCKSET) {
72 std::cout << "BLOCKSET" << std::endl;
73 myfile << "BLOCKSET" << std::endl;
74 }
75 if (it->getBcTypeULong() & SIDESET) {
76 std::cout << "SIDESET" << std::endl;
77 myfile << "SIDESET" << std::endl;
78 }
79 if (it->getBcTypeULong() & NODESET) {
80 std::cout << "NODESET" << std::endl;
81 myfile << "NODESET" << std::endl;
82 }
83 }
84
85 // Close mesh_file_name.txt
86 myfile.close();
87 }
89
91}
int main()
Definition: adol-c_atom.cpp:46
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:483
@ NODESET
Definition: definitions.h:146
@ SIDESET
Definition: definitions.h:147
@ BLOCKSET
Definition: definitions.h:148
#define CHKERR
Inline error check.
Definition: definitions.h:535
#define _IT_CUBITMESHSETS_BY_NAME_FOR_LOOP_(MESHSET_MANAGER, NAME, IT)
Iterator that loops over Cubit BlockSet having a particular name.
#define _IT_CUBITMESHSETS_FOR_LOOP_(MESHSET_MANAGER, IT)
Iterator that loops over all the Cubit MeshSets in a moFEM field.
#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.
static char help[]
Definition: loops_test.cpp:7
char mesh_file_name[255]
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Core (interface) class.
Definition: Core.hpp:82
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
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
Deprecated interface functions.