source: Sophya/trunk/SophyaLib/Manual/sophya.tex@ 1292

Last change on this file since 1292 was 1292, checked in by ansari, 25 years ago

amelioration doc reza 3/11/00

File size: 11.9 KB
Line 
1\documentclass[twoside,11pt]{article}
2% Package standard : Utilisation de caracteres accentues, mode francais et graphique
3\usepackage{url}
4\usepackage[latin1]{inputenc}
5\usepackage[T1]{fontenc}
6\usepackage[english]{babel}
7\usepackage{graphicx}
8% package a mettre pour faire du pdf
9\usepackage{palatino}
10
11% Extension de symboles mathematiques
12\usepackage{amssymb}
13
14% Definition pour Docs Sophya
15\usepackage{defsophya}
16
17
18
19\begin{document}
20
21\begin{titlepage}
22% The title page - top of the page with the title of the paper
23\titrehp{Sophya \\ An overview }
24% Authors list
25\auteurs{
26R. Ansari & ansari@lal.in2p3.fr \\
27G. Le Meur & lemeur@lal.in2p3.fr \\
28C. Magneville & cmv@hep.saclay.cea.fr \\
29S. Henrot-Versille & versille@in2p3.fr
30}
31% \auteursall
32% The title page - bottom of the page with the paper number
33\titrebp{1}
34\end{titlepage}
35
36\tableofcontents
37
38\newpage
39
40\section{Introduction}
41
42 {\bf SOPHYA} ({\bf SO}ftware for {\bf PHY}sics {\bf A}nalysis)
43is a collection of C++ classes designed for numerical and
44physics analysis software development. Our goal is to provide
45easy to use, yet powerful classes which can be used by scientists.
46We have decided to use as much as possible available
47numerical analysis libraries, encapsulating them whenever
48possible.
49
50 The SOPHYA design and implementation has been carried out
51with the specific goal of providing the general framework for
52the Planck-HFI data processing software. However, most of the
53packages presented here have a more general scope than the CMB analysis
54and Planck surveyor mission problem.
55 The source directory tree
56\footnote{ CVS server: cvsserver.lal.in2p3.fr:/projects/Eros/CVSEros}
57is organised into a number of modules.
58
59\begin{itemize}
60\item[] {\bf Mgr/} Scripts for code management,
61makefile generation and software installation
62\item[] {\bf SysTools/} General architecture support classes such
63as {\tt PPersist, NDataBlock<T>}, and few utility classes
64({\tt DataCard, DVList} \ldots).
65\item[] {\bf TArray/} template numerical arrays, vectors and matrices
66({\tt PixelMap<T> SphericalMap<T>} \ldots)
67\item[] {\bf NTools/} Some standard numerical analysis tools
68(linear, and non linear parameter fitting, FFT, \ldots)
69\item[] {\bf HiStats/} Histogram-ming and data set handling classes \\
70({\tt Histo Histo2D NTuple XNTuple} \ldots)
71\end{itemize}
72
73The modules listed below are more tightly related to the
74CMB (Cosmic Microwave Background) data analysis problem:
75\begin{itemize}
76\item[] {\bf SkyMap/} Local and full sky maps, and few geometry
77handling utility classes. \\
78({\tt PixelMap<T>, LocalMap<T>, SphericalMap<T>, \ldots})
79\item[] {\bf SkyT/}
80classes for spectral emission and detector frequency response modelling \\
81({\tt SpectralResponse, RadSpectra, BlackBody} \ldots)
82\item[] {\bf Samba/} few classes for map and TOD analysis.
83\item[] {\bf PMixer/} skymixer and related programs
84\end{itemize}
85
86The following modules contain the interface classes with
87external libraries:
88\begin{itemize}
89\item[] {\bf FitsIOServer/} Classes for handling file input-output
90in FITS format using the cfitsio library.
91\item[] {\bf LinAlg/} Interface with Lapack linear algebra package
92\item[] {\bf IFFTW/} Interface with FFTW package
93\end{itemize}
94
95Other modules:
96\begin{itemize}
97\item[] {\bf Tests/} Simple test programs
98\item[] {\bf ProgPI/} interactive analysis tool - It should be noted that
99this module uses the SOPHYA class library and is based on {\bf PI}
100which is a C++ library defining a complete GUI program
101architecture. An additional module (PIext) define the interactive
102analysis program framework and the interfaces with the objects
103in SOPHYA. The {\bf PI/} \footnote{the PI package documentation
104is available from {\bf http://www.lal.in2p3.fr/recherche/eros/PeidaDoc/} }
105and {\bf PIext/} modules are not currently part
106of the SOPHYA CVS structure.
107\end{itemize}
108
109\newpage
110
111\section{Using Sophya}
112Two environment variables {\bf DPCBASEREP} and {\bf EROSCXX} are used
113to define the path where the Sophya libraries and executable are installed.
114{\bf DPCBASEREP} defines the base directory path and {\bf EROSCXX} the
115name of the C++ compiler. The complete path is built using {\bf DPCBASEREP},
116the operating system name (as obtained by the {\tt uname} command), and
117the compiler name. In the example below, we show the complete path
118for a {\tt Linux} system, using the GNU g++ compiler:
119
120\begin{itemize}
121\item \$DPCBASEREP/Include : Include (.h) files
122\item \$DPCBASEREP/Linux-g++/Libs : Path for the archive libraries (.a)
123\item \$DPCBASEREP/Linux-g++/ShLibs : Shared library path (.so)
124\item \$DPCBASEREP/Linux-g++/Exec : Executable file path
125\end{itemize}
126
127In order to use the shared libraries, the {\bf LD\_LIBRARY\_PATH} variable
128should contain the Sophya shared library path
129({\tt \$DPCBASEREP/Linux-g++/ShLibs } when using g++ compiler on Linux)
130
131The file {\tt \$DPCBASEREP/Include/MakefileUser.h} defines the compilation
132flag and the list of Sophya libraries. It should be included in the
133user's makefile. The default compilation rules assumes that the object (.o)
134and executable files would be put in the following diretories: \\
135{\tt \$HOME/`uname`-\$EROSCXX/Objs} \\
136{\tt \$HOME/`uname`-\$EROSCXX/Exec}.
137In the case of a {\tt Linux} system and using {\tt g++} as the C++ compiler,
138these two directories would be translated to \\
139{\tt \$HOME/Linux-g++/Objs} and {\tt \$HOME/Linux-g++/Exec}.
140The GNU make program should be used.
141\par
142The file {\tt \$DPCBASEREP/Include/makefile\_auto} defines the rules to compile
143a given source program, and link it against the Sophya libraries to produce
144an executable. The example below shows the steps to compile a program named
145{\tt trivial.cc }.
146\begin{verbatim}
147csh> cp $DPCBASEREP/Include/makefile_auto makefile
148csh> make trivial
149\end{verbatim}
150This command should compile the {\tt trivial.cc} file,
151and link it against the sophya libraries. The object and executable
152file names are: \\
153{\tt \$HOME/`uname`-\$EROSCXX/Objs/trivial.o} \\
154{\tt \$HOME/`uname`-\$EROSCXX/Exec/trivial}.
155\par
156The file {\tt \$DPCBASEREP/Include/makefile\_example} provides another
157example makefile.
158
159
160\newpage
161
162\section{Building and installing Sophya}
163Presently, the Sophya library compilation has been tested with the following
164compiler/platform pairs:
165
166\begin{center}
167\begin{tabular}{ll}
168Compaq/DEC OSF1 & cxx (6.0 , 6.2) \\
169Linux & g++ (2.91 , 2.95) \\
170Linux & KCC (3.4) \\
171Solaris & g++ (2.95) \\
172SGI IRIX64 & CC \\
173\end{tabular}
174\end{center}
175
176Some of the modules in the Sophya package uses external libraries. The
177{\bf FitsIOServer} is the example of such a module, where the {\tt libcfitsio.a}
178is used.
179The build procedure expects to find the include files and the libraries in: \\
180{\tt \$EXTLIBDIR/Include/FitsIO } \\
181{\tt \$EXTLIBDIR/`uname`-\$EROSCXX/Libs} \\
182
183The object files from a given Sophya module are grouped in an archive library
184with the module's name ({\tt libmodulename.a}). All Sophya modules
185 are grouped in a single shared library ({\tt libsophya.so}), while the
186modules with reference to external libraries are grouped in
187({\tt libextsophya.so}). The {\bf PI} and {\bf PIext} modules are
188grouped in ({\tt libPI.so}).
189
190The environment variables {\bf DPCDEVREP}, {\bf EXTLIBDIR} and {\bf EROSCXX}
191must be defined in order to install the Sophya package.
192In the example below, we assume that we want to install Sophya from a
193released (tagged) version in the source directory {\tt \$SRC} in the
194{\tt /usr/local/Sophya} diretory, using {\tt g++}. We assume that
195the external libraries directory tree has been set up in
196{\tt /usr/local/ExtLibs/}. \\[3mm]
197\centerline{
198 \rule{20mm}{0.5mm}
199 {\bf \large the use of GNU make is mandatory}
200 \rule{20mm}{0.5mm} }
201
202\vspace*{3mm}
203\begin{verbatim}
204# We select our C++ compiler
205csh> setenv EROSCXX g++
206# Setup the build directory
207csh> mkdir /usr/local/Sophya/
208csh> setenv DPCDEVREP /usr/local/Sophya/
209csh> setenv EXTLIBDIR /usr/local/ExtLibs/
210# Use the top level makefile in Mgr/
211csh> cd $SRC
212csh> cp Mgr/Makefile Makefile
213# Step 1: Create the directory tree and copy the include files (.h)
214csh> make depend
215# Step 2: Compile the modules without external library reference
216csh> make libs
217# Step 3: Compile the modules WITH external library reference (optional)
218csh> make extlibs
219# Step 4: Build libsophya.so
220csh> make slb
221# Step 5: Build libextsophya.so (optional)
222csh> make slbext
223# Step 6: Compile the PI and PIext modules (optional)
224csh> make PI
225# Step 7: Build the corresponding shared library libPI.so (optional)
226csh> make slbpi
227\end{verbatim}
228
229To compile all modules and build the shared libraries, it is possible
230to use:
231\begin{verbatim}
232# Step 2,3,6
233csh> make all
234# Step 4,5,7
235csh> make slball
236\end{verbatim}
237
238At this step, all libraries sould have been made. Programs using
239Sophya libraries can now be built:
240\begin{verbatim}
241# To compile test programs
242csh> cd Tests
243csh> make arrt ...
244csh> cd ..
245# To compile other programs, for example from the PMixer module
246csh> cd PMixer
247csh> make
248csh> cd ..
249# To build (s)piapp (libPI.so is needed)
250csh> cd ProgPI
251csh> make
252csh> cd ..
253\end{verbatim}
254
255\subsection{Mgr module}
256This module contains scripts which can be used for generating the
257makefiles for each module.
258\begin{itemize}
259\item {\bf Makefile} Top level Makefile for builiding the libraries.
260\item {\bf Makefile.h} contains the defintion of compilation flags for the
261different compilers and systems. This file is used for building the
262library and generating {\bf MakefileUser.h} (to be included in makefiles).
263\item {\bf Makefile.slb} contains the rules for building shared libraries
264for the different compilers and systems. (to be included in makefiles)
265\item {\bf crerep\_sophya} c-shell script for creating the directory tree
266under {\tt \$DPCBASEREP} and {\tt \$DPCDEVREP}
267\item {\bf install\_sophya} c-shell script for installing the Sophya package.
268Usually from {\tt \$DPCDEVREP} to {\tt \$DPCBASEREP}
269\item {\bf mkmflien} c-shell script for making symbolic links or copying
270include files to {\tt \$DPCDEVREP/Include} or {\tt \$DPCBASEREP/Include}
271\item {\bf mkmf} c-shell script for generating module makefiles and the
272top level makefile (named GNUmakefile)
273\item {\bf mkmflib} c-shell script for generating each library module
274makefile (named GNUmakefile)
275\item {\bf mkmfprog} c-shell script for generating makefile for a module
276containing the source for executable programs (named GNUmakefile).
277\item {\bf mkmfPI} c-shell script for generating makefile for PI and PIext
278modules (named GNUmakefile)
279\item {\bf libdirs} List of Sophya modules without reference to external
280libraries.
281\item {\bf extlibdirs} List of Sophya modules with reference to external
282libraries.
283
284\end{itemize}
285
286\newpage
287
288\section{Learning Sophya through examples}
289The examples here illustrates the basic
290usage of Sophya classes. Sophya documentation can be found at our web site: \\
291{\bf http://hfi-l2.in2p3.fr}.
292
293\subsection{Using classes in SysTools}
294
295{\bf SysTools} contains utility classes such as {\tt DataCards} or
296{\tt DVlist}, an hierarchy of exception classes for Sophya, a template
297class {\tcls{NDataBlock}} for handling reference counting on numerical
298arrays, as well as classes providing the services for implementing simple
299serialization. For simple programs, it is a good practice to handle
300the exceptions at least at high level, in the {\tt main()} function.
301The example below shows the exception handling and the usage
302of Sophya persistence.
303\vspace*{5mm}
304
305\begin{figure}[hbt]
306\dclsa{PPersist}
307\dclsbb{PIOPersist}{PInPersist}
308\dclsb{POutPersist}
309\caption{partial class diagram for classes handling persistencein Sophya}
310\end{figure}
311
312\input{ex1.inc}
313
314\subsection{Using arrays and matrices}
315{\bf TArray} module contains template classes for handling standard
316operations on numerical arrays. Using the class {\tt \tcls{TArray} },
317it is possible to create and manipulate up to 5-dimension numerical
318arrays {\tt (int, float, double, complex, \ldots)}.
319
320\end{document}
Note: See TracBrowser for help on using the repository browser.