Generated on Tue Dec 16 13:34:02 2008 for ell-3.0.0 by doxygen 1.5.1

src/ell/spinglass/S_SG_Ising.hh

Go to the documentation of this file.
00001 #ifndef S_SG_ISING_HH_
00002 #define S_SG_ISING_HH_
00003 
00004 #include "ell/State.hh"
00005 #include "ell/IterableNeighbors.hh"
00006 #include <biu/assertbiu.hh>
00007 #include <biu/Alphabet.hh>
00008 
00009 namespace ell
00010 {
00017     class S_SG_Ising : public State, public IterableNeighbors 
00018     {
00019         
00020     public:
00022         typedef biu::Alphabet::AlphElem SpinType;
00024         typedef biu::Alphabet::Sequence SpinArray;
00025         
00027         static const SpinType SPIN_UP;
00029         static const SpinType SPIN_DOWN;
00030 
00032         static const std::string ID;
00033 
00034     protected:
00035 
00037         static const biu::Alphabet spinAlph;
00038 
00040         SpinArray spin; 
00041         
00042     public:
00043         
00050         S_SG_Ising(size_t size, bool random = true);
00051 
00054         S_SG_Ising(const std::string& spinStr);
00055         
00056         S_SG_Ising(const S_SG_Ising& s2);
00057         
00058         virtual ~S_SG_Ising();
00059         
00065         virtual const std::string& getID( void ) const;
00066     
00067 
00068         
00069         virtual bool            operator== (const State& state2) const;
00070         virtual bool            operator!= (const State& state2) const;
00071 
00072         virtual void            operator= (const S_SG_Ising& sg2);
00073         
00074         
00078         virtual double      getEnergy() const;
00079         
00086         virtual unsigned int    getMinimalDistance(const State& state2) const;
00087         
00095         virtual S_SG_Ising* clone(State* toFill = NULL) const;
00096         
00099         virtual State* fromString(const std::string& stringRep) const;  
00100     
00103         virtual std::string toString() const;
00104         
00110         virtual std::string& toString( std::string & toFill ) const;
00111 
00112         // neighborhood
00116         virtual NeighborListPtr getNeighborList() const;
00117 
00121         virtual NeighborListPtr getRandomNeighborList() const;
00122 
00126         virtual State* getRandomNeighbor(State* inPlaceNeigh = NULL) const;
00127         
00128         
00129         
00130         
00132         
00135         virtual size_t getNeighborNumber(void) const;
00136         
00143         virtual State* getNeighbor(const size_t index, State* neigh) const;
00144         
00153         virtual State* undoNeighborChange(const size_t index, State* const neigh) const;
00154         
00164         virtual State* applyNeighborChange(const size_t index, State* const neigh) const;
00165 
00167         
00171         virtual CSequence compress(void) const ;
00172         
00178         virtual CSequence& compress(CSequence& toFill) const;
00179         
00188         virtual State* uncompress(const CSequence& cseq, State* toFill) const;
00189         
00195         virtual State* uncompress(const CSequence& cseq);
00196         
00197         
00198 
00199     protected:
00200     
00202         inline SpinType flipSpin( SpinType s ) const {
00203             return ( s == SPIN_UP ? SPIN_DOWN : SPIN_UP);
00204         }
00205 
00206     }; // class
00207     
00208 } // namespace ell
00209 
00210 #endif /*S_SG_ISING_HH_*/