Index: /trunk/SophyaLib/Manual/sophya.tex
===================================================================
--- /trunk/SophyaLib/Manual/sophya.tex	(revision 1359)
+++ /trunk/SophyaLib/Manual/sophya.tex	(revision 1360)
@@ -200,7 +200,24 @@
 SOPHYA persistence services can thus be used to transfer objects
 through network links.
+\item[] The serialisation (reading/writing) for objects for a given class
+is implemented through a delegate object. The delegate class inherits
+from {\tt PPersist} class.
 \end{itemize}
-The example below shows writing of objects through the use of overloaded 
-operator $ << $ :
+A complete description of SOPHYA persistence mechanism and guidelines
+for writing delegate classes for handling object persistence is beyond
+the scope of this document. The example in the next paragraph shows
+simple use of SOPHYA persistence.
+
+\subsection{\tcls{NDataBlock}}
+The {\bf \tcls{NDataBlock}} is designed to handle reference counting 
+and sharing of memory blocs (contiguous arrays) for numerical data 
+types. Initialisation, resizing, basic arithmetic operations, as
+well as persistence handling services are provided. 
+The persistence handler class ({\tt \tcls{FIO\_NDataBlock}}) insures
+that a single copy of data is written for multiply referenced objects,
+and the data is shared among objects when reading. 
+\par
+The example below shows writing of NDataBlock objects through the 
+use of overloaded operator $ << $ :
 \begin{verbatim}
 #include "fiondblock.h"
@@ -261,4 +278,25 @@
 \end{verbatim}
 
+\subsection{CxxCompilerLinker class}
+This class provides the services to compile C++ code and building 
+shared libraries, using the same compiler and options which have 
+been used to create the SOPHYA shared library. 
+The sample program below illustrates using this class to build
+the shared library (myfunc.so) from the source file myfunc.cc :
+\begin{verbatim}
+#include "cxxcmplnk.h"
+// ...
+string flnm = "myfunc.cc";
+string oname, soname;
+int rc;
+CxxCompilerLinker cxx;
+// The Compile method provides a default object file name
+rc = cxx.Compile(flnm, oname);
+if (rc != 0 ) { // Error when compiling ... }
+// The BuildSO method provides a default shared object file name
+rc = cxx.BuildSO(oname, soname);
+if (rc != 0 ) { // Error when creating shared object ... }
+\end{verbatim}
+
 \section{Module TArray}
 {\bf TArray} module contains template classes for handling standard 
@@ -273,4 +311,5 @@
 \caption{partial class diagram for arrays, matrices and vectors}
 \end{figure}
+
 
 \subsection{Using arrays}
@@ -298,4 +337,68 @@
   for(int k=w; k<in.Size()-w; k++)
     out(k) = in(Range(k-w, k+w).Sum()/(2.*w+1.);
+\end{verbatim}
+
+\subsection{Memory organisation}
+{\tt \tcls{TArray} } can handle numerical arrays with various memory 
+organisation, as long as the spacing (steps) along each axis is 
+regular. The five axis are labeled X,Y,Z,T,U. The examples below
+illustrates the memory location for a 2-dimensional, $N_x=4 \times N_y=3$.
+The first index is along the X axis and the second index along the Y axis.
+\begin{verbatim}
+    | (0,0)  (0,1)  (0,2)  (0,3) |
+    | (1,0)  (1,1)  (1,2)  (1,3) |
+    | (2,0)  (2,1)  (2,2)  (2,3) |
+\end{verbatim}
+In the first case, the array is completely packed 
+($Step_X=1, Step_Y=N_X=4$), with zero offset,
+while in the second case, $Step_X=2, Step_Y=10, Offset=10$:
+\begin{verbatim}
+    | 0  1  2  3  |         | 10 12 14 16 |
+Ex1 | 4  5  6  7  |     Ex2 | 20 22 24 26 |
+    | 8  9  10 11 |         | 30 32 34 36 | 
+\end{verbatim} 
+
+For matrices and vectors, an optional argument ({\tt MemoryMapping}) 
+can be used to select the memory mapping, where two basic schemes 
+are available: \\
+{\tt CMemoryMapping} and {\tt FortranMemoryMapping}. \\
+In the case where {\tt CMemoryMapping} is used, a given matrix line
+is packed in memory, while the columns are packed when 
+{\tt FortranMemoryMapping} is used. The first index when addressing 
+the matrix elements (line number index) runs along
+the Y-axis if  {\tt CMemoryMapping} is used, and along the X-axis
+in the case of {\tt FortranMemoryMapping}. 
+Arithmetic operations between matrices
+with different memory organisation is allowed as long as 
+the two matrices have the same sizes (Number of rows and columns). 
+The following code example and the corresponding output illustrates 
+these two memory mappings.
+\begin{verbatim}
+TArray<r_4> X(4,2); 
+X = RegularSequence(1,1);
+cout << "Array X= " << X << endl;
+TMatrix<r_4> X_C(X, true, BaseArray::CMemoryMapping);
+cout << "Matrix X_C (CMemoryMapping) = " << X_C << endl;
+TMatrix<r_4> X_F(X, true, BaseArray::FortranMemoryMapping);
+cout << "Matrix X_F (FortranMemoryMapping) = " << X_F << endl;
+\end{verbatim}
+This code would produce the following output (X\_F = Transpose(X\_C)) :
+\begin{verbatim}
+Array X= 
+--- TArray<f>  ND=2 SizeX*Y*...= 4x2 ---
+1, 2, 3, 4
+5, 6, 7, 8
+
+Matrix X_C (CMemoryMapping) = 
+--- TMatrix<f>(NRows=2, NCols=4) ND=2 SizeX*Y*...= 4x2 ---
+1, 2, 3, 4
+5, 6, 7, 8
+
+Matrix X_F (FortranMemoryMapping) = 
+--- TMatrix<f>(NRows=4, NCols=2) ND=2 SizeX*Y*...= 4x2 ---
+1, 5
+2, 6
+3, 7
+4, 8
 \end{verbatim}
 
