v0.14.0
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 31 of file simple_l2_only.cpp.

◆ BoundaryEleOp

Examples
simple_l2_only.cpp.

Definition at line 32 of file simple_l2_only.cpp.

◆ DomainEle

Definition at line 29 of file simple_l2_only.cpp.

◆ DomainEleOp

Examples
simple_l2_only.cpp.

Definition at line 30 of file simple_l2_only.cpp.

◆ EntData

Examples
simple_l2_only.cpp.

Definition at line 33 of file simple_l2_only.cpp.

Function Documentation

◆ main()

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

Definition at line 35 of file simple_l2_only.cpp.

35  {
36 
37  // initialize petsc
38  MoFEM::Core::Initialize(&argc, &argv, (char *)0, help);
39 
40  try {
41 
42  // Create MoAB database
43  moab::Core moab_core;
44  moab::Interface &moab = moab_core;
45 
46  // Create MoFEM database and link it to MoAB
47  MoFEM::Core mofem_core(moab);
48  MoFEM::Interface &m_field = mofem_core;
49 
50  // Register DM Manager
51  DMType dm_name = "DMMOFEM";
52  CHKERR DMRegister_MoFEM(dm_name);
53 
54  // Simple interface
55  Simple *simple_interface;
56  CHKERR m_field.getInterface(simple_interface);
57  {
58 
59  // get options from command line
60  CHKERR simple_interface->getOptions();
61  // load mesh file
62  CHKERR simple_interface->loadFile();
63 
64  CHKERR simple_interface->addDomainField("FIELD", L2,
66 
67  simple_interface->getAddBoundaryFE() = true;
68  simple_interface->getAddSkeletonFE() = true;
69 
70  // set fields order
71  CHKERR simple_interface->setFieldOrder("FIELD", 1);
72  // setup problem
73  CHKERR simple_interface->setUp();
74 
75  int count_fe;
76  int count_side_fe;
77 
78  PipelineManager *pipeline_mng = m_field.getInterface<PipelineManager>();
79 
80  // Create OP for side FE
81  auto op_side_fe = new DomainEleOp(NOSPACE, DomainEleOp::OPSPACE);
82  op_side_fe->doWorkRhsHook = [&](DataOperator *op_ptr, int side,
83  EntityType type,
85  auto domain_op = static_cast<DomainEleOp *>(op_ptr);
87 
88  MOFEM_LOG("SELF", Sev::verbose)
89  << "Side element name [ " << count_side_fe << " ] "
90  << domain_op->getFEName();
91 
92  ++count_side_fe;
93 
95  };
96 
97  // Create side FE
98  auto side_fe = boost::make_shared<DomainEle>(m_field);
99  side_fe->getOpPtrVector().push_back(op_side_fe);
100 
101  // Create boundary FE OP
102 
103  auto do_work_rhs = [&](DataOperator *op_ptr, int side, EntityType type,
105  auto bdy_op = static_cast<BoundaryEleOp *>(op_ptr);
107 
108  MOFEM_LOG("SELF", Sev::verbose) << "Element name [ " << count_fe
109  << " ] " << bdy_op->getFEName();
110 
111  CHKERR bdy_op->loopSide(simple_interface->getDomainFEName(),
112  side_fe.get(), SPACE_DIM);
113 
114  ++count_fe;
115 
117  };
118 
119  auto op_bdy_fe = new BoundaryEleOp(NOSPACE, DomainEleOp::OPSPACE);
120  op_bdy_fe->doWorkRhsHook = do_work_rhs;
121 
122  auto op_skeleton_fe = new BoundaryEleOp(NOSPACE, DomainEleOp::OPSPACE);
123  op_skeleton_fe->doWorkRhsHook = do_work_rhs;
124 
125  // Count boundary
126  count_fe = 0;
127  count_side_fe = 0;
128 
129  pipeline_mng->getOpBoundaryRhsPipeline().push_back(op_bdy_fe);
130  pipeline_mng->getOpSkeletonRhsPipeline().push_back(op_skeleton_fe);
131  pipeline_mng->loopFiniteElements();
132 
133  MOFEM_LOG("SELF", Sev::inform) << "Number of elements " << count_fe;
134  MOFEM_LOG("SELF", Sev::inform)
135  << "Number of side elements " << count_side_fe;
136 
137  if (count_fe != 16)
138  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
139  "Wrong numbers of FEs");
140  if (count_side_fe != 24)
141  SETERRQ(PETSC_COMM_SELF, MOFEM_ATOM_TEST_INVALID,
142  "Wrong numbers of side FEs");
143  }
144  }
145  CATCH_ERRORS;
146 
147  // finish work cleaning memory, getting statistics, etc.
149 
150  return 0;
151 }

Variable Documentation

◆ help

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

Definition at line 16 of file simple_l2_only.cpp.

◆ SPACE_DIM

constexpr int SPACE_DIM = 2
constexpr
Examples
simple_l2_only.cpp.

Definition at line 18 of file simple_l2_only.cpp.

NOSPACE
@ NOSPACE
Definition: definitions.h:83
MoFEM::UnknownInterface::getInterface
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
Definition: UnknownInterface.hpp:93
MoFEM::EntitiesFieldData::EntData
Data on single entity (This is passed as argument to DataOperator::doWork)
Definition: EntitiesFieldData.hpp:128
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
MoFEM::DataOperator
base operator to do operations at Gauss Pt. level
Definition: DataOperators.hpp:24
MoFEM::PipelineManager::getOpSkeletonRhsPipeline
boost::ptr_deque< UserDataOperator > & getOpSkeletonRhsPipeline()
Get the Op Skeleton Rhs Pipeline object.
Definition: PipelineManager.hpp:869
BoundaryEleOp
BoundaryEle::UserDataOperator BoundaryEleOp
Definition: simple_l2_only.cpp:32
L2
@ L2
field with C-1 continuity
Definition: definitions.h:88
MoFEM::PipelineManager::loopFiniteElements
MoFEMErrorCode loopFiniteElements(SmartPetscObj< DM > dm=nullptr)
Iterate finite elements.
Definition: PipelineManager.cpp:19
help
static char help[]
Definition: simple_l2_only.cpp:16
MoFEM::Simple::loadFile
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
Definition: Simple.cpp:194
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
DomainEleOp
DomainEle::UserDataOperator DomainEleOp
Definition: simple_l2_only.cpp:30
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:2010
MoFEM::Simple::getOptions
MoFEMErrorCode getOptions()
get options
Definition: Simple.cpp:180
MoFEM::Simple::getAddSkeletonFE
bool & getAddSkeletonFE()
Get the addSkeletonFE.
Definition: Simple.hpp:452
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
BoundaryEleOp
convert.type
type
Definition: convert.py:64
MoFEM::Simple::addDomainField
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:264
MoFEM::Simple::getAddBoundaryFE
bool & getAddBoundaryFE()
Get the addSkeletonFE.
Definition: Simple.hpp:463
MoFEM::DMRegister_MoFEM
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
Definition: DMMoFEM.cpp:43
MoFEM::Simple::getDomainFEName
const std::string getDomainFEName() const
Get the Domain FE Name.
Definition: Simple.hpp:368
MoFEM::Simple::setFieldOrder
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
Definition: Simple.cpp:545
DomainEleOp
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
MOFEM_LOG
#define MOFEM_LOG(channel, severity)
Log.
Definition: LogManager.hpp:308
CATCH_ERRORS
#define CATCH_ERRORS
Catch errors.
Definition: definitions.h:385
SPACE_DIM
constexpr int SPACE_DIM
Definition: simple_l2_only.cpp:18
MoFEM::Core
CoreTmp< 0 > Core
Definition: Core.hpp:1148
AINSWORTH_LEGENDRE_BASE
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
Definition: definitions.h:60
MoFEM::PipelineManager::getOpBoundaryRhsPipeline
boost::ptr_deque< UserDataOperator > & getOpBoundaryRhsPipeline()
Get the Op Boundary Rhs Pipeline object.
Definition: PipelineManager.hpp:821
MOFEM_ATOM_TEST_INVALID
@ MOFEM_ATOM_TEST_INVALID
Definition: definitions.h:40
MoFEM::Simple::setUp
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
Definition: Simple.cpp:683
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359