Changeset 3419 in Sophya for trunk/SophyaLib/Manual/sophya.tex


Ignore:
Timestamp:
Dec 7, 2007, 7:06:56 PM (18 years ago)
Author:
ansari
Message:

sophya.tex (overview) complete pour tag V2.1, Reza 07/12/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Manual/sophya.tex

    r3417 r3419  
    279279dot . in unix).
    280280
     281\subsection{Copy constructor and assignment operator}
     282\label{memgt}
     283In C++, objects can be copied by assignment or by initialisation.
     284Copying by initialisation corresponds to creating an object and
     285initialising its value through the copy constructor.
     286The copy constructor has its first argument as a reference, or
     287const reference to the object's class type. It can have 
     288more arguments, if default values are provided.
     289Copying by assignment applies to an existing object and
     290is performed through the assignment operator (=).
     291The copy constructor implements this for identical type objects:
     292\begin{verbatim}
     293class MyObject {
     294public:
     295  MyObject();      // Default constructor
     296  MyObject(MyObject const & a);  // Copy constructor
     297  MyObject & operator = (MyObject const & a) // Assignment operator
     298}
     299\end{verbatim}
     300The copy constructors play an important role, as they are
     301called when class objects are passed by value,
     302returned by value, or thrown as an exception.
     303\begin{verbatim}
     304// A function declaration with an argument of type MyObject,
     305// passed by value, and returning a MyObject
     306MyObject f(MyObject x)
     307{
     308  MyObject r;
     309  ...
     310  return(r);  // Copy constructor is called here
     311}
     312// Calling the function :
     313MyObject a;
     314f(a);        // Copy constructor called for a
     315\end{verbatim}
     316It should be noted that the C++ syntax is ambiguous for the
     317assignment operator. {\tt MyObject x; x=y; } and
     318{\tt MyObject x=y;} have different meaning.
     319\begin{verbatim}
     320MyObject a;        // default constructor call
     321MyObject b(a);     // copy constructor call
     322MyObject bb = a;   // identical to bb(a) : copy constructor call
     323MyObject c;        // default constructor call
     324c = a;             // assignment operator call
     325\end{verbatim}
     326
     327As a general rule in SOPHYA, objects which implements
     328reference sharing on their data members have a copy constructor
     329which shares the data, while the assignment operator copies or
     330duplicate the data.
     331
     332\subsection{Multi-thread programming with SOPHYA}
     333Multi-thread programming is usually safe as long as different threads DO NOT access
     334the same memory locations. SOPHYA is mainly organized as classes having only
     335data members, with very few cases having static data members (memory locations
     336common to all instances of a class), or seldom, global variables. \\
     337Using different instances of a class in different threads is thus safe for most
     338classes / methods in SOPHYA. \\
     339A major exception is the reference sharing mechanism, where different instances
     340of a class may  shared memory locations. This reference sharing mechanism has been
     341made thread-safe in SOPHYA, from version V=2.1. \\
     342As a consequence, different execution threads can access non overlapping sub-arrays
     343and access (read/write) the corresponding elements without the need of
     344mutex and thread synchonisation. Moreover, thread safe filling of
     345NTuple and DataTable objects can be activated, on an object per object basis. \\
     346The {\tt ZThread, ZMutex \ldots} classes in the {\bf SysTools } module offer a relatively
     347easy way of writing multi-threaded programs.   
     348
    281349\subsection{the runcxx program}
    282350\index{runcxx} \label{runcxx}
     
    303371                LinAlg, IFFTW, XAstroPack
    304372\end{verbatim}
    305 Most examples in this manual can be tested using runcxx. The
    306 example below shows how to compile, link and run a sample
     373Most examples in this manual can be tested using runcxx.
     374The preprocessor macro {\tt KeepObj()} is defined by runcxx and let the user
     375to save an objet to an PPF file, with the same name as the corresponding variable.
     376The example below shows how to compile, link and run a sample
    307377code.
    308378\begin{verbatim}
    309 //  File example.icc
    310 Matrix a(3,3);
    311 a = IdentityMatrix(1.);
    312 cout << a ;
    313 // Executing this sample code
     379##  File example.icc :
     380
     381Matrix mxa(3,3);
     382mxa = IdentityMatrix(1.);
     383cout << mxa ;
     384// Save the object mxa in a PPF file named mxa
     385KeepObj(mxa);
     386
     387## Executing this sample code
    314388csh> runcxx -f example.icc
    315389\end{verbatim}
     
    385459
    386460\end{verbatim}
    387 \newpage
    388 
    389 \section{Copy constructor and assignment operator}
    390 \label{memgt}
    391 In C++, objects can be copied by assignment or by initialisation.
    392 Copying by initialisation corresponds to creating an object and
    393 initialising its value through the copy constructor.
    394 The copy constructor has its first argument as a reference, or
    395 const reference to the object's class type. It can have 
    396 more arguments, if default values are provided.
    397 Copying by assignment applies to an existing object and
    398 is performed through the assignment operator (=).
    399 The copy constructor implements this for identical type objects:
    400 \begin{verbatim}
    401 class MyObject {
    402 public:
    403   MyObject();      // Default constructor
    404   MyObject(MyObject const & a);  // Copy constructor
    405   MyObject & operator = (MyObject const & a) // Assignment operator
    406 }
    407 \end{verbatim}
    408 The copy constructors play an important role, as they are
    409 called when class objects are passed by value,
    410 returned by value, or thrown as an exception.
    411 \begin{verbatim}
    412 // A function declaration with an argument of type MyObject,
    413 // passed by value, and returning a MyObject
    414 MyObject f(MyObject x)
    415 {
    416   MyObject r;
    417   ...
    418   return(r);  // Copy constructor is called here
    419 }
    420 // Calling the function :
    421 MyObject a;
    422 f(a);        // Copy constructor called for a
    423 \end{verbatim}
    424 It should be noted that the C++ syntax is ambiguous for the
    425 assignment operator. {\tt MyObject x; x=y; } and
    426 {\tt MyObject x=y;} have different meaning.
    427 \begin{verbatim}
    428 MyObject a;        // default constructor call
    429 MyObject b(a);     // copy constructor call
    430 MyObject bb = a;   // identical to bb(a) : copy constructor call
    431 MyObject c;        // default constructor call
    432 c = a;             // assignment operator call
    433 \end{verbatim}
    434 
    435 As a general rule in SOPHYA, objects which implements
    436 reference sharing on their data members have a copy constructor
    437 which shares the data, while the assignment operator copies or
    438 duplicate the data.
    439 
    440 \section{Multi-thread programming with SOPHYA}
    441 Multi-thread programming is usually safe as long as different threads DO NOT access
    442 the same memory locations. SOPHYA is mainly organized as classes having only
    443 data members, with very few cases having static data members (memory locations
    444 common to all instances of a class), or seldom, global variables. \\
    445 Using different instances of a class in different threads is thus safe for most
    446 classes / methods in SOPHYA. \\
    447 A major exception is the reference sharing mechanism, where different instances
    448 of a class may  shared memory locations. This reference sharing mechanism has been
    449 made thread-safe in SOPHYA, from version V=2.1. \\
    450 As a consequence, different execution threads can access non overlapping sub-arrays
    451 and access (read/write) the corresponding elements without the need of
    452 mutex and thread synchonisation. Moreover, thread safe filling of
    453 NTuple and DataTable objects can be activated, on an object per object basis. \\
    454 The {\tt ZThread, ZMutex \ldots} classes in the {\bf SysTools } module offer a relatively
    455 easy way of writing multi-threaded programs.   
     461
    456462
    457463\newpage
     
    462468class {\tcls{NDataBlock}} for handling reference counting on numerical
    463469arrays, as well as classes providing the services for implementing simple
    464 serialisation.
     470serialisation (object persistence services).
    465471\vspace*{5mm}
    466472
     
    517523with data objects {\bf AnyDataObject} for write operations.
    518524\end{itemize}
    519 A complete description of SOPHYA persistence mechanism and guidelines
    520 for writing delegate classes for handling object persistence is beyond
    521 the scope of this document. The most useful methods for using Sophya
    522 persistence are listed below:
     525The most useful methods for using Sophya
     526persistence are listed below. A brief description of the PPF file format
     527and some guidelines for writing writing delegate classes for handling
     528object persistence can be found in the following paragraphs.
    523529\begin{itemize}
    524530\item[] {\tt POutPersist::PutObject(AnyDataObj \& o)} \\
     
    556562The {\bf scanppf} program can be used to list the content of a PPF file.
    557563
     564\subsubsection{PPF file format}
     565The PPF file consist of :
     566\begin{itemize}
     567\item[\rond] A file header (3x32=96 bytes) , containing  an identification string,
     568PPF format version (currently V3), the file endiannes {\tt (BIG-ENDIAN , LITTLE-ENDIAN)}
     569and the file creation date and time. It should be noted that the present SOPHYA version
     570(V=2.1) does not allow updating an existing PPF file.
     571\item[\rond] A collection of tagged data items and data structuring tags.
     572the PPF tags are one byte (8 bits) long and may be followed by a length information
     573for arrays, or strings. The length information might be 4 bytes or 8 bytes long.
     574Characters, various length (1,2,4,8 bytes long) signed and unsigned integers,
     575simple or double precision (4/8) bytes floating point and complex numbers are
     576the basic data types handled by PPF streams.
     577\begin{verbatim}
     578tag=PPS_SIMPLE_Integer4  +  data (4 bytes)
     579tag=PPS_SIMPLE_Float4 + data (4 bytes)
     580tag=PPS_SIMPLE_Complex8 + data (2x8=16 bytes)
     581tag=PPS_STRING + Length (4 bytes) + data (Length bytes)
     582tag=PPS_SIMPLE_ARRAY4_UInt2 + Length (4 bytes) + data (2xLength bytes)
     583\end{verbatim}
     584The two tags  {\tt PPS\_OBJECT} and {\tt PPS\_ENDOBJECT} are used for identifying
     585objects.
     586\item[\rond] The file trailer contains some global statistics such as the total number
     587of objects in file, the list of name tags, with their corresponding positions.
     588These informations are grouped under the identifier tag {\tt  PPS\_NAMETAG\_TABLE }.
     589The last byte in file contains the value {\tt PPS\_EOF}
     590\end{itemize}
     591We show below the result of the analysis of a PPF file using
     592 {\tt PPFBinaryInputStream::AnalyseTags()}. This can easily be done using the
     593 {\bf runcxx} program.
     594The PPF file contains four objects:
     595a {\tt TimeStamp} object, two {\tt NDataBlock} objects, the second one sharing its data with
     596the first one. The second NDataBlock is only written as a reference to the first object. The fourth
     597object is a {\tt RandomGenerator} which has an {\tt NDataBlock} object as data member.
     598Notice the corresponding nested structure of object marker tags.
     599The first object and the last objects in the file are written associated with a {\bf NameTag}.
     600{\small
     601\begin{verbatim}
     602 ----------------------------------------------------------
     603 PPFBinaryInputStream::AnalyseTags(Level= 49)
     604   FileName= toto.ppf
     605   Version= 3 FileSize= 8884 Creation Date= Fri Dec  7 15:30:58 2007
     606
     607 NbPosTag=0 NbNameTag=2 NbObjs=4 NbTopLevObjs=3 NbRefs=1 MaxNest=2
     608
     609<PPS_NAMETAG_MARK> tag at position 60
     610<PPS_OBJECT> tag at position 61 ClassId= c09dfe032b341cee  ObjectId= 10
     611  <PPS_SIMPLE> tag at position 72 DataType=INTEGER x4
     612  <PPS_SIMPLE> tag at position 77 DataType=INTEGER x8
     613  <PPS_SIMPLE> tag at position 80 DataType=FLOAT x8
     614<PPS_ENDOBJECT> tag at position 89  ObjectId= 10
     615<PPS_OBJECT> tag at position 92 ClassId= e670300b367585d1  ObjectId= 21
     616  <PPS_SIMPLE_ARRAY4> tag at position a3 DataType=UNSIGNED x8 NElts= 3
     617  <PPS_SIMPLE_ARRAY4> tag at position c0 DataType=INTEGER x4 NElts= 50
     618<PPS_ENDOBJECT> tag at position 18d  ObjectId= 21
     619<PPS_REFERENCE> tag at position 196  ObjectId= 21  OrigPos=92
     620<PPS_NAMETAG_MARK> tag at position 1a7
     621<PPS_OBJECT> tag at position 1a8 ClassId= eb6c427a5a30caed  ObjectId= 30
     622  <PPS_SIMPLE_ARRAY4> tag at position 1b9 DataType=UNSIGNED x4 NElts= 6
     623  <PPS_SIMPLE> tag at position 1d6 DataType=UNSIGNED x8
     624  <PPS_SIMPLE> tag at position 1df DataType=UNSIGNED x8
     625  <PPS_OBJECT> tag at position 1e8 ClassId= 6531a8f47336d4aa  ObjectId= 41
     626    <PPS_SIMPLE_ARRAY4> tag at position 1f9 DataType=UNSIGNED x8 NElts= 3
     627    <PPS_SIMPLE_ARRAY4> tag at position 216 DataType=FLOAT x8 NElts= 1024
     628  <PPS_ENDOBJECT> tag at position 221b  ObjectId= 41
     629<PPS_ENDOBJECT> tag at position 2224  ObjectId= 30
     630<PPS_NAMETAG_TABLE> tag at position 222d
     631<PPS_NAMETAG_ENTRY>  NameTag=rg-randgen NameTagMark Position=1a7
     632<PPS_NAMETAG_ENTRY>  NameTag=ts-timestamp NameTagMark Position=60
     633<PPS_EOF> tag at position 22b3 TagPos=222d
     634 PPFBinaryInputStream::AnalyseTags() - End - Total Number of Tags= 23
     635 ----------------------------------------------------------
     636\end{verbatim}
     637}  % fin de small
     638
     639\subsubsection{Writing PPF handlers}
     640Here are some guidelines for creating PPF handler classes to make
     641a class persistent through the SOPHYA PPersist mechanism. The example
     642discussed here can be found in the {\bf Examples} module, in the directory
     643{\bf MyPPF}.
     644\begin{enumerate}
     645\item The class should inherit from the {\bf SOPHYA::AnyDataObj} class.
     646   In the example here, we want to make the class {\bf Vfs} persistent
     647\begin{verbatim}   
     648class Vfs : public SOPHYA::AnyDataObj {
     649 ...
     650}
     651\end{verbatim}
     652%%%%
     653\item The PPF handler class
     654should inherit from {\bf SOPHYA::PPersist} . The pure virtual methods
     655of PPersist class (DataObj() , SetDataObj() , ReadSelf(), WriteSelf()
     656must be implemented.
     657\begin{verbatim}   
     658class PPFHandlerVfs : public SOPHYA::PPersist {
     659public:
     660  virtual SOPHYA::AnyDataObj* DataObj();
     661  virtual void       SetDataObj(SOPHYA::AnyDataObj &);
     662protected:
     663  virtual void       ReadSelf(SOPHYA::PInPersist&);
     664  virtual void       WriteSelf(SOPHYA::POutPersist&) const;
     665}
     666\end{verbatim}
     667%%%
     668It is possible to use the template class {\tt SOPHYA::ObjFileIO<T>}, and
     669specialize it for the tharget class (here {\tt SOPHYA::ObjFileIO<Vfs>}),
     670by defining the two methods :  \\
     671\hspace*{5mm} {\tt  SOPHYA::ObjFileIO<Vfs>::ReadSelf(SOPHYA::PInPersist\&) } \\
     672\hspace*{5mm}  {\tt  SOPHYA::ObjFileIO<Vfs>::WriteSelf(SOPHYA::POutPersist\&) const }
     673%%%%
     674\item If it is NOT possible to have the target class inherit from {\bf AnyDataObj},
     675a wrapper class should be used. The same class can play the role of wrapper
     676AND the PPF handler. See the PPF handler / wrapper class for STL vectors : \\
     677\hspace*{5mm} {\tt   SOPHYA::PPFWrapperSTLVector<T>} in file BaseTools/ppfwrapstlv.h
     678%%%
     679\item Implement the ReadSelf() and WriteSelf() methods of the PPF handler.
     680All the I/O services from the following classes can be used :
     681\begin{itemize}
     682\item PPFBinaryIOStrem , PPFBinaryInputStream , PInPersist
     683\item PPFBinaryIOStrem , PPFBinaryOutputStream , POutPersist
     684\end{itemize}
     685Writing and reading of the embeded objects for which a handler has been register
     686ed can simply be performed by :  \\
     687\hspace*{5mm} {\tt   POutPersist::PutObject() } \\
     688\hspace*{5mm} {\tt   PInPersist::GetObject() }
     689
     690{\bf Warning:} The services associated with nametags : \\
     691\hspace*{5mm}  {\tt PPFBinaryOutputStream::WriteNameTag() } \\
     692\hspace*{5mm}  {\tt PPFBinaryInputStream::GotoNameTag() } \\
     693are {\bf NOT} intented to be used in WriteSelf() , ReadSelf()
     694%%%%%
     695\item The new PPF handler, as well as the list of classes it can handle has to be
     696registered prior to use PPF read/write for the target classes. This must be
     697performed during the initialization phase, for example at the beginning of the
     698main() program. Another possibility is to use a module initializer
     699(See {\bf SophyaInitiator} class in file BaseTools/sophyainit.h )
     700and declare a static instance of the class. Notice that this works only if
     701the system loader handles correcly the call of constructor
     702for the statically declared objects.
     703
     704The registration can be performed using the CPP macros defined in
     705BaseTools/ppersist.h
     706\begin{verbatim}
     707  // First, register the PPF handler ObjFileIO<Vfs>
     708  PPRegister(ObjFileIO<Vfs>);
     709  // Register the list of classes which can be handled by ObjFileIO<Vfs>
     710  DObjRegister(ObjFileIO<Vfs>, Vfs);
     711\end{verbatim}
     712%%%%%%%%%%%%%%%%
     713\end{enumerate}
     714
     715%%%%%%%%%%%%
    558716\subsection{\tcls{NDataBlock}}
    559717\index{\tcls{NDataBlock}}
     
    667825\end{itemize}
    668826 
     827 \subsection{Random numbers}
     828 \index{RandomGenerator}
     829 The C-functions defined in the file BaseTools/srandgen.h can be used
     830 for generating sequence of random numbers with different PDF (probability
     831 distribution functions : flat, gaussian, poisson \ldots.
     832 However, we advise to use the {\bf RandomGenerator} class which provides
     833can be used in multi-threaded programs. In this case, a different instance of
     834the  RandomGenerator class should be created in each thread running in parallel.
     835In addition, this class has a PPF handler which saves the complete state of the class and
     836the underlying generatoir to the PPF stream. This can be used to generate very long sequence
     837of random numbers, distributed over several runs.
     838\begin{verbatim}
     839sa_size_t N = 1000;
     840Vector vf(2*N), vg(2*N);
     841{
     842// Instanciate the random generator
     843RandomGenerator rg;
     844// Generate some sequence of random numbers
     845for(sa_size_t i=0; i<N; i++) {
     846  vf(i) = rg.Flat01();
     847  vg(i) = rg.Gaussian();
     848  }
     849// Save the generator to file rg.ppf
     850POutPersist po("rg.ppf");
     851po << rg; 
     852}
     853// ....
     854{
     855// Create and read the generator from file rg.ppf
     856RandomGenerator rg;
     857PInPersist pi("rg.ppf");
     858pi >> rg; 
     859// Continue the generation sequence
     860for(sa_size_t i=N; i<2*N; i++) {
     861  vf(i) = rg.Flat01();
     862  vg(i) = rg.Gaussian();
     863  }
     864}
     865\end{verbatim}
     866
     867%%%%%%%%%%%%
    669868\newpage
    670869\section{Module TArray}
     
    9981197TArray<int_4> ia(5,3);
    9991198ia = 8;
    1000 pos << ia;                 // (1)
     1199pos << ia;         // (1)
    10011200ia = 16;
    1002 pos << ia;                 // (2) Only a reference to the previously ia array is written
     1201pos << ia;        // (2) Only a reference to the previously ia array is written
    10031202ia = 32;
    10041203ia.RenewObjId();    // We change the object Id
    1005 pos << ia;                 //  (3) The complete array is dumped again
     1204pos << ia;        //  (3) The complete array is dumped again
    10061205}
    10071206\end{verbatim}
     
    10971296\item[\bul] Functions returning arrays corresponding to real and imaginary
    10981297parts of a complex array: {\tt real(za) , imag(za) }
    1099 ({\bf Warning:} Note that the these functions do not provide
    1100 shared memory access to real and imaginary parts.)
     1298({\bf Warning:} Note that the these functions create an array and copies
     1299the data from the original complex array. They do not provide
     1300shared memory access to real and imaginary parts.
     1301For shared memory access, use functions {\tt SDRealPart()} and
     1302{\tt SDImagPart() } (see below).
    11011303\item[\bul] Functions returning arrays corresponding to the module,
    11021304phase, and module squared of a complex array:
     
    11551357TArray<r_4> aza = ArrCastC2R(za);
    11561358cout << " za --> aza= " << aza;
     1359TArray< complex<r_4> > zb;
     1360zb = ArrCastR2C(aza);
     1361KeepObj(zb);
    11571362\end{verbatim}
    11581363
     
    11641369The first index is along the X axis and the second index along the Y axis.
    11651370\begin{verbatim}
    1166     | (0,0)  (0,1)  (0,2)  (0,3) |
    1167     | (1,0)  (1,1)  (1,2)  (1,3) |
    1168     | (2,0)  (2,1)  (2,2)  (2,3) |
     1371    | (0,0)  (1,0)  (2,0)  (3,0) |
     1372    | (0,1)  (1,1)  (2,1)  (3,1) |
     1373    | (0,2)  (1,2)  (2,2)  (3,2) |
    11691374\end{verbatim}
    11701375In the first case, the array is completely packed
     
    11961401
    11971402\begin{verbatim}
     1403BaseArray::SetDefaultMemoryMapping(BaseArray::CMemoryMapping);
    11981404TArray<r_4> X(4,2);
    11991405X = RegularSequence(1,1);
    12001406cout << "Array X= " << X << endl;
    1201 TMatrix<r_4> X_C(X, true, BaseArray::CMemoryMapping);
     1407TMatrix<r_4> X_C(X, true);
    12021408cout << "Matrix X_C (CMemoryMapping) = " << X_C << endl;
    1203 TMatrix<r_4> X_F(X, true, BaseArray::FortranMemoryMapping);
     1409TMatrix<r_4> X_F(X_C, true);
     1410X_F.TransposeSelf();    // we make it a FortranMemoryMapping matrix
    12041411cout << "Matrix X_F (FortranMemoryMapping) = " << X_F << endl;
    12051412\end{verbatim}
     
    122314304, 8
    12241431\end{verbatim}
     1432
     1433{\bf Note:} Only the {\tt TMatrix} class is sensitive to the memory organisation. It should also
     1434be noted that the first index for a matrix is the row index. For a {\tt TArray} object, the first
     1435index correspond always to the X axis. For a matrix in the {\tt CMemoryMapping}, the row
     1436index is the Y index of the corresponding array, while for a matrix
     1437with {\tt FortranMemoryMapping}, the row index is the X index.
     1438\begin{verbatim}
     1439#  2D array  arr ,  matrix mx
     1440TArray<r_4> arr;
     1441...
     1442TMatrix<r_4> mx(arr);
     1443...
     1444###   CMemoryMapping  :
     1445mx( row , col ) -> arr( ix=col, jy= row )
     1446###   FortranMemoryMapping  :
     1447mx( row , col ) -> arr( ix=row, jy= col )
     1448\end{verbatim}
     1449The following code fragment shows the difference between element access
     1450index order for the different memory organisation:
     1451\begin{verbatim}
     1452   TArray<int_4> a(5,3);
     1453   a = RegularSequence(10,2);
     1454   cout << "Array a = " << a << endl;
     1455   TMatrix<r_4> mac(a);
     1456   cout << "Matrix mac (CMemoryMapping) = " << mac << endl;
     1457   TMatrix<r_4> maf(mac);
     1458   maf.TransposeSelf();    // we make it a FortranMemoryMapping matrix
     1459   cout << "Matrix maf (FortranMemoryMapping) = " << maf << endl;
     1460   // ---- element access
     1461   cout <<  " Array(ix,jy) : a(2,0)= " << a(2,0) << " a(1,2)= " << a(1,2)
     1462        <<   "  a(0,2)= " << a(0,2) << endl;
     1463   cout <<  " mac(row,col) :  mac(2,0)= " << mac(2,0) << " mac(1,2)= " << mac(1,2)
     1464        <<   "  mac(0,2)= " << mac(0,2) << endl;
     1465   cout <<  " maf(row,col) :  maf(2,0)= " << maf(2,0) << " maf(1,2)= " << maf(1,2)
     1466        <<   "  maf(0,2)= " << maf(0,2) << endl;
     1467\end{verbatim}
     1468
    12251469
    12261470\newpage
     
    14341678   
    14351679\subsection{Writing, viewing \dots }
    1436 
    1437 All these objects have been design to be written to or read from a persistent file.
     1680%%
     1681Histogram and NTuple/DataTable objects have PPF handlers and
     1682can be written to or read from PPF files. Sophya graphical tool (spiapp) can
     1683automatically display and operate on all these objects.
    14381684The following example shows how to write the previously created objects
    14391685into such a file~:
    14401686\begin{verbatim}
    1441 //-- Writing
    14421687{
    14431688char *fileout = "myfile.ppf";
     
    14491694}  // closing ``}'' destroy ``outppf'' and automatically close the file !
    14501695\end{verbatim}
    1451 
    1452 Sophya graphical tools (spiapp) can automatically display and operate
    1453 all these objects.
    14541696
    14551697\newpage
     
    17021944The classes {\bf ZMutex} \index{mutex} and {\bf ZSync} can be used
    17031945to perform synchronisation and signaling between threads.
    1704  
     1946Example multithread programs using these classes can be found in
     1947the {\bf Tests} module : \\
     1948\hspace{10mm} {\tt zthr.cc  , tmtdt.cc , tmtrnd.cc }
     1949
    17051950\subsection{Dynamic linker and C++ compiler classes}
    17061951\index{PDynLinkMgr}
     
    17431988
    17441989\subsection{Command interpreter}
     1990\index{Commander}
     1991\index{Expression evaluation}
    17451992The class {\bf Commander} can be used in interactive programs to provide
    17461993c-shell like command interpreter and scripting capabilties.
    17471994Arithmetic expression evaluation is implemented through the {\bf CExpressionEvaluator}
    1748 and {\bf RPNExpressionEvaluator} classes.
     1995and {\bf RPNExpressionEvaluator} classes. The latter can be used to perform evaluation
     1996in reverse polish notation (old HP calculators),
     1997while the former uses the usual algebraic (c-language like) expressions.
    17491998The command language provides variable manipulation through the usual
    17501999{\tt \$varname} vector variable and arithmetic expression extensions, as well
     
    17722021\end{figure}
    17732022The {\bf SkyMap} module provides classes for creating, filling, reading pixelized spherical  and 2D-maps. The types of values stored in pixels can be int, float, double , complex etc. according to the specialization of the template type.
     2023\subsection{3D geometry}
     2024Some of the classes in this module simplify the angle manipulation, or the 3D geometry
     2025and rotation calculations, such as the {\bf Vector3d} and {\bf UnitVector} classes.
     2026\index{Vector3d}
     2027The classes {\bf Vector3d} and {\bf UnitVector}  are useful for angle conversions.
     2028\index{Angle}
     2029{\bf LongLat} class and {\bf Angle} class (defined in file vector3d.h) can be used for
     2030angle conversions :
     2031\begin{verbatim}
     2032   // Example to convert 0.035 radians to arcsec
     2033   double vr = 0.035;
     2034   cout << "Angle rad= " << vr << " ->arcsec= " << Angle(vr).ToArcSec() << endl;
     2035   // Example to convert 2.3 arcmin to radian - we use the conversion operator
     2036   double vam = 2.3;
     2037   cout << "Angle arcmin= " << vam << " ->rad= "
     2038        << (double)Angle(vam, Angle::ArcMin) << endl;
     2039\end{verbatim}
     2040%%%
    17742041\subsection {Spherical maps}
    17752042SkyMap module provides three kinds of complete ($4 \pi$) spherical maps according to the
     
    21132380The {\bf FFTWServer} class (in module FFTW) implements FFTServerInterface class
    21142381methods, for one dimensional and multi-dimensional Fourier
    2115 transforms on double precision data using the FFTW package
    2116 (available from {\tt http://www.fftw.org}).
     2382transforms  using the FFTW package (available from {\tt http://www.fftw.org}).
     2383Depending on the configuration options during library build, only
     2384transforms on double precision data might be available.
    21172385
    21182386\newpage
     
    23932661\input{ex1.inc}
    23942662
    2395 
    23962663\newpage
    23972664\addcontentsline{toc}{section}{Index}
Note: See TracChangeset for help on using the changeset viewer.