Testing problem for partitioned mesh.
static char help[] =
"...\n\n";
return 0;
}
private:
};
return 0;
}
private:
};
int main(
int argc,
char *argv[]) {
try {
PetscBool flg = PETSC_TRUE;
#if PETSC_VERSION_GE(3, 6, 4)
255, &flg);
#else
#endif
if (flg != PETSC_TRUE) {
SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
}
DMType dm_name = "DMMOFEM";
DM dm;
CHKERR DMCreate(PETSC_COMM_WORLD, &dm);
CHKERR DMSetType(dm, dm_name);
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
auto moab_comm_wrap =
boost::make_shared<WrapMPIComm>(PETSC_COMM_WORLD, false);
if (pcomm == NULL)
pcomm = new ParallelComm(&moab, moab_comm_wrap->get_comm());
const char *option;
option = "PARALLEL=BCAST_DELETE;PARALLEL_RESOLVE_SHARED_ENTS;PARTITION="
"PARALLEL_PARTITION;";
bit_level0.set(0);
root_set, 3, bit_level0);
int field_rank = 3;
#if PETSC_VERSION_GE(3, 6, 4)
&flg);
#else
&field_rank, &flg);
#endif
"FIELD1");
"FIELD2");
"FE_ONLY_DATA");
dm, PETSC_FALSE);
->checkMPIAIJWithArraysMatrixFillIn<PetscGlobalIdx_mi_tag>(
"TEST_PROBLEM", -1, -1, 1);
->checkMPIAIJMatrixFillIn<PetscGlobalIdx_mi_tag>("TEST_PROBLEM", -1, -1,
1);
std::vector<std::string> fields_list;
fields_list.push_back("FIELD1");
PetscSection section;
§ion);
CHKERR PetscSectionView(section, PETSC_VIEWER_STDOUT_WORLD);
CHKERR DMSetSection(dm, section);
CHKERR PetscSectionDestroy(§ion);
PetscBool save_file = PETSC_TRUE;
#if PETSC_VERSION_GE(3, 6, 4)
&flg);
#else
&save_file, &flg);
#endif
if (save_file) {
PetscViewer viewer;
CHKERR PetscViewerASCIIOpen(PETSC_COMM_WORLD,
"dm_build_partitioned_mesh.txt", &viewer);
CHKERR PetscViewerPushFormat(viewer, PETSC_VIEWER_ASCII_INFO);
CHKERR PetscViewerDestroy(&viewer);
}
int count = 0;
boost::make_shared<CountUp>(count));
boost::make_shared<CountDown>(count));
if (count)
count);
auto check_consistency_of_uids = [&]() {
for (auto &fe : *field_ents_ptr) {
if (fe->getOwnerProc() !=
(FieldEntity::getOwnerFromUniqueId(fe->getGlobalUniqueId()))) {
<< "UId owner proc "
<< FieldEntity::getOwnerFromUniqueId(fe->getGlobalUniqueId());
<< "Entity owner proc " << fe->getOwnerProc();
"UId and entity handle inconsistency");
}
if (fe->getEnt() !=
FieldEntity::getHandleFromUniqueId(fe->getLocalUniqueId())) {
<< "UId handle "
<< FieldEntity::getHandleFromUniqueId(fe->getLocalUniqueId());
MOFEM_LOG(
"SELF", Sev::error) <<
"Entity handle " << fe->getEnt();
"UId and entity handle inconsistency");
}
const auto field_bit_number_from_uid =
FieldEntity::getFieldBitNumberFromUniqueId(fe->getLocalUniqueId());
if (fe->getBitNumber() != field_bit_number_from_uid) {
<< "UId field bit " << field_bit_number_from_uid;
<< "Entity owner proc " << fe->getBitNumber();
"UId and entity handle inconsistency");
}
field_bit_number_from_uid - 1))) {
<< "UId field bit "
<< "Entity owner proc " << fe->getName();
"UId and entity handle inconsistency");
}
}
};
CHKERR check_consistency_of_uids();
}
return 0;
}
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ L2
field with C-1 continuity
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_ATOM_TEST_INVALID
@ MOFEM_DATA_INCONSISTENCY
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
PetscErrorCode DMMoFEMSetIsPartitioned(DM dm, PetscBool is_partitioned)
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
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 DMCreateMatrix_MoFEM(DM dm, Mat *M)
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.
virtual const FieldEntity_multiIndex * get_field_ents() const =0
Get the field ents 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 modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
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.
virtual MoFEMErrorCode add_ents_to_field_by_type(const Range &ents, const EntityType type, const std::string &name, int verb=DEFAULT_VERBOSITY)=0
Add entities to field meshset.
#define MOFEM_LOG(channel, severity)
Log.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
std::bitset< BITFIELDID_SIZE > BitFieldId
Field Id.
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
PetscErrorCode PetscOptionsGetInt(PetscOptions *, const char pre[], const char name[], PetscInt *ivalue, PetscBool *set)
PetscErrorCode PetscOptionsGetBool(PetscOptions *, const char pre[], const char name[], PetscBool *bval, PetscBool *set)
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
FTensor::Index< 'm', 3 > m
MoFEMErrorCode preProcess()
Pre-processing function executed at loop initialization.
MoFEMErrorCode operator()()
Main operator function executed for each loop iteration.
MoFEMErrorCode postProcess()
Post-processing function executed at loop completion.
MoFEMErrorCode postProcess()
Post-processing function executed at loop completion.
MoFEMErrorCode preProcess()
Pre-processing function executed at loop initialization.
MoFEMErrorCode operator()()
Main operator function executed for each loop iteration.
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 std::string get_field_name(const BitFieldId id) const =0
get field name from 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.
FEMethod()=default
Default constructor.
Section manager is used to create indexes and sections.
Matrix 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.