Skip to content
Snippets Groups Projects
Commit 4cab3815 authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

Merge branch 'ArchitectureDoc' into develop

parents 802d79eb 542e80fe
No related branches found
No related tags found
No related merge requests found
File added
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{float}
\usepackage{tikz}
\usepackage{tikz-uml}
\usepackage{amsmath}
\newcommand{\reffig}[1]{figure \ref{fig:#1}}
%opening
\title{}
\author{}
\begin{document}
%\maketitle
\begin{abstract}
This document describes the general architecture of the BornAgain project.
\end{abstract}
\section{Data classes for simulations and fits}
This section will give an overview of the classes that are used to describe all the data needed to perform a single simulation. The prime elements of this data are formed by the sample, the experimental conditions (beam and detector parameters) and simulation parameters.
These classes constitute the main interface to the software's users, since they will mostly be interacting with the program by creating samples and running simulations with specific parameters. Since it is not the intent to explain internals of classes in this document, the text and figures will only mention the most important methods and fields of the classes discussed. Furthermore, getters and setters of private member fields will not be indicated, although these do belong to the public interface. For more detailed information about the project's classes, their methods and fields, the reader is referred to the source code documentation. REF?
\subsection{The Experiment object}
The Experiment class holds all references to data objects that are needed to perform a simulation. These consist of a sample description, possibly implemented by a builder object, detector and beam parameters and finally, a simulation parameter class that defines the different approximations that can be used during a simulation. Besides getters and setters for these fields, the class also contains a runSimulation() method that will generate an ISimulation object that will perform the actual computations. The class diagram for Experiment is shown in \reffig{exp}.
\vspace{8mm}
\begin{figure}[H]
%the makebox macro ensures centering of the resulting figure
\makebox[\textwidth][c]{
\begin{tikzpicture}
\begin{umlpackage}{Simulation Data}
\umlclass{Experiment}{
-- mp\_sample : ISample* \\
-- mp\_sample\_builder : ISampleBuilder* \\
-- m\_detector : Detector \\
-- m\_beam : Beam \\
-- m\_intensity\_map : OutputData<double> \\
-- m\_sim\_params : SimulationParameters
}{
\umlvirt{+ clone() : Experiment*} \\
\umlvirt{+ runSimulation() : void} \\
\umlvirt{+ normalize() : void}
}
\umlemptyclass[x=7, y=0]{ISample}
\umlemptyclass[x=7, y=-2]{Detector}
\umlemptyclass[x=7, y=-4]{Beam}
\umlemptyclass[x=7, y=-6]{SimulationParameters}
\umlemptyclass[y=-4]{GISASExperiment}
\umluniassoc[geometry=|-, anchor1=0]{Experiment}{ISample}
\umluniassoc[geometry=|-, anchor1=0]{Experiment}{Detector}
\umluniassoc[geometry=|-, anchor1=0]{Experiment}{Beam}
\umluniassoc[geometry=|-, anchor1=0]{Experiment}{SimulationParameters}
\umlinherit[geometry=--]{GISASExperiment}{Experiment}
\umlnote[y=-6.5, width=6cm]{GISASExperiment}{
The ``runSimulation()'' method retrieves an ISimulation object
from the topmost ISample object and calls its ``run()'' method
to perform the actual computations.
}
\end{umlpackage}
\end{tikzpicture}
} %end makebox
\caption{The Experiment class as a container for sample, beam, detector and simulation parameters.}
\label{fig:exp}
\end{figure}
\subsection{The ISample class hi\"erarchy}
Samples are described by a hi\"erarchy tree of objects which all adhere to the ISample interface. The composite pattern is used to achieve a common interface for all objects in the sample tree. The sample description is maximally decoupled from all computational classes, with the exception of the ``createDWBASimulation()'' method. This method will create a new object of type ``DWBASimulation'' that is capable of calculating the scattering contributions originating from the sample in question. The coupling is however not very tight, since the ISample subclasses only need to know about which class to instantiate and return.
This interface and two of its subclasses are sketched in \reffig{isample}.
\vspace{8mm}
\begin{figure}[H]
\makebox[\textwidth][c]{
\begin{tikzpicture}
\begin{umlpackage}{Sample description}
% Code from official documentation goes here...
\umlinterface{ISample}{
}{
\umlvirt{+ clone() : ISample*} \\
\umlvirt{+ createDWBASimulation() : DWBASimulation*}
}
\umlclass[y=-4]{MultiLayer}{
-- m\_layers : std::vector<Layer *> \\
-- m\_interfaces : std::vector<LayerInterface *>
}{
+ getNumberOfLayers() : size\_t \\
+ getNumberOfInterfaces() : size\_t \\
+ addLayer(const Layer \&layer) : void
}
\umlclass[x=8,y=-4]{Layer}{
-- mp\_material : IMaterial* \\
-- m\_thickness : double
}{
+ getThickness() : double \\
+ setThickness(double thickness) : void
}
\umlinherit[geometry=-|]{MultiLayer}{ISample}
\umlinherit[geometry=|-]{Layer}{ISample}
\umluniassoc[geometry=--, mult2=n]{MultiLayer}{Layer}
\end{umlpackage}
\end{tikzpicture}
}
\caption{The ISample interface}
\label{fig:isample}
\end{figure}
\end{document}
File added
File added
File added
File added
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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