v0.14.0
Classes | Macros | Functions | Variables
hello_world.cpp File Reference
#include <MoFEM.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"
 

Macro Definition Documentation

◆ HelloFunctionBegin

#define HelloFunctionBegin
Value:
MOFEM_LOG_CHANNEL("SYNC"); \
MOFEM_LOG_FUNCTION(); \
MOFEM_LOG_TAG("WORLD", "HelloWorld");
Examples
hello_world.cpp.

Definition at line 16 of file hello_world.cpp.

Function Documentation

◆ main()

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

[set operator to the volume element instance]

[set operator to the volume element instance]

[set operator to the face element instance]

[set operator to the face element instance]

[create skeleton side element and push operator to it]

[create skeleton side element and push operator to it]

[set operator to the face element on skeleton instance]

[set operator to the face element on skeleton instance]

[executing finite elements]

[executing finite elements]

Examples
hello_world.cpp.

Definition at line 130 of file hello_world.cpp.

130  {
131 
132  // initialize petsc
133  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
134 
135  try {
136 
137  // Register DM Manager
138  DMType dm_name = "DMMOFEM";
139  CHKERR DMRegister_MoFEM(dm_name);
140 
141  // Create MoAB database
142  moab::Core moab_core;
143  moab::Interface &moab = moab_core;
144 
145  // Create MoFEM database and link it to MoAB
146  MoFEM::Core mofem_core(moab);
147  MoFEM::Interface &m_field = mofem_core;
148 
149  // Simple interface
150  Simple *simple;
151  CHKERR m_field.getInterface(simple);
152 
153  // get options from command line
154  CHKERR simple->getOptions();
155  // load mesh file
156  CHKERR simple->loadFile();
157  // add fields
158  CHKERR simple->addDomainField("U", H1, AINSWORTH_LEGENDRE_BASE, 3);
159  CHKERR simple->addBoundaryField("L", H1, AINSWORTH_LEGENDRE_BASE, 3);
160  CHKERR simple->addSkeletonField("S", H1, AINSWORTH_LEGENDRE_BASE, 3);
161  // set fields order
162  CHKERR simple->setFieldOrder("U", 4);
163  CHKERR simple->setFieldOrder("L", 3);
164  CHKERR simple->setFieldOrder("S", 3);
165 
166  // setup problem
167  CHKERR simple->setUp();
168 
169  auto pipeline_mng = m_field.getInterface<PipelineManager>();
170 
171  //! [set operator to the volume element instance]
172  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpRow("U"));
173  pipeline_mng->getOpDomainRhsPipeline().push_back(new OpVolume("U"));
174  pipeline_mng->getOpDomainLhsPipeline().push_back(
175  new OpRowCol("U", "U", true));
176  //! [set operator to the volume element instance]
177 
178  //! [set operator to the face element instance]
179  pipeline_mng->getOpBoundaryRhsPipeline().push_back(new OpRow("L"));
180  pipeline_mng->getOpBoundaryRhsPipeline().push_back(new OpFace("L"));
181  pipeline_mng->getOpBoundaryLhsPipeline().push_back(
182  new OpRowCol("U", "L", false));
183  //! [set operator to the face element instance]
184 
185  //! [create skeleton side element and push operator to it]
186  boost::shared_ptr<VolumeElementForcesAndSourcesCoreOnSide> side_fe(
188  side_fe->getOpPtrVector().push_back(new OpVolumeSide("U"));
189  //! [create skeleton side element and push operator to it]
190 
191  //! [set operator to the face element on skeleton instance]
192  pipeline_mng->getOpSkeletonRhsPipeline().push_back(new OpRow("S"));
193  pipeline_mng->getOpSkeletonRhsPipeline().push_back(
194  new OpFaceSide("S", side_fe));
195  //! [set operator to the face element on skeleton instance]
196 
197  //! [executing finite elements]
198  CHKERR pipeline_mng->loopFiniteElements();
199  //! [executing finite elements]
200 
201  MOFEM_LOG_SYNCHRONISE(m_field.get_comm());
202  }
203  CATCH_ERRORS;
204 
205  // finish work cleaning memory, getting statistics, etc.
207 
208  return 0;
209 }

Variable Documentation

◆ help

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

Definition at line 14 of file hello_world.cpp.

MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
H1
@ H1
continuous field
Definition: definitions.h:85
OpRowCol
Definition: hello_world.cpp:42
MoFEM::CoreInterface::get_comm
virtual MPI_Comm & get_comm() const =0
help
static char help[]
Definition: hello_world.cpp:14
MoFEM::PipelineManager::getOpDomainRhsPipeline
boost::ptr_deque< UserDataOperator > & getOpDomainRhsPipeline()
Get the Op Domain Rhs Pipeline object.
Definition: PipelineManager.hpp:773
MoFEM::PipelineManager
PipelineManager interface.
Definition: PipelineManager.hpp:24
MoFEM::CoreTmp< 0 >::Finalize
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Definition: Core.cpp:112
MoFEM::Simple
Simple interface for fast problem set-up.
Definition: Simple.hpp:27
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
simple
void simple(double P1[], double P2[], double P3[], double c[], const int N)
Definition: acoustic.cpp:69
OpVolumeSide
Definition: hello_world.cpp:113
OpRow
Definition: hello_world.cpp:22
MOFEM_LOG_SYNCHRONISE
#define MOFEM_LOG_SYNCHRONISE(comm)
Synchronise "SYNC" channel.
Definition: LogManager.hpp:345
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
OpFace
Definition: boundary_marker.cpp:19
MoFEM::CoreTmp< 0 >::Initialize
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
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
OpFaceSide
Definition: hello_world.cpp:94
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::VolumeElementForcesAndSourcesCoreOnSide
Base volume element used to integrate on skeleton.
Definition: VolumeElementForcesAndSourcesCoreOnSide.hpp:22
OpVolume
Definition: simple_interface.cpp:18
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359