Index: trunk/SophyaLib/SkyMap/Makefile
===================================================================
--- trunk/SophyaLib/SkyMap/Makefile	(revision 2609)
+++ trunk/SophyaLib/SkyMap/Makefile	(revision 2610)
@@ -3,7 +3,7 @@
 all: $(LIB)libSkyMap.a
 clean:
-	rm -f $(OBJ)HEALPixUtils.o $(OBJ)fiolocalmap.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
+	rm -f $(OBJ)HEALPixUtils.o $(OBJ)fiolocalmap.o $(OBJ)fiosphereecp.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)sphereecp.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
 	rm -f $(LIB)libSkyMap.a
-$(LIB)libSkyMap.a : $(OBJ)HEALPixUtils.o $(OBJ)fiolocalmap.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
+$(LIB)libSkyMap.a : $(OBJ)HEALPixUtils.o $(OBJ)fiolocalmap.o $(OBJ)fiosphereecp.o $(OBJ)fiospherehealpix.o $(OBJ)fiospherethetaphi.o $(OBJ)localmap.o $(OBJ)longlat.o $(OBJ)mapoperation.o $(OBJ)skymapinit.o $(OBJ)sphereecp.o $(OBJ)spherehealpix.o $(OBJ)spherepos.o $(OBJ)spherethetaphi.o $(OBJ)unitvector.o $(OBJ)utilgeom.o $(OBJ)vector3d.o
 	$(ARCXX) $(ARCXXFLAGS) $@ $($(ARARGS))
 ifeq ($(CXX),cxx)
@@ -25,4 +25,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)utilarr.h \
  $(INC)smathconst.h
@@ -33,4 +36,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)dvlist.h \
  $(INC)objfio.h \
@@ -47,4 +53,26 @@
  $(INC)fiondblock.h \
  $(INC)datatype.h
+$(OBJ)fiosphereecp.o: fiosphereecp.cc fiosphereecp.h sphereecp.h \
+ sphericalmap.h $(INC)smathconst.h \
+ $(INC)machdefs.h pixelmap.h \
+ $(INC)ppersist.h \
+ $(INC)pexceptions.h \
+ $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
+ $(INC)dvlist.h \
+ $(INC)objfio.h \
+ $(INC)anydataobj.h \
+ $(INC)mutyv.h spherepos.h unitvector.h \
+ vector3d.h longlat.h utilgeom.h \
+ $(INC)tvector.h \
+ $(INC)tmatrix.h \
+ $(INC)tarray.h \
+ $(INC)basarr.h \
+ $(INC)ndatablock.h \
+ $(INC)utilarr.h \
+ $(INC)fioarr.h \
+ $(INC)datatype.h
 $(OBJ)fiospherehealpix.o: fiospherehealpix.cc fiospherehealpix.h \
  sphericalmap.h $(INC)smathconst.h \
@@ -53,4 +81,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)dvlist.h \
  $(INC)objfio.h \
@@ -72,4 +103,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)dvlist.h \
  $(INC)objfio.h \
@@ -90,4 +124,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)dvlist.h \
  $(INC)objfio.h \
@@ -113,4 +150,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)dvlist.h \
  $(INC)objfio.h \
@@ -124,4 +164,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)dvlist.h \
  $(INC)objfio.h \
@@ -136,5 +179,25 @@
  $(INC)utilarr.h fiospherehealpix.h \
  spherehealpix.h HEALPixUtils.h fiospherethetaphi.h fiolocalmap.h \
- localmap.h
+ localmap.h fiosphereecp.h sphereecp.h
+$(OBJ)sphereecp.o: sphereecp.cc sphereecp.h sphericalmap.h \
+ $(INC)smathconst.h \
+ $(INC)machdefs.h pixelmap.h \
+ $(INC)ppersist.h \
+ $(INC)pexceptions.h \
+ $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
+ $(INC)dvlist.h \
+ $(INC)objfio.h \
+ $(INC)anydataobj.h \
+ $(INC)mutyv.h spherepos.h unitvector.h \
+ vector3d.h longlat.h utilgeom.h \
+ $(INC)tvector.h \
+ $(INC)tmatrix.h \
+ $(INC)tarray.h \
+ $(INC)basarr.h \
+ $(INC)ndatablock.h \
+ $(INC)utilarr.h
 $(OBJ)spherehealpix.o: spherehealpix.cc \
  $(INC)machdefs.h \
@@ -143,4 +206,7 @@
  $(INC)ppersist.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)ndatablock.h \
  $(INC)anydataobj.h spherehealpix.h \
@@ -160,5 +226,8 @@
  $(INC)ppersist.h \
  $(INC)pexceptions.h \
- $(INC)gnumd5.h unitvector.h vector3d.h \
+ $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h unitvector.h vector3d.h \
  longlat.h utilgeom.h $(INC)anydataobj.h \
  $(INC)datatype.h
@@ -169,4 +238,7 @@
  $(INC)pexceptions.h \
  $(INC)gnumd5.h \
+ $(INC)ppfbinstream.h \
+ $(INC)rawstream.h \
+ $(INC)ppfnametag.h \
  $(INC)dvlist.h \
  $(INC)objfio.h \
Index: trunk/SophyaLib/SkyMap/fiosphereecp.cc
===================================================================
--- trunk/SophyaLib/SkyMap/fiosphereecp.cc	(revision 2610)
+++ trunk/SophyaLib/SkyMap/fiosphereecp.cc	(revision 2610)
@@ -0,0 +1,147 @@
+// G. Le Meur 04/2000
+
+#include "fiosphereecp.h"
+#include "fioarr.h"
+#include "pexceptions.h"
+#include "datatype.h"
+#include <typeinfo>
+
+///////////////////////////////////////////////////////////
+// --------------------------------------------------------
+//   Les classes delegues pour la gestion de persistance 
+// --------------------------------------------------------
+//////////////////////////////////////////////////////////
+namespace SOPHYA {
+
+template <class T>
+FIO_SphereECP<T>::FIO_SphereECP()
+{
+  dobj= new SphereECP<T>;
+  ownobj= true;
+}
+
+template <class T>
+FIO_SphereECP<T>::FIO_SphereECP(string const& filename)
+{
+  dobj= new SphereECP<T>;
+  ownobj= true;
+  Read(filename);
+}
+
+template <class T>
+FIO_SphereECP<T>::FIO_SphereECP(const SphereECP<T>& obj)
+{
+  dobj= new SphereECP<T>(obj, true);
+  ownobj= true;
+}
+
+template <class T>
+FIO_SphereECP<T>::FIO_SphereECP(SphereECP<T>* obj)
+{
+  dobj= obj;
+  ownobj= false;
+}
+
+template <class T>
+FIO_SphereECP<T>::~FIO_SphereECP()
+{
+  if (ownobj && dobj) delete dobj;
+}
+
+template <class T>
+AnyDataObj* FIO_SphereECP<T>::DataObj()
+{
+  return(dobj);
+}
+
+
+template <class T>
+void FIO_SphereECP<T>::SetDataObj(AnyDataObj & o)
+{
+  SphereECP<T> * po = dynamic_cast< SphereECP<T> * >(&o);
+  if (po == NULL) {
+    char buff[160];
+    sprintf(buff,"FIO_SphereECP<%s>::SetDataObj(%s) - Object type  error ! ",
+	    DataTypeInfo<T>::getTypeName().c_str(), typeid(o).name());
+    throw TypeMismatchExc(PExcLongMessage(buff));    
+  }
+
+  if (ownobj && dobj) delete dobj;
+  dobj = po; ownobj = false;
+} 
+
+template <class T>
+void FIO_SphereECP<T>::ReadSelf(PInPersist& is)
+{
+  if(dobj == NULL)  {
+    dobj= new SphereECP<T>;
+    ownobj= true;      
+  }
+  
+  // On lit les 3 premiers uint_8
+  int_4 itab[4];
+  is.Get(itab, 4);
+  dobj->_partial = (itab[1] & 1) ? true : false;
+
+  is >> dobj->_theta1 >> dobj->_theta2 ; 
+  is >> dobj->_phi1 >> dobj->_phi2; 
+  is >> dobj->_dtheta >> dobj->_dphi;
+  is >> dobj->_outofmapidx >> dobj->_outofmappix >> dobj->_outofmapval;
+  // Let's Read the SphereCoordSys object  -- ATTENTIOn - $CHECK$
+  FIO_SphereCoordSys fio_scs( dobj->GetCoordSys());
+  fio_scs.Read(is);
+  // S'il y avait un objet Info() a lire 
+  if (itab[1] & 2)  is >> dobj->Info();  
+  // On lit le tableau des pixels
+  is >> dobj->_pixels;
+}
+
+template <class T>
+void FIO_SphereECP<T>::WriteSelf(POutPersist& os) const
+{
+  if(dobj == NULL) {
+      cout << " FIO_SphereECP<T>::WriteSelf:: dobj= null " << endl;
+      return;
+    }
+//  On ecrit 4 int_4 
+//  itab[0] : Numero de version,  
+//itab[1] = 0 full map, , =1 partial map  (bit 0) , bit 1 set -> has info
+//  itab[2], itab[3]  reserve a un usage futur
+  int_4 itab[4];
+  itab[0] = 1;
+  itab[1] = (dobj->IsPartial()) ? 1 : 0;
+  if (dobj->ptrInfo() != NULL)  itab[1] |= 
+  itab[2] = itab[3] = 0;
+  os.Put(itab, 4);
+
+  os << dobj->_theta1 << dobj->_theta2 ; 
+  os << dobj->_phi1 << dobj->_phi2; 
+  os << dobj->_dtheta << dobj->_dphi;
+  os << dobj->_outofmapidx << dobj->_outofmappix << dobj->_outofmapval;
+
+  // Let's write the SphereCoordSys object
+  FIO_SphereCoordSys fio_scs( dobj->GetCoordSys());
+  fio_scs.Write(os);
+  // On ecrit l'objet info si necessaire
+  if (dobj->ptrInfo() != NULL) os << dobj->Info();
+
+  // On ecrit le tableau des pixels
+  os << dobj->_pixels;
+}
+
+#ifdef __CXX_PRAGMA_TEMPLATES__
+#pragma define_template FIO_SphereECP<int_4>
+#pragma define_template FIO_SphereECP<r_8>
+#pragma define_template FIO_SphereECP<r_4>
+#pragma define_template FIO_SphereECP< complex<r_4> >
+#pragma define_template FIO_SphereECP< complex<r_8> >
+#endif
+#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
+template class FIO_SphereECP<int_4>;
+template class FIO_SphereECP<r_8>;
+template class FIO_SphereECP<r_4>;
+template class FIO_SphereECP< complex<r_4> >;
+template class FIO_SphereECP< complex<r_8> >;
+#endif
+
+}// Fin du namespace
Index: trunk/SophyaLib/SkyMap/fiosphereecp.h
===================================================================
--- trunk/SophyaLib/SkyMap/fiosphereecp.h	(revision 2610)
+++ trunk/SophyaLib/SkyMap/fiosphereecp.h	(revision 2610)
@@ -0,0 +1,51 @@
+// This may look like C code, but it is really -*- C++ -*-
+// Gestion de persistance PPF pour les sphereECP 
+// R. Ansari, Septembre 2004 
+
+#ifndef FIOSPHEREECP_SEEN
+#define FIOSPHEREECP_SEEN
+
+#include "sphereecp.h"
+#include "ppersist.h"
+
+
+namespace SOPHYA {
+
+template <class T>
+class FIO_SphereECP : public PPersist  
+{
+public:
+
+FIO_SphereECP();
+FIO_SphereECP(string const & filename); 
+FIO_SphereECP(const SphereECP<T>& obj);
+FIO_SphereECP(SphereECP<T>* obj);
+virtual ~FIO_SphereECP();
+virtual AnyDataObj* DataObj();
+void SetDataObj(AnyDataObj & o);
+inline operator SphereECP<T>() { return(*dobj); }
+
+protected :
+
+virtual void ReadSelf(PInPersist&);           
+virtual void WriteSelf(POutPersist&) const;  
+SphereECP<T>* dobj;
+bool ownobj;
+};
+
+/*! \ingroup SkyMap \fn operator<<(POutPersist&,SphereECP<T>&)
+  \brief Write SphereECP \b obj into POutPersist stream \b os */
+template <class T>
+inline POutPersist& operator << (POutPersist& os, SphereECP<T> & obj)
+{ FIO_SphereECP<T> fio(&obj);  fio.Write(os);  return(os); }
+
+/*! \ingroup SkyMap \fn operator>>(PInPersist&,SphereECP<T>&)
+  \brief Read SphereECP \b obj from PInPersist stream \b os */
+template <class T>
+inline PInPersist& operator >> (PInPersist& is, SphereECP<T> & obj)
+{ FIO_SphereECP<T> fio(&obj); is.SkipToNextObject(); fio.Read(is); return(is); }
+
+
+} // Fin du namespace
+
+#endif
Index: trunk/SophyaLib/SkyMap/objlist.list
===================================================================
--- trunk/SophyaLib/SkyMap/objlist.list	(revision 2609)
+++ trunk/SophyaLib/SkyMap/objlist.list	(revision 2610)
@@ -1,4 +1,5 @@
 HEALPixUtils.o
 fiolocalmap.o
+fiosphereecp.o
 fiospherehealpix.o
 fiospherethetaphi.o
@@ -7,4 +8,5 @@
 mapoperation.o
 skymapinit.o
+sphereecp.o
 spherehealpix.o
 spherepos.o
Index: trunk/SophyaLib/SkyMap/skymap.h
===================================================================
--- trunk/SophyaLib/SkyMap/skymap.h	(revision 2609)
+++ trunk/SophyaLib/SkyMap/skymap.h	(revision 2610)
@@ -9,7 +9,9 @@
 #include "spherehealpix.h"
 #include "localmap.h"
+#include "sphereecp.h"
 #include "fiospherethetaphi.h"
 #include "fiospherehealpix.h"
 #include "fiolocalmap.h"
+#include "fiosphereecp.h"
 
 #endif
Index: trunk/SophyaLib/SkyMap/skymapinit.cc
===================================================================
--- trunk/SophyaLib/SkyMap/skymapinit.cc	(revision 2609)
+++ trunk/SophyaLib/SkyMap/skymapinit.cc	(revision 2610)
@@ -8,5 +8,5 @@
 #include "fiospherethetaphi.h"
 #include "fiolocalmap.h"
-#include "localmap.h"
+#include "fiosphereecp.h"
  
 /*!
@@ -85,4 +85,22 @@
   DObjRegister(FIO_LocalMap< complex<r_8> >, LocalMap< complex<r_8> >);
 
+  // ---------- Les SphereECP ---------
+
+  PPRegister(FIO_SphereECP<int_4>);
+  DObjRegister(FIO_SphereECP<int_4>, SphereECP<int_4>);
+
+  PPRegister(FIO_SphereECP<r_4>);
+  DObjRegister(FIO_SphereECP<r_4>, SphereECP<r_4>);
+
+  PPRegister(FIO_SphereECP<r_8>);
+  DObjRegister(FIO_SphereECP<r_8>, SphereECP<r_8>);
+
+  PPRegister(FIO_SphereECP< complex<r_4> >);
+  DObjRegister(FIO_SphereECP< complex<r_4> >, SphereECP< complex<r_4> >);
+
+  PPRegister(FIO_SphereECP< complex<r_8> >);
+  DObjRegister(FIO_SphereECP< complex<r_8> >, SphereECP< complex<r_8> >);
+
+
 
 }
Index: trunk/SophyaLib/SkyMap/sphereecp.cc
===================================================================
--- trunk/SophyaLib/SkyMap/sphereecp.cc	(revision 2610)
+++ trunk/SophyaLib/SkyMap/sphereecp.cc	(revision 2610)
@@ -0,0 +1,370 @@
+#include "sphereecp.h"
+#include <math.h>
+
+namespace SOPHYA {
+
+template <class T>
+SphereECP<T>::SphereECP()
+  : _pixels()
+{
+  _partial = false;
+  _theta1 = 0.;
+  _theta2 = M_PI;
+  _phi1 = 0.;
+  _phi2 = 2*M_PI;
+  _outofmapidx = -99;
+  _outofmappix = 0;
+  _outofmapval = 0;
+  _dtheta = 0.;
+  _dphi = 0.;
+}
+
+template <class T>
+SphereECP<T>::SphereECP(int m)
+  : _pixels(2*m,m,0,0,0,true)
+{
+  _partial = false;
+  _theta1 = 0.;
+  _theta2 = M_PI;
+  _phi1 = 0.;
+  _phi2 = 2*M_PI;
+  _outofmapidx = -99;
+  _outofmappix = 0;
+  _outofmapval = 0;
+  _dtheta = _dphi = M_PI/m;
+}
+
+template <class T>
+SphereECP<T>::SphereECP(int ntet, int nphi)
+  : _pixels(nphi,ntet,0,0,0,true)
+{
+  _partial = false;
+  _theta1 = 0.;
+  _theta2 = M_PI;
+  _phi1 = 0.;
+  _phi2 = 2*M_PI; 
+  _outofmapidx = -99;
+  _outofmappix = 0;
+  _outofmapval = 0;
+  _dtheta = M_PI/ntet;
+  _dphi = 2*M_PI/nphi;
+}
+
+template <class T>
+SphereECP<T>::SphereECP(r_8 tet1, r_8 tet2, int ntet, r_8 phi1, r_8 phi2, int nphi)
+  : _pixels(nphi,ntet,0,0,0,true)
+{
+  if( (tet1 > M_PI) || (tet1 < 0.) || (tet2 > M_PI) || (tet2 < 0.) || 
+      (phi1 < 0.) || (phi1 > 2*M_PI) || (phi1 < 0.) || (phi1 > 2*M_PI) ||
+      (tet2 <= tet1) || (phi2 <= phi1) )
+    throw  ParmError("SphereECP::SphereECP() Bad range for theta/phi limits");
+
+   _partial = true;
+  _theta1 = tet1;
+  _theta2 = tet2;
+  _phi1 = phi1;
+  _phi2 = phi2; 
+  _outofmapidx = _pixels.Size()+659;
+  _outofmappix = 0;
+  _outofmapval = 0;
+  _dtheta = (_theta2-_theta1)/ntet;
+  _dphi = (_phi2-_phi1)/nphi;
+}
+
+template <class T>
+SphereECP<T>::SphereECP(const SphereECP<T>& a, bool share)
+  : _pixels(a._pixels, share)
+{
+  _partial = a._partial;
+  _theta1 = a._theta1;
+  _theta2 = a._theta2;
+  _phi1 = a._phi1;
+  _phi2 = a._phi2;   
+  _outofmapidx = a._outofmapidx;
+  _outofmappix = a._outofmappix;
+  _outofmapval = a._outofmapval;
+  _dtheta = a._dtheta;
+  _dphi = a._dphi;
+}
+
+template <class T>
+SphereECP<T>::SphereECP(const SphereECP<T>& a)
+  : _pixels(a._pixels)
+{
+  _partial = a._partial;
+  _theta1 = a._theta1;
+  _theta2 = a._theta2;
+  _phi1 = a._phi1;
+  _phi2 = a._phi2;   
+  _outofmapidx = a._outofmapidx;
+  _outofmappix = a._outofmappix;
+  _outofmapval = a._outofmapval;
+  _dtheta = a._dtheta;
+  _dphi = a._dphi;
+}
+
+template <class T>
+SphereECP<T>::~SphereECP()
+{
+}
+
+template <class T>
+string SphereECP<T>::TypeOfMap() const
+{
+  return string("TETAFI");
+}
+
+template <class T>
+void SphereECP<T>::SetTemp(bool temp) const
+{
+  _pixels.SetTemp(temp);
+}
+
+template <class T>
+int_4 SphereECP<T>::NbPixels() const
+{
+  return _pixels.Size();
+}
+
+template <class T>
+T& SphereECP<T>::PixVal(int_4 k)
+{
+  if ((_partial) && (k==_outofmapidx))   return _outofmappix;
+  if((k < 0) || (k >= _pixels.Size()) )  
+     throw RangeCheckError("SphereECP::PIxVal() Pixel index out of range");
+  return _pixels.DataBlock()(k);
+}
+
+template <class T>
+T const& SphereECP<T>::PixVal(int_4 k)  const
+{
+  if ((_partial) && (k==_outofmapidx))   return _outofmapval;
+  if((k < 0) || (k >= _pixels.Size()) )  
+     throw RangeCheckError("SphereECP::PIxVal() Pixel index out of range");
+  //  return _pixels.DataBlock()(k);
+  return _pixels.Data()[k];
+}
+
+template <class T>
+bool  SphereECP<T>::ContainsSph(double theta, double phi) const
+{
+  if (_partial) {
+    if ( (theta >= _theta1) && (theta <= _theta2) &&
+	 (phi >= _phi1) && (phi <= _phi2) )  return true;
+    else return false;
+  }
+  else return false;
+}
+
+template <class T>
+int_4  SphereECP<T>::PixIndexSph(double theta, double phi) const
+{
+  if((theta > M_PI) || (theta < 0.)) return(-1);
+  if((phi < 0.) || (phi > 2*M_PI)) return(-1);
+  if (_partial) {
+    if ( (theta < _theta1) || (theta > _theta2) ||
+	 (phi < _phi1) || (phi > _phi2) )  return _outofmapidx;
+  }
+  int_4 it = (theta-_theta1)/_dtheta;
+  int_4 jp = (phi-_phi1)/_dphi;
+  return (it*_pixels.SizeX()+jp);
+}
+
+template <class T>
+void  SphereECP<T>::PixThetaPhi(int_4 k, double& theta, double& phi) const
+{
+  if ((_partial) && (k==_outofmapidx)) {
+    theta = M_PI;
+    phi = 2*M_PI;
+    return;
+  }
+  if((k < 0) || (k >= _pixels.Size()) )  
+     throw RangeCheckError("SphereECP::PixThetaPhi() Pixel index out of range");
+
+  int_4 it = k / _pixels.SizeX();
+  int_4 jp = k % _pixels.SizeX();
+  theta = _theta1+it*_dtheta;
+  phi = _phi1*jp*_dphi;
+  return;
+}
+
+template <class T>
+T  SphereECP<T>::SetPixels(T v)
+{
+  _pixels = v;
+  return v;
+}
+
+template <class T>
+double  SphereECP<T>::PixSolAngle(int_4 k) const
+{
+  if ((k < 0) || (k >= _pixels.Size()))  return (_dtheta*_dphi);
+  int_4 it = k / _pixels.SizeX();
+  double theta = _theta1+it*_dtheta;
+  return (_dtheta*_dphi*sin(theta));
+}
+
+template <class T>
+int_4  SphereECP<T>::SizeIndex() const
+{
+  return _pixels.SizeY();
+}
+
+template <class T>
+void  SphereECP<T>::Resize(int_4 m)
+{
+  if ( (m <= 0) || ( m == _pixels.SizeY()) ) { 
+    cout << " SphereECP<T>::Resize(int_4 " << m << ") m<0 ou m=NTheta - Ne fait rien " << endl;
+    return;
+  }
+  int mphi = m;
+  if (_pixels.Size() > 0)  mphi = m*_pixels.SizeX()/_pixels.SizeY();
+  cout << " SphereECP<T>::Resize(" << m 
+       << ") -> _pixels.Resize(" << mphi << "," << m << ")" << endl; 
+  sa_size_t sz[5] = {0,0,0,0,0};
+  sz[0] = mphi;  sz[1] = m;
+  _pixels.ReSize(2,sz);
+  _outofmapidx = _pixels.Size()+659;
+  _dtheta = (_theta2-_theta1)/m;
+  _dphi = (_phi2-_phi1)/mphi;
+  return;
+}
+
+template <class T>
+uint_4  SphereECP<T>::NbThetaSlices() const
+{
+  return _pixels.SizeY();
+}
+
+template <class T>
+void  SphereECP<T>::GetThetaSlice(int_4 index,r_8& theta, 
+				  TVector<r_8>& phi, TVector<T>& value) const 
+{
+  if( (index < 0) || (index >= _pixels.SizeY()) )  
+     throw RangeCheckError("SphereECP::GetThetaSlice() theta index out of range");
+
+  theta = _theta1 + index*_dtheta;
+  int_4 nphit = 2.*M_PI/_dphi;
+  phi.ReSize(nphit); 
+  value.ReSize(nphit); 
+  int_4 ioff = _phi1/_dphi;
+  int_4 i;
+  for(i=0; i<ioff; i++) {
+    phi(i) = _phi1 + (i-ioff)*_dphi;
+    value(i) = _outofmapval;
+  }
+  for(i=ioff; i<ioff+_pixels.SizeX(); i++) {
+    phi(i) = _phi1 + (i-ioff)*_dphi;
+    value(i) = _pixels(i-ioff,index,0);
+  }
+  for(i=ioff+_pixels.SizeX(); i<nphit; i++) {
+    phi(i) = _phi1 + (i-ioff)*_dphi;
+    value(i) = _outofmapval;
+  }
+  return;
+}
+
+template <class T>
+void  SphereECP<T>::GetThetaSlice(int_4 index, r_8& theta, r_8& phi0, 
+				  TVector<int_4>& pixidx, TVector<T>& value) const
+{
+  if( (index < 0) || (index >= _pixels.SizeY()) )  
+    throw RangeCheckError("SphereECP::GetThetaSlice() theta index out of range");
+  
+  theta = _theta1 + index*_dtheta;
+  int_4 ioff = _phi1/_dphi;
+  phi0 = _phi1 - ioff*_dphi;
+
+  int_4 nphit = 2.*M_PI/_dphi;
+  pixidx.ReSize(nphit); 
+  value.ReSize(nphit);
+ 
+  int_4 i;
+  for(i=0; i<ioff; i++) {
+    pixidx(i) =  _outofmapidx;
+    value(i) = _outofmapval;
+  }
+  for(i=ioff; i<ioff+_pixels.SizeX(); i++) {
+    pixidx(i) = index*_pixels.SizeX()+(i-ioff);
+    value(i) = _pixels(i-ioff,index,0);
+  }
+  for(i=ioff+_pixels.SizeX(); i<nphit; i++) {
+    pixidx(i) =  _outofmapidx;
+    value(i) = _outofmapval;
+  }
+  return;
+
+}
+
+template <class T>
+void  SphereECP<T>::Print(ostream& os) const
+{
+  if (_partial)
+    os << "SphereECP<T>::Print() - Partial ECP Map NPhi=" << _pixels.SizeX() 
+       << " x NTheta= " <<  _pixels.SizeX() << " SolidAngle=" << PixSolAngle() << "\n"
+       << "ThetaLimits= " << _theta1 << " .. " << _theta2 
+       << "  PhiLimits= " << _phi1 << " .. " << _phi2 << endl;
+  else 
+    os << "SphereECP<T>::Print() - Full ECP Map NPhi=" << _pixels.SizeX() 
+       << " x NTheta= " <<  _pixels.SizeY() << " SolidAngle=" << PixSolAngle() << endl;
+  os << _pixels;
+}
+
+template <class T>
+SphereECP<T>&  SphereECP<T>::Set(const SphereECP<T>& a)
+{
+  _pixels.Set(a._pixels);
+  _partial = a._partial;
+  _theta1 = a._theta1;
+  _theta2 = a._theta2;
+  _phi1 = a._phi1;
+  _phi2 = a._phi2;   
+  _outofmapidx = a._outofmapidx;
+  _outofmappix = a._outofmappix;
+  _outofmapval = a._outofmapval;
+  _dtheta = a._dtheta;
+  _dphi = a._dphi; 
+  return *this ;
+}
+
+template <class T>
+SphereECP<T>&  SphereECP<T>::SetCst(T x)
+{
+  _pixels.SetCst(x);
+  return *this ;
+}
+
+template <class T>
+SphereECP<T>&  SphereECP<T>::AddCst(T x)
+{
+  _pixels += x;
+  return *this ;
+}
+
+template <class T>
+SphereECP<T>&  SphereECP<T>::MulCst(T x)
+{
+  _pixels *= x;
+  return *this ;
+}
+
+
+
+
+
+#ifdef __CXX_PRAGMA_TEMPLATES__
+#pragma define_template SphereECP<int_4>
+#pragma define_template SphereECP<r_4>
+#pragma define_template SphereECP<r_8>
+#pragma define_template SphereECP< complex<r_4> >
+#pragma define_template SphereECP< complex<r_8> >
+#endif
+#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
+template class SphereECP<int_4>;
+template class SphereECP<r_4>;
+template class SphereECP<r_8>;
+template class SphereECP< complex<r_4> >;
+template class SphereECP< complex<r_8> >;
+#endif
+
+}// Fin du namespace
Index: trunk/SophyaLib/SkyMap/sphereecp.h
===================================================================
--- trunk/SophyaLib/SkyMap/sphereecp.h	(revision 2610)
+++ trunk/SophyaLib/SkyMap/sphereecp.h	(revision 2610)
@@ -0,0 +1,144 @@
+#ifndef SPHEREECP_SEEN
+#define SPHEREECP_SEEN
+
+#include "sphericalmap.h"
+#include "ndatablock.h"
+#include "tvector.h"
+
+
+/* Classe de carte spherique avec decoupage theta-phi 
+  (projection cylindique: Equatorial Cylindrical Projection) 
+  avec couverture posiibilite de couverture partielle,
+  limites en theta,phi
+  R. Ansari  - Septembre 2004 
+ */
+
+namespace SOPHYA {
+template <class T>
+class FIO_SphereECP;  
+
+template <class T> 
+class SphereECP : public SphericalMap<T>
+{
+public :
+  // Constructeur par defaut
+			SphereECP();
+  // Constructeur , couverture complete, m tranches en theta (delta theta = M_PI), 2m en phi (delta phi = 2Pi)
+			SphereECP(int m);
+  // Constructeur , couverture complete, ntet tranches en theta (delta theta = M_PI), nphi en phi (delta phi = 2Pi)
+			SphereECP(int ntet, int nphi);
+  // Constructeur , couverture partielle, ntet tranches en theta , nphi en phi 
+			SphereECP(r_8 tet1, r_8 tet2, int ntet, r_8 phi1, r_8 phi2, int nphi);
+  // Constructeur de copie, share=true -> partage des pixels
+			SphereECP(const SphereECP<T>& a, bool share);
+  // Constructeur de copie, partage des pixels
+			SphereECP(const SphereECP<T>& a);
+  virtual		~SphereECP();
+
+// Renvoie TETAPHI comme les SphereThetaPhi pour le moment  
+  virtual string	TypeOfMap() const;  
+  virtual void		SetTemp(bool temp=false) const;  // A supprimer 
+
+// Informations sur carte partielle/complete + zone de couverture
+  inline  bool		IsPartial() const { return _partial; }
+  inline  double        MinTheta() const { return _theta1; }
+  inline  double        MaxTheta() const { return _theta2; }
+  inline  double        DeltaTheta() const { return _dtheta; }
+  inline  double        MinPhi() const { return _phi1; }
+  inline  double        MaxPhi() const { return _phi2; }
+  inline  double        DeltaPhi() const { return _dphi; }
+
+// Interface de Pixelmap
+/*!    Return total number of pixels  */
+  virtual int_4		NbPixels() const;
+
+/* retourne la valeur du pixel d'indice k */ 
+/*!    Return value of pixel with index k */
+  virtual T&		PixVal(int_4 k);
+  virtual T const&	PixVal(int_4 k) const;
+
+/* Return true if teta,phi in map  */
+  virtual bool		ContainsSph(double theta, double phi) const;
+/* retourne l'indice du pixel a (theta,phi) */ 
+/*    Return index of the pixel corresponding to direction (theta, phi). */
+  virtual int_4		PixIndexSph(double theta, double phi) const;
+
+/* retourne les coordonnees Spheriques du centre du pixel d'indice k */ 
+/*!   Return (theta,phi) coordinates of middle of  pixel with  index k */
+  virtual void		PixThetaPhi(int_4 k, double& theta, double& phi) const;
+
+/*! Setting pixel values to a constant */
+  virtual T		SetPixels(T v);
+
+/* retourne/fixe l'angle Solide de Pixel   (steradians) */ 
+/*!   Pixel Solid angle  (steradians)
+
+    All the pixels have the same solid angle. The dummy argument is
+   for compatibility with eventual pixelizations which would not 
+    fulfil this requirement.
+*/
+  virtual double	PixSolAngle(int_4 dummy=0) const;
+ 
+/* retourne/fixe la valeur du parametre de decoupage m */ 
+  virtual int_4		SizeIndex() const ;
+
+// Interface de SphericalMap 
+// index characterizing the size pixelization : m for SphereThetaPhi
+// nside for Gorski sphere...
+  virtual void		Resize(int_4 m);
+  virtual uint_4	NbThetaSlices() const;
+
+  // Nb de tranches en Phi
+  inline  uint_4	NbPhiSlices() const { return _pixels.SizeX(); }
+
+  virtual void		GetThetaSlice(int_4 index,r_8& theta, 
+				      TVector<r_8>& phi, TVector<T>& value) const ; 
+  virtual void		GetThetaSlice(int_4 sliceIndex, r_8& theta, r_8& phi0, 
+				      TVector<int_4>& pixelIndices,TVector<T>& value) const ;
+
+  // Valeur de pixel hors carte
+  inline void		SetOutOfMapValue(T v) { _outofmappix = _outofmapval = v; }
+  inline T		GetOutOfMapValue(T v) { return _outofmapval; }
+
+  // Impression 
+  virtual void          Print(ostream& os) const;
+  inline void		print(ostream& os) const { Print(os); }
+
+  // ---- les operations =, +, - , *
+  // operation = (remplissage avec une valeur ou carte)
+  virtual SphereECP<T>& Set(const SphereECP<T>& a);
+  inline  SphereECP<T>&	operator = (const SphereECP<T>& a) { return Set(a); }
+  virtual SphereECP<T>& SetCst(T x);
+  inline  SphereECP<T>&	operator = (T x)   { return SetCst(x); }
+  // Operation + , * avec des Constantes 
+  virtual SphereECP<T>&	AddCst(T x) ;
+  virtual SphereECP<T>&	MulCst(T x) ;
+
+  inline  SphereECP<T>&  operator += (T x)            { return AddCst(x); }
+  inline  SphereECP<T>&  operator -= (T x)            { return AddCst(-x); }
+  inline  SphereECP<T>&  operator *= (T x)            { return MulCst(x); }
+
+  // Acces au tableau des pixels
+  inline TArray<T>&	GetPixelArray() { return _pixels; }
+  inline TArray<T>	GetPixelArray() const { return _pixels; }
+
+  friend class  FIO_SphereECP<T>;   // Gestion de persistance PPF
+
+protected:
+  bool _partial;
+  r_8 _theta1,_theta2;
+  r_8 _phi1, _phi2;
+  r_8 _dtheta, _dphi;
+  TArray<T> _pixels;
+  int_4 _outofmapidx;
+  T _outofmappix;
+  T _outofmapval;
+};
+
+template <class T>
+inline ostream& operator << (ostream& os, const SphereECP<T>& a)
+  { a.Print(os);    return(os);  }
+
+}// Fin du namespace
+
+#endif
