Commit 95a18a4c authored by Dave Moxey's avatar Dave Moxey

Make PartitionCheck utility a little more usable, start rename to PartitionAnalyse

parent ff2d25c4
///////////////////////////////////////////////////////////////////////////////
//
// File: PartitionCheck.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: Small utility to export histogram of partition sizes.
//
///////////////////////////////////////////////////////////////////////////////
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <LibUtilities/BasicUtils/MeshPartition.h>
#include <LibUtilities/Communication/CommSerial.h>
......@@ -8,36 +43,54 @@ using namespace std;
using namespace Nektar;
using namespace Nektar::LibUtilities;
class BrokenComm : public CommSerial
class FauxComm : public CommSerial
{
public:
LIB_UTILITIES_EXPORT BrokenComm(int argc, char* argv[], int size) : CommSerial(argc, argv)
LIB_UTILITIES_EXPORT FauxComm(int argc, char* argv[], int size)
: CommSerial(argc, argv)
{
m_size = size;
m_type = "Broken parallel";
m_type = "Faux parallel";
}
LIB_UTILITIES_EXPORT BrokenComm(int size) : CommSerial(0, NULL)
LIB_UTILITIES_EXPORT FauxComm(int size) : CommSerial(0, NULL)
{
m_size = size;
m_type = "Broken parallel";
m_type = "Faux parallel";
}
LIB_UTILITIES_EXPORT virtual ~BrokenComm() {}
LIB_UTILITIES_EXPORT virtual ~FauxComm() {}
void v_SplitComm(int pRows, int pColumns)
{
m_commRow = boost::shared_ptr<BrokenComm>(new BrokenComm(pColumns));
m_commColumn = boost::shared_ptr<BrokenComm>(new BrokenComm(pRows));
m_commRow = boost::shared_ptr<FauxComm>(new FauxComm(pColumns));
m_commColumn = boost::shared_ptr<FauxComm>(new FauxComm(pRows));
}
};
int main(int argc, char *argv[])
{
vector<string> filenames(1);
filenames[0] = argv[argc-1];
if (argc < 3)
{
cerr << "Usage: PartitionAnalyze <nproc> <xml file1> [xml file 2..n]"
<< endl;
return 1;
}
CommSharedPtr vComm = boost::shared_ptr<BrokenComm>(new BrokenComm(argc, argv, 256));
int nParts = atoi(argv[1]);
vector<string> filenames(argv + 2, argv + argc);
CommSharedPtr vComm = boost::shared_ptr<FauxComm>(
new FauxComm(argc, argv, nParts));
char **new_argv = new char*[argc];
new_argv[0] = strdup("PartitionAnalyze");
new_argv[1] = strdup("--part-info");
for (int i = 0; i < argc-2; ++i)
{
new_argv[i+2] = strdup(filenames[i].c_str());
}
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv, filenames, vComm);
= LibUtilities::SessionReader::CreateInstance(
argc, new_argv, filenames, vComm);
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