12static char help[] =
"...\n\n";
20 const auto &ref_ptr = field_ptr->getRefEntityPtr();
21 const auto owner = ref_ptr->getOwnerProcAndEnt();
22 mismatches +=
owner.first != ref_ptr->getOwnerProc();
23 mismatches +=
owner.second != ref_ptr->getOwnerEnt();
25 ref_ptr->getOwnerProc(), field_ptr->getBitNumber(),
26 ref_ptr->getOwnerEnt());
27 mismatches += field_ptr->getGlobalUniqueId() != expected;
29 for (
const auto &dof_ptr : *m_field.
get_dofs()) {
30 const UId local = dof_ptr->getFieldEntityPtr()->getLocalUniqueId() |
31 dof_ptr->getEntDofIdx();
32 const UId global = dof_ptr->getFieldEntityPtr()->getGlobalUniqueId() |
33 dof_ptr->getEntDofIdx();
34 mismatches += dof_ptr->getLocalUniqueId() != local;
35 mismatches += dof_ptr->getGlobalUniqueId() != global;
39 entity_uid != dof_ptr->getFieldEntityPtr()->getGlobalUniqueId();
42 for (EntityHandle
handle : {EntityHandle(0), EntityHandle(1),
43 std::numeric_limits<EntityHandle>::max()})
46 const UId entity_uid =
48 const UId expected = entity_uid | dof;
51 mismatches += uid != expected;
54 "UID evaluation preserves ownership, encoding and value lifetime",
62 const std::string &
label,
65 const auto &
index = dofs.get<
I>();
66 std::vector<boost::shared_ptr<NumeredDofEntity>> expected(dofs.begin(),
68 const auto compare =
index.value_comp();
69 std::stable_sort(expected.begin(), expected.end(), compare);
71 auto actual =
index.begin();
72 for (
auto first = expected.begin(); first != expected.end();) {
73 auto last = std::next(first);
74 while (last != expected.end() && !compare(*first, *last))
76 const auto key =
index.key_extractor()(*first);
77 mismatches +=
index.lower_bound(
key) != actual;
78 for (
auto it = first;
it != last; ++
it, ++actual)
79 mismatches += (*it)->getLocalUniqueId() != (*actual)->getLocalUniqueId();
80 mismatches +=
index.upper_bound(
key) != actual;
84 label +
" index " + std::to_string(
I) +
" traversal and bounds",
87 if constexpr (
I < 4) {
94 const std::string &
name) {
99 CHKERR checkPublishedIndex(*testing_ptr,
name +
" rows",
103 CHKERR checkPublishedIndex(*testing_ptr,
name +
" columns",
111int main(
int argc,
char *argv[]) {
117 moab::Core mb_instance;
118 moab::Interface &moab = mb_instance;
120 MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
122 PetscBool flg = PETSC_TRUE;
123 char mesh_file_name[255];
124#if PETSC_VERSION_GE(3, 6, 4)
129 mesh_file_name, 255, &flg);
131 if (flg != PETSC_TRUE) {
132 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
135 CHKERR moab.load_file(mesh_file_name, 0,
"");
152 EntityHandle root_set = moab.get_root_set();
169 CHKERR checkUidEvaluation(m_field);
216 ->checkMPIAIJWithArraysMatrixFillIn<PetscGlobalIdx_mi_tag>(
"P1", -1, -1,
221 ->checkMPIAIJWithArraysMatrixFillIn<PetscGlobalIdx_mi_tag>(
"P2", -1, -1,
229 CHKERR checkPublishedDofs(m_field,
"P3");
234 ->checkMPIAIJWithArraysMatrixFillIn<PetscGlobalIdx_mi_tag>(
"P3", -1, -1,
244 CHKERR checkPublishedDofs(m_field,
"P4");
252 CHKERR checkPublishedDofs(m_field,
"P4_sub");
256 const std::map<std::string, boost::shared_ptr<Range>> entity_map = {
257 {
"F2", boost::make_shared<Range>()}};
259 {
"F1",
"F2"},
"P4",
true, &entity_map,
261 CHKERR checkPublishedDofs(m_field,
"P4_empty_field");
266 CHKERR checkPublishedDofs(m_field,
"P4_composed");
281 CHKERR MatGetInfo(empty_matrix, MAT_GLOBAL_SUM, &info);
282 CHKERR testing_ptr->checkValue<TestType::SCALAR>(
283 "excluded field block has an empty CSR graph", info.nz_used, 0, zero);
284 empty_matrix.reset();
286 CHKERR MatGetInfo(empty_matrix, MAT_GLOBAL_SUM, &info);
287 CHKERR testing_ptr->checkValue<TestType::SCALAR>(
288 "excluded field block has zero preallocation", info.nz_allocated, 0,
CGALInterfaceImpl & owner
std::map< EntityHandle, int > index
#define CATCH_ERRORS
Catch errors.
#define MAX_DOFS_ON_ENTITY
Maximal number of DOFs on entity.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
#define MAX_PROCESSORS_NUMBER
Maximal number of processors.
@ L2
field with C-1 continuity
@ HDIV
field with continuous normal traction
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define BITFIELDID_SIZE
max number of fields
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
multi_index_container< boost::shared_ptr< NumeredDofEntity >, indexed_by< ordered_unique< tag< Unique_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, UId, &NumeredDofEntity::getLocalUniqueId > >, ordered_non_unique< tag< Part_mi_tag >, member< NumeredDofEntity, unsigned int, &NumeredDofEntity::pArt > >, ordered_non_unique< tag< PetscGlobalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscGloablDofIdx > >, ordered_non_unique< tag< PetscLocalIdx_mi_tag >, member< NumeredDofEntity, DofIdx, &NumeredDofEntity::petscLocalDofIdx > >, ordered_non_unique< tag< Ent_mi_tag >, const_mem_fun< NumeredDofEntity::interface_type_DofEntity, EntityHandle, &NumeredDofEntity::getEnt > > > > NumeredDofEntity_multiIndex
MultiIndex container keeps NumeredDofEntity.
virtual const Problem * get_problem(const std::string problem_name) const =0
Get the problem object.
virtual const FieldEntity_multiIndex * get_field_ents() const =0
Get the field ents object.
virtual const DofEntity_multiIndex * get_dofs() const =0
Get the dofs object.
virtual MoFEMErrorCode add_finite_element(const std::string &fe_name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
add finite element
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 add_ents_to_finite_element_by_type(const EntityHandle entities, const EntityType type, const std::string name, const bool recursive=true)=0
add entities to finite element
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 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.
MoFEMErrorCode partitionGhostDofs(const std::string name, int verb=VERBOSE)
determine ghost nodes
MoFEMErrorCode buildComposedProblem(const std::string out_name, const std::vector< std::string > add_row_problems, const std::vector< std::string > add_col_problems, const bool square_matrix=true, int verb=1)
build composite problem
MoFEMErrorCode buildProblem(const std::string name, const bool square_matrix, int verb=VERBOSE)
build problem data structures
MoFEMErrorCode buildSubProblem(const std::string out_name, const std::vector< std::string > &fields_row, const std::vector< std::string > &fields_col, const std::string main_problem, const bool square_matrix=true, const map< std::string, boost::shared_ptr< Range > > *entityMapRow=nullptr, const map< std::string, boost::shared_ptr< Range > > *entityMapCol=nullptr, int verb=VERBOSE)
build sub problem
MoFEMErrorCode partitionProblem(const std::string name, int verb=VERBOSE)
partition problem dofs (collective)
MoFEMErrorCode inheritPartition(const std::string name, const std::string problem_for_rows, bool copy_rows, const std::string problem_for_cols, bool copy_cols, int verb=VERBOSE)
build indexing and partition problem inheriting indexing and partitioning from two other problems
MoFEMErrorCode partitionFiniteElements(const std::string name, bool part_from_moab=false, int low_proc=-1, int hi_proc=-1, int verb=VERBOSE)
partition finite elements
virtual MoFEMErrorCode add_problem(const std::string &name, enum MoFEMTypes bh=MF_EXCL, int verb=DEFAULT_VERBOSITY)=0
Add problem.
virtual MoFEMErrorCode modify_problem_ref_level_add_bit(const std::string &name_problem, const BitRefLevel &bit)=0
add ref level to problem
virtual MoFEMErrorCode modify_problem_add_finite_element(const std::string name_problem, const std::string &fe_name)=0
add finite element to problem, this add entities assigned to finite element to a particular problem
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
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
MoFEMErrorCode TestingInterface::checkValue< TestType::SCALAR >(const std::string &check_name, PetscReal actual, PetscReal expected, Tolerance tolerance, Sev error_severity, Sev success_severity) const
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
constexpr IntegrationType I
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 BitFieldId get_field_id(const std::string &name) const =0
Get field Id.
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.
static UId getUniqueIdCalculate(const DofIdx dof, const UId &ent_uid)
UId getGlobalUniqueIdCalculate() const
Calculate global UId.
Matrix manager is used to build and partition problems.
keeps information about indexed dofs for the problem
Index tags of the numbered DOF containers that also read the index.
keeps basic data about problem
auto & getNumeredColDofsPtr() const
get access to numeredColDofsPtr storing DOFs on cols
BlockFieldPair & addFieldToEmptyFieldBlocks(const BlockFieldPair add_fields) const
Add fields to the empty field blocks.
auto & getNumeredRowDofsPtr() const
get access to numeredRowDofsPtr storing DOFs on rows
Problem manager is used to build and partition problems.
intrusive_ptr for managing petsc objects
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
UId getEntGlobalUniqueId() const