10 *iface =
const_cast<Simple *
>(
this);
16 static_assert(DIM == 2 || DIM == 3,
"not implemented");
26 boost::make_shared<ParentFiniteElementAdjacencyFunctionSkeleton<1>>(
40 boost::make_shared<ParentFiniteElementAdjacencyFunctionSkeleton<2>>(
59 return setSkeletonAdjacency<2>(fe_name);
61 return setSkeletonAdjacency<3>(fe_name);
68 static_assert(DIM == 2 || DIM == 3,
"not implemented");
77 boost::make_shared<ParentFiniteElementAdjacencyFunction<3>>(
80 boost::make_shared<ParentFiniteElementAdjacencyFunction<2>>(
108 boost::make_shared<ParentFiniteElementAdjacencyFunction<2>>(
111 boost::make_shared<ParentFiniteElementAdjacencyFunction<1>>(
134 return setParentAdjacency<2>();
136 return setParentAdjacency<3>();
164 bitLevelMask(
BitRefLevel().set()), meshSet(0), boundaryMeshset(0),
165 skeletonMeshset(0), nameOfProblem(
"SimpleProblem"), domainFE(
"dFE"),
166 boundaryFE(
"bFE"), skeletonFE(
"sFE"), dIm(-1), addSkeletonFE(false),
167 addBoundaryFE(false), addParentAdjacencies(false),
173 PetscLogEventRegister(
"SimpBuildFEs", 0,
181 PetscBool flg = PETSC_TRUE;
183 ierr = PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"Simple interface options",
186 ierr = PetscOptionsString(
"-file_name",
"file name",
"",
"mesh.h5m",
189 ierr = PetscOptionsEnd();
213 if (nb_ents_3d > 0) {
219 if (nb_ents_2d > 0) {
241 MOFEM_LOG(
"WORLD", Sev::warning) <<
"BitRefLevel is none and not set";
257 "PARALLEL_RESOLVE_SHARED_ENTS;"
258 "PARTITION=PARALLEL_PARTITION;",
267 const TagType tag_type,
const enum MoFEMTypes bh,
272 CHKERR m_field.
add_field(name, space, base, nb_of_coefficients, tag_type, bh,
278 "NOFIELD space for boundary filed not implemented in Simple interface");
288 const TagType tag_type,
const enum MoFEMTypes bh,
294 auto get_side_map_hcurl = [&]() {
297 std::pair<EntityType,
311 auto get_side_map_hdiv = [&]() {
314 std::pair<EntityType,
328 auto get_side_map = [&](
auto space) {
331 return get_side_map_hcurl();
333 return get_side_map_hdiv();
337 <<
"Side dof map for broken space <" << space <<
"> not implemented";
341 std::pair<EntityType,
348 get_side_map(space), tag_type, bh, verb);
353 "NOFIELD space for boundary filed not implemented in Simple interface");
361 const TagType tag_type,
const enum MoFEMTypes bh,
365 CHKERR m_field.
add_field(name, space, base, nb_of_coefficients, tag_type, bh,
371 "NOFIELD space for boundary filed not implemented in Simple interface");
379 const TagType tag_type,
const enum MoFEMTypes bh,
384 CHKERR m_field.
add_field(name, space, base, nb_of_coefficients, tag_type, bh,
390 "NOFIELD space for boundary filed not implemented in Simple interface");
399 const TagType tag_type,
const enum MoFEMTypes bh,
404 CHKERR m_field.
add_field(name, space, base, nb_of_coefficients, tag_type, bh,
417 const TagType tag_type,
const enum MoFEMTypes bh,
422 CHKERR m_field.
add_field(name, space, base, nb_of_coefficients, tag_type, bh,
435 auto remove_field_from_list = [&](
auto &vec) {
436 auto it = std::find(vec.begin(), vec.end(), name);
449 auto remove_field_from_list = [&](
auto &vec) {
450 auto it = std::find(vec.begin(), vec.end(), name);
463 auto remove_field_from_list = [&](
auto &vec) {
464 auto it = std::find(vec.begin(), vec.end(), name);
478 auto clear_rows_and_cols = [&](
auto &fe_name) {
482 ->get<FiniteElement_name_mi_tag>();
483 auto it_fe = fe_by_name.find(fe_name);
484 if (it_fe != fe_by_name.end()) {
488 "modification unsuccessful");
492 "modification unsuccessful");
503 auto add_fields = [&](
auto &fe_name,
auto &fields) {
505 for (
auto &field : fields) {
513 auto add_data_fields = [&](
auto &fe_name,
auto &fields) {
515 for (
auto &field : fields)
547 auto create_meshset = [&]() {
549 auto create = [&]() {
551 CHKERR m_field.
get_moab().create_meshset(MESHSET_SET, fe_meshset);
604 ents == NULL ?
false :
true);
617 auto add_ents_to_field = [&](
auto meshset,
auto dim,
auto &fields) {
619 for (
auto &field : fields) {
621 CHKERR comm_interface_ptr->synchroniseFieldEntities(field, 0);
626 auto make_no_field_ents = [&](
auto &fields) {
628 for (
auto &field : fields) {
629 std::array<double, 6> coords = {0, 0, 0, 0, 0, 0};
631 CHKERR comm_interface_ptr->makeFieldEntitiesMultishared(field, 0);
642 std::set<std::string> nofield_fields;
644 nofield_fields.insert(f);
646 nofield_fields.insert(f);
648 CHKERR make_no_field_ents(nofield_fields);
654 const auto f = std::get<0>(
t);
655 const auto order = std::get<1>(
t);
658 <<
"Set order to field " << f <<
" order " <<
order;
660 if (std::get<3>(
t)) {
662 <<
"To ents: " << std::endl
663 << std::get<2>(
t) << std::endl;
667 if (std::get<3>(
t)) {
672 auto f_ptr = get_field_ptr(f);
674 if (f_ptr->getSpace() ==
H1) {
682 for (
auto d = 1; d <=
dIm; ++d) {
683 for (EntityType
t = CN::TypeDimensionMap[d].first;
684 t <= CN::TypeDimensionMap[d].second; ++
t) {
717 auto add_fields_ents = [&](
auto list) {
726 for (
auto f : list) {
729 CHKERR m_field.
get_moab().get_entities_by_handle(field_meshset, ents,
733 CHKERR m_field.
get_moab().add_entities(meshset_entity_fe, fe_ents);
734 CHKERR m_field.
get_moab().add_entities(fe_meshset, &meshset_entity_fe,
743 for (std::vector<std::string>::iterator fit =
otherFEs.begin();
814 const auto problem_name = problem_ptr->
getName();
865 const std::string col_field)
const {
876 ParallelComm *pcomm =
885 CHKERR pcomm->filter_pstatus(domain_ents,
886 PSTATUS_SHARED | PSTATUS_MULTISHARED,
887 PSTATUS_NOT, -1,
nullptr);
891 CHKERR skin.find_skin(0, domain_ents,
false, domain_skin);
892 CHKERR pcomm->filter_pstatus(domain_skin,
893 PSTATUS_SHARED | PSTATUS_MULTISHARED,
894 PSTATUS_NOT, -1,
nullptr);
898 auto create_boundary_meshset = [&](
auto &&domain_skin) {
906 for (
int dd = 0; dd !=
dIm - 1; dd++) {
908 CHKERR m_field.
get_moab().get_adjacencies(domain_skin, dd,
false, adj,
909 moab::Interface::UNION);
924 ParallelComm *pcomm =
927 auto create_skeleton_meshset = [&](
auto meshset) {
933 Range boundary_ents, skeleton_ents;
935 dIm - 1, boundary_ents);
940 domain_ents,
dIm - 1,
true, skeleton_ents, moab::Interface::UNION);
941 skeleton_ents = subtract(skeleton_ents, boundary_ents);
942 CHKERR pcomm->filter_pstatus(skeleton_ents, PSTATUS_NOT_OWNED, PSTATUS_NOT,
957 MOFEM_LOG(
"WORLD", Sev::verbose) <<
"Exchange ghost cells";
959 ParallelComm *pcomm =
970 for (
auto d =
dIm - 1; d >= 0; --d) {
971 CHKERR m_field.
get_moab().get_adjacencies(shared, d,
false, shared,
972 moab::Interface::UNION);
974 CHKERR pcomm->filter_pstatus(shared, PSTATUS_SHARED | PSTATUS_MULTISHARED,
975 PSTATUS_OR, -1, &shared);
976 Tag part_tag = pcomm->part_tag();
977 CHKERR pcomm->exchange_tags(part_tag, shared);
static auto get_skin(MoFEM::Interface &m_field, Range body_ents)
#define MOFEM_LOG_SEVERITY_SYNC(comm, severity)
Synchronise "SYNC" on curtain severity level.
#define MOFEM_TAG_AND_LOG(channel, severity, tag)
Tag and log in channel.
MoFEMTypes
Those types control how functions respond on arguments, f.e. error handling.
FieldApproximationBase
approximation base
@ AINSWORTH_BERNSTEIN_BEZIER_BASE
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
FieldSpace
approximation spaces
@ NOFIELD
scalar or vector of scalars describe (no true field)
@ HCURL
field with continuous tangents
@ HDIV
field with continuous normal traction
#define MYPCOMM_INDEX
default communicator number PCOMM
@ DISCONTINUOUS
Broken continuity (No effect on L2 space)
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
@ MOFEM_OPERATION_UNSUCCESSFUL
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
PetscErrorCode DMMoFEMCreateMoFEM(DM dm, MoFEM::Interface *m_field_ptr, const char problem_name[], const MoFEM::BitRefLevel bit_level, const MoFEM::BitRefLevel bit_mask=MoFEM::BitRefLevel().set())
Must be called by user to set MoFEM data structures.
PetscErrorCode DMMoFEMGetProblemPtr(DM dm, const MoFEM::Problem **problem_ptr)
Get pointer to problem data structure.
PetscErrorCode DMSetUp_MoFEM(DM dm)
multi_index_container< boost::shared_ptr< FiniteElement >, indexed_by< hashed_unique< tag< FiniteElement_Meshset_mi_tag >, member< FiniteElement, EntityHandle, &FiniteElement::meshset > >, hashed_unique< tag< BitFEId_mi_tag >, const_mem_fun< FiniteElement, BitFEId, &FiniteElement::getId >, HashBit< BitFEId >, EqBit< BitFEId > >, ordered_unique< tag< FiniteElement_name_mi_tag >, const_mem_fun< FiniteElement, boost::string_ref, &FiniteElement::getNameRef > > > > FiniteElement_multiIndex
MultiIndex for entities for FiniteElement.
virtual const FiniteElement_multiIndex * get_finite_elements() const =0
Get the finite elements object.
virtual MoFEMErrorCode add_ents_to_finite_element_by_dim(const EntityHandle entities, const int dim, const std::string &name, const bool recursive=true)=0
add entities to finite element
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
virtual EntityHandle get_finite_element_meshset(const std::string name) const =0
virtual MoFEMErrorCode build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
virtual MoFEMErrorCode modify_finite_element_add_field_col(const std::string &fe_name, const std::string name_row)=0
set field col which finite element use
virtual MoFEMErrorCode modify_finite_element_adjacency_table(const std::string &fe_name, const EntityType type, ElementAdjacencyFunct function)=0
modify finite element table, only for advanced user
virtual MoFEMErrorCode add_ents_to_finite_element_by_MESHSET(const EntityHandle meshset, const std::string &name, const bool recursive=false)=0
add MESHSET element to finite element database given by name
virtual MoFEMErrorCode modify_finite_element_add_field_row(const std::string &fe_name, const std::string name_row)=0
set field row which finite element use
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
virtual const Field * get_field_structure(const std::string &name, enum MoFEMTypes bh=MF_EXIST) const =0
get field structure
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
virtual MoFEMErrorCode add_ents_to_field_by_dim(const Range &ents, const int dim, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
virtual MoFEMErrorCode set_field_order(const EntityHandle meshset, const EntityType type, const std::string &name, const ApproximationOrder order, int verb=DEFAULT_VERBOSITY)=0
Set order approximation of the entities in the field.
#define MOFEM_LOG(channel, severity)
Log.
#define MOFEM_LOG_CHANNEL(channel)
Set and reset channel.
virtual MoFEMErrorCode modify_problem_mask_ref_level_set_bit(const std::string &name_problem, const BitRefLevel &bit)=0
set dof mask ref level for problem
virtual MoFEMErrorCode modify_problem_ref_level_set_bit(const std::string &name_problem, const BitRefLevel &bit)=0
set ref level for problem
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
int FieldCoefficientsNumber
Number of field coefficients.
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
implementation of Data Operators for Forces and Sources
PetscObject getPetscObject(T obj)
auto createDM(MPI_Comm comm, const std::string dm_type_name)
Creates smart DM object.
constexpr double t
plate stiffness
constexpr auto field_name
multi_index_container< DofsSideMapData, indexed_by< ordered_non_unique< tag< TypeSide_mi_tag >, composite_key< DofsSideMapData, member< DofsSideMapData, EntityType, &DofsSideMapData::type >, member< DofsSideMapData, int, &DofsSideMapData::side > > >, ordered_unique< tag< EntDofIdx_mi_tag >, member< DofsSideMapData, int, &DofsSideMapData::dof > > > > DofsSideMap
Map entity stype and side to element/entity dof index.
virtual int get_comm_size() const =0
virtual moab::Interface & get_moab()=0
virtual EntityHandle get_field_meshset(const std::string name) const =0
get field meshset
virtual MoFEMErrorCode add_broken_field(const std::string name, const FieldSpace space, const FieldApproximationBase base, const FieldCoefficientsNumber nb_of_coefficients, const std::vector< std::pair< EntityType, std::function< MoFEMErrorCode(BaseFunction::DofsSideMap &)> > > list_dof_side_map, const TagType tag_type=MB_TAG_SPARSE, const enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
virtual bool check_finite_element(const std::string &name) const =0
Check if finite element is in database.
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MoFEMErrorCode add_field(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_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add field.
virtual MPI_Comm & get_comm() const =0
virtual MoFEMErrorCode delete_finite_element(const std::string name, int verb=DEFAULT_VERBOSITY)=0
delete finite element from mofem database
virtual MoFEMErrorCode rebuild_database(int verb=DEFAULT_VERBOSITY)=0
Clear database and initialize it once again.
virtual MoFEMErrorCode create_vertices_and_add_to_field(const std::string name, const double coords[], int size, int verb=DEFAULT_VERBOSITY)=0
Create a vertices and add to field object.
Deprecated interface functions.
keeps basic data about problem
Problem manager is used to build and partition problems.
Simple interface for fast problem set-up.
boost::shared_ptr< ParentFiniteElementAdjacencyFunction< 2 > > parentAdjFunctionDim2
EntityHandle boundaryMeshset
meshset with boundary
MoFEMErrorCode buildProblem()
Build problem.
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.
std::vector< std::string > dataFields
Data fields.
MoFEMErrorCode setParentAdjacency()
std::list< std::tuple< std::string, int, Range, bool > > fieldsOrder
std::vector< std::string > domainFields
domain fields
MoFEMErrorCode defineFiniteElements()
Define finite elements.
BitRefLevel bitAdjEnt
bit ref level for parent
char meshFileName[255]
mesh file name
EntityHandle meshSet
domain meshset
int getDim() const
Get the problem dimension.
MoFEMErrorCode loadFile(const std::string options, const std::string mesh_file_name, LoadFileFunc loadFunc=defaultLoadFileFunc)
Load mesh file.
std::vector< std::string > otherFEs
Other finite elements.
MoFEMErrorCode buildFiniteElements()
Build finite elements.
MoFEMErrorCode addMeshsetField(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 meshset field.
boost::shared_ptr< ParentFiniteElementAdjacencyFunctionSkeleton< 2 > > parentAdjSkeletonFunctionDim2
MoFEMErrorCode exchangeGhostCells()
PetscLogEvent MOFEM_EVENT_SimpleBuildFields
PetscLogEvent MOFEM_EVENT_SimpleLoadMesh
MoFEMErrorCode reSetUp(bool only_dm=false)
Rebuild internal MoFEM data structures.
MoFEMErrorCode addBoundaryField(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 boundary.
std::vector< std::string > noFieldFields
NOFIELD field name.
std::string meshsetFE
meshset finite element
bool addSkeletonFE
Add skeleton FE.
BitRefLevel bitAdjParent
bit ref level for parent
bool addBoundaryFE
Add boundary FE.
MoFEMErrorCode addFieldToEmptyFieldBlocks(const std::string row_field, const std::string col_field) const
add empty block to problem
std::string skeletonFE
skeleton finite element
std::vector< std::string > noFieldDataFields
NOFIELD field name.
std::vector< std::string > meshsetFields
meshset fields
std::string boundaryFE
boundary finite element
std::string nameOfProblem
problem name
boost::shared_ptr< ParentFiniteElementAdjacencyFunction< 3 > > parentAdjFunctionDim3
MoFEMErrorCode getOptions()
get options
std::string domainFE
domain finite element
std::vector< std::string > boundaryFields
boundary fields
boost::shared_ptr< ParentFiniteElementAdjacencyFunctionSkeleton< 1 > > parentAdjSkeletonFunctionDim1
MoFEMErrorCode removeSkeletonField(const std::string name)
Remove field form skeleton.
BitRefLevel bitAdjEntMask
bit ref level for parent parent
SmartPetscObj< DM > dM
Discrete manager (interface to PETSc/MoFEM functions)
MoFEMErrorCode removeDomainField(const std::string name)
Remove field form domain.
MoFEMErrorCode buildFields()
Build fields.
SmartPetscObj< DM > getDM()
Return smart DM object.
std::vector< Range > meshsetFiniteElementEntities
Meshset element entities.
BitRefLevel bitLevel
BitRefLevel of the problem.
MoFEMErrorCode setFieldOrder(const std::string field_name, const int order, const Range *ents=NULL)
Set field order.
MoFEMErrorCode defineProblem(const PetscBool is_partitioned=PETSC_TRUE)
define problem
std::vector< std::string > skeletonFields
fields on the skeleton
MoFEMErrorCode addDataField(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.
boost::function< MoFEMErrorCode(Interface &, const char *, const char *)> LoadFileFunc
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
MoFEMErrorCode setUp(const PetscBool is_partitioned=PETSC_TRUE)
Setup problem.
MoFEMErrorCode removeBoundaryField(const std::string name)
Remove field form boundary.
const std::string getProblemName() const
Get the Problem Name.
int dIm
dimension of problem
MoFEMErrorCode setSkeletonAdjacency(int dim=-1, std::string fe_name="")
Set the skeleton adjacency object.
MoFEMErrorCode deleteDM()
Delete dm.
PetscLogEvent MOFEM_EVENT_SimpleSetUP
PetscLogEvent MOFEM_EVENT_SimpleKSPSolve
MoFEMErrorCode createBoundaryMeshset()
PetscLogEvent MOFEM_EVENT_SimpleBuildFiniteElements
BitRefLevel bitLevelMask
BitRefLevel of the problem.
BitRefLevel bitAdjParentMask
bit ref level for parent parent
PetscLogEvent MOFEM_EVENT_SimpleBuildProblem
boost::shared_ptr< ParentFiniteElementAdjacencyFunction< 1 > > parentAdjFunctionDim1
MoFEMErrorCode deleteFiniteElements()
Delete finite elements.
Simple(const MoFEM::Core &core)
EntityHandle skeletonMeshset
skeleton meshset with boundary
MoFEMErrorCode createSkeletonMeshset()
bool addParentAdjacencies
If set to true parent adjacencies are build.
MoFEMErrorCode addDomainBrokenField(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 broken field on domain.
MoFEMErrorCode addSkeletonField(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 skeleton.
static MoFEMErrorCode setDofsSideMap(const FieldSpace space, const FieldContinuity continuity, const FieldApproximationBase base, DofsSideMap &)
Set map of dof to side number.
static MoFEMErrorCode setDofsSideMap(const FieldSpace space, const FieldContinuity continuity, const FieldApproximationBase base, DofsSideMap &)
Set map of dof to side number.
base class for all interface classes
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.