Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit acaf84b7 authored by Christof Metzger-Kraus's avatar Christof Metzger-Kraus
Browse files

whitespaces

parent 1c0fa9ac
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,7 @@ Inform *gmsg; ...@@ -54,7 +54,7 @@ Inform *gmsg;
/* /*
Includes related the to optimizer Includes related the to optimizer
*/ */
#include "boost/smart_ptr.hpp" #include "boost/smart_ptr.hpp"
#include "Pilot/Pilot.h" #include "Pilot/Pilot.h"
...@@ -102,82 +102,82 @@ void errorHandlerGSL(const char *reason, ...@@ -102,82 +102,82 @@ void errorHandlerGSL(const char *reason,
bool haveOpimiseRun(int argc, char *argv[]) { bool haveOpimiseRun(int argc, char *argv[]) {
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
std::string so("--initialPopulation"); std::string so("--initialPopulation");
bool foundOptArg = false; bool foundOptArg = false;
int arg = -1; int arg = -1;
std::string fname; std::string fname;
for(int ii = 1; ii < argc; ++ ii) { for(int ii = 1; ii < argc; ++ ii) {
std::string argStr = std::string(argv[ii]); std::string argStr = std::string(argv[ii]);
if (argStr.find(so) != std::string::npos) { if (argStr.find(so) != std::string::npos) {
foundOptArg = true; foundOptArg = true;
} }
if (argStr == std::string("--input")) { if (argStr == std::string("--input")) {
++ ii; ++ ii;
arg = ii; arg = ii;
INFOMSG(argv[ii] << endl); INFOMSG(argv[ii] << endl);
continue; continue;
} else if (argStr == std::string("-restart") || } else if (argStr == std::string("-restart") ||
argStr == std::string("--restart")) { argStr == std::string("--restart")) {
return false; return false;
} else if (argStr == std::string("-restartfn") || } else if (argStr == std::string("-restartfn") ||
argStr == std::string("--restartfn")) { argStr == std::string("--restartfn")) {
return false; return false;
} else if (argStr == std::string("-version") || } else if (argStr == std::string("-version") ||
argStr == std::string("--version")) { argStr == std::string("--version")) {
return false; return false;
} else if (argStr == std::string("-help") || } else if (argStr == std::string("-help") ||
argStr == std::string("--help")) { argStr == std::string("--help")) {
return false; return false;
} }
else { else {
if (arg == -1 && if (arg == -1 &&
(ii == 1 || ii + 1 == argc) && (ii == 1 || ii + 1 == argc) &&
argv[ii][0] != '-') { argv[ii][0] != '-') {
arg = ii; arg = ii;
continue; continue;
} else { } else {
continue; continue;
} }
}
} }
}
if (arg == -1) { if (arg == -1) {
INFOMSG("No input file provided!" << endl); INFOMSG("No input file provided!" << endl);
exit(1); exit(1);
} }
fname = std::string(argv[arg]); fname = std::string(argv[arg]);
if (!fs::exists(fname)) { if (!fs::exists(fname)) {
INFOMSG("Input file \"" << fname << "\" doesn't exist!" << endl); INFOMSG("Input file \"" << fname << "\" doesn't exist!" << endl);
exit(1); exit(1);
} }
std::ifstream inFile; std::ifstream inFile;
inFile.open(fname); inFile.open(fname);
std::stringstream strStream; std::stringstream strStream;
strStream << inFile.rdbuf(); strStream << inFile.rdbuf();
std::string str = strStream.str(); std::string str = strStream.str();
std::transform(str.begin(), str.end(),str.begin(), ::toupper); std::transform(str.begin(), str.end(),str.begin(), ::toupper);
const std::string s1("OPTIMIZE"); const std::string s1("OPTIMIZE");
const std::string s2("OBJECTIVE"); const std::string s2("OBJECTIVE");
const std::string s3("DVAR"); const std::string s3("DVAR");
bool res = (boost::algorithm::contains(str, s1) && bool res = (boost::algorithm::contains(str, s1) &&
boost::algorithm::contains(str, s2) && boost::algorithm::contains(str, s2) &&
boost::algorithm::contains(str, s3)); boost::algorithm::contains(str, s3));
inFile.close(); inFile.close();
return res && foundOptArg; return res && foundOptArg;
} }
int mainOPALOptimiser(int argc, char *argv[]) { int mainOPALOptimiser(int argc, char *argv[]) {
...@@ -202,24 +202,24 @@ int mainOPALOptimiser(int argc, char *argv[]) { ...@@ -202,24 +202,24 @@ int mainOPALOptimiser(int argc, char *argv[]) {
client::function::type ff; client::function::type ff;
ff = FromFile(); ff = FromFile();
funcs.insert(std::pair<std::string, client::function::type> funcs.insert(std::pair<std::string, client::function::type>
("fromFile", ff)); ("fromFile", ff));
ff = SumErrSq(); ff = SumErrSq();
funcs.insert(std::pair<std::string, client::function::type> funcs.insert(std::pair<std::string, client::function::type>
("sumErrSq", ff)); ("sumErrSq", ff));
ff = SDDSVariable(); ff = SDDSVariable();
funcs.insert(std::pair<std::string, client::function::type> funcs.insert(std::pair<std::string, client::function::type>
("sddsVariableAt", ff)); ("sddsVariableAt", ff));
ff = RadialPeak(); ff = RadialPeak();
funcs.insert(std::pair<std::string, client::function::type> funcs.insert(std::pair<std::string, client::function::type>
("radialPeak", ff)); ("radialPeak", ff));
ff = SumErrSqRadialPeak(); ff = SumErrSqRadialPeak();
funcs.insert(std::pair<std::string, client::function::type> funcs.insert(std::pair<std::string, client::function::type>
("sumErrSqRadialPeak", ff)); ("sumErrSqRadialPeak", ff));
ff = ProbeVariable(); ff = ProbeVariable();
funcs.insert(std::pair<std::string, client::function::type> funcs.insert(std::pair<std::string, client::function::type>
("probVariableWithID", ff)); ("probVariableWithID", ff));
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
...@@ -238,7 +238,7 @@ int mainOPALOptimiser(int argc, char *argv[]) { ...@@ -238,7 +238,7 @@ int mainOPALOptimiser(int argc, char *argv[]) {
std::cout << "Exception caught: " << e.what() << std::endl; std::cout << "Exception caught: " << e.what() << std::endl;
MPI_Abort(MPI_COMM_WORLD, -100); MPI_Abort(MPI_COMM_WORLD, -100);
} }
Ippl::Comm->barrier(); Ippl::Comm->barrier();
Fieldmap::clearDictionary(); Fieldmap::clearDictionary();
OpalData::deleteInstance(); OpalData::deleteInstance();
...@@ -539,21 +539,21 @@ int mainOPAL(int argc, char *argv[]) { ...@@ -539,21 +539,21 @@ int mainOPAL(int argc, char *argv[]) {
return 0; return 0;
} catch(ClassicException &ex) { } catch(ClassicException &ex) {
*gmsg << endl << "*** User error detected by function \"" << ex.where() << "\":\n" *gmsg << endl << "*** User error detected by function \"" << ex.where() << "\":\n"
<< ex.what() << endl; << ex.what() << endl;
abort(); abort();
} catch(std::bad_alloc &) { } catch(std::bad_alloc &) {
*gmsg << "Sorry, virtual memory exhausted." << endl; *gmsg << "Sorry, virtual memory exhausted." << endl;
abort(); abort();
} catch(std::exception const& e) { } catch(std::exception const& e) {
*gmsg << "Exception: " << e.what() << "\n"; *gmsg << "Exception: " << e.what() << "\n";
abort(); abort();
} catch(...) { } catch(...) {
*gmsg << "Unexpected exception." << endl; *gmsg << "Unexpected exception." << endl;
abort(); abort();
} }
} }
...@@ -570,14 +570,12 @@ void errorHandlerGSL(const char *reason, ...@@ -570,14 +570,12 @@ void errorHandlerGSL(const char *reason,
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int res; int res;
if ((argc <= 1) || !haveOpimiseRun(argc, argv))
res = mainOPAL(argc, argv);
else
res = mainOPALOptimiser(argc, argv);
return res;
}
if ((argc <= 1) || !haveOpimiseRun(argc, argv))
res = mainOPAL(argc, argv);
else
res = mainOPALOptimiser(argc, argv);
return res;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment