![Logo](MoFEMLogo.png) |
| v0.14.0
|
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
- Examples
- dm_partitioned_no_field.cpp.
Definition at line 14 of file dm_partitioned_no_field.cpp.
20 PetscBool flg = PETSC_TRUE;
24 if (flg != PETSC_TRUE)
25 SETERRQ(PETSC_COMM_SELF, 1,
"*** ERROR -my_file (MESH FILE NEEDED)");
28 DMType dm_name =
"DMMOFEM";
33 CHKERR DMCreate(PETSC_COMM_WORLD, &dm);
34 CHKERR DMSetType(dm, dm_name);
40 ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
42 boost::make_shared<WrapMPIComm>(PETSC_COMM_WORLD,
false);
44 pcomm =
new ParallelComm(&moab, moab_comm_wrap->get_comm());
46 const std::string options =
"PARALLEL=READ_PART;"
47 "PARALLEL_RESOLVE_SHARED_ENTS;"
48 "PARTITION=PARALLEL_PARTITION;";
72 std::array<double, 6> coords = {0, 0, 0, 0, 0, 0};
74 CHKERR comm_interface_ptr->makeFieldEntitiesMultishared(
"LAMBDA", 0,
76 CHKERR bit_ref_ptr->setFieldEntitiesBitRefLevel(
"LAMBDA",
82 auto print_field_ents = [&](
const std::string
field_name) {
86 FieldEntity::getLoBitNumberUId(field_bit_number));
88 FieldEntity::getHiBitNumberUId(field_bit_number));
89 for (
auto it = lo; it != hi; ++it) {
90 std::ostringstream ss;
91 ss <<
"Rank " << m_field.
get_comm_rank() <<
" -> " << **it << endl;
92 PetscSynchronizedPrintf(m_field.
get_comm(),
"%s", ss.str().c_str());
93 PetscSynchronizedFlush(m_field.
get_comm(), PETSC_STDOUT);
97 print_field_ents(
"LAMBDA");
104 CHKERR comm_interface_ptr->exchangeFieldData(
"LAMBDA");
105 CHKERR comm_interface_ptr->exchangeFieldData(
"FIELD");
107 auto check_exchanged_values = [&](
const std::string
field_name) {
113 FieldEntity::getLoBitNumberUId(field_bit_number));
115 FieldEntity::getHiBitNumberUId(field_bit_number));
116 for (
auto it = lo; it != hi; ++it) {
118 for (
auto v : field_data)
121 "Wrong value on field %4.3f",
v);
127 CHKERR check_exchanged_values(
"LAMBDA");
152 CHKERR DMSetFromOptions(dm);
160 ->checkMPIAIJWithArraysMatrixFillIn<PetscGlobalIdx_mi_tag>(
161 "TEST_PROBLEM", -1, -1, 1);
167 CHKERR moab.write_file(
"test_out.h5m",
"MOAB",
"PARALLEL=WRITE_PART");
◆ debug
constexpr bool debug = false |
|
constexpr |
◆ help
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
#define MYPCOMM_INDEX
default communicator number PCOMM
virtual MPI_Comm & get_comm() const =0
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
PetscErrorCode DMMoFEMSetSquareProblem(DM dm, PetscBool square_problem)
set squared problem
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.
virtual FieldBitNumber get_field_bit_number(const std::string name) const =0
get field bit number
virtual int get_comm_rank() const =0
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
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.
PetscErrorCode DMMoFEMAddElement(DM dm, std::string fe_name)
add element to dm
Deprecated interface functions.
DeprecatedCoreInterface Interface
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
#define CHKERR
Inline error check.
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 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 build_finite_elements(int verb=DEFAULT_VERBOSITY)=0
Build finite elements.
PetscErrorCode DMRegister_MoFEM(const char sname[])
Register MoFEM problem.
virtual const FieldEntity_multiIndex * get_field_ents() const =0
Get the field ents object.
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.
virtual MoFEMErrorCode modify_finite_element_add_field_data(const std::string &fe_name, const std::string name_field)=0
set finite element field data
constexpr auto field_name
Matrix manager is used to build and partition problems.
const double v
phase velocity of light in medium (cm/ns)
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
#define CATCH_ERRORS
Catch errors.
@ AINSWORTH_LEGENDRE_BASE
Ainsworth Cole (Legendre) approx. base .
PetscErrorCode PetscOptionsGetString(PetscOptions *, const char pre[], const char name[], char str[], size_t size, PetscBool *set)
virtual MoFEMErrorCode build_fields(int verb=DEFAULT_VERBOSITY)=0
UBlasVector< double > VectorDouble
FTensor::Index< 'm', 3 > m
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
@ MOFEM_ATOM_TEST_INVALID
virtual MoFEMErrorCode build_adjacencies(const Range &ents, int verb=DEFAULT_VERBOSITY)=0
build adjacencies
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 MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
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.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ NOFIELD
scalar or vector of scalars describe (no true field)