Geant4  9.6.p02
 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 // $Id$
30 //
31 
32 #include "XLatticeManager3.hh"
33 #include "G4VPhysicalVolume.hh"
34 
35 //int XLatticeManager3::fTotalLattices = 0;
36 XLatticeManager3* XLatticeManager3::LM;
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
39 
40 
42 {
43  fTotalLattices = 0;
44 }
45 
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
48 
50 {;}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53 
55 
56  //if no lattice manager exists, create one.
57  if(!LM) LM = new XLatticeManager3();
58 
59  //return pointer to single existing lattice manager
60  return LM;
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
64 
68  //using "fTotalLattices-1" so that first lattice corresponds to index 0
70  G4cout<<"\nXLatticeManager3::registerLattice: Registering Lattice. Total number of lattices:"<<fTotalLattices<<"\n"<<endl;
71 
72  return true;
73  }
74 
75  G4cout<<"\nXLatticeManager::RegisterLattice(XPhysicalLattice*): 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 
109 double XLatticeManager3::MapKtoV(G4VPhysicalVolume* Vol, int polarizationState, const G4ThreeVector & k)
110 {
111  //Given the phonon wave vector k, phonon physical volume Vol
112  //and polarizationState(0=LON, 1=FT, 2=ST),
113  //returns phonon velocity in m/s
114 
115  if((Vol==NULL)&&(fTotalLattices>0)) 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 " <<Vol->GetName()<<". Total number of lattices is "<<fTotalLattices<<endl;
122 return 300;
123 }
124 
125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
126 
128 {
129  //Given the phonon wave vector k, phonon physical volume Vol
130  //and polarizationState(0=LON, 1=FT, 2=ST),
131  //returns phonon propagation direction as dimensionless unit vector
132 
133  if((Vol==NULL)&&(fTotalLattices>0)) return fLatticeList[0]->MapKtoVDir(polarizationState, k);
134  for(int counter=0;counter<fTotalLattices;counter++){
135  if(fLatticeList[counter]->GetVolume()==Vol) {
136  if(counter!=0) G4cout<<"\nLattiveManager2::MapKtoV:returning group velocity from lattise position: "<<counter;
137  return fLatticeList[counter]->MapKtoVDir(polarizationState, k);
138  }
139  }
140  //G4cout<<"\nXLatticeManager::MapKtoVDir: Found no matching lattices for " <<Vol->GetName()<<". Total number of lattices is "<<fTotalLattices<<endl;
141 return G4ThreeVector(1,0,0);
142 }
143