v0.13.1
Classes | Typedefs | Functions | Variables
simple_l2_only.cpp File Reference
#include <MoFEM.hpp>

Go to the source code of this file.

Classes

struct  ElementsAndOps< DIM >
 
struct  ElementsAndOps< 2 >
 

Typedefs

using DomainEle = ElementsAndOps< SPACE_DIM >::DomainEle
 
using DomainEleOp = DomainEle::UserDataOperator
 
using BoundaryEle = ElementsAndOps< SPACE_DIM >::BoundaryEle
 
using BoundaryEleOp = BoundaryEle::UserDataOperator
 
using EntData = EntitiesFieldData::EntData
 

Functions

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

Variables

static char help [] = "...\n\n"
 
constexpr int SPACE_DIM = 2
 

Typedef Documentation

◆ BoundaryEle

Definition at line 43 of file simple_l2_only.cpp.

◆ BoundaryEleOp

Examples
simple_l2_only.cpp.

Definition at line 44 of file simple_l2_only.cpp.

◆ DomainEle

Definition at line 41 of file simple_l2_only.cpp.

◆ DomainEleOp

Examples
simple_l2_only.cpp.

Definition at line 42 of file simple_l2_only.cpp.

◆ EntData

Examples
simple_l2_only.cpp.

Definition at line 45 of file simple_l2_only.cpp.

Function Documentation

◆ main()

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

Definition at line 47 of file simple_l2_only.cpp.

47 {
48
49 // initialize petsc
50 MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
51
52 try {
53
54 // Create MoAB database
55 moab::Core moab_core;
56 moab::Interface &moab = moab_core;
57
58 // Create MoFEM database and link it to MoAB
59 MoFEM::Core mofem_core(moab);
60 MoFEM::Interface &m_field = mofem_core;
61
62 // Register DM Manager
63 DMType dm_name = "DMMOFEM";
64 CHKERR DMRegister_MoFEM(dm_name);
65
66 // Simple interface
67 Simple *simple_interface;
68 CHKERR m_field.getInterface(simple_interface);
69 {
70
71 // get options from command line
72 CHKERR simple_interface->getOptions();
73 // load mesh file
74 CHKERR simple_interface->loadFile();
75
76 CHKERR simple_interface->addDomainField("FIELD", L2,
78
79 simple_interface->getAddBoundaryFE() = true;
80 simple_interface->getAddSkeletonFE() = true;
81
82 // set fields order
83 CHKERR simple_interface->setFieldOrder("FIELD", 1);
84 // setup problem
85 CHKERR simple_interface->setUp();
86
87 int count_fe;
88 int count_side_fe;
89
90 PipelineManager *pipeline_mng = m_field.getInterface<PipelineManager>();
91
92 // Create OP for side FE
93 auto op_side_fe = new DomainEleOp(NOSPACE, DomainEleOp::OPSPACE);
94 op_side_fe->doWorkRhsHook = [&](DataOperator *op_ptr, int side,
97 auto domain_op = static_cast<DomainEleOp *>(op_ptr);
99
100 MOFEM_LOG("SELF", Sev::verbose)
101 << "Side element name [ " << count_side_fe << " ] "
102 << domain_op->getFEName();
103
104 ++count_side_fe;
105
107 };
108
109 // Create side FE
110 auto side_fe = boost::make_shared<DomainEle>(m_field);
111 side_fe->getOpPtrVector().push_back(op_side_fe);
112
113 // Create boundary FE OP
114
115 auto do_work_rhs = [&](DataOperator *op_ptr, int side, EntityType type,
117 auto bdy_op = static_cast<BoundaryEleOp *>(op_ptr);
119
120 MOFEM_LOG("SELF", Sev::verbose) << "Element name [ " << count_fe
121 << " ] " << bdy_op->getFEName();
122
123 CHKERR bdy_op->loopSide(simple_interface->getDomainFEName(),
124 side_fe.get(), SPACE_DIM);
125
126 ++count_fe;
127
129 };
130
131 auto op_bdy_fe = new BoundaryEleOp(NOSPACE, DomainEleOp::OPSPACE);
132 op_bdy_fe->doWorkRhsHook = do_work_rhs;
133
134 auto op_skeleton_fe = new BoundaryEleOp(NOSPACE, DomainEleOp::OPSPACE);
135 op_skeleton_fe->doWorkRhsHook = do_work_rhs;
136
137 // Count boundary
138 count_fe = 0;
139 count_side_fe = 0;
140
141 pipeline_mng->getOpBoundaryRhsPipeline().push_back(op_bdy_fe);
142 pipeline_mng->getOpSkeletonRhsPipeline().push_back(op_skeleton_fe);
143 pipeline_mng->loopFiniteElements();
144
145 MOFEM_LOG("SELF", Sev::inform) << "Number of elements " << count_fe;
146 MOFEM_LOG("SELF", Sev::inform)
147 << "Number of side elements " << count_side_fe;
148
149 if (count_fe != 16)
150 SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
151 "Wrong numbers of FEs");
152 if (count_side_fe != 24)
153 SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
154 "Wrong numbers of side FEs");
155 }
156 }
158
159 // finish work cleaning memory, getting statistics, etc.
161
162 return 0;
163}
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:73
@ L2
field with C-1 continuity
Definition: definitions.h:101
@ NOSPACE
Definition: definitions.h:96
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:53
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
#define CHKERR
Inline error check.
Definition: definitions.h:548
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMMoFEM.cpp:59
MoFEMErrorCode loopFiniteElements(SmartPetscObj< DM > dm=nullptr)
Iterate finite elements.
boost::ptr_vector< UserDataOperator > & getOpSkeletonRhsPipeline()
Get the Op Skeleton Rhs Pipeline object.
boost::ptr_vector< UserDataOperator > & getOpBoundaryRhsPipeline()
Get the Op Boundary Rhs Pipeline object.
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:311
CoreTmp< 0 > Core
Definition: Core.hpp:1096
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1965
static char help[]
constexpr int SPACE_DIM
DomainEle::UserDataOperator DomainEleOp
BoundaryEle::UserDataOperator BoundaryEleOp
Core (interface) class.
Definition: Core.hpp:92
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
Definition: Core.cpp:85
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:125
base operator to do operations at Gauss Pt. level
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
@ OPSPACE
operator do Work is execute on space data
PipelineManager interface.
Simple interface for fast problem set-up.
Definition: Simple.hpp:35
bool & getAddBoundaryFE()
Get the addSkeletonFE.
Definition: Simple.hpp:416
MoFEMErrorCode addDomainField(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_ZERO, int verb=-1)
Add field on domain.
Definition: Simple.cpp:378
MoFEMErrorCode getOptions()
get options
Definition: Simple.cpp:294
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name)
Load mesh file.
Definition: Simple.cpp:308
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition: Simple.cpp:593
bool & getAddSkeletonFE()
Get the addSkeletonFE.
Definition: Simple.hpp:405
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition: Simple.cpp:753
const std::string getDomainFEName() const
Get the Domain FE Name.
Definition: Simple.hpp:321
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

Variable Documentation

◆ help

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

Definition at line 28 of file simple_l2_only.cpp.

◆ SPACE_DIM

constexpr int SPACE_DIM = 2
constexpr
Examples
simple_l2_only.cpp.

Definition at line 30 of file simple_l2_only.cpp.