MOAB: Mesh Oriented datABase
(version 5.5.0)
scdpart.cpp
Go to the documentation of this file.
1
#include "
TestUtil.hpp
"
2
#include "
moab/Core.hpp
"
3
#include "
moab/ParallelComm.hpp
"
4
#include "
moab/ScdInterface.hpp
"
5
#include "
moab/ProgOptions.hpp
"
6
#include "
MBParallelConventions.h
"
7
8
using namespace
moab
;
9
10
std::string
example
= TestDir +
"unittest/io/eul3x48x96.t.3.nc"
;
11
12
void
test_read_parallel
(
int
nverts );
13
void
test_read_parallel_alljorkori
();
14
void
test_read_parallel_alljkbal
();
15
void
test_read_parallel_sqij
();
16
void
test_read_parallel_sqjk
();
17
18
std::string
partition_method
;
19
20
int
main
(
int
argc,
char
** argv )
21
{
22
MPI_Init( &argc, &argv );
23
int
result = 0;
24
25
result +=
RUN_TEST
(
test_read_parallel_alljorkori
);
26
result +=
RUN_TEST
(
test_read_parallel_alljkbal
);
27
result +=
RUN_TEST
(
test_read_parallel_sqij
);
28
result +=
RUN_TEST
(
test_read_parallel_sqjk
);
29
30
MPI_Finalize();
31
return
result;
32
}
33
34
void
test_read_parallel_alljorkori
()
35
{
36
partition_method
= std::string(
";PARTITION_METHOD=alljorkori"
);
37
test_read_parallel
( 4704 );
38
}
39
40
void
test_read_parallel_alljkbal
()
41
{
42
partition_method
= std::string(
";PARTITION_METHOD=alljkbal"
);
43
test_read_parallel
( 4704 );
44
}
45
46
void
test_read_parallel_sqij
()
47
{
48
partition_method
= std::string(
";PARTITION_METHOD=sqij"
);
49
test_read_parallel
( 4704 );
50
}
51
52
void
test_read_parallel_sqjk
()
53
{
54
partition_method
= std::string(
";PARTITION_METHOD=sqjk"
);
55
test_read_parallel
( 4704 );
56
}
57
58
void
test_read_parallel
(
int
num_verts )
59
{
60
Core
moab
;
61
Interface
&
mb
=
moab
;
62
EntityHandle
file_set;
63
ErrorCode
rval;
64
rval =
mb
.
create_meshset
(
MESHSET_SET
, file_set );
CHECK_ERR
( rval );
65
66
std::string opt = std::string(
"PARALLEL=READ_PART;PARTITION=;PARTITION_DISTRIBUTE;PARALLEL_RESOLVE_SHARED_ENTS"
) +
67
partition_method
;
68
rval =
mb
.
load_file
(
example
.c_str(), &file_set, opt.c_str() );
CHECK_ERR
( rval );
69
70
ParallelComm
* pcomm =
ParallelComm::get_pcomm
( &
mb
, 0 );
71
72
rval = pcomm->
check_all_shared_handles
();
CHECK_ERR
( rval );
73
74
// get the total # owned verts
75
Range
verts;
76
rval =
mb
.
get_entities_by_type
( 0,
MBVERTEX
, verts );
CHECK_ERR
( rval );
77
rval = pcomm->
filter_pstatus
( verts,
PSTATUS_NOT_OWNED
,
PSTATUS_NOT
);
CHECK_ERR
( rval );
78
int
my_num = verts.
size
(), total_verts;
79
MPI_Reduce( &my_num, &total_verts, 1, MPI_INT, MPI_SUM, 0, pcomm->
proc_config
().
proc_comm
() );
80
81
if
( 0 == pcomm->
proc_config
().
proc_rank
() )
CHECK_EQUAL
( total_verts, num_verts );
82
}
test
parallel
scdpart.cpp
Generated on Wed Oct 4 2023 14:20:31 for MOAB: Mesh Oriented datABase by
1.9.1