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

src/ell/LandscapeTopology.hh

Go to the documentation of this file.
00001 #ifndef LANDSCAPETOPOLOGY_HH_
00002 #define LANDSCAPETOPOLOGY_HH_
00003 
00004 #include "ell/State.hh"
00005 
00006 #include <string>
00007 
00008  // check which map to use
00009 #include "biu/HashMap.hh"
00010 
00011 
00012 //##############################################################################
00013 //##############################################################################
00014 
00015 namespace ell {
00016 
00023 class LandscapeTopology {
00024 
00025 public:
00026     
00027 #ifdef HAVE_GNU_HASH_MAP
00028     typedef __gnu_cxx::hash_map< int, size_t > Int2SizeT_MAP;
00029 #else
00030     typedef std::map< int, size_t > Int2SizeT_MAP;
00031 #endif
00032     
00033 public:  
00034     
00037     static const size_t INVALID_INDEX;
00038     
00041     static const double AVOGADRO_CONSTANT_NA;
00044     static const double GAS_CONSTANT_R;
00047     static const double BOLTZMANN_CONSTANT_KB;
00048     
00049 public:  
00050     
00054     static double BOLTZMANN_KT;
00055     
00061     static double MISSING_MINIMUM_PENALTY;
00062     
00063 public:
00064     
00066     virtual 
00067     ~LandscapeTopology();
00068     
00074     virtual 
00075     bool 
00076     addSaddle(const size_t i, const size_t j, const State* const s) = 0;
00077     
00083     virtual 
00084     bool 
00085     addSaddle(const State* const m_i, const State* const m_j, const State* const s) = 0;
00086     
00093     virtual 
00094     const size_t 
00095     addMin(const State* const m) = 0;
00096     
00101     virtual 
00102     const size_t 
00103     getMinIndex(const State* const m) const = 0;
00104     
00107     virtual 
00108     const size_t 
00109     getMinCount() const = 0;
00110     
00114     virtual 
00115     const State* const 
00116     getMin(size_t i) const = 0;
00117     
00122     virtual 
00123     const State* const 
00124     getMFEState() const = 0;
00125 
00134     virtual 
00135     double 
00136     getDistance(const LandscapeTopology* const lt) const;
00137     
00140     virtual 
00141     void 
00142     sort() = 0;
00143 
00147     virtual 
00148     bool 
00149     isSorted() const = 0;
00150 
00153     virtual 
00154     void 
00155     clear() = 0;
00156 
00161     virtual 
00162     void
00163     write(  std::ostream & out, 
00164             const bool writeGraph = false ) const = 0;
00165 
00175     virtual 
00176     std::pair<int,std::string>
00177     read(   std::istream & in, 
00178             const State * const templateState ) = 0;
00179 
00180     
00181     
00183     
00184     
00185     
00193     static
00194     void
00195     writeHeader(    std::ostream & out, 
00196                     const std::string& LT_ID,
00197                     const size_t minNumber,
00198                     const std::string & StateDescription );
00199     
00204     static
00205     void
00206     writeMinimum(   std::ostream & out, 
00207                     const State* const minimum,
00208                     const size_t index );
00209 
00216     static
00217     void
00218     writeMinimum(   std::ostream & out, 
00219                     const std::vector<const State*> & minima,
00220                     const size_t index );
00221 
00227     static
00228     void
00229     writeBarrier(   std::ostream & out, 
00230                     const State* const barrier,
00231                     const size_t index,
00232                     const std::vector<size_t> & minConnected );
00233     
00234     
00240     static
00241     void
00242     writeSaddle(    std::ostream & out, 
00243                     const State* const saddle,
00244                     const size_t index,
00245                     const std::vector<size_t> & minConnected );
00246     
00261     static
00262     std::pair<int,std::string>
00263     parseHeader(    const std::string & line, 
00264                     std::string& LT_ID,
00265                     size_t& minNumber,
00266                     std::string & StateDescription );
00267 
00284     static
00285     std::pair<int,std::string>
00286     parseMinimum(   LandscapeTopology & toFill,
00287                     const std::string & line, 
00288                     const State * const templateState,
00289                     Int2SizeT_MAP & idx2min );
00290     
00291     
00304     static
00305     std::pair<int,std::string>
00306     parseBarrier(   LandscapeTopology & toFill,
00307                     const std::string & line, 
00308                     const State * const templateState,
00309                     const Int2SizeT_MAP & idx2min );
00310 
00311     
00324     static
00325     std::pair<int,std::string>
00326     parseSaddle(    LandscapeTopology & toFill,
00327                     const std::string & line, 
00328                     const State * const templateState,
00329                     const Int2SizeT_MAP & idx2min );
00330 
00331 protected:  
00332     
00333     static
00334     double 
00335     getSortedMinimaDistance(    const std::vector<const State*> & m1,
00336                                 const std::vector<const State*> & m2 );
00337     
00338     
00341     static const std::string OUTPUT_KEY_ELL_HEAD;
00344     static const std::string OUTPUT_KEY_MINIMUM;
00347     static const std::string OUTPUT_KEY_BARRIER;
00350     static const std::string OUTPUT_KEY_SADDLE;
00351     
00358     static
00359     void
00360     writeConnection(    std::ostream & out, 
00361                         const State* const connectionState,
00362                         const size_t index,
00363                         const std::vector<size_t> & minConnected,
00364                         const std::string& connectionKey  );
00365     
00380     static
00381     std::pair< State*, std::string>
00382     parseConnection(    const std::string & line, 
00383                         const State * const templateState,
00384                         const Int2SizeT_MAP & idx2min,
00385                         const std::string& connectionKey,
00386                         std::vector<size_t> & connectedMinima );
00387     
00388 };
00389 
00390 //##############################################################################
00391 //##############################################################################
00392 
00393 
00394 
00395 }// ell
00396 
00397 
00398 #endif /*LANDSCAPETOPOLOGY_HH_*/