v0.15.0
Loading...
Searching...
No Matches
Functions | Variables
activate_deactivate_dofs.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[] 
)

Definition at line 15 of file activate_deactivate_dofs.cpp.

15 {
16 MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
17
18 try {
19
20 moab::Core mb_instance;
21 moab::Interface &moab = mb_instance;
22 int rank;
23 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
24
25 PetscBool flg = PETSC_TRUE;
26 char mesh_file_name[255];
27#if PETSC_VERSION_GE(3, 6, 4)
28 CHKERR PetscOptionsGetString(PETSC_NULLPTR, "", "-my_file", mesh_file_name,
29 255, &flg);
30#else
31 CHKERR PetscOptionsGetString(PETSC_NULLPTR, PETSC_NULLPTR, "-my_file",
32 mesh_file_name, 255, &flg);
33#endif
34 if (flg != PETSC_TRUE) {
35 SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
36 }
37
38 const char *option;
39 option = "";
40 CHKERR moab.load_file(mesh_file_name, 0, option);
42
43 // Create MoFEM (Joseph) database
44 MoFEM::Core core(moab);
45 MoFEM::Interface &m_field = core;
46
47 // set entitities bit level
48 BitRefLevel bit_level0;
49 bit_level0.set(0);
50 EntityHandle meshset_level0;
51 CHKERR moab.create_meshset(MESHSET_SET, meshset_level0);
53 CHKERR m_field.getInterface<BitRefManager>()->setBitRefLevelByDim(
54 0, 3, bit_level0);
55
56 // Fields
57 CHKERR m_field.add_field("F1", L2, AINSWORTH_LEGENDRE_BASE, 1);
59
60 // meshset consisting all entities in mesh
61 EntityHandle root_set = moab.get_root_set();
62 // add entities to field
63 CHKERR m_field.add_ents_to_field_by_type(root_set, MBTET, "F1");
64 CHKERR m_field.add_ents_to_field_by_type(root_set, MBTET, "F2");
65
66 // set app. order
67 // see Hierarchic Finite Element Bases on Unstructured Tetrahedral Meshes
68 // (Mark Ainsworth & Joe Coyle)
69 int order = 4;
70 CHKERR m_field.set_field_order(root_set, MBTET, "F1", order - 1, 2);
71 CHKERR m_field.set_field_order(root_set, MBTET, "F2", order, 2);
72 CHKERR m_field.set_field_order(root_set, MBTRI, "F2", order, 2);
73
74 CHKERR m_field.build_fields();
75
76 order = 2;
77 CHKERR m_field.set_field_order(root_set, MBTET, "F1", order - 1, 2);
78 CHKERR m_field.set_field_order(root_set, MBTET, "F2", order, 2);
79 CHKERR m_field.set_field_order(root_set, MBTRI, "F2", order, 2);
80
82 CHKERR m_field.build_fields();
83
84 auto dofs_ptr = m_field.get_dofs();
85 const unsigned int expected_size = 300;
86 if (dofs_ptr->size() != expected_size) {
87 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
88 "Data inconsistency, should %d dofs but is %d", expected_size,
89 dofs_ptr->size());
90 }
91 }
93
94 // finish work cleaning memory, getting statistics, ect.
96
97 return 0;
98}
static char help[]
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition definitions.h:60
@ L2
field with C-1 continuity
Definition definitions.h:88
@ HDIV
field with continuous normal traction
Definition definitions.h:87
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
@ MOFEM_DATA_INCONSISTENCY
Definition definitions.h:31
#define CHKERR
Inline error check.
constexpr int order
virtual const DofEntity_multiIndex * get_dofs() const =0
Get the dofs object.
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
virtual MoFEMErrorCode clear_inactive_dofs(int verb=DEFAULT_VERBOSITY)=0
char mesh_file_name[255]
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition Types.hpp:40
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
Managing BitRefLevels.
virtual MoFEMErrorCode add_field(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
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:118
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

Variable Documentation

◆ help

char help[] = "...\n\n"
static
Examples
ep.cpp, mofem/atom_tests/add_blockset.cpp, mofem/atom_tests/add_cubit_meshsets.cpp, mofem/atom_tests/bernstein_bezier_generate_base.cpp, mofem/atom_tests/boundary_marker.cpp, mofem/atom_tests/build_composite_problem.cpp, mofem/atom_tests/build_large_problem.cpp, mofem/atom_tests/build_problems.cpp, mofem/atom_tests/child_and_parent.cpp, mofem/atom_tests/continuity_check_on_contact_prism_side_ele.cpp, mofem/atom_tests/continuity_check_on_skeleton_3d.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_h1.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hcurl.cpp, mofem/atom_tests/continuity_check_on_skeleton_with_simple_2d_for_hdiv.cpp, mofem/atom_tests/cubit_bc_test.cpp, mofem/atom_tests/dg_projection.cpp, mofem/atom_tests/dm_build_partitioned_mesh.cpp, mofem/atom_tests/dm_create_subdm.cpp, mofem/atom_tests/dm_partitioned_no_field.cpp, mofem/atom_tests/edge_and_bubble_shape_functions_on_quad.cpp, mofem/atom_tests/field_blas.cpp, mofem/atom_tests/field_blas_axpy.cpp, mofem/atom_tests/field_evaluator.cpp, mofem/atom_tests/find_local_coordinates.cpp, mofem/atom_tests/forces_and_sources_testing_edge_element.cpp, mofem/atom_tests/forces_and_sources_testing_flat_prism_element.cpp, mofem/atom_tests/forces_and_sources_testing_users_base.cpp, mofem/atom_tests/gauss_points_on_outer_product.cpp, mofem/atom_tests/hanging_node_approx.cpp, mofem/atom_tests/hcurl_check_approx_in_2d.cpp, mofem/atom_tests/hcurl_curl_operator.cpp, mofem/atom_tests/hcurl_divergence_operator_2d.cpp, mofem/atom_tests/hdiv_check_approx_in_3d.cpp, mofem/atom_tests/hdiv_divergence_operator.cpp, mofem/atom_tests/higher_derivatives.cpp, mofem/atom_tests/log.cpp, mofem/atom_tests/loop_entities.cpp, mofem/atom_tests/matrix_function.cpp, mofem/atom_tests/mesh_insert_interface_atom.cpp, mofem/atom_tests/node_merge.cpp, mofem/atom_tests/operators_tests.cpp, mofem/atom_tests/partition_mesh.cpp, mofem/atom_tests/petsc_smart_ptr_objects.cpp, mofem/atom_tests/prism_elements_from_surface.cpp, mofem/atom_tests/prism_polynomial_approximation.cpp, mofem/atom_tests/quad_polynomial_approximation.cpp, mofem/atom_tests/remove_entities_from_problem.cpp, mofem/atom_tests/remove_entities_from_problem_not_partitioned.cpp, mofem/atom_tests/scalar_check_approximation.cpp, mofem/atom_tests/schur_test_diag_mat.cpp, mofem/atom_tests/simple_interface.cpp, mofem/atom_tests/simple_l2_only.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/atom_tests/test_broken_space.cpp, mofem/atom_tests/test_cache_on_entities.cpp, mofem/tools/delete_ho_nodes.cpp, mofem/tools/extrude_prisms.cpp, mofem/tools/field_to_vertices.cpp, mofem/tools/mesh_cut.cpp, mofem/tools/mesh_smoothing.cpp, mofem/tools/meshset_to_vtk.cpp, mofem/tools/remove_mofem_meshsets.cpp, mofem/tools/split_sideset.cpp, mofem/tutorials/adv-0/plastic.cpp, mofem/tutorials/adv-2/thermo_elastic.cpp, mofem/tutorials/adv-3/level_set.cpp, mofem/tutorials/adv-4/dynamic_first_order_con_law.cpp, mofem/tutorials/adv-5/seepage.cpp, mofem/tutorials/clx-0/helmholtz.cpp, mofem/tutorials/cor-0to1/unsaturated_transport.cpp, mofem/tutorials/cor-10/navier_stokes.cpp, mofem/tutorials/cor-2to5/analytical_nonlinear_poisson.cpp, mofem/tutorials/cor-2to5/analytical_poisson.cpp, mofem/tutorials/cor-2to5/analytical_poisson_field_split.cpp, mofem/tutorials/cor-6/simple_elasticity.cpp, mofem/tutorials/cor-7/elasticity_mixed_formulation.cpp, mofem/tutorials/cor-9/reaction_diffusion.cpp, mofem/tutorials/fun-0/hello_world.cpp, mofem/tutorials/fun-1/integration.cpp, mofem/tutorials/fun-2/plot_base.cpp, mofem/tutorials/max-0/magnetostatic.cpp, mofem/tutorials/max-1/lorentz_force.cpp, mofem/tutorials/mix-0/mixed_poisson.cpp, mofem/tutorials/mix-1/phase.cpp, mofem/tutorials/scl-0/approximaton.cpp, mofem/tutorials/scl-1/poisson_2d_homogeneous.cpp, mofem/tutorials/scl-10/initial_diffusion.cpp, mofem/tutorials/scl-10/photon_diffusion.cpp, mofem/tutorials/scl-11/poisson_2d_dis_galerkin.cpp, mofem/tutorials/scl-12/electrostatics.cpp, mofem/tutorials/scl-6/heat_equation.cpp, mofem/tutorials/scl-7/wave_equation.cpp, mofem/tutorials/scl-8/radiation.cpp, mofem/tutorials/scl-9/heat_method.cpp, mofem/tutorials/vec-0/elastic.cpp, mofem/tutorials/vec-1/eigen_elastic.cpp, mofem/tutorials/vec-2/nonlinear_elastic.cpp, mofem/tutorials/vec-3/nonlinear_dynamic_elastic.cpp, mofem/tutorials/vec-4/approx_sphere.cpp, mofem/tutorials/vec-4/shallow_wave.cpp, mofem/tutorials/vec-5/free_surface.cpp, mofem/tutorials/vec-6/plate.cpp, mofem/tutorials/vec-7/adjoint.cpp, mofem/tutorials/vec-9/arc_length.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_element.cpp, mofem/users_modules/basic_finite_elements/atom_tests/testing_jacobian_of_hook_scaled_with_density_element.cpp, mofem/users_modules/basic_finite_elements/elasticity/elasticity.cpp, mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp, mofem/users_modules/bone_remodelling/bone_adaptation.cpp, mofem/users_modules/eshelbian_plasticity/ep.cpp, and mofem/users_modules/minimal_surface_equation/minimal_surface_area.cpp.

Definition at line 13 of file activate_deactivate_dofs.cpp.