uns.h 3.45 KB
Newer Older
jcl's avatar
jcl committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
// ============================================================================
// Copyright Jean-Charles LAMBERT - 2008-2010                                       
// e-mail:   Jean-Charles.Lambert@oamp.fr                                      
// address:  Dynamique des galaxies                                            
//           Laboratoire d'Astrophysique de Marseille                          
//           Pole de l'Etoile, site de Chateau-Gombert                         
//           38, rue Frederic Joliot-Curie                                     
//           13388 Marseille cedex 13 France                                   
//           CNRS U.M.R 6110                                                   
// ============================================================================
#ifndef UNSENGINE_H
#define UNSENGINE_H
/**
	@author Jean-Charles Lambert <jean-charles.lambert@oamp.fr>
*/

#include <cstring>
#include <string>
#include "snapshotinterface.h"
#include <map>

namespace uns {
     enum StringData {
      // data
      Time      ,
      Redshift  ,
      Pos       ,
      Vel       ,
      Mass      ,
      Id        ,
      Rho       ,
      Hsml      ,
      U         ,  // internal Energy
      Keys      ,
      Aux       ,
      Pot       ,
      Acc       ,
      Age       ,
      Temp      ,  // temperature
      Metal     ,  // total metal : gas+stars
      GasMetal  ,  // metal for gas
      StarsMetal,  // metal for stars
      Zs        ,
      ZSMT      ,
      Im        ,
      Czs       ,
      Czsmt     ,
      
      // Nbodies  per component
      Nsel      ,
      Nbody     ,
      Ngas      ,
      Nhalo     ,
      Ndisk     ,
      Nbulge    ,
      Nstars    ,
      Nbndry    ,

      // Components
      Gas       ,
      Halo      ,
      Disk      ,
      Bulge     ,
      Stars     ,
      Bndry     ,
      All       ,
      
      GasMPV    ,
      HaloMPV   ,
      DiskMPV   ,
      BulgeMPV  ,
      StarsMPV  ,
      BndryMPV
  };

  // class Cuns                                              
  // manage Unified Nbody Snapshot Input operations            
  class CunsIn {
  public:
    // constructor for READING opertaions
    CunsIn(const char * ,const char * , const char *, const bool verb=false );
    CunsIn(const std::string ,const std::string,const std::string, const bool verb=false );
    ~CunsIn();
    bool isValid() { return valid;}
    CSnapshotInterfaceIn * snapshot; // object to store data

  private:
    void init(const std::string ,const std::string,const std::string, const bool verb=false );
    std::string simname, sel_comp, sel_time; // IN
    void tryGadget();
    void tryNemo();
    void trySimDB();
    void trySnapList();
94 95
    void tryRamses();

jcl's avatar
jcl committed
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
    //bool findSim();
    bool valid;
    bool verbose;
  };

  // class CunsOut                                              
  // manage Unified Nbody Snapshot Output operations            
  class CunsOut {
  public:

    // constructor for WRITING operations
    CunsOut(const std::string, const std::string, const bool verb=false);
    ~CunsOut();
    bool isValid() { return valid;};
    CSnapshotInterfaceOut * snapshot; // object to store data


    // Map to associate the strings with the enum values
    static std::map<std::string, StringData> s_mapStringValues;

    static  void initializeStringMap(const bool);
  private:
    std::string simname, simtype;           // OUT
    
    //bool findSim();
    bool valid;
    bool verbose;
  };

    
}

#endif