View | Details | Raw Unified | Return to problem 1156
Collapse All | Expand All

(-)a/source/processes/hadronic/models/neutron_hp/include/G4NeutronHPData.hh (-3 / +9 lines)
Lines 51-81 public: Link Here
51
51
52
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPFissionData * theP)
52
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPFissionData * theP)
53
  {
53
  {
54
     InitialiseTheData();
54
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
55
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
55
  }
56
  }
56
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPCaptureData * theP)
57
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPCaptureData * theP)
57
  {
58
  {
59
     InitialiseTheData();
58
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
60
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
59
  }
61
  }
60
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPElasticData * theP)
62
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPElasticData * theP)
61
  {
63
  {
64
     InitialiseTheData();
62
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
65
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
63
  }
66
  }
64
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPInelasticData * theP)
67
  inline G4PhysicsVector * MakePhysicsVector(G4Element * thE, G4NeutronHPInelasticData * theP)
65
  {
68
  {
66
//     G4cout << "entered G4NeutronHPData::MakePhysicsVector!!!"<<G4endl;
69
//	G4cout << "entered G4NeutronHPData::MakePhysicsVector(G4Element * thE, G4NeutronHPInelasticData * theP)!!!"<<G4endl;
67
//     G4cout << "thE->GetIndex()="<<thE->GetIndex()<<G4endl;
70
//	G4cout << "thE->GetIndex()="<<thE->GetIndex()<<G4endl;
71
     InitialiseTheData();
68
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
72
     return DoPhysicsVector(theData[thE->GetIndex()].GetData(theP));
69
  }
73
  }
70
74
71
  G4PhysicsVector * DoPhysicsVector(G4NeutronHPVector * theVector);
75
  G4PhysicsVector * DoPhysicsVector(G4NeutronHPVector * theVector);
72
  
76
  
77
  void InitialiseTheData();
78
  
73
  static G4NeutronHPData * Instance();
79
  static G4NeutronHPData * Instance();
74
  
80
  
75
private:
81
private:
76
82
77
  G4NeutronHPElementData * theData;
83
  G4NeutronHPElementData * theData;
78
  G4int numEle;
84
  size_t numEle;
79
  
85
  
80
};
86
};
81
87
(-)a/source/processes/hadronic/models/neutron_hp/src/G4NeutronHPData.cc (-8 / +27 lines)
Lines 32-44 Link Here
32
32
33
  G4NeutronHPData::G4NeutronHPData()
33
  G4NeutronHPData::G4NeutronHPData()
34
  {
34
  {
35
     numEle = G4Element::GetNumberOfElements();
35
     numEle = 0;
36
     theData = new G4NeutronHPElementData[numEle];
36
     theData = NULL;
37
//     G4cout << "G4NeutronHPData::G4NeutronHPData(): numEle="<<numEle<<G4endl;
37
38
     for (G4int i=0; i<numEle; i++)
38
     InitialiseTheData();
39
     {
40
       theData[i].Init((*(G4Element::GetElementTable()))[i]);
41
     }
42
  }
39
  }
43
  
40
  
44
  G4NeutronHPData::~G4NeutronHPData()
41
  G4NeutronHPData::~G4NeutronHPData()
Lines 55-60 Link Here
55
  G4PhysicsVector * G4NeutronHPData::DoPhysicsVector(G4NeutronHPVector * theVector)
52
  G4PhysicsVector * G4NeutronHPData::DoPhysicsVector(G4NeutronHPVector * theVector)
56
  {
53
  {
57
//    G4cout << "Entered G4NeutronHPData::DoPhysicsVector."<<G4endl;
54
//    G4cout << "Entered G4NeutronHPData::DoPhysicsVector."<<G4endl;
55
58
    G4int len = theVector->GetVectorLength();
56
    G4int len = theVector->GetVectorLength();
59
//    G4cout <<"zahl der energie-punkte "<< len<<G4endl;
57
//    G4cout <<"zahl der energie-punkte "<< len<<G4endl;
60
    if(len==0) return new G4LPhysicsFreeVector(0, 0, 0);
58
    if(len==0) return new G4LPhysicsFreeVector(0, 0, 0);
Lines 70-72 Link Here
70
    }
68
    }
71
    return theResult;
69
    return theResult;
72
  }
70
  }
73
- 
71
  
72
  
73
  void G4NeutronHPData::InitialiseTheData()
74
  {
75
	if (numEle != G4Element::GetNumberOfElements()) 
76
	{
77
		//G4cout << "\n\nERROR! numEle="<<numEle<<" != G4Element::GetNumberOfElements()="
78
		//<<G4Element::GetNumberOfElements()<<", resizing theData vector\n"; 
79
		
80
		numEle = G4Element::GetNumberOfElements();
81
		
82
		if (theData != NULL) delete [] theData;
83
		
84
		theData = new G4NeutronHPElementData[numEle];
85
		for (size_t i=0; i<numEle; i++)
86
		{
87
			theData[i].Init((*(G4Element::GetElementTable()))[i]);
88
		}
89
     }
90
     
91
     return;
92
}

Return to problem 1156