MOAB: Mesh Oriented datABase
(version 5.5.0)
|
#include "moab/ParallelComm.hpp"
#include "MBParallelConventions.h"
#include "moab/ParCommGraph.hpp"
#include "ReadParallel.hpp"
#include "moab/FileOptions.hpp"
#include "MBTagConventions.hpp"
#include "moab/Core.hpp"
#include "moab_mpi.h"
#include "TestUtil.hpp"
#include <iostream>
#include <algorithm>
#include <map>
#include <sstream>
#include <cassert>
#include <unistd.h>
Go to the source code of this file.
Classes | |
struct | VtxData |
Macros | |
#define | CHKERR(a) |
#define | PCHECK(A) if( is_any_proc_error( !( A ) ) ) return report_error( __FILE__, __LINE__ ) |
#define | RUN_TEST_ARG2(A, B) run_test( &( A ), #A, B ) |
Functions | |
ErrorCode | report_error (const char *file, int line) |
ErrorCode | get_sharing_processors (Interface &moab, EntityHandle entity, std::vector< int > &other_procs_out) |
ErrorCode | parallel_create_mesh (Interface &mb, int output_vertx_ids[9], EntityHandle output_vertex_handles[9], Range &output_elements, EntityHandle output_sets[3]=0) |
int | is_any_proc_error (int is_my_error) |
ErrorCode | test_elements_on_several_procs (const char *filename) |
ErrorCode | test_ghost_elements_3_2_1 (const char *filename) |
ErrorCode | test_ghost_elements_3_2_2 (const char *filename) |
ErrorCode | test_ghost_elements_3_0_1 (const char *filename) |
ErrorCode | test_ghost_elements_2_0_1 (const char *filename) |
ErrorCode | test_ghost_tag_exchange (const char *filename) |
ErrorCode | regression_ghost_tag_exchange_no_default (const char *filename) |
ErrorCode | test_interface_owners (const char *) |
ErrorCode | regression_owners_with_ghosting (const char *) |
ErrorCode | test_ghosted_entity_shared_data (const char *) |
ErrorCode | test_assign_global_ids (const char *) |
ErrorCode | test_shared_sets (const char *) |
ErrorCode | test_reduce_tags (const char *) |
ErrorCode | test_reduce_tag_failures (const char *) |
ErrorCode | test_reduce_tag_explicit_dest (const char *) |
ErrorCode | test_delete_entities (const char *) |
ErrorCode | test_ghost_polyhedra (const char *) |
ErrorCode | test_too_few_parts (const char *) |
ErrorCode | test_sequences_after_ghosting (const char *) |
void | test_trivial_partition () |
int | run_test (ErrorCode(*func)(const char *), const char *func_name, const char *file_name) |
int | main (int argc, char *argv[]) |
ErrorCode | parallel_create_mesh (Interface &mb, int vtx_ids[9], EntityHandle vtx_handles[9], Range &range, EntityHandle *entity_sets) |
ErrorCode | get_ghost_entities (ParallelComm &pcomm, Range &ghost_ents) |
ErrorCode | get_ents_from_geometric_sets (Interface &moab, const Tag tags[2], int dimension, const std::vector< int > &ids, Range &results) |
ErrorCode | get_expected_ghosts (Interface &moab, const std::vector< int > partition_geom_ids[4], std::vector< int > &ghost_entity_ids, int ghost_dimension, int bridge_dimension, int num_layers) |
Given entire file and IDs of geometric sets, get expected ghost entities. More... | |
ErrorCode | test_ghost_elements (const char *filename, int ghost_dimension, int bridge_dimension, int num_layers) |
ErrorCode | get_owner_handles (ParallelComm *pcomm, const Range &ents, EntityHandle *handle_arr) |
int | MPI_swap (void *buffer, int num_val, MPI_Datatype val_type, int other_proc) |
int | valid_ghosting_owners (int comm_size, const int *ids, const int *owners) |
ErrorCode | test_interface_owners_common (int num_ghost_layers) |
ErrorCode | check_consistent_ids (Interface &mb, const EntityHandle *entities, const int *orig_ids, int num_ents, const char *singular_name, const char *plural_name) |
template<typename T > | |
ErrorCode | check_shared_ents (ParallelComm &pcomm, Tag tagh, T fact, MPI_Op mpi_op) |
template<typename T > | |
ErrorCode | test_reduce_tags (const char *, DataType tp) |
#define CHKERR | ( | a | ) |
Definition at line 22 of file parallel_unit_tests.cpp.
#define PCHECK | ( | A | ) | if( is_any_proc_error( !( A ) ) ) return report_error( __FILE__, __LINE__ ) |
Definition at line 33 of file parallel_unit_tests.cpp.
#define RUN_TEST_ARG2 | ( | A, | |
B | |||
) | run_test( &( A ), #A, B ) |
Definition at line 150 of file parallel_unit_tests.cpp.
ErrorCode check_consistent_ids | ( | Interface & | mb, |
const EntityHandle * | entities, | ||
const int * | orig_ids, | ||
int | num_ents, | ||
const char * | singular_name, | ||
const char * | plural_name | ||
) |
Definition at line 1162 of file parallel_unit_tests.cpp.
References CHKERR, entities, ErrorCode, moab::Core::globalId_tag(), id_tag, ierr, mb, MB_SUCCESS, MPI_COMM_WORLD, rank, size, and moab::Core::tag_get_data().
Referenced by test_assign_global_ids().
ErrorCode check_shared_ents | ( | ParallelComm & | pcomm, |
Tag | tagh, | ||
T | fact, | ||
MPI_Op | mpi_op | ||
) |
Definition at line 1474 of file parallel_unit_tests.cpp.
References moab::Range::begin(), CHKERR, moab::Range::end(), ErrorCode, moab::ParallelComm::get_moab(), moab::ParallelComm::get_shared_entities(), moab::ParallelComm::get_sharing_data(), MAX_SHARING_PROCS, MB_SUCCESS, np, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), moab::ParallelComm::rank(), moab::Range::size(), and moab::Interface::tag_get_data().
Referenced by test_reduce_tags().
ErrorCode get_ents_from_geometric_sets | ( | Interface & | moab, |
const Tag | tags[2], | ||
int | dimension, | ||
const std::vector< int > & | ids, | ||
Range & | results | ||
) |
Definition at line 578 of file parallel_unit_tests.cpp.
References moab::Range::begin(), CHKERR, moab::Range::end(), ErrorCode, MB_SUCCESS, MBENTITYSET, and moab::Range::merge().
Referenced by get_expected_ghosts().
ErrorCode get_expected_ghosts | ( | Interface & | moab, |
const std::vector< int > | partition_geom_ids[4], | ||
std::vector< int > & | ghost_entity_ids, | ||
int | ghost_dimension, | ||
int | bridge_dimension, | ||
int | num_layers | ||
) |
Given entire file and IDs of geometric sets, get expected ghost entities.
moab | The entire mesh, loaded in serial |
partition_geom_ids | IDs of: geometric volumes owned by this proc and interface topology |
ghost_entity_ids | output list |
Definition at line 606 of file parallel_unit_tests.cpp.
References CHKERR, moab::Range::clear(), ErrorCode, GEOM_DIMENSION_TAG_NAME, get_ents_from_geometric_sets(), MB_SUCCESS, MB_TYPE_INTEGER, moab::Range::size(), skin(), moab::subtract(), and moab::Interface::UNION.
Referenced by test_ghost_elements().
ErrorCode get_ghost_entities | ( | ParallelComm & | pcomm, |
Range & | ghost_ents | ||
) |
Definition at line 561 of file parallel_unit_tests.cpp.
References moab::Range::begin(), CHKERR, moab::Range::end(), ErrorCode, moab::Interface::get_entities_by_handle(), moab::ParallelComm::get_moab(), moab::Range::insert(), MB_SUCCESS, PSTATUS_INTERFACE, PSTATUS_NOT_OWNED, moab::ParallelComm::pstatus_tag(), moab::Range::size(), and moab::Interface::tag_get_data().
Referenced by test_ghost_elements().
ErrorCode get_owner_handles | ( | ParallelComm * | pcomm, |
const Range & | ents, | ||
EntityHandle * | handle_arr | ||
) |
Definition at line 849 of file parallel_unit_tests.cpp.
References moab::Range::begin(), moab::Range::end(), ErrorCode, moab::ParallelComm::get_owner_handle(), and MB_SUCCESS.
Referenced by test_ghost_tag_exchange().
ErrorCode get_sharing_processors | ( | Interface & | moab, |
EntityHandle | entity, | ||
std::vector< int > & | other_procs_out | ||
) |
Definition at line 273 of file parallel_unit_tests.cpp.
References CHKERR, ErrorCode, MAX_SHARING_PROCS, MB_SUCCESS, MB_TYPE_HANDLE, MB_TYPE_INTEGER, MB_TYPE_OPAQUE, PARALLEL_SHARED_HANDLE_TAG_NAME, PARALLEL_SHARED_HANDLES_TAG_NAME, PARALLEL_SHARED_PROC_TAG_NAME, PARALLEL_SHARED_PROCS_TAG_NAME, PARALLEL_STATUS_TAG_NAME, and PSTATUS_SHARED.
Referenced by test_elements_on_several_procs(), and test_ghost_elements().
int is_any_proc_error | ( | int | is_my_error | ) |
Definition at line 305 of file parallel_unit_tests.cpp.
References MPI_COMM_WORLD.
Referenced by run_test(), and test_ghost_elements().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 169 of file parallel_unit_tests.cpp.
References filename, filename2, MPI_COMM_WORLD, rank, regression_ghost_tag_exchange_no_default(), regression_owners_with_ghosting(), RUN_TEST, RUN_TEST_ARG2, size, test_assign_global_ids(), test_delete_entities(), test_elements_on_several_procs(), test_ghost_elements_2_0_1(), test_ghost_elements_3_0_1(), test_ghost_elements_3_2_1(), test_ghost_elements_3_2_2(), test_ghost_polyhedra(), test_ghost_tag_exchange(), test_ghosted_entity_shared_data(), test_interface_owners(), test_reduce_tag_explicit_dest(), test_reduce_tag_failures(), test_reduce_tags(), test_sequences_after_ghosting(), test_shared_sets(), test_too_few_parts(), and test_trivial_partition().
int MPI_swap | ( | void * | buffer, |
int | num_val, | ||
MPI_Datatype | val_type, | ||
int | other_proc | ||
) |
Definition at line 997 of file parallel_unit_tests.cpp.
References buffer, MPI_COMM_WORLD, and rank.
ErrorCode parallel_create_mesh | ( | Interface & | mb, |
int | output_vertx_ids[9], | ||
EntityHandle | output_vertex_handles[9], | ||
Range & | output_elements, | ||
EntityHandle | output_sets[3] = 0 |
||
) |
ErrorCode parallel_create_mesh | ( | Interface & | mb, |
int | vtx_ids[9], | ||
EntityHandle | vtx_handles[9], | ||
Range & | range, | ||
EntityHandle * | entity_sets | ||
) |
Definition at line 312 of file parallel_unit_tests.cpp.
References moab::Core::add_entities(), moab::Range::begin(), CHKERR, moab::Range::clear(), moab::Core::create_element(), moab::Core::create_meshset(), moab::Core::create_vertices(), moab::Range::end(), ErrorCode, moab::Core::globalId_tag(), id_tag, moab::Range::insert(), mb, MB_SUCCESS, MBQUAD, MESHSET_SET, MPI_COMM_WORLD, rank, size, moab::Range::size(), and moab::Core::tag_set_data().
ErrorCode regression_ghost_tag_exchange_no_default | ( | const char * | filename | ) |
Definition at line 957 of file parallel_unit_tests.cpp.
References CHKERR, ErrorCode, moab::ParallelComm::exchange_tags(), filename, moab::ParallelComm::get_pcomm(), mb_instance(), MB_SUCCESS, MB_TAG_DENSE, MB_TAG_EXCL, MB_TYPE_HANDLE, and PCHECK.
Referenced by main().
ErrorCode regression_owners_with_ghosting | ( | const char * | ) |
Definition at line 1122 of file parallel_unit_tests.cpp.
References test_interface_owners_common().
Referenced by main().
ErrorCode report_error | ( | const char * | file, |
int | line | ||
) |
Definition at line 36 of file parallel_unit_tests.cpp.
Referenced by moab::FileTokenizer::get_newline().
int run_test | ( | ErrorCode(*)(const char *) | func, |
const char * | func_name, | ||
const char * | file_name | ||
) |
Definition at line 152 of file parallel_unit_tests.cpp.
References ErrorCode, is_any_proc_error(), MB_SUCCESS, MPI_COMM_WORLD, and rank.
ErrorCode test_assign_global_ids | ( | const char * | ) |
Definition at line 1246 of file parallel_unit_tests.cpp.
References moab::ParallelComm::assign_global_ids(), moab::Range::begin(), check_consistent_ids(), CHKERR, moab::Range::end(), ErrorCode, moab::Core::globalId_tag(), id_tag, mb, MB_SUCCESS, MPI_COMM_WORLD, parallel_create_mesh(), PCHECK, rank, moab::ParallelComm::resolve_shared_ents(), size, moab::Range::size(), moab::Core::tag_get_data(), and moab::Core::tag_set_data().
Referenced by main().
ErrorCode test_delete_entities | ( | const char * | filename | ) |
Definition at line 1702 of file parallel_unit_tests.cpp.
References moab::Range::begin(), CHKERR, moab::ParallelComm::delete_entities(), moab::Range::end(), ErrorCode, filename, moab::ParallelComm::get_pcomm(), mb_instance(), MB_SUCCESS, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), and moab::Range::size().
Referenced by main().
ErrorCode test_elements_on_several_procs | ( | const char * | filename | ) |
Definition at line 421 of file parallel_unit_tests.cpp.
References moab::Range::begin(), moab::ParallelComm::check_all_shared_handles(), CHKERR, moab::Range::clear(), dim, moab::Range::empty(), moab::Range::end(), ErrorCode, filename, GEOM_DIMENSION_TAG_NAME, geom_tag, moab::ParallelComm::get_pcomm(), get_sharing_processors(), id_tag, moab::Range::insert(), mb_instance(), MB_SUCCESS, MB_TYPE_INTEGER, MBENTITYSET, moab::Range::merge(), PCHECK, moab::ParallelComm::proc_config(), and moab::ProcConfig::proc_rank().
Referenced by main().
ErrorCode test_ghost_elements | ( | const char * | filename, |
int | ghost_dimension, | ||
int | bridge_dimension, | ||
int | num_layers | ||
) |
Definition at line 662 of file parallel_unit_tests.cpp.
References moab::Range::begin(), moab::ParallelComm::check_all_shared_handles(), CHKERR, moab::Range::clear(), dim, moab::Range::empty(), moab::Range::end(), moab::Range::equal_range(), moab::Range::erase(), moab::error(), ErrorCode, moab::ParallelComm::exchange_tags(), filename, GEOM_DIMENSION_TAG_NAME, geom_tag, get_expected_ghosts(), get_ghost_entities(), moab::ParallelComm::get_pcomm(), moab::ParallelComm::get_shared_entities(), get_sharing_processors(), id_tag, moab::Range::insert(), is_any_proc_error(), moab::Core::load_file(), mb_instance(), MB_SUCCESS, MB_TYPE_INTEGER, MBVERTEX, moab::Range::merge(), moab::ParallelComm::partition_sets(), PCHECK, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), size, moab::Range::size(), moab::Range::swap(), moab::Interface::UNION, and vtx().
Referenced by test_ghost_elements_2_0_1(), test_ghost_elements_3_0_1(), test_ghost_elements_3_2_1(), and test_ghost_elements_3_2_2().
ErrorCode test_ghost_elements_2_0_1 | ( | const char * | filename | ) |
Definition at line 844 of file parallel_unit_tests.cpp.
References filename, and test_ghost_elements().
Referenced by main().
ErrorCode test_ghost_elements_3_0_1 | ( | const char * | filename | ) |
Definition at line 839 of file parallel_unit_tests.cpp.
References filename, and test_ghost_elements().
Referenced by main().
ErrorCode test_ghost_elements_3_2_1 | ( | const char * | filename | ) |
Definition at line 829 of file parallel_unit_tests.cpp.
References filename, and test_ghost_elements().
Referenced by main().
ErrorCode test_ghost_elements_3_2_2 | ( | const char * | filename | ) |
Definition at line 834 of file parallel_unit_tests.cpp.
References filename, and test_ghost_elements().
Referenced by main().
ErrorCode test_ghost_polyhedra | ( | const char * | filename | ) |
Definition at line 1737 of file parallel_unit_tests.cpp.
References CHKERR, ErrorCode, filename, mb_instance(), and MB_SUCCESS.
Referenced by main().
ErrorCode test_ghost_tag_exchange | ( | const char * | filename | ) |
Definition at line 861 of file parallel_unit_tests.cpp.
References moab::Range::begin(), CHKERR, moab::Range::clear(), moab::Range::end(), moab::Range::erase(), ErrorCode, moab::ParallelComm::exchange_tags(), filename, moab::ParallelComm::get_owner(), get_owner_handles(), moab::ParallelComm::get_pcomm(), moab::Range::insert(), mb_instance(), MB_SUCCESS, MB_TAG_DENSE, MB_TAG_EXCL, MB_TYPE_HANDLE, MB_TYPE_INTEGER, PCHECK, moab::ParallelComm::proc_config(), moab::ProcConfig::proc_rank(), rank, and moab::Range::size().
Referenced by main().
ErrorCode test_ghosted_entity_shared_data | ( | const char * | ) |
Definition at line 1134 of file parallel_unit_tests.cpp.
References moab::ParallelComm::check_all_shared_handles(), ErrorCode, moab::ParallelComm::exchange_ghost_cells(), mb, MB_SUCCESS, MPI_COMM_WORLD, parallel_create_mesh(), PCHECK, rank, moab::ParallelComm::resolve_shared_ents(), and size.
Referenced by main().
ErrorCode test_interface_owners | ( | const char * | ) |
Definition at line 1117 of file parallel_unit_tests.cpp.
References test_interface_owners_common().
Referenced by main().
ErrorCode test_interface_owners_common | ( | int | num_ghost_layers | ) |
Definition at line 1069 of file parallel_unit_tests.cpp.
References ErrorCode, moab::ParallelComm::exchange_ghost_cells(), moab::ParallelComm::get_owner(), ierr, mb, MB_SUCCESS, MPI_COMM_WORLD, parallel_create_mesh(), PCHECK, rank, moab::ParallelComm::resolve_shared_ents(), size, and valid_ghosting_owners().
Referenced by regression_owners_with_ghosting(), and test_interface_owners().
ErrorCode test_reduce_tag_explicit_dest | ( | const char * | ) |
Definition at line 1653 of file parallel_unit_tests.cpp.
References CHKERR, ErrorCode, moab::ParallelComm::get_shared_entities(), mb, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_DOUBLE, MPI_COMM_WORLD, parallel_create_mesh(), PCHECK, rank, moab::ParallelComm::reduce_tags(), moab::ParallelComm::resolve_shared_ents(), size, moab::Range::size(), moab::Core::tag_delete(), moab::Core::tag_get_handle(), and moab::Core::tag_set_data().
Referenced by main().
ErrorCode test_reduce_tag_failures | ( | const char * | ) |
Definition at line 1585 of file parallel_unit_tests.cpp.
References CHKERR, ErrorCode, mb, MB_ENTITY_NOT_FOUND, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MB_TYPE_DOUBLE, MB_TYPE_INTEGER, MPI_COMM_WORLD, parallel_create_mesh(), PCHECK, rank, moab::ParallelComm::reduce_tags(), moab::ParallelComm::resolve_shared_ents(), size, moab::Core::tag_delete(), and moab::Core::tag_get_handle().
Referenced by main().
ErrorCode test_reduce_tags | ( | const char * | ) |
Definition at line 1632 of file parallel_unit_tests.cpp.
References ErrorCode, MB_SUCCESS, MB_TYPE_DOUBLE, and MB_TYPE_INTEGER.
Referenced by main().
Definition at line 1520 of file parallel_unit_tests.cpp.
References check_shared_ents(), CHKERR, ErrorCode, moab::ParallelComm::get_shared_entities(), mb, MB_SUCCESS, MB_TAG_CREAT, MB_TAG_DENSE, MPI_COMM_WORLD, parallel_create_mesh(), PCHECK, moab::ParallelComm::rank(), rank, moab::ParallelComm::reduce_tags(), moab::ParallelComm::resolve_shared_ents(), size, moab::Range::size(), T, moab::Core::tag_delete(), moab::Core::tag_get_handle(), and moab::Core::tag_set_data().
ErrorCode test_sequences_after_ghosting | ( | const char * | filename | ) |
Definition at line 1767 of file parallel_unit_tests.cpp.
References moab::Range::begin(), CHKERR, moab::Range::end(), ErrorCode, filename, id_tag, mb_instance(), MB_SUCCESS, moab::Range::psize(), and moab::Range::size().
Referenced by main().
ErrorCode test_shared_sets | ( | const char * | ) |
Definition at line 1290 of file parallel_unit_tests.cpp.
References moab::Range::clear(), ErrorCode, moab::ParallelComm::get_entityset_local_handle(), moab::ParallelComm::get_entityset_owner(), moab::ParallelComm::get_entityset_owners(), moab::ParallelComm::get_entityset_procs(), moab::ParallelComm::get_owned_sets(), moab::Core::globalId_tag(), id_tag, moab::Range::insert(), mb, MB_SUCCESS, MPI_COMM_WORLD, parallel_create_mesh(), PCHECK, rank, moab::ParallelComm::resolve_shared_ents(), moab::ParallelComm::resolve_shared_sets(), and moab::Core::tag_get_data().
Referenced by main().
ErrorCode test_too_few_parts | ( | const char * | filename | ) |
Definition at line 1751 of file parallel_unit_tests.cpp.
References ErrorCode, filename, and mb_instance().
Referenced by main().
void test_trivial_partition | ( | ) |
Definition at line 1840 of file parallel_unit_tests.cpp.
References moab::ParCommGraph::compute_trivial_partition(), MPI_COMM_WORLD, rank, moab::Range::size(), and moab::ParCommGraph::split_owned_range().
Referenced by main().
int valid_ghosting_owners | ( | int | comm_size, |
const int * | ids, | ||
const int * | owners | ||
) |
Definition at line 1024 of file parallel_unit_tests.cpp.
References error_count.
Referenced by test_interface_owners_common().