Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 //
28 //
29 
30 #include "XLatticeManager3.hh"
31 #include "G4VPhysicalVolume.hh"
32 
33 //int XLatticeManager3::fTotalLattices = 0;
34 XLatticeManager3* XLatticeManager3::LM;
35 
36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
37 
38 
40 {
41  fTotalLattices = 0;
42 }
43 
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 
48 {;}
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 
53 
54  //if no lattice manager exists, create one.
55  if(!LM) LM = new XLatticeManager3();
56 
57  //return pointer to single existing lattice manager
58  return LM;
59 }
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
62 
66  //using "fTotalLattices-1" so that first lattice corresponds to index 0
68  G4cout<<"\nXLatticeManager3::registerLattice: Registering Lattice.";
69  G4cout<< "Total number of lattices:"<<fTotalLattices<<"\n"<<endl;
70 
71  return true;
72  }
73 
74  G4cout<<"\nXLatticeManager::RegisterLattice(XPhysicalLattice*):";
75  G4cout<<"Maximum number of lattices MAXLAT exceeded."<<endl;
76 
77  return false;
78 }
79 
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
82 
84 //returns a pointer to the PhysicalLattice associated with Vol
85 
86  for(int counter=0;counter<fTotalLattices;counter++){
87  if(fLatticeList[counter]->GetVolume()==Vol) {
88  return fLatticeList[counter]; //found matching lattice
89  }
90  }
91  return fLatticeList[0];
92 }
93 
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95 
97  //return true if Vol has a physical lattice
98 
99  for(int counter=0;counter<fTotalLattices;counter++){
100  if(fLatticeList[counter]->GetVolume()==Vol) {
101  return true; //found matching lattice
102  }
103  }
104  return false;
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
108 
110  int polarizationState,
111  const G4ThreeVector & k)
112 {
113  //Given the phonon wave vector k, phonon physical volume Vol
114  //and polarizationState(0=LON, 1=FT, 2=ST),
115  //returns phonon velocity in m/s
116 
117  if((Vol==NULL)&&(fTotalLattices>0))
118  return fLatticeList[0]->MapKtoV(polarizationState, k);
119  for(int counter=0;counter<fTotalLattices;counter++){
120  if(fLatticeList[counter]->GetVolume()==Vol) {
121  return fLatticeList[counter]->MapKtoV(polarizationState, k);
122  }
123  }
124  G4cout<<"\nXLatticeManager::MapKtoV: Found no matching lattices for "
125  <<Vol->GetName()<<". Total number of lattices is "<<fTotalLattices<<endl;
126 return 300;
127 }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
130 
132  int polarizationState,
133  const G4ThreeVector & k)
134 {
135  //Given the phonon wave vector k, phonon physical volume Vol
136  //and polarizationState(0=LON, 1=FT, 2=ST),
137  //returns phonon propagation direction as dimensionless unit vector
138 
139  if((Vol==NULL)&&(fTotalLattices>0))
140  return fLatticeList[0]->MapKtoVDir(polarizationState, k);
141  for(int counter=0;counter<fTotalLattices;counter++){
142  if(fLatticeList[counter]->GetVolume()==Vol) {
143  if(counter!=0)
144  G4cout<<"\nLattiveManager2::MapKtoV:"
145  <<" Returning group velocity from lattice position "
146  <<counter;
147  return fLatticeList[counter]->MapKtoVDir(polarizationState, k);
148  }
149  }
150 return G4ThreeVector(1,0,0);
151 }
152 
double MapKtoV(int, G4ThreeVector)
static XLatticeManager3 * GetXLatticeManager()
CLHEP::Hep3Vector G4ThreeVector
Definition of the XLatticeManager3 class.
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 *)
G4ThreeVector MapKtoVDir(int, G4ThreeVector)
#define MAXLAT
bool HasLattice(G4VPhysicalVolume *)