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 5e0771db authored by gsell's avatar gsell
Browse files

repo reorganization

parents
No related branches found
No related merge requests found
Showing
with 2601 additions and 0 deletions
This diff is collapsed.
Doxyfile 0 → 100644
# Doxyfile 1.3.8
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "OPAL (Object Oriented Parallel Accelerator Library)"
PROJECT_NUMBER = "V1.1.2"
OUTPUT_DIRECTORY = ./doc
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
USE_WINDOWS_ENCODING = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = /home2/adelmann/svnwork/ua/OPAL
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 8
ALIASES =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = NO
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./src ./classic/5.0/src
FILE_PATTERNS = *.c \
*.cpp \
*.cc \
*.h \
*.hh
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = NO
TOC_EXPAND = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = NO
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES = amsfonts, amssymb
LATEX_HEADER =
PDF_HYPERLINKS = YES
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = HAVE_ML_SOLVER
PREDEFINED = HAVE_ENVELOPE_SOLVER
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES = YES
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = png
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
MAX_DOT_GRAPH_DEPTH = 1000
GENERATE_LEGEND = YES
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
README 0 → 100644
OPAL (Object Oriented Parallel Accelerator Library)
V 1.1.2 17.9.2008
A fusion of MAD9, CLASSIC (V3.3.1 -> 5.0) MAD9p with the help of IPPL V 1.0 .
Effort started 5/12/2006 by Andreas Adelmann (PSI)
Goto amas.web.psi.ch for more information and the documentation.
N E W S
=======
New in 1.1.2:
- much faster now
- Bend
- Gun, SW TW structures fully benchmarked against IMPACT-T
- Cyclotron model ready for: Ring and Injector 2 with neighbouring bunches
- Experimental (only for geeks):
=> iterative solver (needs special configure options)
=> wake fields
=> envelope mode (SW,Solenoids) ok w.r.t. BET
- Many more regression tests
Plans for 1.1.3
- CSR
- Transision from experimental to production
New in 1.1.5
------------
Sort range wake fields and SBend with field gradient.
Thermal emittance most probable close to the ASTRA model.
Iteative solver with simple geometry (not ready for XT3/4 at CSCS due to some
library installation problem).
I N S T A L L A T I O N
=======================
Please check out chapter 2 in the manual for details.
On very often used systems the configure commands are given below
however you have to make sure the individual location of include and
libraries are set right.
FELSIM (PSI)
------------
OPAL/src
./configure --with-blas=mkl --with-lapack=mkl --enable-ml-solver \
--with-classic-includedir=$HOME/svnwork/OPAL/classic/5.0/src --with-classic-libdir=$HOME/svnwork/OPAL/classic/5.0/src \
--with-doom-includedir=$HOME/svnwork/OPAL/doom/ --with-doom-libdir=$HOME/svnwork/OPAL/doom/ \
--with-ippl-includedir=/home2/ineichen/felsim/ippl/src --with-ippl-libdir=/home2/ineichen/felsim/ippl/lib/LINUX \
--with-h5part-includedir=$HOME/svnwork/H5Part/src --with-h5part-libdir=$HOME/svnwork/H5Part/src \
--with-hdf5-includedir=$HDF5HOME/include --with-hdf5-libdir=$HDF5HOME/lib \
--with-trilinos-includedir=/opt/trilinos/trilinos-8.0.7/include --with-trilinos-libdir=/opt/trilinos/trilinos-8.0.7/lib \
--with-libdir="-L/opt/parmetis/parmetis-3.1 -L/opt/intel-mkl/mkl-10.0/lib/em64t -L/opt/intel/intel-10.0/fce-10.0/lib" \
--with-libs="-lz -lm -lfftw3 /home2/ineichen/felsim_build/SuperLU_DIST_2.2/lib/libsuperlu_dist_2.0.a -lifcore -lparmetis -lmetis" \
CXX=mpicxx --no-create --no-recursion
OPAL/classic/5.0/src
./configure --with-ippl-includedir=/home2/ineichen/felsim/ippl/src \
--with-h5part-includedir=/home2/adelmann/svnwork/H5Part/src \
--with-h5part-libdir=/home2/adelmann/svnwork/H5Part/src \
--with-hdf5-includedir=/opt/hdf5/hdf5-1.6.7/include \
--with-hdf5-ibdir=/opt/hdf5/hdf5-1.6.7/lib \
CXX=mpicxx --no-create --no-recursion
OPAL/doom
./configure CC=mpicc --no-create --no-recursion
HORIZON (XT3 @ CSCS)
Andreas Adelmann
// ------------------------------------------------------------------------
// $RCSfile: AlignWrapper.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: AlignWrapper
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/AlignWrapper.h"
#include "AbsBeamline/BeamlineVisitor.h"
// Class AlignWrapper
// ------------------------------------------------------------------------
void AlignWrapper::accept(BeamlineVisitor &visitor) const
{
visitor.visitAlignWrapper(*this);
}
AlignWrapper *AlignWrapper::clone() const
{
return new AlignWrapper(*this);
}
ElementBase *AlignWrapper::copyStructure()
{
if (isSharable()) {
return this;
} else {
AlignWrapper *wrap = new AlignWrapper(*this);
wrap->itsElement = itsElement->copyStructure();
return wrap;
}
}
void AlignWrapper::makeSharable()
{
shareFlag = true;
itsElement->makeSharable();
}
Euclid3D AlignWrapper::getEntranceTransform() const
{
if (itsOffset.isIdentity()) {
return itsOffset;
} else {
Euclid3D frame = itsElement->getEntranceFrame();
return frame.inverse() * itsOffset * frame;
}
}
Euclid3D AlignWrapper::getExitTransform() const
{
if (itsOffset.isIdentity()) {
return itsOffset;
} else {
Euclid3D frame = itsElement->getExitFrame();
return frame * Inverse(itsOffset) * Inverse(frame);
}
}
ElementBase *AlignWrapper::getElement() const
{
return &*itsElement;
}
void AlignWrapper::setElement(ElementBase *elem)
{
itsElement = elem;
}
Geometry &AlignWrapper::getGeometry()
{
return itsElement->getGeometry();
}
const Geometry &AlignWrapper::getGeometry() const
{
return itsElement->getGeometry();
}
const string &AlignWrapper::getType() const
{
return itsElement->getType();
}
Euclid3D &AlignWrapper::offset() const
{
return itsOffset;
}
ElementBase *AlignWrapper::makeAlignWrapper()
{
return this;
}
ElementBase *AlignWrapper::makeFieldWrapper()
{
itsElement = itsElement->makeFieldWrapper();
itsElement->setName(itsElement->getName());
return this;
}
ElementBase *AlignWrapper::removeAlignWrapper()
{
return &*itsElement;
}
const ElementBase *AlignWrapper::removeAlignWrapper() const
{
return &*itsElement;
}
ElementBase *AlignWrapper::removeFieldWrapper()
{
return new AlignWrapper(itsElement->removeFieldWrapper());
}
const ElementBase *AlignWrapper::removeFieldWrapper() const
{
return new AlignWrapper(itsElement->removeFieldWrapper());
}
ElementBase *AlignWrapper::removeWrappers()
{
return itsElement->removeWrappers();
}
const ElementBase *AlignWrapper::removeWrappers() const
{
return itsElement->removeWrappers();
}
AlignWrapper::AlignWrapper(const AlignWrapper &rhs):
ElementBase(rhs), itsElement(rhs.itsElement), itsOffset(rhs.itsOffset)
{
shareFlag = false;
}
AlignWrapper::~AlignWrapper()
{}
AlignWrapper::AlignWrapper(ElementBase *elem):
ElementBase(elem->getName()), itsElement(elem), itsOffset()
{
shareFlag = false;
}
#ifndef CLASSIC_AlignWrapper_HH
#define CLASSIC_AlignWrapper_HH
// ------------------------------------------------------------------------
// $RCSfile: AlignWrapper.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: AlignWrapper
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/ElementBase.h"
#include "BeamlineGeometry/Euclid3D.h"
#include "MemoryManagement/Pointer.h"
class BeamlineVisitor;
// Class AlignWrapper
// ------------------------------------------------------------------------
/// Define the position of a misaligned element.
// An AlignWrapper is used to store misalignment errors or deliberate
// misalignments. It acts as a wrapper around a component or a complete
// beam line. Rotations and translations are defined about the design
// local frame, which in turn is specified by the position of the element
// on the design geometry. An AlignWrapper is non-sharable by default.
class AlignWrapper: public ElementBase {
friend class ElementBase;
public:
/// Apply BeamlineVisitor.
virtual void accept(BeamlineVisitor &) const;
/// Return clone.
// Return an identical deep copy of the wrapper and its contents.
virtual AlignWrapper *clone() const;
/// Make structural copy.
virtual ElementBase *copyStructure();
/// Set sharable flag.
// The whole structure depending on [b]this[/b] is marked as sharable.
// After this call a [b]copyStructure()[/b] call reuses the element.
virtual void makeSharable();
/// Get entrance patch.
// Returns the entrance patch (transformation) which is used to
// transform the global geometry to the local geometry at entrance
// of the misaligned element.
virtual Euclid3D getEntranceTransform() const;
/// Get exit patch.
// Returns the exit patch (transformation) which is used to
// transform the local geometry to the global geometry at exit of
// the misaligned element.
virtual Euclid3D getExitTransform() const;
/// Return the contained element.
virtual ElementBase *getElement() const;
/// Replace the contained element.
void setElement(ElementBase *);
/// Get geometry.
// Return the element geometry.
// Version for non-constant object.
virtual Geometry &getGeometry();
/// Get geometry.
// Return the element geometry.
// Version for constant object.
virtual const Geometry &getGeometry() const;
/// Return the offset.
// This method can be used to get or set the offset. The offset is
// declared as mutable, so as to allow changing it in a constant
// structure.
Euclid3D &offset() const;
/// Get element type string.
// Returns the type string for the enclosed item.
virtual const string &getType() const;
/// Disallow misalignment of an already misaligned object.
// This method returns [b]this[/b], since "this" is already an
// AlignWrapper.
virtual ElementBase *makeAlignWrapper();
/// Allow field errors.
// Wrap the contained element in a field wrapper, unless such a
// wrapper already exists.
virtual ElementBase *makeFieldWrapper();
/// Remove AlignWrapper.
// Return the element or field wrapper contained in "this".
// Version for non-const object.
virtual ElementBase *removeAlignWrapper();
/// Remove AlignWrapper.
// Return the element or field wrapper contained in "this".
// Version for const object.
virtual const ElementBase *removeAlignWrapper() const;
/// Remove field wrapper.
// Remove any field wrapper on the contained object.
virtual ElementBase *removeFieldWrapper();
/// Remove field wrapper.
// Remove the field wrapper for constant object.
virtual const ElementBase *removeFieldWrapper() const;
/// Return the design element.
// This method removes all wrappers on the contained object.
// Version for non-const object.
virtual ElementBase *removeWrappers();
/// Return the design element.
// Version for const object.
virtual const ElementBase *removeWrappers() const;
private:
AlignWrapper(const AlignWrapper &);
virtual ~AlignWrapper();
// Constructor.
// Constructs an AlignWrapper wrapping the given element.
AlignWrapper(ElementBase *);
// Not implemented.
AlignWrapper();
void operator=(const AlignWrapper &);
// The pointer to the wrapped element.
Pointer<ElementBase> itsElement;
// The offset of the contained element.
// The data member [b]offset[/b] is declared mutable, so as to allow
// setting of a misalignment by a Visitor (algorithm) in an otherwise
// constant line. This mechanism protects the beam line structure against
// accidental change by a Visitor.
mutable Euclid3D itsOffset;
};
#endif // CLASSIC_AlignWrapper_HH
// ------------------------------------------------------------------------
// $RCSfile: AttributeSet.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: AttributeSet
// A map of name (string) versus value (double) intended to store
// user-defined attributes.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/12/16 16:26:43 $
// $Author: mad $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/AttributeSet.h"
#include "AbsBeamline/ElementBase.h"
#include "Channels/DirectChannel.h"
// Class AttributeSet
// ------------------------------------------------------------------------
AttributeSet::AttributeSet():
itsMap()
{}
AttributeSet::AttributeSet(const AttributeSet &rhs):
itsMap(rhs.itsMap)
{}
AttributeSet::~AttributeSet()
{}
const AttributeSet &AttributeSet::operator=(const AttributeSet &rhs)
{
itsMap = rhs.itsMap;
return *this;
}
double AttributeSet::getAttribute(const string &aKey) const
{
const_iterator index = itsMap.find(aKey);
if (index == itsMap.end()) {
return 0.0;
} else {
return index->second;
}
}
bool AttributeSet::hasAttribute(const string &aKey) const
{
return (itsMap.find(aKey) != itsMap.end());
}
void AttributeSet::removeAttribute(const string &aKey)
{
itsMap.erase(aKey);
}
void AttributeSet::setAttribute(const string &aKey, double value)
{
itsMap[aKey] = value;
}
// This method is inlined so its const version can wrap it.
// ada 3-7-2000 remove inline because KCC does not like it.
Channel *AttributeSet::getChannel(const string &aKey, bool create)
{
NameMap::iterator index = itsMap.find(aKey);
if (index == itsMap.end()) {
if (create){
itsMap[aKey] = 0.0;
return new DirectChannel(itsMap[aKey]);
}
// for (NameMap::iterator index = itsMap.begin(); index != itsMap.end(); index++)
return NULL;
} else {
return new DirectChannel((*index).second);
}
}
const ConstChannel *AttributeSet::getConstChannel(const string &aKey) const
{
// Use const_cast to allow calling the non-const GetChannel().
// The const return value will nevertheless inhibit set().
return const_cast<AttributeSet*>(this)->getChannel(aKey);
}
#ifndef CLASSIC_AttributeSet_HH
#define CLASSIC_AttributeSet_HH
// ------------------------------------------------------------------------
// $RCSfile: AttributeSet.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: AttributeSet
// A map of name (string) versus value (double) intended to store
// user-defined attributes.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/12/16 16:26:43 $
// $Author: mad $
//
// ------------------------------------------------------------------------
#include "Channels/Channel.h"
#include <functional>
#include <string>
#include <map>
using namespace std;
//using std::string;
class ElementBase;
// Class AttributeSet
// ------------------------------------------------------------------------
/// Map of string versus double value.
// Class AttributeSet implements a map of name (string) versus value
// (double) for user-defined attributes. This map is intended for
// algorithms that require specific, but not predefined data in the
// accelerator model for their working.
class AttributeSet {
public:
/// A map of name versus value.
typedef std::map<string, double, std::less<string> > NameMap;
/// An iterator for a map of name versus value.
typedef NameMap::const_iterator const_iterator;
/// Default constructor.
// Constructs an empty map.
AttributeSet();
AttributeSet(const AttributeSet &);
virtual ~AttributeSet();
const AttributeSet &operator=(const AttributeSet &);
/// Iterator accessing first member.
const_iterator begin() const;
/// Iterator marking the end of the list.
const_iterator end() const;
/// Get attribute value.
// If the attribute does not exist, return zero.
double getAttribute(const string &aKey) const;
/// Test for presence of an attribute.
// If the attribute exists, return true, otherwise false.
bool hasAttribute(const string &aKey) const;
/// Remove an existing attribute.
// If the key [b]aKey[/b] exists, this method removes it.
void removeAttribute(const string &aKey);
/// Set value of an attribute.
void setAttribute(const string &aKey, double val);
/// Construct a read/write channel.
// This method constructs a Channel permitting read/write access to
// the attribute [b]aKey[/b] and returns it.
// If the attribute does not exist, it returns NULL.
Channel *getChannel(const string &aKey, bool create = false);
/// Construct a read-only channel.
// This method constructs a Channel permitting read-only access to
// the attribute [b]aKey[/b] and returns it.
// If the attribute does not exist, it returns NULL.
const ConstChannel *getConstChannel(const string &aKey) const;
protected:
/// The attribute map.
NameMap itsMap;
};
// Implementation.
// ------------------------------------------------------------------------
inline AttributeSet::const_iterator AttributeSet::begin() const
{ return itsMap.begin(); }
inline AttributeSet::const_iterator AttributeSet::end() const
{ return itsMap.end(); }
#endif // CLASSIC_AttributeSet_HH
// ------------------------------------------------------------------------
// $RCSfile: BeamBeam.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BeamBeam
// Defines the abstract interface for a beam-beam interaction.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/BeamBeam.h"
#include "AbsBeamline/BeamlineVisitor.h"
// Class BeamBeam
// ------------------------------------------------------------------------
BeamBeam::BeamBeam():
Component()
{}
BeamBeam::BeamBeam(const BeamBeam &right):
Component(right)
{}
BeamBeam::BeamBeam(const string &name):
Component(name)
{}
BeamBeam::~BeamBeam()
{}
void BeamBeam::accept(BeamlineVisitor &visitor) const
{
visitor.visitBeamBeam(*this);
}
bool BeamBeam::apply(const int &i, const double &t, double E[], double B[])
{
return false;
}
bool BeamBeam::apply(const int &i, const double &t, Vector_t &E, Vector_t &B)
{
return false;
}
bool BeamBeam::apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B)
{
return false;
}
void BeamBeam::initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor)
{
RefPartBunch_m = bunch;
}
void BeamBeam::finalise()
{}
bool BeamBeam::bends() const
{
return false;
}
void BeamBeam::getDimensions(double &zBegin, double &zEnd) const
{
}
const string& BeamBeam::getType() const
{
static const string type("BeamBeam");
return type;
}
#ifndef CLASSIC_BeamBeam_HH
#define CLASSIC_BeamBeam_HH
// ------------------------------------------------------------------------
// $RCSfile: BeamBeam.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BeamBeam
// Defines the abstract interface for a beam-beam interaction.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Component.h"
class Matrix3D;
class Vector3D;
// Class BeamBeam
// ------------------------------------------------------------------------
/// Abstract beam-beam interaction.
// Class BeamBeam defines the abstract interface for beam-beam interactions.
class BeamBeam: public Component {
public:
/// Constructor with given name.
explicit BeamBeam(const string &name);
BeamBeam();
BeamBeam(const BeamBeam &right);
virtual ~BeamBeam();
/// Apply visitor to BeamBeam.
virtual void accept(BeamlineVisitor &) const;
/// Get bunch charge.
// Return the number of particles times the particle charge in the
// opposite bunch. Units are proton charges.
virtual double getBunchCharge() const = 0;
/// Get moments.
// Return the moment matrix for the opposite bunch
// (the matrix of second momenta). Units are square metres.
virtual const Matrix3D &getBunchMoment() const = 0;
/// Get displacement.
// Return the displacement vector for position of opposite bunch.
// Units are metres.
virtual const Vector3D &getBunchDisplacement() const = 0;
virtual bool apply(const int &i, const double &t, double E[], double B[]);
virtual bool apply(const int &i, const double &t, Vector_t &E, Vector_t &B);
virtual bool apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B);
virtual void initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor);
virtual void finalise();
virtual bool bends() const;
virtual const string& getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
private:
// Not implemented.
void operator=(const BeamBeam &);
};
#endif // CLASSIC_BeamBeam_HH
// ------------------------------------------------------------------------
// $RCSfile: BeamlineVisitor.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BeamlineVisitor
// Defines the abstract interface for a BeamlineVisitor.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/BeamlineVisitor.h"
// Class BeamlineVisitor
// ------------------------------------------------------------------------
BeamlineVisitor::BeamlineVisitor()
{}
BeamlineVisitor::~BeamlineVisitor()
{}
#ifndef CLASSIC_BeamlineVisitor_HH
#define CLASSIC_BeamlineVisitor_HH
// ------------------------------------------------------------------------
// $RCSfile: BeamlineVisitor.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BeamlineVisitor
// Defines the abstract interface for a BeamlineVisitor.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
// Generic element classes interacting with a BeamlineVisitor.
class ElementBase;
class Component;
// Beam line structure classes.
class Beamline;
class AlignWrapper;
class CorrectorWrapper;
class FlaggedElmPtr;
class MultipoleWrapper;
class RBendWrapper;
class SBendWrapper;
class CyclotronWrapper;
// Specific element classes interacting with a BeamlineVisitor
class BeamBeam;
class Collimator;
class Corrector;
class Diagnostic;
class Drift;
class Lambertson;
class Marker;
class Monitor;
class Multipole;
class Patch;
class Probe;
class RBend;
class RFCavity;
class TravelingWave;
class RFQuadrupole;
class SBend;
class Cyclotron;
class Separator;
class Septum;
class Solenoid;
// Integrators.
class Integrator;
class MapIntegrator;
class TrackIntegrator;
// Class BeamlineVisitor
// ------------------------------------------------------------------------
/// Abstract algorithm.
// The abstract class BeamlineVisitor is the base class for all visitors
// (algorithms) that can iterator over a beam line representation.
// A BeamlineVisitor applies itself to the representation via the
// ``Visitor'' pattern, see
// [p]
// E. Gamma, R. Helm, R. Johnson, and J. Vlissides,
// [BR]
// Design Patterns, Elements of Reusable Object-Oriented Software.
// [p]
// By using only pure abstract classes as an interface between the
// BeamlineVisitor and the beam line representation,
// we decouple the former from the implementation details of the latter.
// [p]
// The interface is defined in such a way that a visitor cannot modify the
// structure of a beam line, but it can assign special data like misalignments
// or integrators without problems.
class BeamlineVisitor {
public:
BeamlineVisitor();
virtual ~BeamlineVisitor();
/// Execute the algorithm on the attached beam line.
virtual void execute() = 0;
/// Apply the algorithm to a beam-beam interaction.
virtual void visitBeamBeam(const BeamBeam &) = 0;
/// Apply the algorithm to a collimator.
virtual void visitCollimator(const Collimator &) = 0;
/// Apply the algorithm to an arbitrary component (catch all).
virtual void visitComponent(const Component &) = 0;
/// Apply the algorithm to a closed orbit corrector.
virtual void visitCorrector(const Corrector &) = 0;
/// Apply the algorithm to a diagnostic.
virtual void visitDiagnostic(const Diagnostic &) = 0;
/// Apply the algorithm to a drift space.
virtual void visitDrift(const Drift &) = 0;
/// Apply the algorithm to a drift space.
virtual void visitCyclotron(const Cyclotron &) = 0;
/// Apply the algorithm to a Lambertson septum magnet.
virtual void visitLambertson(const Lambertson &) = 0;
/// Apply the algorithm to a marker.
virtual void visitMarker(const Marker &) = 0;
/// Apply the algorithm to a beam position monitor.
virtual void visitMonitor(const Monitor &) = 0;
/// Apply the algorithm to a multipole.
virtual void visitMultipole(const Multipole &) = 0;
/// Apply the algorithm to a patch.
virtual void visitPatch(const Patch &) = 0;
/// Apply the algorithm to a probe.
virtual void visitProbe(const Probe &) = 0;
/// Apply the algorithm to a rectangular bend.
virtual void visitRBend(const RBend &) = 0;
/// Apply the algorithm to a RF cavity.
virtual void visitRFCavity(const RFCavity &) = 0;
/// Apply the algorithm to a RF cavity.
virtual void visitTravelingWave(const TravelingWave &) = 0;
/// Apply the algorithm to a RF quadrupole.
virtual void visitRFQuadrupole(const RFQuadrupole &) = 0;
/// Apply the algorithm to a sector bend.
virtual void visitSBend(const SBend &) = 0;
/// Apply the algorithm to an electrostatic separator.
virtual void visitSeparator(const Separator &) = 0;
/// Apply the algorithm to a septum magnet.
virtual void visitSeptum(const Septum &) = 0;
/// Apply the algorithm to a solenoid.
virtual void visitSolenoid(const Solenoid &) = 0;
/// Apply the algorithm to a Beamline.
virtual void visitBeamline(const Beamline &) = 0;
/// Apply the algorithm to a FlaggedElmPtr.
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &) = 0;
/// Apply the algorithm to an align wrapper.
virtual void visitAlignWrapper(const AlignWrapper &) = 0;
/// Apply the algorithm to an corrector wrapper.
virtual void visitCorrectorWrapper(const CorrectorWrapper &) = 0;
/// Apply the algorithm to an corrector wrapper.
virtual void visitCyclotronWrapper(const CyclotronWrapper &) = 0;
/// Apply the algorithm to an multipole wrapper.
virtual void visitMultipoleWrapper(const MultipoleWrapper &) = 0;
/// Apply the algorithm to an RBend wrapper.
virtual void visitRBendWrapper(const RBendWrapper &) = 0;
/// Apply the algorithm to an SBend wrapper.
virtual void visitSBendWrapper(const SBendWrapper &) = 0;
/// Apply the algorithm to a generic integrator.
virtual void visitIntegrator(const Integrator &) = 0;
/// Apply the algorithm to an integrator capable of tracking.
virtual void visitTrackIntegrator(const TrackIntegrator &) = 0;
/// Apply the algorithm to an integrator capable of mapping.
virtual void visitMapIntegrator(const MapIntegrator &) = 0;
private:
// Not implemented.
BeamlineVisitor(const BeamlineVisitor &);
void operator=(const BeamlineVisitor &);
};
#endif // CLASSIC_BeamlineVisitor_HH
// ------------------------------------------------------------------------
// $RCSfile: Collimator.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Collimator
// Defines the abstract interface for a beam Collimator.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "Physics/Physics.h"
#include "AbsBeamline/Collimator.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "Fields/Fieldmap.hh"
#include "AbstractObjects/OpalData.h"
extern Inform *gmsg;
// Class Collimator
// ------------------------------------------------------------------------
Collimator::Collimator():
Component(),
H5file_m(NULL),
filename_m(""),
plane_m(OFF),
position_m(0.0),
PosX_m(0),
PosY_m(0),
PosZ_m(0),
MomentumX_m(0),
MomentumY_m(0),
MomentumZ_m(0),
time_m(0),
id_m(0),
informed_m(false),
a_m(0.0),
b_m(0.0),
x0_m(0.0),
y0_m(0.0),
isAPepperPot_m(false),
isASlit_m(false),
isARColl_m(false),
isAWire_m(false),
rHole_m(0.0),
nHolesX_m(0),
nHolesY_m(0),
pitch_m(0.0)
{}
Collimator::Collimator(const Collimator &right):
Component(right),
H5file_m(NULL),
filename_m(right.filename_m),
plane_m(right.plane_m),
position_m(right.position_m),
PosX_m(right.PosX_m),
PosY_m(right.PosY_m),
PosZ_m(right.PosZ_m),
MomentumX_m(right.MomentumX_m),
MomentumY_m(right.MomentumY_m),
MomentumZ_m(right.MomentumZ_m),
time_m(right.time_m),
id_m(right.id_m),
informed_m(right.informed_m),
a_m(right.a_m),
b_m(right.b_m),
x0_m(right.x0_m),
y0_m(right.y0_m),
isAPepperPot_m(right.isAPepperPot_m),
isASlit_m(right.isASlit_m),
isARColl_m(right.isARColl_m),
isAWire_m(right.isAWire_m),
rHole_m(right.rHole_m),
nHolesX_m(right.nHolesX_m),
nHolesY_m(right.nHolesY_m),
pitch_m(right.pitch_m)
{}
Collimator::Collimator(const string &name):
Component(name),
H5file_m(NULL),
filename_m(""),
plane_m(OFF),
position_m(0.0),
PosX_m(0),
PosY_m(0),
PosZ_m(0),
MomentumX_m(0),
MomentumY_m(0),
MomentumZ_m(0),
time_m(0),
id_m(0),
informed_m(false),
a_m(0.0),
b_m(0.0),
x0_m(0.0),
y0_m(0.0),
isAPepperPot_m(false),
isASlit_m(false),
isARColl_m(false),
isAWire_m(false),
rHole_m(0.0),
nHolesX_m(0),
nHolesY_m(0),
pitch_m(0.0)
{}
Collimator::~Collimator()
{
}
void Collimator::accept(BeamlineVisitor &visitor) const
{
visitor.visitCollimator(*this);
}
bool Collimator::apply(const int &i, const double &t, double E[], double B[])
{
Vector_t Ev(0,0,0), Bv(0,0,0);
return apply(i,t,Ev,Bv);
}
bool Collimator::apply(const int &i, const double &t, Vector_t &E, Vector_t &B)
{
const Vector_t &R = RefPartBunch_m->R[i];
const Vector_t &P = RefPartBunch_m->P[i];
const double recpgamma = Physics::c * RefPartBunch_m->getdT() / sqrt(1.0 + dot(P,P));
/** check if we are in the longitudinal
range of the collimator
*/
const double z = R(2) + P(2) * recpgamma;
/// particle is not dead
bool pdead = false;
if ((z > position_m) && (z <= position_m + getElementLength()))
{
if (isAPepperPot_m)
{
/**
------------
|(0)| |(0)|
---- -----
| a) |
| |
---- -----
|(0)| |(0)|
yL------------
xL
|---| d
|--| pitch
Observation: the area in a) is much larger than the
area(s) (0). In a) particles are lost in (0)
particles they are not lost.
*/
const double h = pitch_m;
const double xL = - 0.5*h*(nHolesX_m-1);
const double yL = - 0.5*h*(nHolesY_m-1);
bool alive = false;
for (int m=0; (m<nHolesX_m && (!alive)); m++) {
for (int n=0; (n<nHolesY_m && (!alive)); n++) {
double x_m = xL + (m*h);
double y_m = yL + (n*h);
/** are we in a) ? */
double rr = std::pow((R(0)-x_m)/rHole_m,2) + std::pow((R(1)-y_m)/rHole_m,2);
alive = (rr < 1.0);
}
}
pdead = !alive;
}
else {
// case of an elliptic collimator
}
if (pdead)
{
double frac = (R(2) - position_m) / P(2) * recpgamma;
PosX_m.push_back(R(0));
PosY_m.push_back(R(1));
PosZ_m.push_back(z);
MomentumX_m.push_back(P(0));
MomentumY_m.push_back(P(1));
MomentumZ_m.push_back(P(2));
time_m.push_back(t + frac * RefPartBunch_m->getdT());
id_m.push_back(i);
}
}
return pdead;
}
bool Collimator::apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B)
{
return false;
}
void Collimator::initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor)
{
RefPartBunch_m = bunch;
position_m = startField;
endField = position_m + getElementLength();
}
void Collimator::finalise()
{}
void Collimator::goOnline()
{
Inform msg("Collimator ");
if (RefPartBunch_m == NULL)
{
if (!informed_m)
{
string errormsg = Fieldmap::typeset_msg("BUNCH SIZE NOT SET", "warning");
msg << errormsg << "\n"
<< endl;
if (Ippl::myNode() == 0) {
ofstream omsg("errormsg.txt", ios_base::app);
omsg << errormsg << endl;
omsg.close();
}
informed_m = true;
}
return;
}
if (isAPepperPot_m)
msg << "Pepperpot x= " << a_m << " y= " << b_m << " r= " << rHole_m << " nx= " << nHolesX_m << " ny= " << nHolesY_m << " pitch= " << pitch_m << endl;
else if (isASlit_m)
msg << "Slit x= " << getXsize() << " start= " << position_m << " fn= " << filename_m << " ny= " << nHolesY_m << " pitch= " << pitch_m << endl;
else if(isARColl_m)
msg << "RCollimator a= " << getXsize() << " b= " << b_m << " start= " << position_m << " fn= " << filename_m << " ny= " << nHolesY_m << " pitch= " << pitch_m << endl;
else if(isAWire_m)
msg << "Wire x= " << x0_m << " y= " << y0_m << endl;
else
msg << "ECollimator a= " << getXsize() << " b= " << b_m << " start= " << position_m << " fn= " << filename_m << " ny= " << nHolesY_m << " pitch= " << pitch_m << endl;
PosX_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
PosY_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
PosZ_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
MomentumX_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
MomentumY_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
MomentumZ_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
time_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
id_m.reserve((int)(1.1 * RefPartBunch_m->getLocalNum()));
online_m = true;
}
void Collimator::goOffline()
{
Inform msg("Collimator::goOffline( ");
reduce(online_m,online_m,OpOr());
if (online_m) {
online_m = false;
if (filename_m == "") return;
/**
Check how much particles we have lost
*/
int localLost = PosX_m.size();
int globLost = 0;
reduce(localLost,globLost,OpAddAssign());
/**
Check if we have to append of
if we write a new file
*/
if (globLost != 0) {
ifstream inp;
inp.open(filename_m.c_str(), ifstream::in);
inp.close();
if(inp.fail()) {
#ifdef PARALLEL_IO
H5file_m=H5PartOpenFileParallel(filename_m.c_str(),H5PART_WRITE,MPI_COMM_WORLD);
#else
H5file_m=H5PartOpenFile(filename_m.c_str(),H5PART_WRITE);
#endif
H5PartSetStep(H5file_m,0);
msg << "Lost " << globLost << " partices at collimator/pepperpot " << getName() << " write step 0" << endl;
H5PartWriteFileAttribString(H5file_m,"timeUnit","s");
H5PartWriteFileAttribString(H5file_m,"xUnit","m");
H5PartWriteFileAttribString(H5file_m,"yUnit","m");
H5PartWriteFileAttribString(H5file_m,"zUnit","m");
H5PartWriteFileAttribString(H5file_m,"pxUnit","#beta#gamma");
H5PartWriteFileAttribString(H5file_m,"pyUnit","#beta#gamma");
H5PartWriteFileAttribString(H5file_m,"pzUnit","#beta#gamma");
} else {
#ifdef PARALLEL_IO
H5file_m=H5PartOpenFileParallel(filename_m.c_str(),H5PART_APPEND,MPI_COMM_WORLD);
#else
H5file_m=H5PartOpenFile(filename_m.c_str(),H5PART_APPEND);
#endif
int numStepsInFile = H5PartGetNumSteps(H5file_m);
H5PartSetStep(H5file_m,numStepsInFile);
msg << "Lost " << globLost << " partices at collimator/pepperpot " << getName() << " append step " << numStepsInFile << endl;
}
} else {
msg << "collimator/pepperpot not used" << getName() << endl;
return;
}
H5PartSetNumParticles(H5file_m,PosX_m.size());
void *varray = malloc(PosX_m.size()*sizeof(double));
double *fvalues = (double*)varray;
h5part_int64_t *ids = (h5part_int64_t *)varray;
int i = 0;
vector<double>::iterator it;
for (it = PosX_m.begin(); it != PosX_m.end(); ++it)
fvalues[i++] = *it;
H5PartWriteDataFloat64(H5file_m,"x",fvalues);
i = 0;
for (it = PosY_m.begin(); it != PosY_m.end(); ++it)
fvalues[i++] = *it;
H5PartWriteDataFloat64(H5file_m,"y",fvalues);
i = 0;
for (it = PosZ_m.begin(); it != PosZ_m.end(); ++it)
fvalues[i++] = *it;
H5PartWriteDataFloat64(H5file_m,"z",fvalues);
i = 0;
for (it = MomentumX_m.begin(); it != MomentumX_m.end(); ++it)
fvalues[i++] = *it;
H5PartWriteDataFloat64(H5file_m,"px",fvalues);
i = 0;
for (it = MomentumY_m.begin(); it != MomentumY_m.end(); ++it)
fvalues[i++] = *it;
H5PartWriteDataFloat64(H5file_m,"py",fvalues);
i = 0;
for (it = MomentumZ_m.begin(); it != MomentumZ_m.end(); ++it)
fvalues[i++] = *it;
H5PartWriteDataFloat64(H5file_m,"pz",fvalues);
i = 0;
for (it = time_m.begin(); it != time_m.end(); ++it)
fvalues[i++] = *it;
H5PartWriteDataFloat64(H5file_m,"time",fvalues);
i = 0;
for (vector<int>::iterator int_it = id_m.begin(); int_it != id_m.end(); ++int_it)
ids[i++] = *int_it;
H5PartWriteDataInt64(H5file_m,"id",ids);
H5Fflush(H5file_m->file,H5F_SCOPE_GLOBAL);
free(varray);
H5PartCloseFile(H5file_m);
PosX_m.clear();
PosY_m.clear();
PosZ_m.clear();
MomentumX_m.clear();
MomentumY_m.clear();
MomentumZ_m.clear();
time_m.clear();
id_m.clear();
}
}
bool Collimator::bends() const
{
return false;
}
void Collimator::setOutputFN(string fn)
{
filename_m = fn;
}
string Collimator::getOutputFN()
{
return filename_m;
}
void Collimator::setXsize(double a)
{
a_m=a;
}
void Collimator::setYsize(double b)
{
b_m=b;
}
void Collimator::setXpos(double x0)
{
x0_m=x0;
}
void Collimator::setYpos(double y0)
{
y0_m=y0;
}
double Collimator::getXsize(double a)
{
return a_m;
}
double Collimator::getYsize(double b)
{
return b_m;
}
double Collimator::getXpos()
{
return x0_m;
}
double Collimator::getYpos()
{
return y0_m;
}
void Collimator::setRHole (double r)
{
rHole_m = r;
}
void Collimator::setNHoles (unsigned int nx, unsigned int ny)
{
nHolesX_m = nx;
nHolesY_m = ny;
}
void Collimator::setPitch(double p)
{
pitch_m = p;
}
void Collimator::setPepperPot()
{
isAPepperPot_m=true;
}
void Collimator::setSlit()
{
isASlit_m=true;
}
void Collimator::setRColl()
{
isARColl_m=true;
}
void Collimator::setWire()
{
isAWire_m=true;
}
void Collimator::getDimensions(double &zBegin, double &zEnd) const
{
zBegin=position_m;
zEnd=position_m + getElementLength();
// zBegin = position_m - 0.005;
// zEnd = position_m + 0.005;
}
const string& Collimator::getType() const
{
static const string type("Collimator");
return type;
}
string Collimator::getCollimatorShape()
{
if (isAPepperPot_m)
return "PeperPot";
else if (isASlit_m)
return "Slit";
else if (isARColl_m)
return "RCollimator";
else if (isAWire_m)
return "Wire";
else
return "ECollimator";
}
#ifndef CLASSIC_Collimator_HH
#define CLASSIC_Collimator_HH
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Collimator
// Defines the abstract interface for a beam Collimator.
// *** MISSING *** Collimator interface is still incomplete.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Component.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "BeamlineGeometry/StraightGeometry.h"
#include <hdf5.h>
#include "H5Part.h"
#include <vector>
// Class Collimator
// ------------------------------------------------------------------------
/// Abstract collimator.
// Class Collimator defines the abstract interface for a collimator.
class Collimator: public Component {
public:
/// Plane selection.
enum Plane {
/// Monitor is off (inactive).
OFF,
/// Monitor acts on x-plane.
X,
/// Monitor acts on y-plane.
Y,
/// Monitor acts on both planes.
XY
};
/// Constructor with given name.
explicit Collimator(const string &name);
Collimator();
Collimator(const Collimator &rhs);
virtual ~Collimator();
/// Apply visitor to Collimator.
virtual void accept(BeamlineVisitor &) const;
/// Return the horizontal half-aperture.
virtual double getXsize() const {return a_m;}
/// Return the vertical half-aperture.
virtual double getYsize() const {return b_m;}
virtual bool apply(const int &i, const double &t, double E[], double B[]);
virtual bool apply(const int &i, const double &t, Vector_t &E, Vector_t &B);
virtual bool apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B);
virtual void initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor);
virtual void finalise();
virtual bool bends() const;
virtual void goOnline();
virtual void goOffline();
virtual const string& getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
string getCollimatorShape();
void setOutputFN(string fn);
string getOutputFN();
void setXsize(double a) ;
void setYsize(double b) ;
void setXpos(double x0) ;
void setYpos(double y0) ;
double getXsize(double a) ;
double getYsize(double b) ;
double getXpos() ;
double getYpos() ;
void setRHole (double r) ;
void setNHoles (unsigned int nx, unsigned int ny) ;
void setPitch(double p) ;
void setPepperPot() ;
void setSlit() ;
void setRColl() ;
void setWire() ;
private:
// Not implemented.
void operator=(const Collimator &);
H5PartFile *H5file_m;
string filename_m; /**< The name of the outputfile*/
Plane plane_m;
double position_m;
vector<double> PosX_m;
vector<double> PosY_m;
vector<double> PosZ_m;
vector<double> MomentumX_m;
vector<double> MomentumY_m;
vector<double> MomentumZ_m;
vector<double> time_m;
vector<int> id_m;
bool informed_m;
double a_m;
double b_m;
double x0_m;
double y0_m;
/** This defines a pepperpot */
bool isAPepperPot_m;
bool isASlit_m;
bool isARColl_m;
bool isAWire_m;
double rHole_m;
unsigned int nHolesX_m;
unsigned int nHolesY_m;
double pitch_m;
};
#endif // CLASSIC_Collimator_HH
// ------------------------------------------------------------------------
// $RCSfile: Component.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Component
// An abstract base class which defines the common interface for all
// CLASSIC components, i.e. beamline members which are not themselves
// beamlines.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Component.h"
#include "Utilities/LogicalError.h"
// Class Component
// ------------------------------------------------------------------------
// Represents an arbitrary component in an accelerator. A component is
// the basic element in the accelerator model, and can be thought of as
// acting as a leaf in the Composite pattern. A Component is associated
// with an electromagnetic field.
Component::Component():
ElementBase(),
RefPartBunch_m(NULL),
dx_m(0.0),
dy_m(0.0),
ds_m(0.0),
online_m(false),
exit_face_slope_m(0.0),
Orientation_m(Vector_t(0.0, 0.0, 0.0))
{}
Component::Component(const Component &right):
ElementBase(right),
RefPartBunch_m(right.RefPartBunch_m),
dx_m(right.dx_m),
dy_m(right.dy_m),
ds_m(right.ds_m),
online_m(right.online_m),
exit_face_slope_m(right.exit_face_slope_m),
Orientation_m(right.Orientation_m)
{}
Component::Component(const string &name):
ElementBase(name),
RefPartBunch_m(NULL),
dx_m(0.0),
dy_m(0.0),
ds_m(0.0),
online_m(false),
exit_face_slope_m(0.0),
Orientation_m(Vector_t(0.0, 0.0, 0.0))
{
}
Component::~Component()
{}
const ElementBase &Component::getDesign() const
{
return *this;
}
void Component::trackBunch(PartBunch &, const PartData &, bool, bool) const
{
throw LogicalError("Component::trackBunch()",
"Called for component \"" + getName() + "\".");
}
void Component::
trackMap(FVps<double,6> &, const PartData &, bool, bool) const
{
throw LogicalError("Component::trackMap()",
"Called for component \"" + getName() + "\".");
}
void Component::initialise(PartBunch *bunch, const double &scaleFactor)
{}
void Component::initialise(PartBunch *bunch, const int &fieldflag, const double &scaleFactor)
{}
void Component::goOnline()
{
online_m = true;
}
void Component::goOffline()
{
online_m = false;
}
bool Component::Online()
{
return online_m;
}
void Component::setMisalignment(double x, double y, double s)
{
dx_m = x;
dy_m = y;
ds_m = s;
}
void Component::getMisalignment(double &x, double &y, double &s) const
{
x = dx_m;
y = dy_m;
s = ds_m;
}
const string& Component::getType() const
{
static const string type("");
return type;
}
#ifndef CLASSIC_Component_HH
#define CLASSIC_Component_HH
// ------------------------------------------------------------------------
// $RCSfile: Component.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Component
// An abstract base class which defines the common interface for all
// CLASSIC components, i.e. beam line members which are not themselves
// beam lines.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/ElementBase.h"
#include "Fields/EMField.h"
#include "Algorithms/PartBunch.h"
#define EPS_MISALIGNMENT 1e-8
class PartData;
//class PartBunch;
template <class T, int N> class FVps;
// Class Component
// ------------------------------------------------------------------------
/// Interface for a single beam element.
// Class Component defines the abstract interface for an arbitrary single
// component in a beam line. A component is the basic element in the
// accelerator model, like a dipole, a quadrupole, etc. It is normally
// associated with an electro-magnetic field, which may be null.
class Component: public ElementBase {
public:
/// Constructor with given name.
explicit Component(const string &name);
Component();
Component(const Component &right);
virtual ~Component();
/// Return field.
// The representation of the electro-magnetic field of the component
// (version for non-constant object).
virtual EMField &getField() = 0;
/// Return field.
// The representation of the electro-magnetic field of the component
// (version for constant object).
virtual const EMField &getField() const = 0;
/// Return the field in a point.
// Return the value of the time-independent part of the electric
// field at point [b]P[/b].
EVector Efield(const Point3D &P) const;
/// Return the field in a point.
// Return the value of the time-independent part of the magnetic
// field at point [b]P[/b].
BVector Bfield(const Point3D &P) const;
/// Return the field in a point.
// Return the value of the time-dependent part of the electric
// field at point [b]P[/b] for time [b]t[/b].
EVector Efield(const Point3D &P, double t) const;
/// Return the field in a point.
// Return the value of the time-dependent part of the magnetic
// field at point [b]P[/b] for time [b]t[/b].
BVector Bfield(const Point3D &P, double t) const;
/// Return the field in a point.
// Return the value of the time-independent part of both electric
// and magnetic fields at point [b]P[/b].
EBVectors EBfield(const Point3D &P) const;
/// Return the field in a point.
// Return the value of the time-dependent part of both electric
// and magnetic fields at point [b]P[/b] for time [b]t[/b].
EBVectors EBfield(const Point3D &P, double t) const;
virtual void addKR(int i, double t, Vector_t &K) {};
virtual void addKT(int i, double t, Vector_t &K) {};
virtual bool apply(const int &i, const double &t, double E[], double B[]) = 0;
virtual bool apply(const int &i, const double &t, Vector_t &E, Vector_t &B) = 0;
virtual bool apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B) = 0;
virtual void initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor) = 0;
virtual void initialise(PartBunch *bunch, const double &scaleFactor);
virtual void initialise(PartBunch *bunch, const int &fieldflag, const double &scaleFactor);
virtual void finalise() = 0;
virtual bool bends() const = 0;
virtual void goOnline();
virtual void goOffline();
virtual bool Online();
void getOrientation(Vector_t &, double& ) const; // first component is alpha, second is beta. the third component is always neglected.
// alpha is defined as the angle between projection of the normal of the face of the element onto
// the s-u plane and the s vector. for beta the following is valid:
// beta = arccos(|n_{parallel}|) where n_{parallel} is the projection of the normal onto the s-u
// plane
void setOrientation(const Vector_t &direction);
virtual void getDimensions(double &zBegin, double &zEnd) const = 0;
/**
Methods for the cyclotron cmd.
*/
virtual double getRinit() { } ;
virtual double getPRinit() { } ;
virtual double getPHIinit() { } ;
virtual string getFieldMapFN() { } ;
virtual double getRfFrequ() { } ;
virtual double getSymmetry() { } ;
virtual double getTCr1() { } ;
virtual double getTCr2() { } ;
virtual double getMBtc() { } ;
virtual double getSLPtc() { } ;
virtual const string& getType() const;
virtual double getCyclHarm() { } ;
virtual void readFieldMap(double scaleFactor) { };
virtual double getBScale() { };
virtual double getRmax() { };
virtual double getRmin() { };
virtual void setComponentType(string name) { };
virtual string getComponentType() const { };
/// Return design element.
// If a component is a wrapper, this method returns a pointer to
// its underlying design element, otherwise a pointer to this component.
// The default version returns ``this''.
virtual const ElementBase &getDesign() const;
/// Track particle bunch.
// This catch-all method implements a hook for tracking a particle
// bunch through a non-standard component.
// The default version throws a LogicalError.
virtual void trackBunch(PartBunch &bunch, const PartData &,
bool revBeam, bool revTrack) const;
/// Track a map.
// This catch-all method implements a hook for tracking a transfer
// map through a non-standard component.
// The default version throws a LogicalError.
virtual void trackMap(FVps<double,6> &map, const PartData &,
bool revBeam, bool revTrack) const;
void setMisalignment(double x, double y, double s);
void getMisalignment(double &x, double &y, double &s) const;
void setExitFaceSlope(const double&);
protected:
double dx_m;
double dy_m;
double ds_m;
Vector_t Orientation_m;
double exit_face_slope_m;
PartBunch *RefPartBunch_m;
bool online_m;
};
// Inline access functions to fields.
// ------------------------------------------------------------------------
inline EVector Component::Efield(const Point3D &P) const
{ return getField().Efield(P); }
inline BVector Component::Bfield(const Point3D &P) const
{ return getField().Bfield(P); }
inline EVector Component::Efield(const Point3D &P, double t) const
{ return getField().Efield(P, t); }
inline BVector Component::Bfield(const Point3D &P, double t) const
{ return getField().Bfield(P, t); }
inline EBVectors Component::EBfield(const Point3D &P) const
{ return getField().EBfield(P); }
inline EBVectors Component::EBfield(const Point3D &P, double t) const
{ return getField().EBfield(P, t); }
inline void Component::getOrientation(Vector_t& ori, double& m) const
{
ori = Orientation_m;
m = exit_face_slope_m;
}
inline void Component::setOrientation(const Vector_t &direction)
{ Orientation_m = direction; }
inline void Component::setExitFaceSlope(const double& m)
{ exit_face_slope_m = m; }
#endif // CLASSIC_Component_HH
// ------------------------------------------------------------------------
// $RCSfile: Corrector.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Corrector
// Defines the abstract interface for a orbit corrector.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Corrector.h"
#include "AbsBeamline/BeamlineVisitor.h"
// Class Corrector
// ------------------------------------------------------------------------
Corrector::Corrector():
Component()
{ }
Corrector::Corrector(const Corrector &right):
Component(right)
{ }
Corrector::Corrector(const string &name):
Component(name)
{ }
Corrector::~Corrector()
{ }
void Corrector::accept(BeamlineVisitor &visitor) const
{
visitor.visitCorrector(*this);
}
bool Corrector::apply(const int &i, const double &t, double E[], double B[])
{
return false;
}
bool Corrector::apply(const int &i, const double &t, Vector_t &E, Vector_t &B)
{
return false;
}
bool Corrector::apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B)
{
return false;
}
void Corrector::initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor)
{
RefPartBunch_m = bunch;
}
void Corrector::finalise()
{ }
bool Corrector::bends() const
{
return false;
}
void Corrector::getDimensions(double &zBegin, double &zEnd) const
{ }
const string& Corrector::getType() const
{
static const string type("Corrector");
return type;
}
#ifndef CLASSIC_Corrector_HH
#define CLASSIC_Corrector_HH
// ------------------------------------------------------------------------
// $RCSfile: Corrector.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Corrector
// Defines the abstract interface for a orbit corrector.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Component.h"
#include "AbsBeamline/BeamlineVisitor.h"
#include "BeamlineGeometry/StraightGeometry.h"
#include "Fields/BDipoleField.h"
// Class Corrector
// ------------------------------------------------------------------------
/// Interface for general corrector.
// Class Corrector defines the abstract interface for closed orbit
// correctors.
class Corrector: public Component {
public:
/// Plane selection.
enum Plane {
/// Corrector is off (inactive).
OFF,
/// Corrector acts on x-plane.
X,
/// Corrector acts on y-plane.
Y,
/// Corrector acts on both planes.
XY
};
/// Constructor with given name.
explicit Corrector(const string &name);
Corrector();
Corrector(const Corrector &right);
virtual ~Corrector();
/// Apply a visitor to Corrector.
virtual void accept(BeamlineVisitor &) const;
/// Return the corrector field.
// Version for non-constant object.
virtual BDipoleField &getField() = 0;
/// Return the corrector field.
// Version for constant object.
virtual const BDipoleField &getField() const = 0;
/// Return the corrector geometry.
virtual StraightGeometry &getGeometry() = 0;
/// Return the corrector geometry. Version for const object.
virtual const StraightGeometry &getGeometry() const = 0;
/// Return the plane on which the corrector acts.
virtual Plane getPlane() const = 0;
virtual bool apply(const int &i, const double &t, double E[], double B[]);
virtual bool apply(const int &i, const double &t, Vector_t &E, Vector_t &B);
virtual bool apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B);
virtual void initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor);
virtual void finalise();
virtual bool bends() const;
virtual const string& getType() const;
virtual void getDimensions(double &zBegin, double &zEnd) const;
protected:
// Not implemented.
void operator=(const Corrector &);
};
#endif // CLASSIC_Corrector_HH
This diff is collapsed.
This diff is collapsed.
// ------------------------------------------------------------------------
// $RCSfile: Diagnostic.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: Diagnostic
// Defines the abstract interface for a beam diagnostic.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------
#include "AbsBeamline/Diagnostic.h"
#include "AbsBeamline/BeamlineVisitor.h"
// Class Diagnostic
// ------------------------------------------------------------------------
Diagnostic::Diagnostic():
Component()
{ }
Diagnostic::Diagnostic(const Diagnostic &rhs):
Component(rhs)
{ }
Diagnostic::Diagnostic(const string &name):
Component(name)
{ }
Diagnostic::~Diagnostic()
{ }
void Diagnostic::accept(BeamlineVisitor &visitor) const
{
visitor.visitDiagnostic(*this);
}
bool Diagnostic::apply(const int &i, const double &t, double E[], double B[])
{
return false;
}
bool Diagnostic::apply(const int &i, const double &t, Vector_t &E, Vector_t &B)
{
return false;
}
bool Diagnostic::apply(const Vector_t &R, const Vector_t &centroid, const double &t, Vector_t &E, Vector_t &B)
{
return false;
}
void Diagnostic::initialise(PartBunch *bunch, double &startField, double &endField, const double &scaleFactor)
{
RefPartBunch_m = bunch;
}
void Diagnostic::finalise()
{ }
bool Diagnostic::bends() const
{
return false;
}
const string& Diagnostic::getType() const
{
static const string type("Diagnostic");
return type;
}
void Diagnostic::getDimensions(double &zBegin, double &zEnd) const
{ }
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