Import Geant4 9.3.0 source tree
This commit is contained in:
@@ -23,12 +23,14 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointCSMatrix.cc,v 1.4 2009/11/20 10:31:20 ldesorgh Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
|
||||
#include "G4AdjointCSMatrix.hh"
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
|
||||
#include "G4AdjointInterpolator.hh"
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointCSMatrix::G4AdjointCSMatrix(G4bool aBool){
|
||||
@@ -63,27 +65,26 @@ void G4AdjointCSMatrix::Clear()
|
||||
}
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointCSMatrix::AddData(G4double aLogPrimEnergy,G4double aLogCS, std::vector< G4double>* aLogSecondEnergyVector,
|
||||
std::vector< G4double>* aLogProbVector,size_t n_pro_decade){
|
||||
void G4AdjointCSMatrix::AddData(G4double aLogPrimEnergy,G4double aLogCS, std::vector< double>* aLogSecondEnergyVector,
|
||||
std::vector< double>* aLogProbVector,size_t n_pro_decade){
|
||||
|
||||
G4AdjointInterpolator* theInterpolator=G4AdjointInterpolator::GetInstance();
|
||||
//Add this time we consider that the energy are given monotically
|
||||
|
||||
//At this time we consider that the energy is increasing monotically
|
||||
theLogPrimEnergyVector.push_back(aLogPrimEnergy);
|
||||
theLogCrossSectionVector.push_back(aLogCS);
|
||||
theLogSecondEnergyMatrix.push_back(aLogSecondEnergyVector);
|
||||
//G4cout<<"Test Add Data "<<this<<'\t'<<aSecondEnergyVector->size()<<std::endl;
|
||||
//G4cout<<theSecondEnergyMatrix.size()<<std::endl;
|
||||
theLogProbMatrix.push_back(aLogProbVector);
|
||||
//G4cout<<"Test Add Data 1 "<<this<<'\t'<<aSecondEnergyVector->size()<<std::endl;
|
||||
//G4cout<<theSecondEnergyMatrix.size()<<std::endl;
|
||||
|
||||
std::vector< size_t>* aLogProbVectorIndex = 0;
|
||||
dlog =0;
|
||||
|
||||
if (n_pro_decade > 0 && aLogProbVector->size()>0) {
|
||||
aLogProbVectorIndex = new std::vector< size_t>();
|
||||
dlog=std::log(10.)/n_pro_decade;
|
||||
G4double log_val = int(std::min((*aLogProbVector)[0],aLogProbVector->back())/dlog)*dlog;
|
||||
log0Vector.push_back(log_val);
|
||||
|
||||
while(log_val<0.) {
|
||||
aLogProbVectorIndex->push_back(theInterpolator->FindPosition(log_val,(*aLogProbVector)));
|
||||
log_val+=dlog;
|
||||
@@ -101,22 +102,16 @@ void G4AdjointCSMatrix::Clear()
|
||||
}
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
bool G4AdjointCSMatrix::GetData(unsigned int i, G4double& aLogPrimEnergy,G4double& aLogCS,G4double& log0, std::vector< G4double>*& aLogSecondEnergyVector,
|
||||
std::vector< G4double>*& aLogProbVector, std::vector< size_t>*& aLogProbVectorIndex)
|
||||
G4bool G4AdjointCSMatrix::GetData(unsigned int i, G4double& aLogPrimEnergy,G4double& aLogCS,G4double& log0, std::vector< double>*& aLogSecondEnergyVector,
|
||||
std::vector< double>*& aLogProbVector, std::vector< size_t>*& aLogProbVectorIndex)
|
||||
{ if (i>= nb_of_PrimEnergy) return false;
|
||||
//G4cout<<"Test Get Data "<<std::endl;
|
||||
//G4cout<<"Test Get Data "<<G4endl;
|
||||
aLogPrimEnergy = theLogPrimEnergyVector[i];
|
||||
aLogCS = theLogCrossSectionVector[i];
|
||||
aLogSecondEnergyVector = theLogSecondEnergyMatrix[i];
|
||||
//G4cout<<"Test Get Data "<<this<<'\t'<<theSecondEnergyMatrix[i]->size()<<std::endl;
|
||||
//G4cout<<"Test Get Data "<<this<<'\t'<<aSecondEnergyVector->size()<<std::endl;
|
||||
//G4cout<<"Test Get Data "<<this<<'\t'<<aSecondEnergyVector<<std::endl;
|
||||
aLogProbVector = theLogProbMatrix[i];
|
||||
aLogProbVectorIndex = theLogProbMatrixIndex[i];
|
||||
log0=log0Vector[i];
|
||||
//G4cout<<"Test Get Data 1 "<<this<<'\t'<<theProbMatrix[i]->size()<<std::endl;
|
||||
//G4cout<<"Test Get Data 1 "<<this<<'\t'<<aProbVector->size()<<std::endl;
|
||||
//G4cout<<"Test Get Data 1 "<<this<<'\t'<<aLogProbVectorIndex<<std::endl;
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -126,33 +121,33 @@ void G4AdjointCSMatrix::Write(G4String file_name)
|
||||
{ std::fstream FileOutput(file_name, std::ios::out);
|
||||
FileOutput<<std::setiosflags(std::ios::scientific);
|
||||
FileOutput<<std::setprecision(6);
|
||||
FileOutput<<theLogPrimEnergyVector.size()<<std::endl;
|
||||
FileOutput<<theLogPrimEnergyVector.size()<<G4endl;
|
||||
for (size_t i=0;i<theLogPrimEnergyVector.size();i++){
|
||||
FileOutput<<std::exp(theLogPrimEnergyVector[i])/MeV<<'\t'<<std::exp(theLogCrossSectionVector[i])<<std::endl;
|
||||
FileOutput<<std::exp(theLogPrimEnergyVector[i])/MeV<<'\t'<<std::exp(theLogCrossSectionVector[i])<<G4endl;
|
||||
size_t j1=0;
|
||||
FileOutput<<theLogSecondEnergyMatrix[i]->size()<<std::endl;
|
||||
FileOutput<<theLogSecondEnergyMatrix[i]->size()<<G4endl;
|
||||
for (size_t j=0;j<theLogSecondEnergyMatrix[i]->size();j++){
|
||||
FileOutput<<std::exp((*theLogSecondEnergyMatrix[i])[j]);
|
||||
j1++;
|
||||
if (j1<10) FileOutput<<'\t';
|
||||
else {
|
||||
FileOutput<<std::endl;
|
||||
FileOutput<<G4endl;
|
||||
j1=0;
|
||||
}
|
||||
}
|
||||
if (j1>0) FileOutput<<std::endl;
|
||||
if (j1>0) FileOutput<<G4endl;
|
||||
j1=0;
|
||||
FileOutput<<theLogProbMatrix[i]->size()<<std::endl;
|
||||
FileOutput<<theLogProbMatrix[i]->size()<<G4endl;
|
||||
for (size_t j=0;j<theLogProbMatrix[i]->size();j++){
|
||||
FileOutput<<std::exp((*theLogProbMatrix[i])[j]);
|
||||
j1++;
|
||||
if (j1<10) FileOutput<<'\t';
|
||||
else {
|
||||
FileOutput<<std::endl;
|
||||
FileOutput<<G4endl;
|
||||
j1=0;
|
||||
}
|
||||
}
|
||||
if (j1>0) FileOutput<<std::endl;
|
||||
if (j1>0) FileOutput<<G4endl;
|
||||
|
||||
|
||||
}
|
||||
@@ -176,8 +171,8 @@ void G4AdjointCSMatrix::Read(G4String file_name)
|
||||
theLogPrimEnergyVector.push_back(E);
|
||||
theLogCrossSectionVector.push_back(CS);
|
||||
FileOutput>>n2;
|
||||
theLogSecondEnergyMatrix.push_back(new std::vector<double>());
|
||||
theLogProbMatrix.push_back(new std::vector<double>());
|
||||
theLogSecondEnergyMatrix.push_back(new std::vector<G4double>());
|
||||
theLogProbMatrix.push_back(new std::vector<G4double>());
|
||||
|
||||
for (size_t j=0; j<n2;j++){
|
||||
G4double E1;
|
||||
|
||||
Reference in New Issue
Block a user