Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
third-party
moab
Commits
32b6d77d
Commit
32b6d77d
authored
Oct 14, 2016
by
vijaysm
Browse files
Options
Browse Files
Download
Plain Diff
Merged in iulian07/clang_osx_warnings (pull request #262)
Several warning fixes for OSX/Clang
parents
7a0f27b4
81e4f023
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
191 additions
and
204 deletions
+191
-204
config/compiler.m4
config/compiler.m4
+10
-4
itaps/imesh/MOAB_iMeshP_unit_tests.cpp
itaps/imesh/MOAB_iMeshP_unit_tests.cpp
+1
-1
itaps/imesh/iMesh_MOAB.cpp
itaps/imesh/iMesh_MOAB.cpp
+3
-3
itaps/irel/test_entset.cpp
itaps/irel/test_entset.cpp
+1
-1
src/Core.cpp
src/Core.cpp
+1
-1
src/DenseTag.cpp
src/DenseTag.cpp
+7
-2
src/LocalDiscretization/LinearTet.cpp
src/LocalDiscretization/LinearTet.cpp
+1
-1
src/LocalDiscretization/LinearTri.cpp
src/LocalDiscretization/LinearTri.cpp
+1
-1
src/MetisPartitioner.cpp
src/MetisPartitioner.cpp
+67
-70
src/ScdInterface.cpp
src/ScdInterface.cpp
+2
-2
src/WriteUtil.cpp
src/WriteUtil.cpp
+2
-2
src/WriteUtil.hpp
src/WriteUtil.hpp
+1
-3
src/iMOAB.cpp
src/iMOAB.cpp
+7
-7
src/io/IODebugTrack.cpp
src/io/IODebugTrack.cpp
+2
-2
src/io/ReadHDF5.cpp
src/io/ReadHDF5.cpp
+2
-2
src/io/ReadOBJ.cpp
src/io/ReadOBJ.cpp
+5
-5
src/io/ReadOBJ.hpp
src/io/ReadOBJ.hpp
+1
-2
src/io/WriteCGNS.cpp
src/io/WriteCGNS.cpp
+0
-1
src/io/WriteHDF5.cpp
src/io/WriteHDF5.cpp
+10
-30
src/moab/MetisPartitioner.hpp
src/moab/MetisPartitioner.hpp
+1
-7
src/parallel/ParallelComm.cpp
src/parallel/ParallelComm.cpp
+3
-3
src/parallel/ParallelMergeMesh.cpp
src/parallel/ParallelMergeMesh.cpp
+1
-1
src/parallel/WriteHDF5Parallel.cpp
src/parallel/WriteHDF5Parallel.cpp
+47
-38
src/parallel/gs.cpp
src/parallel/gs.cpp
+11
-11
tools/mbcoupler/Coupler.cpp
tools/mbcoupler/Coupler.cpp
+3
-3
tools/mbpart.cpp
tools/mbpart.cpp
+1
-1
No files found.
config/compiler.m4
View file @
32b6d77d
...
@@ -192,6 +192,9 @@ if (test "x$enable_debug" != "xno"); then # debug flags
...
@@ -192,6 +192,9 @@ if (test "x$enable_debug" != "xno"); then # debug flags
# GNU
# GNU
EXTRA_GNU_CXXFLAGS="-Wall -Wno-long-long -pipe -pedantic -Wshadow -Wunused-parameter -Wpointer-arith -Wformat -Wformat-security -Wextra -Wno-variadic-macros -Wno-unknown-pragmas"
EXTRA_GNU_CXXFLAGS="-Wall -Wno-long-long -pipe -pedantic -Wshadow -Wunused-parameter -Wpointer-arith -Wformat -Wformat-security -Wextra -Wno-variadic-macros -Wno-unknown-pragmas"
EXTRA_GNU_FCFLAGS="-pipe -pedantic -ffree-line-length-0"
EXTRA_GNU_FCFLAGS="-pipe -pedantic -ffree-line-length-0"
# CLANG
EXTRA_CLANG_CXXFLAGS="$EXTRA_GNU_CXXFLAGS"
EXTRA_CLANG_FCFLAGS="$EXTRA_GNU_FCFLAGS"
# Intel
# Intel
EXTRA_INTEL_CXXFLAGS="-pipe -C"
EXTRA_INTEL_CXXFLAGS="-pipe -C"
EXTRA_INTEL_FCFLAGS="-C"
EXTRA_INTEL_FCFLAGS="-C"
...
@@ -205,8 +208,11 @@ fi
...
@@ -205,8 +208,11 @@ fi
if (test "x$enable_cxx_optimize" != "xno"); then # optimization flags
if (test "x$enable_cxx_optimize" != "xno"); then # optimization flags
#GNU
#GNU
EXTRA_GNU_CXXFLAGS="$EXTRA_GNU_CXXFLAGS -finline-functions"
EXTRA_GNU_CXXFLAGS="$EXTRA_GNU_CXXFLAGS
-fprefetch-loop-arrays
-finline-functions
-march=native
"
EXTRA_GNU_FCFLAGS="$EXTRA_GNU_FCFLAGS -ffree-line-length-0 -finline-functions"
EXTRA_GNU_FCFLAGS="$EXTRA_GNU_FCFLAGS -ffree-line-length-0 -finline-functions"
#CLANG
EXTRA_CLANG_CXXFLAGS="$EXTRA_CLANG_CXXFLAGS -march=native"
EXTRA_CLANG_FCFLAGS="$EXTRA_CLANG_FCFLAGS -ffree-line-length-0 -finline-functions"
# Intel
# Intel
EXTRA_INTEL_CXXFLAGS="$EXTRA_INTEL_CXXFLAGS -xHost -ip -no-prec-div" # -fast
EXTRA_INTEL_CXXFLAGS="$EXTRA_INTEL_CXXFLAGS -xHost -ip -no-prec-div" # -fast
EXTRA_INTEL_FCFLAGS="$EXTRA_INTEL_FCFLAGS -xHost -ip -no-prec-div" # -fast
EXTRA_INTEL_FCFLAGS="$EXTRA_INTEL_FCFLAGS -xHost -ip -no-prec-div" # -fast
...
@@ -755,7 +761,7 @@ case "$cxx_compiler:$host_cpu" in
...
@@ -755,7 +761,7 @@ case "$cxx_compiler:$host_cpu" in
FATHOM_CXX_SPECIAL="$EXTRA_PGI_CXXFLAGS"
FATHOM_CXX_SPECIAL="$EXTRA_PGI_CXXFLAGS"
;;
;;
Clang:*)
Clang:*)
FATHOM_CXX_SPECIAL="$EXTRA_
GNU
_CXXFLAGS"
FATHOM_CXX_SPECIAL="$EXTRA_
CLANG
_CXXFLAGS"
FATHOM_CXX_32BIT=-m32
FATHOM_CXX_32BIT=-m32
FATHOM_CXX_64BIT=-m64
FATHOM_CXX_64BIT=-m64
;;
;;
...
@@ -934,8 +940,8 @@ case "$cc_compiler:$host_cpu" in
...
@@ -934,8 +940,8 @@ case "$cc_compiler:$host_cpu" in
FATHOM_F77_SPECIAL="$EXTRA_PGI_FCFLAGS"
FATHOM_F77_SPECIAL="$EXTRA_PGI_FCFLAGS"
;;
;;
Clang:*)
Clang:*)
FATHOM_CC_SPECIAL="$EXTRA_
GNU
_CXXFLAGS"
FATHOM_CC_SPECIAL="$EXTRA_
CLANG
_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_
GNU
_FCFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_
CLANG
_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
FATHOM_CC_32BIT=-m32
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
FATHOM_CC_64BIT=-m64
...
...
itaps/imesh/MOAB_iMeshP_unit_tests.cpp
View file @
32b6d77d
...
@@ -2354,7 +2354,7 @@ int test_entity_copies( iMesh_Instance imesh, iMeshP_PartitionHandle prtn, const
...
@@ -2354,7 +2354,7 @@ int test_entity_copies( iMesh_Instance imesh, iMeshP_PartitionHandle prtn, const
// add all vertices to local_data
// add all vertices to local_data
for
(
size_t
j
=
0
;
j
<
verts
.
size
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
verts
.
size
();
++
j
)
{
int
tag
;
int
tag
=
0
;
ierr
=
vertex_tag
(
imesh
,
verts
[
j
],
tag
);
ierr
=
vertex_tag
(
imesh
,
verts
[
j
],
tag
);
if
(
ierr
)
if
(
ierr
)
break
;
break
;
...
...
itaps/imesh/iMesh_MOAB.cpp
View file @
32b6d77d
...
@@ -2406,7 +2406,7 @@ extern "C" {
...
@@ -2406,7 +2406,7 @@ extern "C" {
EntityHandle
set1
=
ENTITY_HANDLE
(
entity_set_1
),
EntityHandle
set1
=
ENTITY_HANDLE
(
entity_set_1
),
set2
=
ENTITY_HANDLE
(
entity_set_2
);
set2
=
ENTITY_HANDLE
(
entity_set_2
);
int
isList1
,
isList2
;
int
isList1
=
0
,
isList2
=
0
;
iMesh_isList
(
instance
,
entity_set_1
,
&
isList1
,
err
);
iMesh_isList
(
instance
,
entity_set_1
,
&
isList1
,
err
);
if
(
*
err
!=
iBase_SUCCESS
)
return
;
if
(
*
err
!=
iBase_SUCCESS
)
return
;
iMesh_isList
(
instance
,
entity_set_2
,
&
isList2
,
err
);
iMesh_isList
(
instance
,
entity_set_2
,
&
isList2
,
err
);
...
@@ -2455,7 +2455,7 @@ extern "C" {
...
@@ -2455,7 +2455,7 @@ extern "C" {
EntityHandle
set1
=
ENTITY_HANDLE
(
entity_set_1
),
EntityHandle
set1
=
ENTITY_HANDLE
(
entity_set_1
),
set2
=
ENTITY_HANDLE
(
entity_set_2
);
set2
=
ENTITY_HANDLE
(
entity_set_2
);
int
isList1
,
isList2
;
int
isList1
=
0
,
isList2
=
0
;
iMesh_isList
(
instance
,
entity_set_1
,
&
isList1
,
err
);
iMesh_isList
(
instance
,
entity_set_1
,
&
isList1
,
err
);
if
(
*
err
!=
iBase_SUCCESS
)
return
;
if
(
*
err
!=
iBase_SUCCESS
)
return
;
iMesh_isList
(
instance
,
entity_set_2
,
&
isList2
,
err
);
iMesh_isList
(
instance
,
entity_set_2
,
&
isList2
,
err
);
...
@@ -2561,7 +2561,7 @@ extern "C" {
...
@@ -2561,7 +2561,7 @@ extern "C" {
EntityHandle
set1
=
ENTITY_HANDLE
(
entity_set_1
),
EntityHandle
set1
=
ENTITY_HANDLE
(
entity_set_1
),
set2
=
ENTITY_HANDLE
(
entity_set_2
);
set2
=
ENTITY_HANDLE
(
entity_set_2
);
int
isList1
,
isList2
;
int
isList1
=
0
,
isList2
=
0
;
iMesh_isList
(
instance
,
entity_set_1
,
&
isList1
,
err
);
iMesh_isList
(
instance
,
entity_set_1
,
&
isList1
,
err
);
if
(
*
err
!=
iBase_SUCCESS
)
return
;
if
(
*
err
!=
iBase_SUCCESS
)
return
;
iMesh_isList
(
instance
,
entity_set_2
,
&
isList2
,
err
);
iMesh_isList
(
instance
,
entity_set_2
,
&
isList2
,
err
);
...
...
itaps/irel/test_entset.cpp
View file @
32b6d77d
...
@@ -34,7 +34,7 @@ typedef void* iRel_EntityHandle;
...
@@ -34,7 +34,7 @@ typedef void* iRel_EntityHandle;
*/
*/
void
handle_error_code
(
const
int
result
,
void
handle_error_code
(
const
int
result
,
int
*
number_failed
,
int
*
number_failed
,
int
*
number_not_implemented
,
int
*
/*
number_not_implemented
*/
,
int
*
number_successful
)
int
*
number_successful
)
{
{
if
(
result
)
{
if
(
result
)
{
...
...
src/Core.cpp
View file @
32b6d77d
...
@@ -359,7 +359,7 @@ ErrorCode Core::query_interface_type( const std::type_info& type, void*& ptr )
...
@@ -359,7 +359,7 @@ ErrorCode Core::query_interface_type( const std::type_info& type, void*& ptr )
}
}
else
if
(
type
==
typeid
(
WriteUtilIface
))
{
else
if
(
type
==
typeid
(
WriteUtilIface
))
{
if
(
!
mMBWriteUtil
)
if
(
!
mMBWriteUtil
)
mMBWriteUtil
=
new
WriteUtil
(
this
,
mError
);
mMBWriteUtil
=
new
WriteUtil
(
this
);
ptr
=
static_cast
<
WriteUtilIface
*>
(
mMBWriteUtil
);
ptr
=
static_cast
<
WriteUtilIface
*>
(
mMBWriteUtil
);
}
}
else
if
(
type
==
typeid
(
ReaderWriterSet
))
{
else
if
(
type
==
typeid
(
ReaderWriterSet
))
{
...
...
src/DenseTag.cpp
View file @
32b6d77d
...
@@ -104,7 +104,10 @@ ErrorCode DenseTag::get_array(const SequenceManager* seqman,
...
@@ -104,7 +104,10 @@ ErrorCode DenseTag::get_array(const SequenceManager* seqman,
const
unsigned
char
*
const
&
ptr
,
const
unsigned
char
*
const
&
ptr
,
size_t
&
count
)
const
size_t
&
count
)
const
{
{
return
get_array
(
seqman
,
NULL
,
h
,
ptr
,
count
);
// cast away the const-ness; do we really want to do this?
// probably we are not calling this anywhere;
// clang compiler found this
return
get_array
(
seqman
,
NULL
,
h
,
const_cast
<
unsigned
char
*>
(
ptr
),
count
);
}
}
ErrorCode
DenseTag
::
get_array
(
const
SequenceManager
*
seqman
,
ErrorCode
DenseTag
::
get_array
(
const
SequenceManager
*
seqman
,
...
@@ -140,7 +143,9 @@ ErrorCode DenseTag::get_array(const SequenceManager* seqman,
...
@@ -140,7 +143,9 @@ ErrorCode DenseTag::get_array(const SequenceManager* seqman,
ErrorCode
DenseTag
::
get_array
(
const
EntitySequence
*
seq
,
ErrorCode
DenseTag
::
get_array
(
const
EntitySequence
*
seq
,
const
unsigned
char
*
const
&
ptr
)
const
const
unsigned
char
*
const
&
ptr
)
const
{
{
return
get_array
(
seq
,
ptr
);
// cast away the constness; otherwise it would be infinite recursion
// probably we are not calling this anywhere
return
get_array
(
seq
,
const_cast
<
unsigned
char
*>
(
ptr
));
}
}
ErrorCode
DenseTag
::
get_array
(
const
EntitySequence
*
seq
,
ErrorCode
DenseTag
::
get_array
(
const
EntitySequence
*
seq
,
...
...
src/LocalDiscretization/LinearTet.cpp
View file @
32b6d77d
...
@@ -104,7 +104,7 @@ namespace moab
...
@@ -104,7 +104,7 @@ namespace moab
// find best initial guess to improve convergence
// find best initial guess to improve convergence
CartVect
tmp_params
[]
=
{
CartVect
(
-
1
,
-
1
,
-
1
),
CartVect
(
1
,
-
1
,
-
1
),
CartVect
(
-
1
,
1
,
-
1
),
CartVect
(
-
1
,
-
1
,
1
)};
CartVect
tmp_params
[]
=
{
CartVect
(
-
1
,
-
1
,
-
1
),
CartVect
(
1
,
-
1
,
-
1
),
CartVect
(
-
1
,
1
,
-
1
),
CartVect
(
-
1
,
-
1
,
1
)};
double
resl
=
HUGE
;
double
resl
=
std
::
numeric_limits
<
double
>::
max
()
;
CartVect
new_pos
,
tmp_pos
;
CartVect
new_pos
,
tmp_pos
;
ErrorCode
rval
;
ErrorCode
rval
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
4
;
i
++
)
{
...
...
src/LocalDiscretization/LinearTri.cpp
View file @
32b6d77d
...
@@ -101,7 +101,7 @@ namespace moab
...
@@ -101,7 +101,7 @@ namespace moab
// find best initial guess to improve convergence
// find best initial guess to improve convergence
CartVect
tmp_params
[]
=
{
CartVect
(
-
1
,
-
1
,
-
1
),
CartVect
(
1
,
-
1
,
-
1
),
CartVect
(
-
1
,
1
,
-
1
)};
CartVect
tmp_params
[]
=
{
CartVect
(
-
1
,
-
1
,
-
1
),
CartVect
(
1
,
-
1
,
-
1
),
CartVect
(
-
1
,
1
,
-
1
)};
double
resl
=
HUGE
;
double
resl
=
std
::
numeric_limits
<
double
>::
max
()
;
CartVect
new_pos
,
tmp_pos
;
CartVect
new_pos
,
tmp_pos
;
ErrorCode
rval
;
ErrorCode
rval
;
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
{
...
...
src/MetisPartitioner.cpp
View file @
32b6d77d
...
@@ -36,17 +36,14 @@ using namespace moab;
...
@@ -36,17 +36,14 @@ using namespace moab;
const
bool
debug
=
false
;
const
bool
debug
=
false
;
MetisPartitioner
::
MetisPartitioner
(
Interface
*
impl
,
MetisPartitioner
::
MetisPartitioner
(
Interface
*
impl
,
const
bool
use_coords
,
const
bool
use_coords
)
int
argc
,
:
PartitionerBase
<
idx_t
>
(
impl
,
use_coords
)
char
**
argv
)
:
PartitionerBase
<
idx_t
>
(
impl
,
use_coords
),
argcArg
(
argc
),
argvArg
(
argv
)
{
{
}
}
MetisPartitioner
::~
MetisPartitioner
()
MetisPartitioner
::~
MetisPartitioner
()
{
{
}
}
...
@@ -63,7 +60,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
...
@@ -63,7 +60,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
#ifdef MOAB_HAVE_MPI
#ifdef MOAB_HAVE_MPI
// should only be called in serial
// should only be called in serial
if
(
mbpc
->
proc_config
().
proc_size
()
!=
1
)
{
if
(
mbpc
->
proc_config
().
proc_size
()
!=
1
)
{
std
::
cout
<<
"MetisPartitioner::partition_mesh_and_geometry must be called in serial."
std
::
cout
<<
"MetisPartitioner::partition_mesh_and_geometry must be called in serial."
<<
std
::
endl
;
<<
std
::
endl
;
return
MB_FAILURE
;
return
MB_FAILURE
;
}
}
...
@@ -76,7 +73,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
...
@@ -76,7 +73,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
<<
std
::
endl
;
<<
std
::
endl
;
return
MB_FAILURE
;
return
MB_FAILURE
;
}
}
std
::
vector
<
double
>
pts
;
// x[0], y[0], z[0], ... from MOAB
std
::
vector
<
double
>
pts
;
// x[0], y[0], z[0], ... from MOAB
std
::
vector
<
idx_t
>
ids
;
// poidx_t ids from MOAB
std
::
vector
<
idx_t
>
ids
;
// poidx_t ids from MOAB
std
::
vector
<
idx_t
>
adjs
,
parts
;
std
::
vector
<
idx_t
>
adjs
,
parts
;
...
@@ -85,17 +82,17 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
...
@@ -85,17 +82,17 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
// Get a mesh from MOAB and diide it across processors.
// Get a mesh from MOAB and diide it across processors.
clock_t
t
=
clock
();
clock_t
t
=
clock
();
ErrorCode
result
;
ErrorCode
result
;
if
(
!
partition_tagged_sets
&&
!
partition_tagged_ents
)
if
(
!
partition_tagged_sets
&&
!
partition_tagged_ents
)
{
{
result
=
assemble_graph
(
part_dim
,
pts
,
ids
,
adjs
,
length
,
elems
);
MB_CHK_ERR
(
result
);
result
=
assemble_graph
(
part_dim
,
pts
,
ids
,
adjs
,
length
,
elems
);
MB_CHK_ERR
(
result
);
}
}
else
if
(
partition_tagged_sets
)
else
if
(
partition_tagged_sets
)
{
{
result
=
assemble_taggedsets_graph
(
part_dim
,
pts
,
ids
,
adjs
,
length
,
elems
,
&
(
*
aggregating_tag
));
MB_CHK_ERR
(
result
);
result
=
assemble_taggedsets_graph
(
part_dim
,
pts
,
ids
,
adjs
,
length
,
elems
,
&
(
*
aggregating_tag
));
MB_CHK_ERR
(
result
);
}
}
else
if
(
partition_tagged_ents
)
else
if
(
partition_tagged_ents
)
{
{
result
=
assemble_taggedents_graph
(
part_dim
,
pts
,
ids
,
adjs
,
length
,
elems
,
&
(
*
aggregating_tag
));
MB_CHK_ERR
(
result
);
result
=
assemble_taggedents_graph
(
part_dim
,
pts
,
ids
,
adjs
,
length
,
elems
,
&
(
*
aggregating_tag
));
MB_CHK_ERR
(
result
);
}
}
...
@@ -109,7 +106,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
...
@@ -109,7 +106,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
t
=
clock
();
t
=
clock
();
}
}
std
::
cout
<<
"Computing partition using "
<<
method
std
::
cout
<<
"Computing partition using "
<<
method
<<
" method for "
<<
nparts
<<
" processors..."
<<
std
::
endl
;
<<
" method for "
<<
nparts
<<
" processors..."
<<
std
::
endl
;
idx_t
nelems
=
length
.
size
()
-
1
;
idx_t
nelems
=
length
.
size
()
-
1
;
...
@@ -124,14 +121,14 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
...
@@ -124,14 +121,14 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
{
{
idx_t
options
[
METIS_NOPTIONS
];
idx_t
options
[
METIS_NOPTIONS
];
METIS_SetDefaultOptions
(
options
);
METIS_SetDefaultOptions
(
options
);
options
[
METIS_OPTION_CONTIG
]
=
1
;
options
[
METIS_OPTION_CONTIG
]
=
1
;
metis_RESULT
=
METIS_PartGraphKway
(
&
nelems
,
&
nconstraidx_ts
,
&
length
[
0
],
&
adjs
[
0
],
NULL
,
NULL
,
NULL
,
&
nOfPartitions
,
NULL
,
NULL
,
options
,
&
edgeCut
,
assign_parts
);
metis_RESULT
=
METIS_PartGraphKway
(
&
nelems
,
&
nconstraidx_ts
,
&
length
[
0
],
&
adjs
[
0
],
NULL
,
NULL
,
NULL
,
&
nOfPartitions
,
NULL
,
NULL
,
options
,
&
edgeCut
,
assign_parts
);
}
}
else
if
(
strcmp
(
method
,
"ML_RB"
)
==
0
)
else
if
(
strcmp
(
method
,
"ML_RB"
)
==
0
)
{
{
idx_t
options
[
METIS_NOPTIONS
];
idx_t
options
[
METIS_NOPTIONS
];
METIS_SetDefaultOptions
(
options
);
METIS_SetDefaultOptions
(
options
);
options
[
METIS_OPTION_OBJTYPE
]
=
METIS_OBJTYPE_CUT
;
// CUT
options
[
METIS_OPTION_OBJTYPE
]
=
METIS_OBJTYPE_CUT
;
// CUT
options
[
METIS_OPTION_IPTYPE
]
=
METIS_IPTYPE_GROW
;
// GROW or RANDOM
options
[
METIS_OPTION_IPTYPE
]
=
METIS_IPTYPE_GROW
;
// GROW or RANDOM
options
[
METIS_OPTION_CTYPE
]
=
METIS_CTYPE_RM
;
// RM or SHEM
options
[
METIS_OPTION_CTYPE
]
=
METIS_CTYPE_RM
;
// RM or SHEM
options
[
METIS_OPTION_RTYPE
]
=
METIS_RTYPE_FM
;
// FM
options
[
METIS_OPTION_RTYPE
]
=
METIS_RTYPE_FM
;
// FM
...
@@ -157,7 +154,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
...
@@ -157,7 +154,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
if
(
metis_RESULT
!=
METIS_OK
)
if
(
metis_RESULT
!=
METIS_OK
)
return
MB_FAILURE
;
return
MB_FAILURE
;
// take results & write onto MOAB partition sets
// take results & write onto MOAB partition sets
std
::
cout
<<
"Saving partition information to MOAB..."
<<
std
::
endl
;
std
::
cout
<<
"Saving partition information to MOAB..."
<<
std
::
endl
;
{
{
...
@@ -184,21 +181,21 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
...
@@ -184,21 +181,21 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
ErrorCode
MetisPartitioner
::
assemble_taggedents_graph
(
const
int
dimension
,
ErrorCode
MetisPartitioner
::
assemble_taggedents_graph
(
const
int
dimension
,
std
::
vector
<
double
>
&
coords
,
std
::
vector
<
double
>
&
coords
,
std
::
vector
<
idx_t
>
&
moab_ids
,
std
::
vector
<
idx_t
>
&
moab_ids
,
std
::
vector
<
idx_t
>
&
adjacencies
,
std
::
vector
<
idx_t
>
&
adjacencies
,
std
::
vector
<
idx_t
>
&
length
,
std
::
vector
<
idx_t
>
&
length
,
Range
&
elems
,
Range
&
elems
,
const
char
*
aggregating_tag
)
const
char
*
aggregating_tag
)
{
{
Tag
partSetTag
;
Tag
partSetTag
;
ErrorCode
result
=
mbImpl
->
tag_get_handle
(
aggregating_tag
,
1
,
MB_TYPE_INTEGER
,
partSetTag
);
ErrorCode
result
=
mbImpl
->
tag_get_handle
(
aggregating_tag
,
1
,
MB_TYPE_INTEGER
,
partSetTag
);
if
(
MB_SUCCESS
!=
result
)
return
result
;
if
(
MB_SUCCESS
!=
result
)
return
result
;
Range
allSubElems
;
Range
allSubElems
;
result
=
mbImpl
->
get_entities_by_dimension
(
0
,
dimension
,
allSubElems
);
result
=
mbImpl
->
get_entities_by_dimension
(
0
,
dimension
,
allSubElems
);
if
(
MB_SUCCESS
!=
result
||
allSubElems
.
empty
())
return
result
;
if
(
MB_SUCCESS
!=
result
||
allSubElems
.
empty
())
return
result
;
idx_t
partSet
;
idx_t
partSet
;
std
::
map
<
idx_t
,
Range
>
aggloElems
;
std
::
map
<
idx_t
,
Range
>
aggloElems
;
for
(
Range
::
iterator
rit
=
allSubElems
.
begin
();
rit
!=
allSubElems
.
end
();
rit
++
)
for
(
Range
::
iterator
rit
=
allSubElems
.
begin
();
rit
!=
allSubElems
.
end
();
rit
++
)
{
{
EntityHandle
entity
=
*
rit
;
EntityHandle
entity
=
*
rit
;
result
=
mbImpl
->
tag_get_data
(
partSetTag
,
&
entity
,
1
,
&
partSet
);
result
=
mbImpl
->
tag_get_data
(
partSetTag
,
&
entity
,
1
,
&
partSet
);
...
@@ -212,26 +209,26 @@ ErrorCode MetisPartitioner::assemble_taggedents_graph(const int dimension,
...
@@ -212,26 +209,26 @@ ErrorCode MetisPartitioner::assemble_taggedents_graph(const int dimension,
if
(
type
==
MB_TAG_DENSE
)
if
(
type
==
MB_TAG_DENSE
)
{
{
// clear tag on ents and sets
// clear tag on ents and sets
result
=
mbImpl
->
tag_delete
(
partSetTag
);
result
=
mbImpl
->
tag_delete
(
partSetTag
);
if
(
MB_SUCCESS
!=
result
)
return
result
;
if
(
MB_SUCCESS
!=
result
)
return
result
;
}
}
if
(
type
==
MB_TAG_SPARSE
)
if
(
type
==
MB_TAG_SPARSE
)
{
{
// clear tag on ents
// clear tag on ents
result
=
mbImpl
->
tag_delete_data
(
partSetTag
,
allSubElems
);
result
=
mbImpl
->
tag_delete_data
(
partSetTag
,
allSubElems
);
if
(
MB_SUCCESS
!=
result
)
return
result
;
if
(
MB_SUCCESS
!=
result
)
return
result
;
// clear tag on sets
// clear tag on sets
result
=
mbImpl
->
get_entities_by_type_and_tag
(
0
,
MBENTITYSET
,
&
partSetTag
,
0
,
1
,
elems
);
result
=
mbImpl
->
get_entities_by_type_and_tag
(
0
,
MBENTITYSET
,
&
partSetTag
,
0
,
1
,
elems
);
if
(
MB_SUCCESS
!=
result
)
return
result
;
if
(
MB_SUCCESS
!=
result
)
return
result
;
result
=
mbImpl
->
tag_delete_data
(
partSetTag
,
elems
);
result
=
mbImpl
->
tag_delete_data
(
partSetTag
,
elems
);
if
(
MB_SUCCESS
!=
result
)
return
result
;
if
(
MB_SUCCESS
!=
result
)
return
result
;
elems
.
clear
();
elems
.
clear
();
}
}
result
=
mbImpl
->
tag_get_handle
(
"PARALLEL_PARTITION"
,
1
,
MB_TYPE_INTEGER
,
result
=
mbImpl
->
tag_get_handle
(
"PARALLEL_PARTITION"
,
1
,
MB_TYPE_INTEGER
,
partSetTag
,
MB_TAG_SPARSE
|
MB_TAG_CREAT
);
partSetTag
,
MB_TAG_SPARSE
|
MB_TAG_CREAT
);
if
(
MB_SUCCESS
!=
result
)
return
result
;
if
(
MB_SUCCESS
!=
result
)
return
result
;
for
(
std
::
map
<
idx_t
,
Range
>::
iterator
mit
=
aggloElems
.
begin
();
mit
!=
aggloElems
.
end
();
mit
++
)
for
(
std
::
map
<
idx_t
,
Range
>::
iterator
mit
=
aggloElems
.
begin
();
mit
!=
aggloElems
.
end
();
mit
++
)
{
{
EntityHandle
new_set
;
EntityHandle
new_set
;
result
=
mbImpl
->
create_meshset
(
MESHSET_SET
,
new_set
);
result
=
mbImpl
->
create_meshset
(
MESHSET_SET
,
new_set
);
...
@@ -249,16 +246,16 @@ ErrorCode MetisPartitioner::assemble_taggedents_graph(const int dimension,
...
@@ -249,16 +246,16 @@ ErrorCode MetisPartitioner::assemble_taggedents_graph(const int dimension,
ErrorCode
MetisPartitioner
::
assemble_taggedsets_graph
(
const
int
dimension
,
ErrorCode
MetisPartitioner
::
assemble_taggedsets_graph
(
const
int
dimension
,
std
::
vector
<
double
>
&
coords
,
std
::
vector
<
double
>
&
coords
,
std
::
vector
<
idx_t
>
&
moab_ids
,
std
::
vector
<
idx_t
>
&
moab_ids
,
std
::
vector
<
idx_t
>
&
adjacencies
,
std
::
vector
<
idx_t
>
&
adjacencies
,
std
::
vector
<
idx_t
>
&
length
,
std
::
vector
<
idx_t
>
&
length
,
Range
&
elems
,
Range
&
elems
,
const
char
*
aggregating_tag
)
const
char
*
aggregating_tag
)
{
{
length
.
push_back
(
0
);
length
.
push_back
(
0
);
// assemble a graph with vertices equal to elements of specified dimension, edges
// assemble a graph with vertices equal to elements of specified dimension, edges
// signified by list of other elements to which an element is connected
// signified by list of other elements to which an element is connected
// get the tagged elements
// get the tagged elements
Tag
partSetTag
;
Tag
partSetTag
;
ErrorCode
result
=
mbImpl
->
tag_get_handle
(
aggregating_tag
,
1
,
MB_TYPE_INTEGER
,
partSetTag
);
MB_CHK_ERR
(
result
);
ErrorCode
result
=
mbImpl
->
tag_get_handle
(
aggregating_tag
,
1
,
MB_TYPE_INTEGER
,
partSetTag
);
MB_CHK_ERR
(
result
);
//ErrorCode result = mbImpl->tag_get_handle("PARALLEL_PARTITION_SET", 1, MB_TYPE_INTEGER, partSetTag);MB_CHK_ERR(result);
//ErrorCode result = mbImpl->tag_get_handle("PARALLEL_PARTITION_SET", 1, MB_TYPE_INTEGER, partSetTag);MB_CHK_ERR(result);
...
@@ -266,11 +263,11 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
...
@@ -266,11 +263,11 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
result
=
mbImpl
->
get_entities_by_type_and_tag
(
0
,
MBENTITYSET
,
&
partSetTag
,
0
,
1
,
elems
);
result
=
mbImpl
->
get_entities_by_type_and_tag
(
0
,
MBENTITYSET
,
&
partSetTag
,
0
,
1
,
elems
);
if
(
MB_SUCCESS
!=
result
||
elems
.
empty
())
return
result
;
if
(
MB_SUCCESS
!=
result
||
elems
.
empty
())
return
result
;
//assign globla ids to elem sets based on aggregating_tag data
//assign globla ids to elem sets based on aggregating_tag data
Tag
gid_tag
;
Tag
gid_tag
;
idx_t
zero1
=
-
1
;
idx_t
zero1
=
-
1
;
result
=
mbImpl
->
tag_get_handle
(
"GLOBAL_ID_AGGLO"
,
1
,
MB_TYPE_INTEGER
,
gid_tag
,
MB_TAG_SPARSE
|
MB_TAG_CREAT
,
&
zero1
);
MB_CHK_ERR
(
result
);
result
=
mbImpl
->
tag_get_handle
(
"GLOBAL_ID_AGGLO"
,
1
,
MB_TYPE_INTEGER
,
gid_tag
,
MB_TAG_SPARSE
|
MB_TAG_CREAT
,
&
zero1
);
MB_CHK_ERR
(
result
);
for
(
Range
::
iterator
rit
=
elems
.
begin
();
rit
!=
elems
.
end
();
rit
++
)
for
(
Range
::
iterator
rit
=
elems
.
begin
();
rit
!=
elems
.
end
();
rit
++
)
{
{
idx_t
partSet
;
idx_t
partSet
;
result
=
mbImpl
->
tag_get_data
(
partSetTag
,
&
(
*
rit
),
1
,
&
partSet
);
MB_CHK_ERR
(
result
);
result
=
mbImpl
->
tag_get_data
(
partSetTag
,
&
(
*
rit
),
1
,
&
partSet
);
MB_CHK_ERR
(
result
);
...
@@ -287,15 +284,15 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
...
@@ -287,15 +284,15 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
{
{
result
=
mbImpl
->
tag_delete_data
(
partSetTag
,
elems
);
MB_CHK_ERR
(
result
);
result
=
mbImpl
->
tag_delete_data
(
partSetTag
,
elems
);
MB_CHK_ERR
(
result
);
}
}
// assemble the graph, using Skinner to get d-1 dimensional neighbors and then idx_tersecting to get adjacencies
// assemble the graph, using Skinner to get d-1 dimensional neighbors and then idx_tersecting to get adjacencies
std
::
vector
<
Range
>
skin_subFaces
(
elems
.
size
());
std
::
vector
<
Range
>
skin_subFaces
(
elems
.
size
());
unsigned
int
i
=
0
;
unsigned
int
i
=
0
;
for
(
Range
::
iterator
rit
=
elems
.
begin
();
rit
!=
elems
.
end
();
rit
++
)
for
(
Range
::
iterator
rit
=
elems
.
begin
();
rit
!=
elems
.
end
();
rit
++
)
{
{
Range
part_ents
;
Range
part_ents
;
result
=
mbImpl
->
get_entities_by_handle
(
*
rit
,
part_ents
,
false
);
result
=
mbImpl
->
get_entities_by_handle
(
*
rit
,
part_ents
,
false
);
if
(
mbImpl
->
dimension_from_handle
(
*
part_ents
.
rbegin
())
!=
mbImpl
->
dimension_from_handle
(
*
part_ents
.
begin
()))
if
(
mbImpl
->
dimension_from_handle
(
*
part_ents
.
rbegin
())
!=
mbImpl
->
dimension_from_handle
(
*
part_ents
.
begin
()))
{
{
Range
::
iterator
lower
=
part_ents
.
lower_bound
(
CN
::
TypeDimensionMap
[
0
].
first
),
Range
::
iterator
lower
=
part_ents
.
lower_bound
(
CN
::
TypeDimensionMap
[
0
].
first
),
upper
=
part_ents
.
upper_bound
(
CN
::
TypeDimensionMap
[
dimension
-
1
].
second
);
upper
=
part_ents
.
upper_bound
(
CN
::
TypeDimensionMap
[
dimension
-
1
].
second
);
...
@@ -320,20 +317,20 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
...
@@ -320,20 +317,20 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
{
{
Range
subFaces
=
intersect
(
skin_subFaces
[
k
],
skin_subFaces
[
t
]);
Range
subFaces
=
intersect
(
skin_subFaces
[
k
],
skin_subFaces
[
t
]);
if
(
subFaces
.
size
()
>
0
)
if
(
subFaces
.
size
()
>
0
)
adjs
.
push_back
(
elems
[
t
]);
adjs
.
push_back
(
elems
[
t
]);
}
}
}
}
if
(
!
adjs
.
empty
())
if
(
!
adjs
.
empty
())
{
{
neighbors
.
resize
(
adjs
.
size
());
neighbors
.
resize
(
adjs
.
size
());
result
=
mbImpl
->
tag_get_data
(
gid_tag
,
&
adjs
[
0
],
adjs
.
size
(),
&
neighbors
[
0
]);
MB_CHK_ERR
(
result
);
result
=
mbImpl
->
tag_get_data
(
gid_tag
,
&
adjs
[
0
],
adjs
.
size
(),
&
neighbors
[
0
]);
MB_CHK_ERR
(
result
);
}
}
// copy those idx_to adjacencies vector
// copy those idx_to adjacencies vector
length
.
push_back
(
length
.
back
()
+
(
idx_t
)
adjs
.
size
());
length
.
push_back
(
length
.
back
()
+
(
idx_t
)
adjs
.
size
());
std
::
copy
(
neighbors
.
begin
(),
neighbors
.
end
(),
std
::
back_inserter
(
adjacencies
));
std
::
copy
(
neighbors
.
begin
(),
neighbors
.
end
(),
std
::
back_inserter
(
adjacencies
));
// get the graph vertex id for this element
// get the graph vertex id for this element
const
EntityHandle
&
setk
=
elems
[
k
];
const
EntityHandle
&
setk
=
elems
[
k
];
result
=
mbImpl
->
tag_get_data
(
gid_tag
,
&
setk
,
1
,
&
moab_id
);
result
=
mbImpl
->
tag_get_data
(
gid_tag
,
&
setk
,
1
,
&
moab_id
);
moab_ids
.
push_back
(
moab_id
);
moab_ids
.
push_back
(
moab_id
);
// get average position of vertices
// get average position of vertices
Range
part_ents
;
Range
part_ents
;
...
@@ -371,9 +368,9 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
...
@@ -371,9 +368,9 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
ErrorCode
MetisPartitioner
::
assemble_graph
(
const
int
dimension
,
ErrorCode
MetisPartitioner
::
assemble_graph
(
const
int
dimension
,
std
::
vector
<
double
>
&
coords
,
std
::
vector
<
double
>
&
coords
,
std
::
vector
<
idx_t
>
&
moab_ids
,
std
::
vector
<
idx_t
>
&
moab_ids
,
std
::
vector
<
idx_t
>
&
adjacencies
,
std
::
vector
<
idx_t
>
&
adjacencies
,
std
::
vector
<
idx_t
>
&
length
,
std
::
vector
<
idx_t
>
&
length
,
Range
&
elems
)
Range
&
elems
)
{
{
length
.
push_back
(
0
);
length
.
push_back
(
0
);
// assemble a graph with vertices equal to elements of specified dimension, edges
// assemble a graph with vertices equal to elements of specified dimension, edges
...
@@ -382,10 +379,10 @@ ErrorCode MetisPartitioner::assemble_graph(const int dimension,
...
@@ -382,10 +379,10 @@ ErrorCode MetisPartitioner::assemble_graph(const int dimension,
// get the elements of that dimension
// get the elements of that dimension
ErrorCode
result
=
mbImpl
->
get_entities_by_dimension
(
0
,
dimension
,
elems
);
ErrorCode
result
=
mbImpl
->
get_entities_by_dimension
(
0
,
dimension
,
elems
);
if
(
MB_SUCCESS
!=
result
||
elems
.
empty
())
return
result
;
if
(
MB_SUCCESS
!=
result
||
elems
.
empty
())
return
result
;
#ifdef MOAB_HAVE_MPI
#ifdef MOAB_HAVE_MPI
// assign global ids
// assign global ids
result
=
mbpc
->
assign_global_ids
(
0
,
dimension
,
0
);
result
=
mbpc
->
assign_global_ids
(
0
,
dimension
,
0
);
#endif
#endif
// now assemble the graph, calling MeshTopoUtil to get bridge adjacencies through d-1 dimensional
// now assemble the graph, calling MeshTopoUtil to get bridge adjacencies through d-1 dimensional
...
@@ -398,19 +395,19 @@ ErrorCode MetisPartitioner::assemble_graph(const int dimension,
...
@@ -398,19 +395,19 @@ ErrorCode MetisPartitioner::assemble_graph(const int dimension,
double
avg_position
[
3
];
double
avg_position
[
3
];
int
moab_id
;
int
moab_id
;
// get the global id tag hanlde
// get the global id tag hanlde