Index: trunk/SophyaProg/Examples/Makefile
===================================================================
--- trunk/SophyaProg/Examples/Makefile	(revision 1337)
+++ trunk/SophyaProg/Examples/Makefile	(revision 1337)
@@ -0,0 +1,59 @@
+MODULECXXREPNAME := Tests
+MODULEDECCXXFLAGS := -msg_quiet
+include $(DPCDEVREP)/Include/Makefile.h
+
+
+ifdef NOSHLIB
+
+LIBF =  $(LIB)libSysTools.a $(LIB)libNTools.a $(LIB)libBlitz.a $(LIB)libFitsIOServer.a $(LIB)libPI.a $(LIB)libPIext.a 
+LIBS = -L$(LIB) -lPIext -lPI -lSysTools -lNTools -lBlitz  -lm
+#LIBS =  -L$(LIB) -lSysTools -lm
+ifeq ($(CXX),cxx)
+# librairie des instances de templates cxx
+LIBS := $(LIBS) -lrt
+endif
+
+else
+
+LIBF =  $(SLB)libsophya.so 
+LIBS = -L$(SLB) -lPI -lextsophya -lsophya -lm 
+ifeq ($(MACHEROS),OSF1)
+LIBS := $(LIBS) -lfor
+endif
+ifeq ($(MACHEROS),Linux)
+LIBS := $(LIBS) -ldl -lf2c
+endif
+
+endif
+
+LDLIBS := $(LIBS) $(LDLIBS) 
+
+%:%.cc
+%:%.o
+%.o:%.cc
+%.o:%.c
+%:%.c
+
+.PRECIOUS: $(EXE)% $(OBJ)%.o
+
+%:$(EXE)%
+	echo $@ " done"
+
+$(EXE)%:$(OBJ)%.o
+	$(LINK.cc)  -o $@ $< $(LIBS)
+
+$(OBJ)%.o:%.cc
+	$(COMPILE.cc)   $(USERFLAGS) -o $@ $<
+
+$(EXE)%:$(OBJ)%.cc
+	$(LINK.cc) $(USERFLAGS)  -o $@ $< $(LIBS) 
+
+$(EXE)%:$(OBJ)%.c
+	$(LINK.c)  $(USERFLAGS) -o $@ $< $(LIBS) 
+
+$(OBJ)%.o:%.c
+	$(COMPILE.c) -c $(CFLAGS) $(USERFLAGS) -o $@ $< 
+
+dump :
+	echo $(LIBS)
+
Index: trunk/SophyaProg/Examples/README
===================================================================
--- trunk/SophyaProg/Examples/README	(revision 1337)
+++ trunk/SophyaProg/Examples/README	(revision 1337)
@@ -0,0 +1,37 @@
+#   Programmes exemple pour l'utilisation de Sophya
+
+On suppose que $DPCBASREP/`uname`-$EROSCXX/Exec est ds le path et 
+  .:$DPCBASREP/`uname`-$EROSCXX/ShLibs ds LD_LIBRARY_PATH 
+
+1) ex1.cc 
+   Un programme simple utilisant SOPHYA
+   
+
+2) arr1.icc 
+   Un bout de code C++ utilisant SOPHYA, pouvant etre execute
+   par runcxx :
+   csh> runcxx -f arr1.icc 
+   OU 
+   csh> runcxx -tmpdir /tmp arr1.icc
+
+3) fft.icc et myf_fft.icc
+   Exemple de code C++ utilisant les transforme de Fourier de SOPHYA,
+   pouvant etre execute ds spiapp.
+
+4) sphylm.icc sphylm.h
+   Exemple d'utilisation des cartes 4Pi (SphericalMaps) et des 
+   transforme en harmonique spherique pouvant etre execute ds spiapp.
+
+
+
+   csh> spiapp   
+   (on peut definir la variable d'environnement TMPDIR avant l'appel
+    a spiapp )
+
+   Commandes a taper dans la fenetre de commande de (s)piapp :
+
+      Cmd> delobjs *
+      Cmd> c++execfrf fft.icc myf_fft.h
+      Cmd> delobjs *
+      Cmd> c++execfrf sphylm.icc sphylm.h
+
Index: trunk/SophyaProg/Examples/arr1.icc
===================================================================
--- trunk/SophyaProg/Examples/arr1.icc	(revision 1337)
+++ trunk/SophyaProg/Examples/arr1.icc	(revision 1337)
@@ -0,0 +1,19 @@
+// Fichier arr1.icc
+// Exemple d'utilisation de tableaux  
+// Appel: runcxx -f arr1.icc
+// Creation , remplissage d'une matrice
+  TMatrix<r_4> ma(7,9);
+  ma = RegularSequence(0.1, 0.05);   
+  cout << "\n arr1.icc: ma = " << ma << endl;
+  float min, max;
+// Utilisation des sous-tableaux
+  ma(Range(2,4), Range(4,7)) = M_PI;
+  cout << "\n Apres ma(Range(2,4), Range(4,7)) = " << ma << endl;
+// Appel de methodes
+  ma.MinMax(min, max);
+  cout << " MinMax(ma) : min= " << min << " max= " << max << endl;
+  TMatrix<r_4> sma = Sin(ma);
+  cout << "\n test pour runcxx - sma = Sin(ma)= " << sma << endl;
+  sma.MinMax(min, max);
+  cout << " MinMax(sma) : min= " << min << " max= " << max << endl;
+
Index: trunk/SophyaProg/Examples/ex1.cc
===================================================================
--- trunk/SophyaProg/Examples/ex1.cc	(revision 1337)
+++ trunk/SophyaProg/Examples/ex1.cc	(revision 1337)
@@ -0,0 +1,77 @@
+#include "dvlist.h"
+#include "ndatablock.h"
+#include "fiondblock.h"
+#include "sophyainit.h"
+
+
+int main(int narg, char* arg[])
+{
+
+  // We handle exception at the high level
+  try {
+  // This macro initialize the library
+  // static objects handle this - However, not all loader call
+  // the constructor for static objects
+  SophyaInit();
+
+  // using a DVList object
+  cout << " Creating and using DVList and NDataBlock<T> " << endl;
+  DVList dvl;
+  dvl["A"] = 12;
+  dvl["bs"] = "hello";
+
+  // Using a datablock object with 66 integers
+  NDataBlock<int_4> idb(66);
+  // We initialize all values with the value 15
+  idb = 15;
+
+  // Using a datablock object with 40 float
+  NDataBlock<r_4> rdb(40);
+  // We initialize all values with the value 3.14
+  rdb = 3.14;
+
+  // Writing (serialiazing) objects into POutPersist streams
+  cout << " Writing objects in POutPersist streams " << endl;
+      {  
+      POutPersist so1("t11.ppf");
+      so1 << dvl;
+      POutPersist so2("t12.ppf");
+      string nom = "idb";
+      so2.PutObject(idb, nom);
+      nom = "rdb";
+      so2.PutObject(rdb, nom);
+      }
+
+  // Reading objects from PInPersist streams
+  cout << " reading objects from PInPersist streams " << endl;
+      {
+      PInPersist si1("t11.ppf");
+      DVList dvlr;
+      si1 >> dvlr;
+      cout << dvlr;     // Print on the standard output
+      PInPersist si2("t12.ppf");
+      string nom = "rdb";
+      NDataBlock<r_4> rrdb;
+      si2.GetObject(rrdb, nom);
+      cout << rrdb;     // Print on the standard output
+      NDataBlock<int_4> ridb;
+      nom = "idb";
+      si2.GetObject(ridb, nom);
+      cout << ridb;     // Print on the standard output
+      si2.GetObject(ridb, nom);      
+      }
+
+  // Opening an non existing file for reading generates an exception
+  cout << " Generating an exception ... " << endl;
+  PInPersist si("zz.zz");
+
+  }
+  catch (PThrowable & exc) {
+    cerr << " Catched Exception " << (string)typeid(exc).name() 
+	 << " - Msg= " << exc.Msg() << endl;
+  }
+  catch (...) {
+    cerr << " some other exception was caught ! " << endl;
+  }
+}
+
Index: trunk/SophyaProg/Examples/fft.icc
===================================================================
--- trunk/SophyaProg/Examples/fft.icc	(revision 1337)
+++ trunk/SophyaProg/Examples/fft.icc	(revision 1337)
@@ -0,0 +1,20 @@
+TVector<r_8> in(4048);
+TVector<r_8> noise(4048);
+TVector< complex<r_8> > out;
+in = RegularSequence(0., 0.05);
+noise = RandomSequence(RandomSequence::Gaussian, 0., 4.);
+MathArray<r_8> ma;
+ma.ApplyFunctionInPlace(in, myf);
+in += noise;
+FFTPackServer FFTServ;
+cout << " Calling FFT " << endl;
+FFTServ.FFTForward(in, out); 
+ExecuteCommand("zone 1 2");
+KeepObj(in);
+DisplayObj(in, "");
+// KeepObj(out);
+DisplayObj(out, "red");
+
+
+
+
Index: trunk/SophyaProg/Examples/myf_fft.h
===================================================================
--- trunk/SophyaProg/Examples/myf_fft.h	(revision 1337)
+++ trunk/SophyaProg/Examples/myf_fft.h	(revision 1337)
@@ -0,0 +1,7 @@
+inline double myf(double x)
+{
+return(3*sin(0.2*x)+4*cos(x)+5*sin(4*x+0.25) +3.5*cos(9*x+0.45) + 0.05*x);
+}
+
+
+
Index: trunk/SophyaProg/Examples/sphylm.h
===================================================================
--- trunk/SophyaProg/Examples/sphylm.h	(revision 1337)
+++ trunk/SophyaProg/Examples/sphylm.h	(revision 1337)
@@ -0,0 +1,2 @@
+#include "skymap.h"
+#include "samba.h"
Index: trunk/SophyaProg/Examples/sphylm.icc
===================================================================
--- trunk/SophyaProg/Examples/sphylm.icc	(revision 1337)
+++ trunk/SophyaProg/Examples/sphylm.icc	(revision 1337)
@@ -0,0 +1,46 @@
+// Generate input spectra  a + b* l + c * gaussienne(l, 50, 20)
+int lmax = 92;
+Vector clin(lmax);
+for(int l=0; l<lmax; l++) {
+  double xx = (l-50.)/10.;
+  clin(l) = 1.e-2 -1.e-4*l + 0.1*exp(-xx*xx);
+}
+
+// Compute map from spectra
+SphericalTransformServer<r_8> ylmserver;
+int m = 128;  // HealPix pixelisation parameter
+SphereHEALPix<r_8> map(m);
+ylmserver.GenerateFromCl(map, m,  clin, 0.);
+// Compute power spectrum from map
+Vector clout = ylmserver.DecomposeToCl(map, lmax,  0.);
+
+// Copy the synthetised map
+SphereHEALPix<r_8> mapdip;
+mapdip = map;
+
+// Define the dipole direction
+double thetadipole = 1.2;
+double phidipole = 0.3;
+UnitVector vd(thetadipole, phidipole);
+UnitVector vc(thetadipole, phidipole);
+
+// Add a dipole component to the map
+for(int i=0; i<mapdip.NbPixels(); i++) {  // Boucle sur les pixels
+  double Thetar,Phir;
+  mapdip.PixThetaPhi(i,Thetar,Phir);  // direction du pixel      
+  vc.SetThetaPhi(Thetar,  Phir);      
+  mapdip(i) += 5.*vd.Psc(vc);  // Produit scalaire 
+}
+
+// Compute the new map power spectrum 
+Vector cldip = ylmserver.DecomposeToCl(mapdip, lmax,  0.);
+
+// Display objects (kept automatically through Display)
+ExecuteCommand("zone 1 2");
+DisplayObj(map, " ");
+DisplayObj(mapdip, " ");
+DisplayObj(clin, "win");
+DisplayObj(clout, "same,red,fcirclemarker5,defline");
+KeepObj(cldip);
+
+
Index: trunk/SophyaProg/Examples/tvm.icc
===================================================================
--- trunk/SophyaProg/Examples/tvm.icc	(revision 1337)
+++ trunk/SophyaProg/Examples/tvm.icc	(revision 1337)
@@ -0,0 +1,7 @@
+Vector v1(5);
+v1 = 12.;
+Vector v2(5);
+v2 = 14;
+Matrix m = v2*v1.Transpose();
+cout << m;
+KeepObj(m);
