Geant4  10.01.p03
XLatticeManager3.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 
27 #include "XLatticeManager3.hh"
28 #include "G4VPhysicalVolume.hh"
29 
30 //int XLatticeManager3::fTotalLattices = 0;
32 
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
34 
35 
37 {
38  fTotalLattices = 0;
39 }
40 
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43 
45 {;}
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48 
50 
51  //if no lattice manager exists, create one.
52  if(!LM) LM = new XLatticeManager3();
53 
54  //return pointer to single existing lattice manager
55  return LM;
56 }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
59 
63  //using "fTotalLattices-1" so that first lattice corresponds to index 0
65  G4cout<<"\nXLatticeManager3::registerLattice: Registering Lattice.";
66  G4cout<< "Total number of lattices:"<<fTotalLattices<<"\n"<<endl;
67 
68  return true;
69  }
70 
71  G4cout<<"\nXLatticeManager::RegisterLattice(XPhysicalLattice*):";
72  G4cout<<"Maximum number of lattices MAXLAT exceeded."<<endl;
73 
74  return false;
75 }
76 
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
79 
81 //returns a pointer to the PhysicalLattice associated with Vol
82 
83  for(int counter=0;counter<fTotalLattices;counter++){
84  if(fLatticeList[counter]->GetVolume()==Vol) {
85  return fLatticeList[counter]; //found matching lattice
86  }
87  }
88  return fLatticeList[0];
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
92 
94  //return true if Vol has a physical lattice
95 
96  for(int counter=0;counter<fTotalLattices;counter++){
97  if(fLatticeList[counter]->GetVolume()==Vol) {
98  return true; //found matching lattice
99  }
100  }
101  return false;
102 }
103 
104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
105 
107  int polarizationState,
108  const G4ThreeVector & k)
109 {
110  //Given the phonon wave vector k, phonon physical volume Vol
111  //and polarizationState(0=LON, 1=FT, 2=ST),
112  //returns phonon velocity in m/s
113 
114  if((Vol==NULL)&&(fTotalLattices>0))
115  return fLatticeList[0]->MapKtoV(polarizationState, k);
116  for(int counter=0;counter<fTotalLattices;counter++){
117  if(fLatticeList[counter]->GetVolume()==Vol) {
118  return fLatticeList[counter]->MapKtoV(polarizationState, k);
119  }
120  }
121  G4cout<<"\nXLatticeManager::MapKtoV: Found no matching lattices for "
122  <<Vol->GetName()<<". Total number of lattices is "<<fTotalLattices<<endl;
123 return 300;
124 }
125 
126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
127 
129  int polarizationState,
130  const G4ThreeVector & k)
131 {
132  //Given the phonon wave vector k, phonon physical volume Vol
133  //and polarizationState(0=LON, 1=FT, 2=ST),
134  //returns phonon propagation direction as dimensionless unit vector
135 
136  if((Vol==NULL)&&(fTotalLattices>0))
137  return fLatticeList[0]->MapKtoVDir(polarizationState, k);
138  for(int counter=0;counter<fTotalLattices;counter++){
139  if(fLatticeList[counter]->GetVolume()==Vol) {
140  if(counter!=0)
141  G4cout<<"\nLattiveManager2::MapKtoV:";
142  G4cout<<"returning group velocity from lattise position: "<<counter;
143  return fLatticeList[counter]->MapKtoVDir(polarizationState, k);
144  }
145  }
146 return G4ThreeVector(1,0,0);
147 }
148 
double MapKtoV(int, G4ThreeVector)
static XLatticeManager3 * GetXLatticeManager()
CLHEP::Hep3Vector G4ThreeVector
double MapKtoV(G4VPhysicalVolume *, int, const G4ThreeVector &)
G4GLOB_DLL std::ostream G4cout
XPhysicalLattice * fLatticeList[MAXLAT]
const G4String & GetName() const
G4ThreeVector MapKtoVDir(G4VPhysicalVolume *, int, const G4ThreeVector &)
bool RegisterLattice(XPhysicalLattice *)
XPhysicalLattice * GetXPhysicalLattice(G4VPhysicalVolume *)
static XLatticeManager3 * LM
G4ThreeVector MapKtoVDir(int, G4ThreeVector)
#define MAXLAT
bool HasLattice(G4VPhysicalVolume *)