Mark skin entities, i.e. boundary, next check DOFs if are properly marked when accessed form user data operator.
static char help[] =
"...\n\n";
const std::vector<unsigned char> &
mArker;
if (nb_dofs == 0)
auto get_boundary_marker_directly_from_range = [&]() {
std::vector<unsigned char> ents_marker_used_for_testing;
switch (type) {
case MBVERTEX: {
ents_marker_used_for_testing[3 * side + 0] =
ents_marker_used_for_testing[3 * side + 2] =
ents_marker_used_for_testing[3 * side + 0];
}
break;
}
default: {
for (size_t dof = 0; dof != nb_dofs; ++dof)
if ((dof % 3) != 1)
ents_marker_used_for_testing[dof] = is_on_boundary ? 1 : 0;
}
};
return ents_marker_used_for_testing;
};
auto test_marker = get_boundary_marker_directly_from_range();
for (
size_t n = 0;
n != nb_dofs; ++
n) {
if (test_marker[
n] !=
mArker[local_index])
"Wrong boundary marker");
}
}
};
int main(
int argc,
char *argv[]) {
try {
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
CHKERR PetscOptionsGetInt(PETSC_NULL,
"",
"-order", &
order, PETSC_NULL);
DMType dm_name = "DMMOFEM";
CHKERR DMRegister_MoFEM(dm_name);
CHKERR simple_interface->loadFile(
"");
CHKERR simple_interface->addDomainField(
"FIELD1",
H1,
CHKERR simple_interface->setFieldOrder(
"FIELD1",
order);
CHKERR simple_interface->setUp();
auto get_ents_on_mesh_skin = [&]() {
CHKERR skin.find_skin(0, faces,
false, skin_edges);
CHKERR moab.get_connectivity(skin_edges, skin_verts,
true);
skin_edges.merge(skin_verts);
return skin_edges;
};
auto mark_boundary_dofs = [&](
Range &skin_edges) {
std::vector<unsigned char>
marker;
problem_manager->
markDofs(simple_interface->getProblemName(),
ROW,
ProblemsManager::OR, skin_edges,
marker);
problem_manager->modifyMarkDofs(simple_interface->getProblemName(),
ROW,
"FIELD1", 1, 1, ProblemsManager::AND, 0,
};
auto skin_ents = get_ents_on_mesh_skin();
auto marker = mark_boundary_dofs(skin_ents);
boost::shared_ptr<FaceEle> fe(
new FaceEle(m_field));
fe->getOpPtrVector().push_back(
new OpFace(skin_ents,
marker));
auto dm = simple_interface->getDM();
fe);
}
}
MoFEM::FaceElementForcesAndSourcesCore FaceEle
FaceEle::UserDataOperator FaceEleOp
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base nme:nme847.
#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 DMoFEMLoopFiniteElements(DM dm, const char fe_name[], MoFEM::FEMethod *method, CacheTupleWeakPtr cache_ptr=CacheTupleSharedPtr())
Executes FEMethod for finite elements in DM.
auto marker
set bit to marker
const double n
refractive index of diffusive medium
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
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
friend class UserDataOperator
int getNumberOfNodesOnElement() const
Get the number of nodes on finite element.
EntityHandle getSideEntity(const int side_number, const EntityType type)
Get the side entity.
@ OPROW
operator doWork function is executed on FE rows
Problem manager is used to build and partition problems.
MoFEMErrorCode markDofs(const std::string problem_name, RowColData rc, const enum MarkOP op, const Range ents, std::vector< unsigned char > &marker) const
Create vector with marked indices.
Simple interface for fast problem set-up.
MoFEMErrorCode getOptions()
get options
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference 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