Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
G4NeutronHPManager Class Reference

#include <G4NeutronHPManager.hh>

Public Member Functions

G4NeutronHPReactionWhiteBoardGetReactionWhiteBoard ()
 
void OpenReactionWhiteBoard ()
 
void CloseReactionWhiteBoard ()
 
void GetDataStream (G4String, std::istringstream &iss)
 
void SetVerboseLevel (G4int i)
 
G4int GetVerboseLevel ()
 

Static Public Member Functions

static G4NeutronHPManagerGetInstance ()
 

Detailed Description

Definition at line 39 of file G4NeutronHPManager.hh.

Member Function Documentation

void G4NeutronHPManager::CloseReactionWhiteBoard ( )
inline
void G4NeutronHPManager::GetDataStream ( G4String  filename,
std::istringstream &  iss 
)

Definition at line 64 of file G4NeutronHPManager.cc.

References uncompress(), and Z_OK.

Referenced by G4NeutronHPNames::GetName(), G4NeutronHPFFFissionFS::Init(), G4NeutronHPFSFissionFS::Init(), G4NeutronHPFissionBaseFS::Init(), G4NeutronHPCaptureFS::Init(), G4NeutronHPElasticFS::Init(), G4NeutronHPIsoData::Init(), G4NeutronHPInelasticBaseFS::Init(), G4NeutronHPInelasticCompFS::Init(), G4ENDFTapeRead::Initialize(), and G4WendtFissionFragmentGenerator::InitializeANucleus().

65 {
66  G4String* data=NULL;
67  G4String compfilename(filename);
68  compfilename += ".z";
69  std::ifstream* in = new std::ifstream ( compfilename , std::ios::binary | std::ios::ate );
70  if ( in->good() )
71  {
72 // Use the compressed file
73  G4int file_size = in->tellg();
74  in->seekg( 0 , std::ios::beg );
75  Bytef* compdata = new Bytef[ file_size ];
76 
77  while ( *in ) {
78  in->read( (char*)compdata , file_size );
79  }
80 
81  uLongf complen = (uLongf) ( file_size*4 );
82  Bytef* uncompdata = new Bytef[complen];
83 
84  while ( Z_OK != uncompress ( uncompdata , &complen , compdata , file_size ) ) {
85  //G4cout << "Too small, retry 2 times bigger size." << G4endl;
86  delete[] uncompdata;
87  complen *= 2;
88  uncompdata = new Bytef[complen];
89  }
90  delete [] compdata;
91  // Now "complen" has uncomplessed size
92  data = new G4String ( (char*)uncompdata , (G4long)complen );
93  delete [] uncompdata;
94  }
95  else {
96 // Use regular text file
97  std::ifstream thefData( filename , std::ios::in | std::ios::ate );
98  if ( thefData.good() ) {
99  G4int file_size = thefData.tellg();
100  thefData.seekg( 0 , std::ios::beg );
101  char* filedata = new char[ file_size ];
102  while ( thefData ) {
103  thefData.read( filedata , file_size );
104  }
105  thefData.close();
106  data = new G4String ( filedata , file_size );
107  delete [] filedata;
108  } else {
109 // found no data file
110 // set error bit to the stream
111  iss.setstate( std::ios::badbit );
112  }
113  }
114  if (data != NULL) iss.str(*data);
115  //G4cout << iss.rdbuf()->in_avail() << G4endl;
116  in->close(); delete in;
117  delete data;
118 }
long G4long
Definition: G4Types.hh:80
int G4int
Definition: G4Types.hh:78
int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Definition: uncompr.cc:24
#define Z_OK
Definition: zlib.h:173
const XML_Char const XML_Char * data
static G4NeutronHPManager* G4NeutronHPManager::GetInstance ( void  )
inlinestatic
G4NeutronHPReactionWhiteBoard * G4NeutronHPManager::GetReactionWhiteBoard ( )

Definition at line 54 of file G4NeutronHPManager.cc.

References G4cout, and G4endl.

Referenced by G4NeutronHPChannelList::ApplyYourself(), and G4NeutronHPChannel::ApplyYourself().

55 {
56  if ( RWB == NULL ) {
57  G4cout << "Warning: try to access G4NeutronHPReactionWhiteBoard before opening" << G4endl;
59  }
60  return RWB;
61 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4int G4NeutronHPManager::GetVerboseLevel ( )
inline
void G4NeutronHPManager::OpenReactionWhiteBoard ( )

Definition at line 45 of file G4NeutronHPManager.cc.

References G4cout, and G4endl.

Referenced by G4NeutronHPCapture::ApplyYourself(), G4NeutronHPElastic::ApplyYourself(), G4NeutronHPFission::ApplyYourself(), and G4NeutronHPInelastic::ApplyYourself().

46 {
47  if ( RWB != NULL ) {
48  G4cout << "Warning: G4NeutronHPReactionWhiteBoard is tried doubly opening" << G4endl;
50  }
51 
53 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4NeutronHPManager::SetVerboseLevel ( G4int  i)

Definition at line 120 of file G4NeutronHPManager.cc.

References G4cout, and G4endl.

Referenced by G4NeutronHPCapture::SetVerboseLevel(), G4NeutronHPFission::SetVerboseLevel(), G4NeutronHPElastic::SetVerboseLevel(), G4NeutronHPFissionData::SetVerboseLevel(), G4NeutronHPElasticData::SetVerboseLevel(), G4NeutronHPCaptureData::SetVerboseLevel(), G4NeutronHPInelasticData::SetVerboseLevel(), and G4NeutronHPInelastic::SetVerboseLevel().

121 {
122  G4cout << "You are setting a new verbose level for neutron HP package." << G4endl;
123  G4cout << "the new value will be used in whole of the neutron HP package, i.e., models and cross sections for Capture, Elastic, Fission and Inelastic interaction." << G4endl;
124  verboseLevel = newValue;
125 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

The documentation for this class was generated from the following files: