Commit 32b6d77d authored by vijaysm's avatar vijaysm

Merged in iulian07/clang_osx_warnings (pull request #262)

Several warning fixes for OSX/Clang
parents 7a0f27b4 81e4f023
......@@ -192,6 +192,9 @@ if (test "x$enable_debug" != "xno"); then # debug flags
# 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_FCFLAGS="-pipe -pedantic -ffree-line-length-0"
# CLANG
EXTRA_CLANG_CXXFLAGS="$EXTRA_GNU_CXXFLAGS"
EXTRA_CLANG_FCFLAGS="$EXTRA_GNU_FCFLAGS"
# Intel
EXTRA_INTEL_CXXFLAGS="-pipe -C"
EXTRA_INTEL_FCFLAGS="-C"
......@@ -205,8 +208,11 @@ fi
if (test "x$enable_cxx_optimize" != "xno"); then # optimization flags
#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"
#CLANG
EXTRA_CLANG_CXXFLAGS="$EXTRA_CLANG_CXXFLAGS -march=native"
EXTRA_CLANG_FCFLAGS="$EXTRA_CLANG_FCFLAGS -ffree-line-length-0 -finline-functions"
# Intel
EXTRA_INTEL_CXXFLAGS="$EXTRA_INTEL_CXXFLAGS -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
FATHOM_CXX_SPECIAL="$EXTRA_PGI_CXXFLAGS"
;;
Clang:*)
FATHOM_CXX_SPECIAL="$EXTRA_GNU_CXXFLAGS"
FATHOM_CXX_SPECIAL="$EXTRA_CLANG_CXXFLAGS"
FATHOM_CXX_32BIT=-m32
FATHOM_CXX_64BIT=-m64
;;
......@@ -934,8 +940,8 @@ case "$cc_compiler:$host_cpu" in
FATHOM_F77_SPECIAL="$EXTRA_PGI_FCFLAGS"
;;
Clang:*)
FATHOM_CC_SPECIAL="$EXTRA_GNU_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_GNU_FCFLAGS"
FATHOM_CC_SPECIAL="$EXTRA_CLANG_CXXFLAGS"
FATHOM_FC_SPECIAL="$EXTRA_CLANG_FCFLAGS"
FATHOM_F77_SPECIAL="$FATHOM_FC_SPECIAL"
FATHOM_CC_32BIT=-m32
FATHOM_CC_64BIT=-m64
......
......@@ -2354,7 +2354,7 @@ int test_entity_copies( iMesh_Instance imesh, iMeshP_PartitionHandle prtn, const
// add all vertices to local_data
for (size_t j = 0; j < verts.size(); ++j) {
int tag;
int tag=0;
ierr = vertex_tag( imesh, verts[j], tag );
if (ierr)
break;
......
......@@ -2406,7 +2406,7 @@ extern "C" {
EntityHandle set1 = ENTITY_HANDLE(entity_set_1),
set2 = ENTITY_HANDLE(entity_set_2);
int isList1, isList2;
int isList1=0, isList2=0;
iMesh_isList(instance, entity_set_1, &isList1, err);
if (*err != iBase_SUCCESS) return;
iMesh_isList(instance, entity_set_2, &isList2, err);
......@@ -2455,7 +2455,7 @@ extern "C" {
EntityHandle set1 = ENTITY_HANDLE(entity_set_1),
set2 = ENTITY_HANDLE(entity_set_2);
int isList1, isList2;
int isList1=0, isList2=0;
iMesh_isList(instance, entity_set_1, &isList1, err);
if (*err != iBase_SUCCESS) return;
iMesh_isList(instance, entity_set_2, &isList2, err);
......@@ -2561,7 +2561,7 @@ extern "C" {
EntityHandle set1 = ENTITY_HANDLE(entity_set_1),
set2 = ENTITY_HANDLE(entity_set_2);
int isList1, isList2;
int isList1=0, isList2=0;
iMesh_isList(instance, entity_set_1, &isList1, err);
if (*err != iBase_SUCCESS) return;
iMesh_isList(instance, entity_set_2, &isList2, err);
......
......@@ -34,7 +34,7 @@ typedef void* iRel_EntityHandle;
*/
void handle_error_code(const int result,
int *number_failed,
int *number_not_implemented,
int * /*number_not_implemented*/,
int *number_successful)
{
if (result) {
......
......@@ -359,7 +359,7 @@ ErrorCode Core::query_interface_type( const std::type_info& type, void*& ptr )
}
else if (type == typeid(WriteUtilIface)) {
if(!mMBWriteUtil)
mMBWriteUtil = new WriteUtil(this, mError);
mMBWriteUtil = new WriteUtil(this);
ptr = static_cast<WriteUtilIface*>(mMBWriteUtil);
}
else if (type == typeid(ReaderWriterSet)) {
......
......@@ -104,7 +104,10 @@ ErrorCode DenseTag::get_array(const SequenceManager* seqman,
const unsigned char* const& ptr,
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,
......@@ -140,7 +143,9 @@ ErrorCode DenseTag::get_array(const SequenceManager* seqman,
ErrorCode DenseTag::get_array(const EntitySequence* seq,
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,
......
......@@ -104,7 +104,7 @@ namespace moab
// 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)};
double resl = HUGE;
double resl = std::numeric_limits<double>::max();
CartVect new_pos, tmp_pos;
ErrorCode rval;
for (unsigned int i = 0; i < 4; i++) {
......
......@@ -101,7 +101,7 @@ namespace moab
// find best initial guess to improve convergence
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;
ErrorCode rval;
for (unsigned int i = 0; i < 3; i++) {
......
......@@ -36,17 +36,14 @@ using namespace moab;
const bool debug = false;
MetisPartitioner::MetisPartitioner( Interface *impl,
const bool use_coords,
int argc,
char **argv)
: PartitionerBase<idx_t>(impl,use_coords),
argcArg(argc),
argvArg(argv)
MetisPartitioner::MetisPartitioner( Interface *impl,
const bool use_coords)
: PartitionerBase<idx_t>(impl,use_coords)
{
}
MetisPartitioner::~MetisPartitioner()
MetisPartitioner::~MetisPartitioner()
{
}
......@@ -63,7 +60,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
#ifdef MOAB_HAVE_MPI
// should only be called in serial
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;
return MB_FAILURE;
}
......@@ -76,7 +73,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
<< std::endl;
return MB_FAILURE;
}
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> adjs, parts;
......@@ -85,17 +82,17 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
// Get a mesh from MOAB and diide it across processors.
clock_t t = clock();
ErrorCode result;
if (!partition_tagged_sets && !partition_tagged_ents)
{
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);
}
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);
}
......@@ -109,7 +106,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
t = clock();
}
std::cout << "Computing partition using " << method
std::cout << "Computing partition using " << method
<<" method for " << nparts << " processors..." << std::endl;
idx_t nelems = length.size()-1;
......@@ -124,14 +121,14 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
{
idx_t options[METIS_NOPTIONS];
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);
}
else if (strcmp(method, "ML_RB") == 0)
{
idx_t options[METIS_NOPTIONS];
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_CTYPE] = METIS_CTYPE_RM; // RM or SHEM
options[METIS_OPTION_RTYPE] = METIS_RTYPE_FM; // FM
......@@ -157,7 +154,7 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
if (metis_RESULT != METIS_OK)
return MB_FAILURE;
// take results & write onto MOAB partition sets
std::cout << "Saving partition information to MOAB..." << std::endl;
{
......@@ -184,21 +181,21 @@ ErrorCode MetisPartitioner::partition_mesh(const idx_t nparts,
ErrorCode MetisPartitioner::assemble_taggedents_graph(const int dimension,
std::vector<double> &coords,
std::vector<idx_t> &moab_ids,
std::vector<idx_t> &adjacencies,
std::vector<idx_t> &adjacencies,
std::vector<idx_t> &length,
Range &elems,
const char *aggregating_tag)
const char *aggregating_tag)
{
Tag partSetTag;
ErrorCode result = mbImpl->tag_get_handle(aggregating_tag, 1, MB_TYPE_INTEGER, partSetTag);
if (MB_SUCCESS != result) return result;
Range allSubElems;
result = mbImpl->get_entities_by_dimension(0, dimension, allSubElems);
if (MB_SUCCESS != result || allSubElems.empty()) return result;
idx_t partSet;
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;
result = mbImpl->tag_get_data(partSetTag,&entity,1,&partSet);
......@@ -212,26 +209,26 @@ ErrorCode MetisPartitioner::assemble_taggedents_graph(const int dimension,
if (type == MB_TAG_DENSE)
{
// clear tag on ents and sets
result = mbImpl->tag_delete(partSetTag);
result = mbImpl->tag_delete(partSetTag);
if (MB_SUCCESS != result) return result;
}
if (type == MB_TAG_SPARSE)
{
// clear tag on ents
result = mbImpl->tag_delete_data(partSetTag, allSubElems);
result = mbImpl->tag_delete_data(partSetTag, allSubElems);
if (MB_SUCCESS != result) return result;
// clear tag on sets
result = mbImpl->get_entities_by_type_and_tag(0 , MBENTITYSET, &partSetTag, 0, 1, elems);
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;
elems.clear();
}
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;
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;
result = mbImpl->create_meshset(MESHSET_SET, new_set);
......@@ -249,16 +246,16 @@ ErrorCode MetisPartitioner::assemble_taggedents_graph(const int dimension,
ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
std::vector<double> &coords,
std::vector<idx_t> &moab_ids,
std::vector<idx_t> &adjacencies,
std::vector<idx_t> &adjacencies,
std::vector<idx_t> &length,
Range &elems,
const char *aggregating_tag)
const char *aggregating_tag)
{
length.push_back(0);
// assemble a graph with vertices equal to elements of specified dimension, edges
// signified by list of other elements to which an element is connected
// get the tagged elements
// get the tagged elements
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("PARALLEL_PARTITION_SET", 1, MB_TYPE_INTEGER, partSetTag);MB_CHK_ERR(result);
......@@ -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);
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;
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);
for (Range::iterator rit = elems.begin(); rit != elems.end(); rit++)
for (Range::iterator rit = elems.begin(); rit != elems.end(); rit++)
{
idx_t partSet;
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,
{
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
std::vector<Range> skin_subFaces(elems.size());
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;
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),
upper = part_ents.upper_bound(CN::TypeDimensionMap[dimension-1].second);
......@@ -320,20 +317,20 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
{
Range subFaces = intersect(skin_subFaces[k],skin_subFaces[t]);
if (subFaces.size() > 0)
adjs.push_back(elems[t]);
adjs.push_back(elems[t]);
}
}
if (!adjs.empty())
if (!adjs.empty())
{
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
length.push_back(length.back()+(idx_t)adjs.size());
std::copy(neighbors.begin(), neighbors.end(), std::back_inserter(adjacencies));
// get the graph vertex id for this element
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);
// get average position of vertices
Range part_ents;
......@@ -371,9 +368,9 @@ ErrorCode MetisPartitioner::assemble_taggedsets_graph(const int dimension,
ErrorCode MetisPartitioner::assemble_graph(const int dimension,
std::vector<double> &coords,
std::vector<idx_t> &moab_ids,
std::vector<idx_t> &adjacencies,
std::vector<idx_t> &adjacencies,
std::vector<idx_t> &length,
Range &elems)
Range &elems)
{
length.push_back(0);
// assemble a graph with vertices equal to elements of specified dimension, edges
......@@ -382,10 +379,10 @@ ErrorCode MetisPartitioner::assemble_graph(const int dimension,
// get the elements of that dimension
ErrorCode result = mbImpl->get_entities_by_dimension(0, dimension, elems);
if (MB_SUCCESS != result || elems.empty()) return result;
#ifdef MOAB_HAVE_MPI
// assign global ids
result = mbpc->assign_global_ids(0, dimension, 0);
result = mbpc->assign_global_ids(0, dimension, 0);
#endif
// 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,
double avg_position[3];
int moab_id;
// get the global id tag hanlde
Tag gid;
result = mbImpl->tag_get_handle(GLOBAL_ID_TAG_NAME, 1, MB_TYPE_INTEGER,
gid, MB_TAG_DENSE|MB_TAG_CREAT);MB_CHK_ERR(result);
for (Range::iterator rit = elems.begin(); rit != elems.end(); rit++) {
// get bridge adjacencies
adjs.clear();
result = mtu.get_bridge_adjacencies(*rit, (dimension > 0 ? dimension-1 : 3),
result = mtu.get_bridge_adjacencies(*rit, (dimension > 0 ? dimension-1 : 3),
dimension, adjs);MB_CHK_ERR(result);
// get the graph vertex ids of those
if (!adjs.empty()) {
assert(adjs.size() < 5*MAX_SUB_ENTITIES);
......@@ -424,7 +421,7 @@ ErrorCode MetisPartitioner::assemble_graph(const int dimension,
// get average position of vertices
result = mtu.get_average_position(*rit, avg_position);MB_CHK_ERR(result);
// get the graph vertex id for this element
result = mbImpl->tag_get_data(gid, &(*rit), 1, &moab_id);MB_CHK_ERR(result);
......@@ -452,7 +449,7 @@ ErrorCode MetisPartitioner::assemble_graph(const int dimension,
}
ErrorCode MetisPartitioner::write_aggregationtag_partition(const idx_t nparts,
Range &elems,
Range &elems,
const idx_t *assignment,
const bool write_as_sets,
const bool write_as_tags)
......@@ -469,16 +466,16 @@ ErrorCode MetisPartitioner::write_aggregationtag_partition(const idx_t nparts,
result = mbImpl->get_entities_by_type_and_tag(0, MBENTITYSET, &part_set_tag, NULL, 1,
tagged_sets, Interface::UNION);MB_CHK_ERR(result);
if (!tagged_sets.empty()) {
result = mbImpl->clear_meshset(tagged_sets);
result = mbImpl->clear_meshset(tagged_sets);
if (!write_as_sets) {
result = mbImpl->tag_delete_data(part_set_tag, tagged_sets);MB_CHK_ERR(result);
}
}
if (write_as_sets) {
// first, create partition sets and store in vector
partSets.clear();
if (nparts > (idx_t) tagged_sets.size()) {
// too few partition sets - create missing ones
idx_t num_new = nparts - tagged_sets.size();
......@@ -496,15 +493,15 @@ ErrorCode MetisPartitioner::write_aggregationtag_partition(const idx_t nparts,
result = mbImpl->delete_entities(&old_set, 1);MB_CHK_ERR(result);
}
}
// assign partition sets to vector
partSets.swap(tagged_sets);
// write a tag to those sets denoting they're partition sets, with a value of the
// proc number
idx_t *dum_ids = new idx_t[nparts];
for (idx_t i = 0; i < nparts; i++) dum_ids[i] = i;
result = mbImpl->tag_set_data(part_set_tag, partSets, dum_ids);MB_CHK_ERR(result);
// assign entities to the relevant sets
......@@ -534,18 +531,18 @@ ErrorCode MetisPartitioner::write_aggregationtag_partition(const idx_t nparts,
if (write_as_tags) {
Tag gid_tag;
result = mbImpl->tag_get_handle("GLOBAL_ID_AGGLO", 1, MB_TYPE_INTEGER, gid_tag, MB_TAG_SPARSE);MB_CHK_ERR(result);
// allocate idx_teger-size partitions
unsigned int i = 0;
idx_t gid;
for (Range::iterator rit = elems.begin(); rit != elems.end(); rit++)
for (Range::iterator rit = elems.begin(); rit != elems.end(); rit++)
{
result = mbImpl->tag_get_data(gid_tag, &(*rit), 1, &gid);
Range part_ents;
// std::cout<<"part ents "<<part_ents.size()<<std::endl;
result = mbImpl->get_entities_by_handle(*rit, part_ents, false);MB_CHK_ERR(result);
for (Range::iterator eit = part_ents.begin(); eit != part_ents.end(); eit++)
for (Range::iterator eit = part_ents.begin(); eit != part_ents.end(); eit++)
{
result = mbImpl->tag_set_data(part_set_tag, &(*eit), 1, &assignment[i]);MB_CHK_ERR(result);
......@@ -558,10 +555,10 @@ ErrorCode MetisPartitioner::write_aggregationtag_partition(const idx_t nparts,
}
ErrorCode MetisPartitioner::write_partition(const idx_t nparts,
Range &elems,
Range &elems,
const idx_t *assignment,
const bool write_as_sets,
const bool write_as_tags)
const bool write_as_tags)
{
ErrorCode result;
......@@ -570,13 +567,13 @@ ErrorCode MetisPartitioner::write_partition(const idx_t nparts,
idx_t dum_id = -1, i;
result = mbImpl->tag_get_handle("PARALLEL_PARTITION", 1, MB_TYPE_INTEGER,
part_set_tag, MB_TAG_SPARSE|MB_TAG_CREAT, &dum_id);MB_CHK_ERR(result);
// get any sets already with this tag, and clear them
Range tagged_sets;
result = mbImpl->get_entities_by_type_and_tag(0, MBENTITYSET, &part_set_tag, NULL, 1,
tagged_sets, Interface::UNION);MB_CHK_ERR(result);
if (!tagged_sets.empty()) {
result = mbImpl->clear_meshset(tagged_sets);
result = mbImpl->clear_meshset(tagged_sets);
if (!write_as_sets) {
result = mbImpl->tag_delete_data(part_set_tag, tagged_sets);MB_CHK_ERR(result);
}
......@@ -585,7 +582,7 @@ ErrorCode MetisPartitioner::write_partition(const idx_t nparts,
if (write_as_sets) {
// first, create partition sets and store in vector
partSets.clear();
if (nparts > (int) tagged_sets.size()) {
// too few partition sets - create missing ones
idx_t num_new = nparts - tagged_sets.size();
......@@ -603,17 +600,17 @@ ErrorCode MetisPartitioner::write_partition(const idx_t nparts,
result = mbImpl->delete_entities(&old_set, 1);MB_CHK_ERR(result);
}
}
// assign partition sets to vector
partSets.swap(tagged_sets);
// write a tag to those sets denoting they're partition sets, with a value of the
// proc number
int *dum_ids = new int[nparts]; // this remains integer
for (i = 0; i < nparts; i++) dum_ids[i] = i;
result = mbImpl->tag_set_data(part_set_tag, partSets, dum_ids);
delete dum_ids;
result = mbImpl->tag_set_data(part_set_tag, partSets, dum_ids);
delete [] dum_ids;
// assign entities to the relevant sets
std::vector<EntityHandle> tmp_part_sets;
......@@ -637,7 +634,7 @@ ErrorCode MetisPartitioner::write_partition(const idx_t nparts,
std::cout << std::endl;
}
}
if (write_as_tags) {
if (sizeof(int) != sizeof(idx_t))
{
......@@ -652,7 +649,7 @@ ErrorCode MetisPartitioner::write_partition(const idx_t nparts,
else
result = mbImpl->tag_set_data(part_set_tag, elems, assignment);MB_CHK_ERR(result);
}
return MB_SUCCESS;
}
......@@ -717,7 +717,7 @@ ErrorCode ScdInterface::tag_shared_vertices(ParallelComm *pcomm, ScdBox *box)
send_reqs(procs.size(), MPI_REQUEST_NULL);
std::vector<EntityHandle> rhandles(4*procs.size()), shandles(4);
for (unsigned int i = 0; i < procs.size(); i++) {
int success = MPI_Irecv(&rhandles[4*i], 4*sizeof(EntityHandle),
int success = MPI_Irecv((void*)&rhandles[4*i], 4*sizeof(EntityHandle),
MPI_UNSIGNED_CHAR, procs[i],
1, pcomm->proc_config().proc_comm(),
&recv_reqs[i]);
......@@ -740,7 +740,7 @@ ErrorCode ScdInterface::tag_shared_vertices(ParallelComm *pcomm, ScdBox *box)
shandles[3] = box->start_element();
}
for (unsigned int i = 0; i < procs.size(); i++) {
int success = MPI_Isend(&shandles[0], 4*sizeof(EntityHandle), MPI_UNSIGNED_CHAR, procs[i],
int success = MPI_Isend((void*)&shandles[0], 4*sizeof(EntityHandle), MPI_UNSIGNED_CHAR, procs[i],
1, pcomm->proc_config().proc_comm(), &send_reqs[i]);
if (success != MPI_SUCCESS) return MB_FAILURE;
}
......
......@@ -42,8 +42,8 @@
namespace moab {
WriteUtil::WriteUtil(Core* mdb, Error* error_handler)
: WriteUtilIface(), mMB(mdb), mError(error_handler)
WriteUtil::WriteUtil(Core* mdb)
: WriteUtilIface(), mMB(mdb)
{
}
......
......@@ -25,18 +25,16 @@
namespace moab {
class Core;