| 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
| 2 | #ifndef SPHEREPOS_H_SEEN | 
|---|
| 3 | #define SPHEREPOS_H_SEEN | 
|---|
| 4 |  | 
|---|
| 5 | #include "machdefs.h" | 
|---|
| 6 | #include "ppersist.h" | 
|---|
| 7 | #include <string> | 
|---|
| 8 | #include "unitvector.h" | 
|---|
| 9 | #include "anydataobj.h" | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 | namespace SOPHYA { | 
|---|
| 13 |  | 
|---|
| 14 |  | 
|---|
| 15 | class SphereCoordSys : public  AnyDataObj { | 
|---|
| 16 | public: | 
|---|
| 17 |  | 
|---|
| 18 | enum SphereCoordSysIds { NEUTRAL =0, | 
|---|
| 19 | ROTATION =1, | 
|---|
| 20 | OTHER = 0xFFFF | 
|---|
| 21 | }; | 
|---|
| 22 |  | 
|---|
| 23 | SphereCoordSys(); | 
|---|
| 24 | SphereCoordSys(const SphereCoordSys& a); | 
|---|
| 25 | SphereCoordSys(int id, const string& description); | 
|---|
| 26 | virtual        ~SphereCoordSys(); | 
|---|
| 27 |  | 
|---|
| 28 | virtual int    Id() const {return id_; } | 
|---|
| 29 | virtual string description() const {return description_; } | 
|---|
| 30 | SphereCoordSys& operator = (const SphereCoordSys& a); | 
|---|
| 31 |  | 
|---|
| 32 |  | 
|---|
| 33 | private: | 
|---|
| 34 | int id_; | 
|---|
| 35 | string description_; | 
|---|
| 36 | }; | 
|---|
| 37 |  | 
|---|
| 38 | // Classe pour la gestion de persistance | 
|---|
| 39 |  | 
|---|
| 40 | class FIO_SphereCoordSys : public  PPersist  { | 
|---|
| 41 | public: | 
|---|
| 42 | FIO_SphereCoordSys(); | 
|---|
| 43 | FIO_SphereCoordSys(string const & filename); | 
|---|
| 44 | FIO_SphereCoordSys(const SphereCoordSys & obj); | 
|---|
| 45 | FIO_SphereCoordSys(SphereCoordSys * obj); | 
|---|
| 46 | virtual ~FIO_SphereCoordSys(); | 
|---|
| 47 | virtual AnyDataObj* DataObj(); | 
|---|
| 48 | virtual   void        SetDataObj(AnyDataObj & o); | 
|---|
| 49 | inline operator SphereCoordSys() { return(*dobj); } | 
|---|
| 50 | protected : | 
|---|
| 51 | virtual void       ReadSelf(PInPersist&); | 
|---|
| 52 | virtual void       WriteSelf(POutPersist&) const; | 
|---|
| 53 | SphereCoordSys * dobj; | 
|---|
| 54 | bool ownobj; | 
|---|
| 55 | }; | 
|---|
| 56 |  | 
|---|
| 57 |  | 
|---|
| 58 | class SpherePosition : public UnitVector { | 
|---|
| 59 | public: | 
|---|
| 60 |  | 
|---|
| 61 | SpherePosition(); | 
|---|
| 62 | // cs should be created by new SphereCoordSys... | 
|---|
| 63 | // It will be deleted by the destructor | 
|---|
| 64 | SpherePosition(double theta, double phi, SphereCoordSys* cs = NULL); | 
|---|
| 65 | SpherePosition(double x, double y, double z, SphereCoordSys* cs = NULL); | 
|---|
| 66 | SpherePosition(const UnitVector& v, SphereCoordSys* cs = NULL); | 
|---|
| 67 | virtual        ~SpherePosition(); | 
|---|
| 68 |  | 
|---|
| 69 | inline double  phi() const {return Phi(); } | 
|---|
| 70 | inline double  theta() const { return(Theta()); } | 
|---|
| 71 | inline SphereCoordSys *   GetCoordSys() const { return(cs_); } | 
|---|
| 72 | virtual UnitVector Transform(const SphereCoordSys& cs) const ; | 
|---|
| 73 |  | 
|---|
| 74 | virtual double     Separation(const SpherePosition& gamma) const; | 
|---|
| 75 |  | 
|---|
| 76 | protected: | 
|---|
| 77 | SphereCoordSys* cs_; | 
|---|
| 78 | }; | 
|---|
| 79 |  | 
|---|
| 80 | } // Fin du namespace | 
|---|
| 81 |  | 
|---|
| 82 | #endif | 
|---|