Commit 19c46ab8 authored by vijaysm's avatar vijaysm
Browse files

Merge branch 'Version4.8.2.1' into Version4.8.2

parents 0ffb0f58 454d81e0
......@@ -19,6 +19,7 @@
#include <iostream>
#include <assert.h>
#include <sstream>
#include <map>
#include "moab/MetisPartitioner.hpp"
#include "moab/Interface.hpp"
......@@ -59,16 +60,18 @@ ErrorCode MetisPartitioner::partition_mesh(const int nparts,
const char *aggregating_tag,
const bool print_time)
{
#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::endl;
return MB_FAILURE;
}
#endif
if (NULL != method && strcmp(method, "ML_RB") && strcmp(method, "ML_KWAY"))
{
std::cout << "ERROR node " << mbpc->proc_config().proc_rank() << ": Method must be "
std::cout << "ERROR: Method must be "
<< "ML_RB or ML_KWAY"
<< std::endl;
return MB_FAILURE;
......@@ -146,8 +149,10 @@ ErrorCode MetisPartitioner::partition_mesh(const int nparts,
t = clock();
}
#ifdef MOAB_HAVE_MPI
// assign global node ids, starting from one! TODO
result = mbpc->assign_global_ids(0, 0, 1);MB_CHK_ERR(result);
#endif
if (metis_RESULT != METIS_OK)
return MB_FAILURE;
......@@ -376,8 +381,10 @@ ErrorCode MetisPartitioner::assemble_graph(const int 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);
#endif
// now assemble the graph, calling MeshTopoUtil to get bridge adjacencies through d-1 dimensional
// neighbors
......
......@@ -17,16 +17,19 @@
#define __partitioner_base_hpp__
#include <stdlib.h>
#include "moab_mpi.h"
#include "moab/Range.hpp"
#include <vector>
#include "moab/MOABConfig.h"
#include "moab/Range.hpp"
#include "moab/Types.hpp"
#ifdef MOAB_HAVE_MPI
#include "moab_mpi.h"
#include "moab/ParallelComm.hpp"
#endif
namespace moab {
class Interface;
class Range;
}
using namespace moab;
......@@ -80,9 +83,9 @@ using namespace moab;
protected:
Interface *mbImpl;
#ifdef MOAB_HAVE_MPI
ParallelComm *mbpc;
#endif
bool write_output;
bool useCoords;
bool newComm;
......@@ -96,19 +99,22 @@ PartitionerBase::PartitionerBase(Interface *impl,
const bool use_coords)
: mbImpl(impl), useCoords(use_coords), newComm(false)
{
#ifdef MOAB_HAVE_MPI
mbpc = ParallelComm::get_pcomm(mbImpl, 0);
if (!mbpc) {
mbpc = new ParallelComm(impl, MPI_COMM_WORLD, 0);
newComm = true;
}
#endif
}
inline
PartitionerBase::~PartitionerBase()
{
#ifdef MOAB_HAVE_MPI
if (newComm)
delete mbpc;
#endif
mbImpl = NULL;
}
......
......@@ -42,13 +42,14 @@ std::ostringstream LONG_DESC;
int main(int argc, char* argv[])
{
#ifdef MOAB_HAVE_MPI
int err = MPI_Init(&argc, &argv);
if (err)
{
std::cerr << "MPI_Init failed. Aborting." << std::endl;
return 3;
}
#endif
Core moab;
Interface& mb = moab;
std::vector<int> set_l;
......@@ -105,7 +106,7 @@ int main(int argc, char* argv[])
opts.addOpt<void>("reorder,R", "Reorder mesh to group entities by partition", &reorder);
double part_geom_mesh_size = -1.0;
#if MOAB_HAVE_ZOLTAN
#ifdef MOAB_HAVE_ZOLTAN
bool part_surf = false;
#ifdef MOAB_HAVE_CGM
opts.addOpt<double>("geom,g", "(CGM) If partition geometry, specify mesh size.", &part_geom_mesh_size);
......@@ -521,5 +522,9 @@ int main(int argc, char* argv[])
delete tool;
#ifdef MOAB_HAVE_MPI
err = MPI_Finalize();
assert(MPI_SUCCESS == err);
#endif
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment