v0.16.3
Loading...
Searching...
No Matches
Functions
bc_displacement_blocks.cpp File Reference

Check displacement types in JSON names containing other BC tokens. More...

#include <MoFEM.hpp>

Go to the source code of this file.

Functions

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

Detailed Description

Check displacement types in JSON names containing other BC tokens.

Definition in file bc_displacement_blocks.cpp.

Function Documentation

◆ main()

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

Definition at line 7 of file bc_displacement_blocks.cpp.

7 {
8 MoFEM::Core::Initialize(&argc, &argv, nullptr,
9 "Displacement block name parsing\n");
10 try {
11 moab::Core moab_core;
12 MoFEM::Core core(moab_core);
13 MoFEM::Interface &m_field = core;
14 auto *meshsets = m_field.getInterface<MeshsetsManager>();
15 CHKERR meshsets->addMeshset(BLOCKSET, 5, "FIX_Z");
16 CHKERR meshsets->addMeshset(BLOCKSET, 6, "FIX_ALL");
17 auto *config = m_field.getInterface<JsonConfigManager>();
19 CHKERR meshsets->setMeshsetFromFile();
20 CHKERR config->applyMeshsets();
21
22 auto *bc_manager = m_field.getInterface<BcManager>();
23 // An empty problem name exercises the BC data parser without a FE problem.
24 CHKERR bc_manager
26 false);
27 const auto &blocks = bc_manager->getBcMapByBlockName();
28 const auto all_it = blocks.find("_P_FIX_ALL_FIX_Z_5");
29 const auto z_it = blocks.find("_P_FIX_Z_FIX_ALL_6");
30 if (all_it == blocks.end() || z_it == blocks.end() ||
31 !all_it->second->dispBcPtr || !z_it->second->dispBcPtr)
32 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
33 "Missing displacement BC data for generated JSON names");
34 const auto &all = all_it->second->dispBcPtr->data;
35 const auto &z = z_it->second->dispBcPtr->data;
36 if (all.flag1 != 1 || all.flag2 != 1 || all.flag3 != 1 ||
37 all.value1 != 1.0 || all.value2 != 2.0 || all.value3 != 3.0)
38 SETERRQ(
39 PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
40 "FIX_ALL must constrain x, y and z despite the FIX_Z source name");
41 if (z.flag1 != 0 || z.flag2 != 0 || z.flag3 != 1 || z.value3 != 6.0)
42 SETERRQ(PETSC_COMM_WORLD, MOFEM_ATOM_TEST_INVALID,
43 "FIX_Z must constrain only z despite the FIX_ALL source name");
44 }
47 return 0;
48}
#define CATCH_ERRORS
Catch errors.
@ BLOCKSET
@ MOFEM_ATOM_TEST_INVALID
Definition definitions.h:40
#define CHKERR
Inline error check.
MoFEMErrorCode addMeshset(const CubitBCType cubit_bc_type, const int ms_id, const std::string name="")
Add CUBIT meshset to manager.
MoFEMErrorCode pushMarkDOFsOnEntities(const std::string problem_name, const std::string block_name, const std::string field_name, int lo, int hi, bool get_low_dim_ents=true)
Mark DOFs on block entities for boundary conditions.
Template specialization for displacement boundary conditions.
Boundary condition manager for finite element problem setup.
Core (interface) class.
Definition Core.hpp:83
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition Core.cpp:68
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition Core.cpp:123
Deprecated interface functions.
MoFEMErrorCode getSubInterfaceOptions()
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.