Commit e7738034 authored by ext-rogers_c's avatar ext-rogers_c
Browse files

Merge branch 'master' of https://gitlab.psi.ch/OPAL/src

parents 751a9978 604e39f2
......@@ -312,11 +312,13 @@ bool reduce_masked(Communicate& comm, T& input, T& output,
}
// we're done ... but do a check to see that we reduced SOMETHING
/* ADA: can be "savely" ignored ...
if (!IncludeVal)
{
WARNMSG("reduce: there was nothing to reduce, since the masks ");
WARNMSG("were all false." << endl);
}
*/
}
//INCIPPLSTAT(incReductions);
......@@ -439,4 +441,4 @@ bool scatter(InputIterator s1, InputIterator s2,
{
return scatter(*Ippl::Comm, s1, s2, t1, target_node, target_position, op);
}
\ No newline at end of file
}
......@@ -181,8 +181,8 @@ IpplInfo::IpplInfo(int& argc, char**& argv, int removeargs, MPI_Comm mpicomm) {
// You can only specify argc, argv once; if it is done again, print a warning
// and continue as if we had not given argc, argv.
if ( CommInitialized ) {
WARNMSG("Attempt to create IpplInfo with argc, argv again." << endl);
WARNMSG("Using previous argc,argv settings." << endl);
// ADA WARNMSG("Attempt to create IpplInfo with argc, argv again." << endl);
//WARNMSG("Using previous argc,argv settings." << endl);
} else {
// dbgmsg << "Starting initialization: argc = " << argc << ", " << endl;
// for (unsigned int dbgi=0; dbgi < argc; ++dbgi)
......@@ -1175,4 +1175,4 @@ void __C_runtime_error ( int trap_code, char *name, int line_no, ... ) {
* $RCSfile: IpplInfo.cpp,v $ $Author: adelmann $
* $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
* IPPL_VERSION_ID: $Id: IpplInfo.cpp,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
***************************************************************************/
\ No newline at end of file
***************************************************************************/
......@@ -24,7 +24,6 @@
#ifdef BOOST_FILESYSTEM
#include "boost/filesystem/operations.hpp"
//#include "boost/filesystem/fstream.hpp"
#endif
// access to OPAL lib
......@@ -75,7 +74,7 @@ OpalSimulation::OpalSimulation(Expressions::Named_t objectives,
std::string hash = HashNameGenerator::generate(dict);
std::ostringstream tmp;
tmp.precision(15);
tmp << simTmpDir_ << "/" << hash << "_" << my_rank;
tmp << simTmpDir_ << "/" << hash ; // ADA << "_" << my_rank;
simulationDirName_ = tmp.str();
if(getenv("TEMPLATES") == NULL) {
......@@ -199,7 +198,7 @@ void OpalSimulation::run() {
if (err != 0) {
std::cout << "Cannot chdir to "
<< simulationDirName_.c_str() << std::endl;
std::cout << "Continuing, disregarding this simulation.."
std::cout << "Continuing 1, disregarding this simulation.."
<< std::endl;
return;
}
......@@ -249,7 +248,7 @@ void OpalSimulation::run() {
std::cout << "Opal exception during simulation run: "
<< ex->what() << std::endl;
std::cout << "Continuing, disregarding this simulation.."
std::cout << "Continuing 2, disregarding this simulation.."
<< std::endl;
} catch(ClassicException *ex) {
......@@ -262,7 +261,7 @@ void OpalSimulation::run() {
std::cout << "Classic exception during simulation run: "
<< ex->what() << std::endl;
std::cout << "Continuing, disregarding this simulation.."
std::cout << "Continuing 3, disregarding this simulation.."
<< std::endl;
}
......
......@@ -24,17 +24,17 @@ else {
FINSS_RGUN_dphi = 2.3603907853129149/180.0*PI;
}
//obj1: OBJECTIVE, EXPR="KS*KS";
//o2: OBJECTIVE, EXPR="sumErrSq("resources/measurement_test.dat", "rms_x", "statfile")";
//ob3: OBJECTIVE, EXPR="fromFile("resources/from_file.dat", "var")";
//d1: DVAR, VARIABLE="KS", LOWERBOUND="0.0", UPPERBOUND="0.5";
//c1: CONSTRAINT, EXPR="KS < 1.0";
obj1: OBJECTIVE, EXPR="KS*KS";
o2: OBJECTIVE, EXPR="sumErrSq("resources/measurement_test.dat", "rms_x", "statfile")";
ob3: OBJECTIVE, EXPR="fromFile("resources/from_file.dat", "var")";
d1: DVAR, VARIABLE="KS", LOWERBOUND="0.0", UPPERBOUND="0.5";
c1: CONSTRAINT, EXPR="KS < 1.0";
//objs: OBJECTIVES = (obj1, o2, ob3);
//dvars: DVARS = (d1);
//constrs: CONSTRAINTS = (c1);
objs: OBJECTIVES = (obj1, o2, ob3);
dvars: DVARS = (d1);
constrs: CONSTRAINTS = (c1);
//opt: OPTIMIZE, OBJECTIVES=objs, DVARS=dvars, CONSTRAINTS=constrs;
opt: OPTIMIZE, OBJECTIVES=objs, DVARS=dvars, CONSTRAINTS=constrs;
// -----------------------------------------------------------------------------------------
// RF-COMPONENTS
......
......@@ -2,7 +2,7 @@
#include <iostream>
#include <sstream>
#include <boost/algorithm/string.hpp>
#include "boost/algorithm/string.hpp"
#include "boost/tuple/tuple.hpp"
#include "boost/foreach.hpp"
......@@ -151,15 +151,20 @@ std::string CommentAnnotatedInputFileParser::getAttribute(
// "name = value" attribute style
if(attribute.compare("name") == 0) {
// get string on left side of colon
StringList_t res;
boost::split(res, str, boost::is_any_of(":"),
boost::token_compress_on);
std::string ret = res[0];
// remove comment symbols at the beginning of the line
if(comment_symbol_ == "")
if(comment_symbol_ == "") {
// trim left space
boost::trim_left(ret);
return ret;
}
// get string on right side of comment
boost::split(res, ret, boost::is_any_of(comment_symbol_),
boost::token_compress_on);
return res[1];
......
......@@ -13,16 +13,15 @@
* \brief Implements a parser for OPAL input files
*
* This class extracts the optimization problem (objectives, constraints,
* design variables) from an Opal input file. All statements are prefixed
* with "//", e.g.,
* design variables) from an Opal input file. E.g.,
*
* \verbatim
//d1: DVAR, ELEMENT="", VARIABLE="SIGX";
//obj1: OBJECTIVE, EXPR="(energy*energy)";
//objs: OBJECTIVES = (obj1);
//dvars: DVARS = (d1);
//constrs: CONSTRAINTS = ();
//opt: OPTIMIZE, OBJECTIVES=objs, DVARS=dvars, CONSTRAINTS=constrs;
d1: DVAR, ELEMENT="", VARIABLE="SIGX";
obj1: OBJECTIVE, EXPR="(energy*energy)";
objs: OBJECTIVES = (obj1);
dvars: DVARS = (d1);
constrs: CONSTRAINTS = ();
opt: OPTIMIZE, OBJECTIVES=objs, DVARS=dvars, CONSTRAINTS=constrs;
\endverbatim
*/
class OpalInputFileParser : public CommentAnnotatedInputFileParser {
......@@ -30,7 +29,7 @@ class OpalInputFileParser : public CommentAnnotatedInputFileParser {
public:
OpalInputFileParser(std::string filename,
functionDictionary_t known_expr_funcs)
: CommentAnnotatedInputFileParser(filename, "//", known_expr_funcs)
: CommentAnnotatedInputFileParser(filename, "", known_expr_funcs)
{}
~OpalInputFileParser()
......
......@@ -325,14 +325,15 @@ void OpalBeamline::compute3DLattice() {
double rotationAngleAboutZ = bendElement->getRotationAboutZ();
Quaternion_t rotationAboutZ(cos(0.5 * rotationAngleAboutZ),
sin(0.5 * rotationAngleAboutZ) * Vector_t(0, 0, 1));
sin(-0.5 * rotationAngleAboutZ) * Vector_t(0, 0, 1));
Vector_t effectiveRotationAxis = rotationAboutZ.rotate(Vector_t(0, -1, 0));
effectiveRotationAxis /= euclidian_norm(effectiveRotationAxis);
Vector_t rotationAxis = rotationAboutZ.rotate(Vector_t(0, -1, 0));
rotationAxis /= euclidian_norm(rotationAxis);
Quaternion_t rotationAboutAxis(cos(0.5 * bendAngle),
sin(0.5 * bendAngle) * rotationAxis);
sin(0.5 * bendAngle) * effectiveRotationAxis);
Quaternion halfRotationAboutAxis(cos(0.25 * bendAngle),
sin(0.25 * bendAngle) * rotationAxis);
sin(0.25 * bendAngle) * effectiveRotationAxis);
double arcLength = (thisLength * std::abs(bendAngle) /
(2 * sin(bendAngle / 2)));
......@@ -340,7 +341,7 @@ void OpalBeamline::compute3DLattice() {
std::vector<Vector_t> truePath = bendElement->getDesignPath();
double entranceAngle = bendElement->getEntranceAngle();
Quaternion_t directionExitHardEdge(cos(0.5 * (0.5 * bendAngle - entranceAngle)),
sin(0.5 * (0.5 * bendAngle - entranceAngle)) * rotationAxis);
sin(0.5 * (0.5 * bendAngle - entranceAngle)) * effectiveRotationAxis);
Vector_t exitHardEdge = thisLength * directionExitHardEdge.rotate(Vector_t(0, 0, 1));
double distanceEntryHETruePath = euclidian_norm(truePath.front());
double distanceExitHETruePath = euclidian_norm(truePath.back() - exitHardEdge);
......@@ -356,7 +357,7 @@ void OpalBeamline::compute3DLattice() {
endPriorPathLength = beginThisPathLength + arcLength;
} else {
Quaternion rotation(1, 0, 0, 0);
// Quaternion rotation(1, 0, 0, 0);
// FieldList::iterator priorDipole = partiallyInsideDipole(it, elements_m.begin(), elements_m.end(), minOrder);
......@@ -382,7 +383,7 @@ void OpalBeamline::compute3DLattice() {
Quaternion_t rotationAboutZ(cos(0.5 * rotationAngleAboutZ),
sin(-0.5 * rotationAngleAboutZ) * Vector_t(0, 0, 1));
CoordinateSystemTrafo fromLastToThis(beginThis3D, rotationAboutZ * rotation);
CoordinateSystemTrafo fromLastToThis(beginThis3D, rotationAboutZ);// * rotation);
(*it).setCoordTransformationTo(fromLastToThis * currentCoordTrafo);
}
......
......@@ -123,6 +123,7 @@ void OpalRingDefinition::update() {
ring->setIsClosed(!(Attributes::getString(itsAttr[IS_CLOSED])=="FALSE"));
double minR = -1;
double maxR = -1;
if (itsAttr[MIN_R]) {
minR = Attributes::getReal(itsAttr[MIN_R]);
if (!itsAttr[MAX_R]) {
......
......@@ -101,14 +101,17 @@ void OpalParser::parse(Statement &stat) const {
std::string hint = getHint(name);
unsigned int position = stat.position();
std::string positionIndicator = std::string(position, ' ') + "^\n";
std::ostringstream statStr;
stat.print(statStr);
if (hint != "") {
throw ParseError("OpalParser::parse()",
statStr.str() +
positionIndicator +
"Syntax error, either the keyword REAL is missing or\n" +
hint);
} else {
throw ParseError("OpalParser::parse()",
statStr.str() +
positionIndicator +
"Syntax error, the keyword REAL is missing\n");
}
......
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