v0.13.0
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:359
Examples
hello_world.cpp.

Definition at line 33 of file hello_world.cpp.

Function Documentation

◆ main()

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

Definition at line 146 of file hello_world.cpp.

146  {
147 
148  // initialize petsc
149  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
150 
151  try {
152 
153  type_name[MBVERTEX] = "Vertex";
154  type_name[MBEDGE] = "Edge";
155  type_name[MBTRI] = "Triangle";
156  type_name[MBTET] = "Tetrahedra";
157 
158  // Register DM Manager
159  DMType dm_name = "DMMOFEM";
160  CHKERR DMRegister_MoFEM(dm_name);
161 
162  // Create MoAB database
163  moab::Core moab_core;
164  moab::Interface &moab = moab_core;
165 
166  // Create MoFEM database and link it to MoAB
167  MoFEM::Core mofem_core(moab);
168  MoFEM::Interface &m_field = mofem_core;
169 
170  // Simple interface
171  Simple *simple;
172  CHKERR m_field.getInterface(simple);
173 
174  // get options from command line
175  CHKERR simple->getOptions();
176  // load mesh file
177  CHKERR simple->loadFile();
178  // add fields
179  CHKERR simple->addDomainField("U", H1, AINSWORTH_LEGENDRE_BASE, 3);
180  CHKERR simple->addBoundaryField("L", H1, AINSWORTH_LEGENDRE_BASE, 3);
181  CHKERR simple->addSkeletonField("S", H1, AINSWORTH_LEGENDRE_BASE, 3);
182  // set fields order
183  CHKERR simple->setFieldOrder("U", 4);
184  CHKERR simple->setFieldOrder("L", 3);
185  CHKERR simple->setFieldOrder("S", 3);
186 
187  // setup problem
188  CHKERR simple->setUp();
189 
190  auto pipeline_mng = m_field.getInterface<PipelineManager>();
191 
192  //! [set operator to the volume element instance]
193  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpRow("U"));
194  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpVolume("U"));
195  pipeline_mng->getOpDomainLhsPipeline().push_back(
196  new OpRowCol("U", "U", true));
197  //! [set operator to the volume element instance]
198 
199  //! [set operator to the face element instance]
200  pipeline_mng->getOpBoundaryRhsPipeline().push_back(new OpRow("L"));
201  pipeline_mng->getOpBoundaryRhsPipeline().push_back(new OpFace("L"));
202  pipeline_mng->getOpBoundaryLhsPipeline().push_back(
203  new OpRowCol("U", "L", false));
204  //! [set operator to the face element instance]
205 
206  //! [create skeleton side element and push operator to it]
207  boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> side_fe(
209  side_fe->getOpPtrVector().push_back(new OpVolumeSide("U"));
210  //! [create skeleton side element and push operator to it]
211 
212  //! [set operator to the face element on skeleton instance]
213  pipeline_mng->getOpSkeletonRhsPipeline().push_back(new OpRow("S"));
214  pipeline_mng->getOpSkeletonRhsPipeline().push_back(
215  new OpFaceSide("S", side_fe));
216  //! [set operator to the face element on skeleton instance]
217 
218  //! [executing finite elements]
219  CHKERR pipeline_mng->loopFiniteElements();
220  //! [executing finite elements]
221 
222  MOFEM_LOG_SYNCHRONISE(m_field.get_comm());
223  }
224  CATCH_ERRORS;
225 
226  // finish work cleaning memory, getting statistics, etc.
228 
229  return 0;
230 }
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:348
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:385
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:73
@ H1
continuous field
Definition: definitions.h:98
#define CHKERR
Inline error check.
Definition: definitions.h:548
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMMoFEM.cpp:59
boost::ptr_vector< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
VolumeElementForcesAndSourcesCoreOnSideSwitch< 0 > VolumeElementForcesAndSourcesCoreOnSide
Volume element used to integrate on skeleton.
static char help[]
Definition: hello_world.cpp:29
static map< EntityType, std::string > type_name
Definition: hello_world.cpp:31
CoreTmp< 0 > Core
Definition: Core.hpp:1096
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1965
virtual MPI_Comm & get_comm() const =0
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
Deprecated interface functions.
PipelineManager interface.
Simple interface for fast problem set-up.
Definition: Simple.hpp:33
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.

Variable Documentation

◆ help

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

Definition at line 29 of file hello_world.cpp.

◆ type_name

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

Definition at line 31 of file hello_world.cpp.