Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:09:52

0001 #ifndef ATOOLS_Org_Integration_Info_H
0002 #define ATOOLS_Org_Integration_Info_H
0003 /** @cond ANTI_INCLUDE_GUARD */
0004 #ifndef ATOOLS_Org_Info_Key_H
0005 #error The header 'Integration_Info.H' must not be included directly. \
0006 Please include the header 'Info_Key.H' instead.
0007 #else
0008 /** @endcond */
0009 
0010 #include "ATOOLS/Org/Info_Key.H"
0011 #include "ATOOLS/Org/My_Limits.H"
0012 #include "ATOOLS/Org/CXXFLAGS.H"
0013 #include <map>
0014 #include <vector>
0015 #include <limits>
0016 
0017 namespace ATOOLS {
0018 
0019   const double UNDEFINED_LOWER=-std::numeric_limits<double>::max();
0020   const double UNDEFINED_UPPER=std::numeric_limits<double>::max();
0021   const double UNDEFINED_DOUBLE=std::numeric_limits<double>::max();
0022   const double UNDEFINED_WEIGHT=0.;
0023 
0024   const ATOOLS::Vec4D UNDEFINED_VECTOR=ATOOLS::Vec4D();
0025 
0026   class Integration_Info {
0027   public:
0028 
0029     typedef std::vector<Info_Key*>                     Key_Vector;
0030     typedef std::pair<size_t,Key_Vector>               SizeT_KeyVector_Pair;
0031     typedef std::map<std::string,SizeT_KeyVector_Pair> String_KeyPair_Map;
0032     typedef std::pair<size_t,String_KeyPair_Map>       SizeT_KeyMap_Pair;
0033     typedef std::map<std::string,SizeT_KeyMap_Pair>    String_MapPair_Map;
0034 
0035   private:
0036 
0037     String_MapPair_Map m_keymap;
0038 
0039     std::vector<Double_Container> m_doubles;
0040     std::vector<Vector_Container> m_vectors;
0041     std::vector<Double_Container> m_weights;
0042     std::vector<si::code>         m_status;
0043 
0044     void AssignKey(Info_Key &key,const size_t doubles,const size_t vectors);
0045     void ReleaseKey(Info_Key &key);
0046 
0047     Double_Container &Doubles(const size_t valuekey);
0048     Vector_Container &Vectors(const size_t valuekey);
0049 
0050     double        &Double(const size_t valuekey,const size_t i);
0051     ATOOLS::Vec4D &Vector(const size_t valuekey,const size_t i);
0052 
0053     double        Double(const size_t valuekey,const size_t i) const;
0054     ATOOLS::Vec4D Vector(const size_t valuekey,const size_t i) const;
0055 
0056     void   SetWeight(const size_t valuekey,const size_t weightkey,
0057              const double weight);
0058     double Weight(const size_t valuekey,const size_t weightkey) const;
0059     
0060     si::code SetStatus(const size_t statuskey,const si::code status);
0061     si::code Status(const size_t statuskey);
0062 
0063     friend class Info_Key;
0064 
0065     friend std::ostream &operator<<(std::ostream &str,
0066                     const Integration_Info &info);
0067     friend std::ostream &operator<<(std::ostream &str,const Info_Key &key);
0068 
0069   public:
0070 
0071     // constructor
0072     Integration_Info();
0073 
0074     // destructor
0075     ~Integration_Info();
0076 
0077     // member functions
0078     void ResetAll();
0079 
0080   };// end of class Integration_Info
0081 
0082   std::ostream &operator<<(std::ostream &str,const Integration_Info &info);
0083   std::ostream &operator<<(std::ostream &str,const Double_Container &doubles);
0084   std::ostream &operator<<(std::ostream &str,const Vector_Container &vectors);
0085 
0086   /*!
0087     \class Integration_Info
0088     \brief Provides fast exchange of information between channels
0089 
0090     This class provides fast and easy information exchange between the channels 
0091     of the phase space integrator.
0092     Information is stored in a std::vector<Double_Container> and a 
0093     std::vector<Vector_Container> respectively to provide constant time access.
0094     Weight storage and status information is provided too, 
0095     such that multiple calculation of weights becomes obsolete.
0096 
0097     Each Channel evaluating a certain variable may access Integration_Info 
0098     through a corresponding Info_Key which communicates with Integration_Info 
0099     automatically.
0100     The appropriate way is to create a key like in the example below
0101     \code
0102        class Example_Channel: public Single_Channel {
0103        private:
0104          Info_Key m_key;
0105        public:
0106          ...
0107        };
0108 
0109        Example_Channel::Example_Channel(Integration_Info *info)
0110        {
0111          // <variable_info> is the exponent for s', for example
0112          m_key.SetInfo("<variable_info>")
0113      // <variable_name> is "s'", for example
0114          m_key.Assign("<variable_name>",<value_size>,<vector_size>,info);
0115        }
0116     \endcode
0117     The usage of keys is described in the documentation of Info_Key.
0118 
0119     Direct access to Integration_Info is prohibited to preserve 
0120     the corruption of data.
0121   */
0122 
0123 }// end of namespace ATOOLS
0124 
0125 #include "ATOOLS/Org/Integration_Info.inl.H"
0126 
0127 /** @cond ANTI_INCLUDE_GUARD */
0128 #endif
0129 /** @endcond */
0130 
0131 #endif