v0.13.1
Classes | Macros | Functions | Variables
hello_world.cpp File Reference
#include <BasicFiniteElements.hpp>

Go to the source code of this file.

Classes

struct  OpRow
 
struct  OpRowCol
 
struct  OpVolume
 
struct  OpFace
 
struct  OpFaceSide
 
struct  OpVolumeSide
 

Macros

#define HelloFunctionBegin
 

Functions

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

Variables

static char help [] = "...\n\n"
 
static map< EntityType, std::string > type_name
 

Macro Definition Documentation

◆ HelloFunctionBegin

#define HelloFunctionBegin
Value:
MOFEM_LOG_CHANNEL("SYNC"); \
MOFEM_LOG_FUNCTION(); \
MOFEM_LOG_TAG("WORLD", "HelloWorld");
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
Examples
hello_world.cpp.

Definition at line 18 of file hello_world.cpp.

Function Documentation

◆ main()

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

Definition at line 131 of file hello_world.cpp.

131 {
132
133 // initialize petsc
134 MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
135
136 try {
137
138 type_name[MBVERTEX] = "Vertex";
139 type_name[MBEDGE] = "Edge";
140 type_name[MBTRI] = "Triangle";
141 type_name[MBTET] = "Tetrahedra";
142
143 // Register DM Manager
144 DMType dm_name = "DMMOFEM";
145 CHKERR DMRegister_MoFEM(dm_name);
146
147 // Create MoAB database
148 moab::Core moab_core;
149 moab::Interface &moab = moab_core;
150
151 // Create MoFEM database and link it to MoAB
152 MoFEM::Core mofem_core(moab);
153 MoFEM::Interface &m_field = mofem_core;
154
155 // Simple interface
156 Simple *simple;
157 CHKERR m_field.getInterface(simple);
158
159 // get options from command line
160 CHKERR simple->getOptions();
161 // load mesh file
162 CHKERR simple->loadFile();
163 // add fields
164 CHKERR simple->addDomainField("U", H1, AINSWORTH_LEGENDRE_BASE, 3);
165 CHKERR simple->addBoundaryField("L", H1, AINSWORTH_LEGENDRE_BASE, 3);
166 CHKERR simple->addSkeletonField("S", H1, AINSWORTH_LEGENDRE_BASE, 3);
167 // set fields order
168 CHKERR simple->setFieldOrder("U", 4);
169 CHKERR simple->setFieldOrder("L", 3);
170 CHKERR simple->setFieldOrder("S", 3);
171
172 // setup problem
173 CHKERR simple->setUp();
174
175 auto pipeline_mng = m_field.getInterface<PipelineManager>();
176
177 //! [set operator to the volume element instance]
178 pipeline_mng->getOpDomainRhsPipeline().push_back(new OpRow("U"));
179 pipeline_mng->getOpDomainRhsPipeline().push_back(new OpVolume("U"));
180 pipeline_mng->getOpDomainLhsPipeline().push_back(
181 new OpRowCol("U", "U", true));
182 //! [set operator to the volume element instance]
183
184 //! [set operator to the face element instance]
185 pipeline_mng->getOpBoundaryRhsPipeline().push_back(new OpRow("L"));
186 pipeline_mng->getOpBoundaryRhsPipeline().push_back(new OpFace("L"));
187 pipeline_mng->getOpBoundaryLhsPipeline().push_back(
188 new OpRowCol("U", "L", false));
189 //! [set operator to the face element instance]
190
191 //! [create skeleton side element and push operator to it]
192 boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> side_fe(
194 side_fe->getOpPtrVector().push_back(new OpVolumeSide("U"));
195 //! [create skeleton side element and push operator to it]
196
197 //! [set operator to the face element on skeleton instance]
198 pipeline_mng->getOpSkeletonRhsPipeline().push_back(new OpRow("S"));
199 pipeline_mng->getOpSkeletonRhsPipeline().push_back(
200 new OpFaceSide("S", side_fe));
201 //! [set operator to the face element on skeleton instance]
202
203 //! [executing finite elements]
204 CHKERR pipeline_mng->loopFiniteElements();
205 //! [executing finite elements]
206
208 }
210
211 // finish work cleaning memory, getting statistics, etc.
213
214 return 0;
215}
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:338
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:372
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
@ H1
continuous field
Definition: definitions.h:85
#define CHKERR
Inline error check.
Definition: definitions.h:535
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMMoFEM.cpp:47
boost::ptr_vector< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
static char help[]
Definition: hello_world.cpp:14
static map< EntityType, std::string > type_name
Definition: hello_world.cpp:16
CoreTmp< 0 > Core
Definition: Core.hpp:1086
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1955
FaceSide::UserDataOperator OpFaceSide
virtual MPI_Comm & get_comm() const =0
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.
PipelineManager interface.
Simple interface for fast problem set-up.
Definition: Simple.hpp:26
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Base volume element used to integrate on skeleton.

Variable Documentation

◆ help

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

Definition at line 14 of file hello_world.cpp.

◆ type_name

map<EntityType, std::string> type_name
static
Examples
hello_world.cpp.

Definition at line 16 of file hello_world.cpp.