Commit 5b44baf7 authored by ext-calvo_p's avatar ext-calvo_p

Merge branch '646-extend-the-list-of-symbolic-constant' into 'master'

Resolve "Extend the list of symbolic constant"

See merge request OPAL/src!487
parents cefb9216 4022141e
// ------------------------------------------------------------------------
// $RCSfile: BoolConstant.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BoolConstant
// Implements a BOOL_CONSTANT definition.
// Class BoolConstant
// The BOOL CONSTANT definition.
//
// ------------------------------------------------------------------------
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// $Date: 2001/08/13 15:26:42 $
// $Author: jowett $
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#include "ValueDefinitions/BoolConstant.h"
#include "Attributes/Attributes.h"
#include "Utilities/Options.h"
#include <iostream>
#include <iostream>
// Class BoolConstant
// ------------------------------------------------------------------------
BoolConstant::BoolConstant():
ValueDefinition(1, "BOOL_CONSTANT",
......@@ -67,4 +65,4 @@ void BoolConstant::print(std::ostream &os) const {
void BoolConstant::printValue(std::ostream &os) const {
os << itsAttr[0];
}
\ No newline at end of file
}
#ifndef OPAL_BoolConstant_HH
#define OPAL_BoolConstant_HH
// ------------------------------------------------------------------------
// $RCSfile: BoolConstant.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BoolConstant
// Class BoolConstant
// The BOOL CONSTANT definition.
//
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
//
// ------------------------------------------------------------------------
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// $Date: 2000/03/27 09:33:49 $
// $Author: Andreas Adelmann $
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#ifndef OPAL_BoolConstant_HH
#define OPAL_BoolConstant_HH
#include "AbstractObjects/ValueDefinition.h"
// Class BoolConstant
// ------------------------------------------------------------------------
/// The BOOL CONSTANT definition.
class BoolConstant: public ValueDefinition {
public:
......@@ -59,4 +56,4 @@ private:
BoolConstant(const std::string &name, BoolConstant *parent);
};
#endif // OPAL_BoolConstant_HH
\ No newline at end of file
#endif // OPAL_BoolConstant_HH
// ------------------------------------------------------------------------
// $RCSfile: RealConstant.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: RealConstant
// Implements a REAL_CONSTANT definition.
// Class RealConstant
// The REAL CONSTANT definition.
//
// ------------------------------------------------------------------------
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// $Date: 2001/08/13 15:26:42 $
// $Author: jowett $
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#include "ValueDefinitions/RealConstant.h"
#include "AbstractObjects/OpalData.h"
#include "Attributes/Attributes.h"
#include "Utilities/Options.h"
#include "Physics/Physics.h"
#include "OPALconfig.h"
#include "Physics/Physics.h"
#include "Utilities/Options.h"
#include "Utility/IpplInfo.h"
#include <cmath>
#include <iostream>
// Class RealConstant
// ------------------------------------------------------------------------
RealConstant::RealConstant():
ValueDefinition(1, "REAL_CONSTANT",
......@@ -44,20 +41,23 @@ RealConstant::RealConstant():
OpalData *opal = OpalData::getInstance();
opal->create(new RealConstant("PI", this, Physics::pi));
opal->create(new RealConstant("TWOPI", this, Physics::two_pi));
opal->create(new RealConstant("RADDEG", this, 180.0 / Physics::pi));
opal->create(new RealConstant("DEGRAD", this, Physics::pi / 180.0));
opal->create(new RealConstant("RADDEG", this, Physics::rad2deg));
opal->create(new RealConstant("DEGRAD", this, Physics::deg2rad));
opal->create(new RealConstant("E", this, Physics::e));
opal->create(new RealConstant("EMASS", this, Physics::m_e));
opal->create(new RealConstant("PMASS", this, Physics::m_p));
opal->create(new RealConstant("HMMASS", this, Physics::m_hm));
opal->create(new RealConstant("UMASS", this, Physics::m_u));
opal->create(new RealConstant("CMASS", this, Physics::m_c));
opal->create(new RealConstant("MMASS", this, Physics::m_mu));
opal->create(new RealConstant("DMASS", this, Physics::m_d));
opal->create(new RealConstant("XEMASS", this, Physics::m_xe));
opal->create(new RealConstant("MUMASS", this, Physics::m_mu));
opal->create(new RealConstant("EMASS", this, Physics::m_e));
opal->create(new RealConstant("PMASS", this, Physics::m_p));
opal->create(new RealConstant("HMMASS", this, Physics::m_hm));
opal->create(new RealConstant("H2PMASS", this, Physics::m_h2p));
opal->create(new RealConstant("DMASS", this, Physics::m_d));
opal->create(new RealConstant("ALPHAMASS", this, Physics::m_alpha));
opal->create(new RealConstant("CMASS", this, Physics::m_c));
opal->create(new RealConstant("XEMASS", this, Physics::m_xe));
opal->create(new RealConstant("UMASS", this, Physics::m_u));
opal->create(new RealConstant("CLIGHT", this, Physics::c));
opal->create(new RealConstant("AMU", this, Physics::amu));
opal->create(new RealConstant("OPALVERSION", this, OPAL_VERSION_MAJOR * 10000
+ OPAL_VERSION_MINOR * 100
......@@ -106,4 +106,4 @@ void RealConstant::print(std::ostream &os) const {
void RealConstant::printValue(std::ostream &os) const {
os << itsAttr[0];
}
\ No newline at end of file
}
#ifndef OPAL_RealConstant_HH
#define OPAL_RealConstant_HH
// ------------------------------------------------------------------------
// $RCSfile: RealConstant.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: RealConstant
// Class RealConstant
// The REAL CONSTANT definition.
//
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
//
// ------------------------------------------------------------------------
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// $Date: 2000/03/27 09:33:49 $
// $Author: Andreas Adelmann $
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#ifndef OPAL_RealConstant_HH
#define OPAL_RealConstant_HH
#include "AbstractObjects/ValueDefinition.h"
// Class RealConstant
// ------------------------------------------------------------------------
/// The REAL CONSTANT definition.
class RealConstant: public ValueDefinition {
public:
......@@ -62,4 +59,4 @@ private:
RealConstant(const std::string &name, RealConstant *parent);
};
#endif // OPAL_RealConstant_HH
\ No newline at end of file
#endif // OPAL_RealConstant_HH
// ------------------------------------------------------------------------
// $RCSfile: RealVariable.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.3 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: RealVariable
// Implements a OPAL REAL_VARIABLE definition.
// Class RealVariable
// The REAL VARIABLE definition.
//
// ------------------------------------------------------------------------
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// $Date: 2001/08/13 15:26:42 $
// $Author: jowett $
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#include "ValueDefinitions/RealVariable.h"
#include "AbstractObjects/OpalData.h"
#include "Attributes/Attributes.h"
#include <iostream>
#include <iostream>
// Class RealVariable
// ------------------------------------------------------------------------
RealVariable::RealVariable():
ValueDefinition(1, "REAL_VARIABLE",
......@@ -82,4 +80,4 @@ void RealVariable::print(std::ostream &os) const {
void RealVariable::printValue(std::ostream &os) const {
os << itsAttr[0];
}
\ No newline at end of file
}
#ifndef OPAL_RealVariable_HH
#define OPAL_RealVariable_HH
// ------------------------------------------------------------------------
// $RCSfile: RealVariable.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: RealVariable
// Class RealVariable
// The REAL VARIABLE definition.
//
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// ------------------------------------------------------------------------
// This file is part of OPAL.
//
// $Date: 2000/03/27 09:33:49 $
// $Author: Andreas Adelmann $
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ------------------------------------------------------------------------
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
#ifndef OPAL_RealVariable_HH
#define OPAL_RealVariable_HH
#include "AbstractObjects/ValueDefinition.h"
// Class RealVariable
// ------------------------------------------------------------------------
/// The REAL VARIABLE definition.
class RealVariable: public ValueDefinition {
......@@ -61,4 +59,4 @@ private:
RealVariable(const std::string &name, RealVariable *parent);
};
#endif // OPAL_RealVariable_HH
\ No newline at end of file
#endif // OPAL_RealVariable_HH
// ------------------------------------------------------------------------
// $RCSfile: RealVector.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: RealVector
// Implements a OPAL REAL_VECTOR definition.
// Class RealVector
// The REAL VECTOR definition.
//
// ------------------------------------------------------------------------
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// $Date: 2000/03/27 09:33:49 $
// $Author: Andreas Adelmann $
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#include "ValueDefinitions/RealVector.h"
#include "Attributes/Attributes.h"
#include "Utilities/Options.h"
#include <iostream>
#include <vector>
// Class RealVector
// ------------------------------------------------------------------------
RealVector::RealVector():
ValueDefinition(1, "REAL_VECTOR",
"The \"REAL VECTOR\" statement defines a global "
......@@ -70,4 +68,4 @@ void RealVector::printValue(std::ostream &os) const {
double RealVector::getRealComponent(int index) const {
std::vector<double> array = Attributes::getRealArray(itsAttr[0]);
return array[index-1];
}
\ No newline at end of file
}
#ifndef OPAL_RealVector_HH
#define OPAL_RealVector_HH
// ------------------------------------------------------------------------
// $RCSfile: RealVector.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: RealVector
// Class RealVector
// The REAL VECTOR definition.
//
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
//
// ------------------------------------------------------------------------
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// $Date: 2000/03/27 09:33:49 $
// $Author: Andreas Adelmann $
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#ifndef OPAL_RealVector_HH
#define OPAL_RealVector_HH
#include "AbstractObjects/ValueDefinition.h"
// Class RealVector
// ------------------------------------------------------------------------
/// The REAL VECTOR definition.
class RealVector: public ValueDefinition {
public:
......@@ -59,4 +56,4 @@ private:
RealVector(const std::string &name, RealVector *parent);
};
#endif // OPAL_RealVector_HH
\ No newline at end of file
#endif // OPAL_RealVector_HH
// ------------------------------------------------------------------------
// $RCSfile: StringConstant.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: StringConstant
// Implements a OPAL STRING_CONSTANT definition.
// Class StringConstant
// The STRING CONSTANT definition.
//
// ------------------------------------------------------------------------
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// $Date: 2001/08/13 15:26:42 $
// $Author: jowett $
// This file is part of OPAL.
//
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#include "ValueDefinitions/StringConstant.h"
#include "AbstractObjects/OpalData.h"
#include "Attributes/Attributes.h"
#include "Utilities/Util.h"
#include <iostream>
#include <iostream>
// Class StringConstant
// ------------------------------------------------------------------------
StringConstant::StringConstant():
ValueDefinition(1, "STRING_CONSTANT",
......@@ -68,13 +66,11 @@ StringConstant *StringConstant::clone(const std::string &name) {
}
std::string StringConstant::getString() const {
return Attributes::getString(itsAttr[0]);
}
void StringConstant::print(std::ostream &os) const {
os << "STRING " << getOpalName() << '=' << itsAttr[0] << ';';
os << std::endl;
......@@ -82,4 +78,4 @@ void StringConstant::print(std::ostream &os) const {
void StringConstant::printValue(std::ostream &os) const {
os << itsAttr[0];
}
\ No newline at end of file
}
#ifndef OPAL_StringConstant_HH
#define OPAL_StringConstant_HH
// ------------------------------------------------------------------------
// $RCSfile: StringConstant.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: StringConstant
// Class StringConstant
// The STRING CONSTANT definition.
//
// Copyright (c) 2000 - 2021, Paul Scherrer Institut, Villigen PSI, Switzerland
// All rights reserved
//
// This file is part of OPAL.
//
// ------------------------------------------------------------------------
// OPAL is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// $Date: 2000/03/27 09:33:49 $
// $Author: Andreas Adelmann $
// You should have received a copy of the GNU General Public License
// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
//
// ------------------------------------------------------------------------
#ifndef OPAL_StringConstant_HH
#define OPAL_StringConstant_HH
#include "AbstractObjects/ValueDefinition.h"
// Class StringConstant
// ------------------------------------------------------------------------
/// The STRING CONSTANT definition.
class StringConstant: public ValueDefinition {
public:
......@@ -60,4 +57,4 @@ private:
StringConstant(const std::string &name, StringConstant *parent, const std::string &value);
};
#endif // OPAL_StringConstant_HH
\ No newline at end of file
#endif // OPAL_StringConstant_HH
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