26 using namespace MoFEM;
28 static char help[] =
"...\n\n";
35 const std::vector<unsigned char> &
mArker;
37 OpFace(
const Range &skin_ents,
const std::vector<unsigned char> &
marker)
51 auto get_boundary_marker_directly_from_range = [&]() {
52 std::vector<unsigned char> ents_marker_used_for_testing;
56 for (
size_t side = 0; side != getNumberOfNodesOnElement(); ++side) {
58 ents_marker_used_for_testing[3 * side + 0] =
59 skinEnts.find(ent) != skinEnts.end() ? 1 : 0;
60 ents_marker_used_for_testing[3 * side + 2] =
61 ents_marker_used_for_testing[3 * side + 0];
67 bool is_on_boundary = skinEnts.find(ent) != skinEnts.end();
68 for (
size_t dof = 0; dof != nb_dofs; ++dof)
70 ents_marker_used_for_testing[dof] = is_on_boundary ? 1 : 0;
73 return ents_marker_used_for_testing;
76 auto test_marker = get_boundary_marker_directly_from_range();
77 for (
size_t n = 0;
n != nb_dofs; ++
n) {
79 if (test_marker[
n] != mArker[local_index])
81 "Wrong boundary marker");
88 int main(
int argc,
char *argv[]) {
104 DMType dm_name =
"DMMOFEM";
108 CHKERR simple_interface->getOptions();
109 CHKERR simple_interface->loadFile(
"");
110 CHKERR simple_interface->addDomainField(
"FIELD1",
H1,
112 CHKERR simple_interface->setFieldOrder(
"FIELD1",
order);
113 CHKERR simple_interface->setUp();
115 auto get_ents_on_mesh_skin = [&]() {
120 CHKERR skin.find_skin(0, faces,
false, skin_edges);
122 CHKERR moab.get_connectivity(skin_edges, skin_verts,
true);
123 skin_edges.merge(skin_verts);
127 auto mark_boundary_dofs = [&](Range &skin_edges) {
129 std::vector<unsigned char>
marker;
130 problem_manager->markDofs(simple_interface->getProblemName(),
ROW,
133 problem_manager->modifyMarkDofs(simple_interface->getProblemName(),
ROW,
139 auto skin_ents = get_ents_on_mesh_skin();
144 auto marker = mark_boundary_dofs(skin_ents);
146 boost::shared_ptr<FaceEle> fe(
new FaceEle(m_field));
147 fe->getOpPtrVector().push_back(
new OpFace(skin_ents,
marker));
149 auto dm = simple_interface->getDM();
ForcesAndSourcesCore::UserDataOperator UserDataOperator
int main(int argc, char *argv[])
MoFEM::FaceElementForcesAndSourcesCore FaceEle
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
PetscErrorCode DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
FaceElementForcesAndSourcesCoreSwitch< 0 > FaceElementForcesAndSourcesCore
Face finite element default.
auto marker
set bit to marker
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
DeprecatedCoreInterface Interface
virtual moab::Interface & get_moab()=0
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
const VectorInt & getLocalIndices() const
get local indices of dofs on entity
const VectorInt & getIndices() const
Get global indices of dofs on entity.
default operator for TRI element
Problem manager is used to build and partition problems.
Simple interface for fast problem set-up.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
OpFace(const Range &skin_ents, const std::vector< unsigned char > &marker)
MoFEMErrorCode doWork(int side, EntityType type, EntitiesFieldData::EntData &data)
Operator for linear form, usually to calculate values on right hand side.
const std::vector< unsigned char > & mArker