-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Isisminer has been refactored to be callable and Makefile tests conve…
…rted to gtest format (#5579) * Fixed minor misspellings in error messages. Addresses #5516. * Test data added for isisminer. Addresses #5516. * Converted isisminer Makefile tests to gtest format. Addresses #5516. * Converted isisminer application to callable function. Addresses #5516. * Minor tweak to isisminer csvwriter test. Addresses #5516. * Added compareCsvLineCustomDelimiter method, specifically for isisminer testing support. Addresses #5516. * Removed isisminer Makefile tests (replaced by gtests) and updated CHANGELOG reflecting conversion of isisminer to callable app. Addresses #5516. * Replace isis cube in /isis/tests/data/isisminer/gistest with isd and label files. Minor tweaks to FunctionalTestsIsisminer.cpp. History entry added to isisminer.xml. Addresses #5516. * Minor changes for conversion of isisminer to callable app. Addresses #5516. * Had to add data file index.lbl to the .gitignore file for it to be uploaded. Addresses #5516.
- Loading branch information
1 parent
60e884f
commit c6b5df4
Showing
42 changed files
with
9,924 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
/** This is free and unencumbered software released into the public domain. | ||
The authors of ISIS do not claim copyright on the contents of this file. | ||
For more details about the LICENSE terms and the AUTHORS, you will | ||
find files of those names at the top level of this repository. **/ | ||
|
||
/* SPDX-License-Identifier: CC0-1.0 */ | ||
|
||
// std library | ||
#include <cmath> | ||
#include <cstdlib> | ||
#include <iomanip> | ||
#include <iostream> | ||
#include <sstream> | ||
#include <string> | ||
#include <vector> | ||
|
||
// Qt library | ||
#include <QList> | ||
#include <QScopedPointer> | ||
//#include <QString> | ||
#include <QStringList> | ||
#include <QTime> | ||
#include <QElapsedTimer> | ||
|
||
// boost library | ||
#include <boost/foreach.hpp> | ||
|
||
// ISIS | ||
#include "Application.h" | ||
#include "Database.h" | ||
#include "FileName.h" | ||
#include "GisGeometry.h" | ||
#include "IString.h" | ||
#include "Progress.h" | ||
#include "Pvl.h" | ||
#include "PvlFlatMap.h" | ||
#include "Resource.h" | ||
#include "SqlQuery.h" | ||
#include "SqlRecord.h" | ||
#include "Strategy.h" | ||
#include "StrategyFactory.h" | ||
|
||
#include "isisminer.h" | ||
|
||
using namespace std; | ||
|
||
namespace Isis { | ||
|
||
// Program constants | ||
const QString isisminer_program = "isisminer"; | ||
const QString isisminer_version = "1.0"; | ||
const QString isisminer_revision = "$Revision: 6513 $"; | ||
const QString isisminer_runtime = Application::DateTime(); | ||
|
||
/** | ||
* Isisminer assists in the identification, manipulation, | ||
* and output of data from a variety of data sources. It | ||
* runs a series of algorithms (or Strategies) that perform | ||
* various operations on input sources (or Resources). | ||
* | ||
* @param ui UserInterface object containing parameters | ||
*/ | ||
void isisminer(UserInterface &ui) { | ||
|
||
// File containing isisminer configuration run | ||
QString configFile = ui.GetFileName("CONFIG"); | ||
|
||
// open optional, global parameter file if provided | ||
// file is for use in global variable pool | ||
if ( ui.WasEntered("GLOBALS") ) { | ||
Pvl pvl_globals(ui.GetFileName("GLOBALS")); | ||
|
||
return isisminer(configFile, ui, &pvl_globals); | ||
} | ||
|
||
return isisminer(configFile, ui); | ||
} | ||
|
||
|
||
/** | ||
* Isisminer assists in the identification, manipulation, | ||
* and output of data from a variety of data sources. It | ||
* runs a series of algorithms (or Strategies) that perform | ||
* various operations on input sources (or Resources). | ||
* | ||
* @param ui UserInterface object containing parameters | ||
* | ||
* @throws IException::User "Ill-formed PARAMETERS [PARAMETERS] - use form @key:val" | ||
* | ||
*/ | ||
void isisminer(QString &configFileName, UserInterface &ui, | ||
Pvl *pvl_globals) { | ||
|
||
StrategyFactory *factory = StrategyFactory::instance(); | ||
|
||
SharedResource globals(new Resource("Globals")); | ||
globals->add("Program", isisminer_program); | ||
globals->add("Version", isisminer_version); | ||
globals->add("Revision", isisminer_revision); | ||
globals->add("RunTime", isisminer_runtime); | ||
|
||
// File containing isisminer configuration run | ||
globals->add("CONFIG", configFileName); | ||
|
||
// Add parameters provided by user to global resources | ||
if ( ui.WasEntered("PARAMETERS") ) { | ||
QString parameters = ui.GetString("PARAMETERS"); | ||
globals->add("PARAMETERS", parameters); | ||
|
||
// Split by separate parameters | ||
QStringList parmlist = parameters.split("@", Qt::SkipEmptyParts); | ||
BOOST_FOREACH (QString parm, parmlist) { | ||
// Split values from keyword name | ||
QStringList keyval = parm.split(":", Qt::SkipEmptyParts); | ||
if ( keyval.size() != 2 ) { | ||
QString mess = "Ill-formed PARAMETERS (" + parm + ") - use form @key:val"; | ||
throw IException(IException::User, mess, _FILEINFO_); | ||
} | ||
|
||
// Now split multi string values and construct the Pvl keyword | ||
QString keyname = keyval[0]; | ||
QStringList values = keyval[1].split(",", Qt::SkipEmptyParts); | ||
PvlKeyword keyword(keyname); | ||
BOOST_FOREACH ( QString val, values) { | ||
keyword.addValue(val); | ||
} | ||
|
||
// Add the parameter to global parameters | ||
globals->add(keyword); | ||
} | ||
} | ||
|
||
// Add to factory | ||
factory->addGlobal(globals); | ||
|
||
// If provided, load optional, global parameter | ||
// file for use in global variable pool | ||
if ( pvl_globals != nullptr ) { | ||
SharedResource gfile(new Resource("GlobalFileResources", PvlFlatMap(*pvl_globals))); | ||
factory->addGlobal(gfile); | ||
globals->add("GLOBALS", ui.GetFileName("GLOBALS")); | ||
} | ||
|
||
// Create strategies (computations, constraints, ranks, sorts, etc...) | ||
cout << "\nCreating strategies...\n"; | ||
StrategyList strategies = factory->buildRun(configFileName); | ||
cout << "Finished creating " << factory->manufactured() << " strategies...\n"; | ||
|
||
// Input resource list preserved for subsequent processing | ||
ResourceList resources; | ||
QTime runTime = QTime::currentTime(); | ||
BOOST_FOREACH ( SharedStrategy strategy, strategies ) { | ||
QTime stime = QTime::currentTime(); | ||
cout << "\nRunning " << strategy->type() << "::" << strategy->name() | ||
<< " (TimeIn: " << stime.toString("hh:mm:ss.zzz") | ||
<< ")\n" | ||
<< "Description: " << strategy->description() << "\n"; | ||
QElapsedTimer stimer; | ||
stimer.start(); | ||
int n = strategy->apply(resources); | ||
unsigned int ntotal = strategy->totalProcessed(); | ||
cout << n << " of " << ntotal << " processed in " | ||
<< strategy->type() << "::" << strategy->name() | ||
<< " (TimeOut: " << QTime::currentTime().toString("hh:mm:ss.zzz") << ")\n"; | ||
cout << "ElapsedTime(s): " << stimer.elapsed() / 1000 << "\n"; | ||
} | ||
|
||
// Get total elapsed time | ||
QTime totalT(0,0); | ||
totalT = totalT.addMSecs(runTime.msecsTo(QTime::currentTime())); | ||
cout << "\nSession complete in " << totalT.toString("hh:mm:ss.zzz") | ||
<< " of elapsed time\n"; | ||
|
||
return; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** This is free and unencumbered software released into the public domain. | ||
The authors of ISIS do not claim copyright on the contents of this file. | ||
For more details about the LICENSE terms and the AUTHORS, you will | ||
find files of those names at the top level of this repository. **/ | ||
|
||
/* SPDX-License-Identifier: CC0-1.0 */ | ||
|
||
#ifndef isisminer_h | ||
#define isisminer_h | ||
|
||
#include "Pvl.h" | ||
#include "UserInterface.h" | ||
|
||
#include <QString> | ||
|
||
namespace Isis{ | ||
extern void isisminer(UserInterface &ui); | ||
extern void isisminer(QString &configFileName, UserInterface &ui, | ||
Pvl *pvl_globals=nullptr); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.