Testing problem for partitioned mesh with NOFIELD field.
static char help[] =
"...\n\n";
constexpr bool debug =
false;
int main(
int argc,
char *argv[]) {
try {
PetscBool flg = PETSC_TRUE;
255, &flg);
if (flg != PETSC_TRUE)
SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
DMType dm_name = "DMMOFEM";
CHKERR DMRegister_MoFEM(dm_name);
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 std::string options = "PARALLEL=READ_PART;"
"PARALLEL_RESOLVE_SHARED_ENTS;"
"PARTITION=PARALLEL_PARTITION;";
std::array<double, 6> coords = {0, 0, 0, 0, 0, 0};
CHKERR comm_interface_ptr->makeFieldEntitiesMultishared(
"LAMBDA", 0,
CHKERR bit_ref_ptr->setFieldEntitiesBitRefLevel(
"LAMBDA",
auto print_field_ents = [&](
const std::string
field_name) {
FieldEntity::getLoBitNumberUId(field_bit_number));
FieldEntity::getHiBitNumberUId(field_bit_number));
for (auto it = lo; it != hi; ++it) {
std::ostringstream ss;
ss <<
"Rank " << m_field.
get_comm_rank() <<
" -> " << **it << endl;
PetscSynchronizedPrintf(m_field.
get_comm(),
"%s", ss.str().c_str());
PetscSynchronizedFlush(m_field.
get_comm(), PETSC_STDOUT);
}
};
print_field_ents("LAMBDA");
}
CHKERR comm_interface_ptr->exchangeFieldData(
"LAMBDA");
CHKERR comm_interface_ptr->exchangeFieldData(
"FIELD");
auto check_exchanged_values = [&](
const std::string
field_name) {
FieldEntity::getLoBitNumberUId(field_bit_number));
FieldEntity::getHiBitNumberUId(field_bit_number));
for (auto it = lo; it != hi; ++it) {
for (
auto v : field_data)
"Wrong value on field %4.3f",
v);
}
}
};
CHKERR check_exchanged_values(
"LAMBDA");
CHKERR DMMoFEMCreateMoFEM(dm, &m_field,
"TEST_PROBLEM",
CHKERR DMMoFEMSetSquareProblem(
dm, PETSC_FALSE);
CHKERR DMMoFEMAddElement(dm,
"FE");
->checkMPIAIJWithArraysMatrixFillIn<PetscGlobalIdx_mi_tag>(
"TEST_PROBLEM", -1, -1, 1);
CHKERR moab.write_file(
"test_out.h5m",
"MOAB",
"PARALLEL=WRITE_PART");
}
return 0;
}
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
@ NOFIELD
scalar or vector of scalars describe (no true field)
#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
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
FTensor::Index< 'm', SPACE_DIM > m
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_data(const std::string &fe_name, const std::string name_filed)=0
set finite element field data
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 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.
const double v
phase velocity of light in medium (cm/ns)
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
UBlasVector< double > VectorDouble
implementation of Data Operators for Forces and Sources
constexpr auto field_name
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
virtual MPI_Comm & get_comm() const =0
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 int get_comm_rank() const =0
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.
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.
Matrix manager is used to build and partition problems.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.