Memosa-FVM  0.2
DensityOfStates.h
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #ifndef _DENSITYOFSTATES_H_
6 #define _DENSITYOFSTATES_H_
7 
8 #include <iostream>
9 #include <fstream>
10 
11 template<class T>
13 {
14 
15  public:
16  typedef Array<T> TArray;
18  typedef shared_ptr<TArray> TArrPtr;
19  typedef vector<TArrPtr> TArrList;
21  typedef shared_ptr<IntArray> IntArrayPtr;
22  typedef vector<IntArrayPtr> IntArrList;
23  typedef Kspace<T> Tkspace;
24  typedef kvol<T> Tkvol;
25  typedef pmode<T> Tmode;
26 
27  DensityOfStates(const Tkspace& kspace):
28  _FreqMids(0),
29  _FreqBounds(0),
30  _Density(0),
31  _BinKpts(),
32  _BinModes(),
34  _kspace(kspace)
35  {}
36 
37  void binMode(const int mode, const int noBins, const T minw, const T maxw)
38  {
39  const T dwStar=1./T(noBins);
40  T Deltaw;
41  if(minw==0.)
42  Deltaw=maxw;
43  else
44  {
45  T ratio=minw/maxw;
46  Deltaw=(1-ratio)*maxw;
47  }
48  TArray modeBounds(noBins+1);
49  TArray modeMids(noBins);
50  IntArray BinKcount(noBins);
51  BinKcount.zero();
52  IntArrList modeKpts;
53 
54  for(int i=0;i<noBins+1;i++)
55  modeBounds[i]=floor(i*dwStar*Deltaw+minw);
56 
57  for(int i=0;i<noBins;i++)
58  modeMids[i]=(modeBounds[i]+modeBounds[i+1])/2.;
59 
60  const int klen=_kspace.getlength();
61 
62  for(int k=0;k<klen;k++)
63  {
64  T omega=_kspace.getkvol(k).getmode(mode).getomega();
65  int bin=findBin(modeBounds, omega);
66  BinKcount[bin]++;
67  }
68 
69  for(int i=0;i<noBins;i++)
70  {
71  IntArrayPtr newArrPtr=IntArrayPtr(new IntArray(BinKcount[i]));
72  newArrPtr->zero();
73  modeKpts.push_back(newArrPtr);
74  }
75 
76  BinKcount.zero();
77 
78  for(int k=0;k<klen;k++)
79  {
80  T omega=_kspace.getkvol(k).getmode(mode).getomega();
81  int bin=findBin(modeBounds, omega);
82  IntArray& binArray=*modeKpts[bin];
83  binArray[BinKcount[bin]]=k;
84  BinKcount[bin]++;
85  }
86 
87  addMode(modeBounds, modeMids, modeKpts, mode);
88 
89  }
90 
91  void binEntireKspace(const int noBins, const T minw, const T maxw)
92  {
93  const T dwStar=1./T(noBins);
94  T Deltaw;
95  if(minw==0.)
96  Deltaw=maxw;
97  else
98  {
99  T ratio=minw/maxw;
100  Deltaw=(1-ratio)*maxw;
101  }
102  TArray modeBounds(noBins+1);
103  TArray modeMids(noBins);
104  IntArray BinKcount(noBins);
105  IntArray BinMcount(noBins);
106  BinKcount.zero();
107  BinMcount.zero();
108  IntArrList modeKpts;
109  IntArrList Mpts;
110 
111  for(int i=0;i<noBins+1;i++)
112  modeBounds[i]=floor(i*dwStar*Deltaw+minw);
113 
114  for(int i=0;i<noBins;i++)
115  modeMids[i]=(modeBounds[i]+modeBounds[i+1])/2.;
116 
117  const int klen=_kspace.getlength();
118 
119  for(int k=0;k<klen;k++)
120  {
121  Tkvol& kv=_kspace.getkvol(k);
122  const int modeNum=kv.getmodenum();
123  for(int m=0;m<modeNum;m++)
124  {
125  T omega=kv.getmode(m).getomega();
126  int bin=findBin(modeBounds, omega);
127  BinKcount[bin]++;
128  BinMcount[bin]++;
129  }
130  }
131 
132  for(int i=0;i<noBins;i++)
133  {
134  IntArrayPtr newArrPtr=IntArrayPtr(new IntArray(BinKcount[i]));
135  IntArrayPtr newArrPtr1=IntArrayPtr(new IntArray(BinKcount[i]));
136  newArrPtr->zero();
137  newArrPtr1->zero();
138  modeKpts.push_back(newArrPtr);
139  Mpts.push_back(newArrPtr1);
140  }
141 
142  BinKcount.zero();
143  BinMcount.zero();
144 
145  for(int k=0;k<klen;k++)
146  {
147  Tkvol& kv=_kspace.getkvol(k);
148  const int modeNum=kv.getmodenum();
149  for(int m=0;m<modeNum;m++)
150  {
151  T omega=kv.getmode(m).getomega();
152  int bin=findBin(modeBounds, omega);
153  IntArray& binArray=*modeKpts[bin];
154  IntArray& mbinArray=*Mpts[bin];
155  binArray[BinKcount[bin]]=k;
156  mbinArray[BinKcount[bin]]=m;
157  BinKcount[bin]++;
158  }
159  }
160 
161  _FreqMids.resize(noBins);
162  _FreqMids.copyFrom(modeMids);
163  _FreqBounds.resize(noBins+1);
164  _FreqBounds.copyFrom(modeBounds);
165  _BinKpts=modeKpts;
166  _BinModes=Mpts;
167 
168  }
169 
170  void copyDOS(DensityOfStates& otherDOS)
171  {
172  _FreqMids.resize(otherDOS.getFreqMidsT().getLength());
173  _FreqMids.copyFrom(otherDOS.getFreqMidsT());
175  _FreqBounds.copyFrom(otherDOS.getFreqBinsT());
176  _BinKpts=otherDOS.getKptsList();
177  _BinModes=otherDOS.getMList();
178  setDensity();
179  }
180 
181  void setDensity()
182  {
184  _Density.zero();
185  for(int i=0;i<_Density.getLength();i++)
186  {
187  IntArray& Kpts=*_BinKpts[i];
188  for(int j=0;j<Kpts.getLength();j++)
189  {
190  const T dk3=_kspace.getkvol(Kpts[j]).getdk3();
191  _Density[i]+=dk3;
192  }
193  }
194  }
195 
196  const Tkspace& getKspace() {return _kspace;}
197 
198  void saveNormDOS(const char* filename)
199  {
200  const T wMax=_FreqBounds[_FreqBounds.getLength()-1];
201  const T wMin=_FreqBounds[0];
202  const T freqDif=wMax-wMin;
203  T maxDen=0.0;
204 
205  for(int i=0;i<_FreqMids.getLength();i++)
206  if(_Density[i]>maxDen)
207  maxDen=_Density[i];
208 
209  ofstream DOSfile;
210  DOSfile.open(filename);
211 
212  for(int i=0;i<_FreqMids.getLength();i++)
213  DOSfile<<(_FreqMids[i]-wMin)/freqDif<<" "<<_Density[i]/maxDen<<endl;
214 
215  DOSfile.close();
216  }
217 
222 
223  int findBin(const TArray& bounds, const T freq)
224  {
225  for(int i=0;i<bounds.getLength()-1;i++)
226  {
227  if(freq>bounds[i] && freq<=bounds[i+1])
228  return i;
229  }
230  throw CException("Frequency not in given discretization!");
231  }
232 
233  const int findBin(const T freq) const
234  {
235  for(int i=0;i<_FreqBounds.getLength()-1;i++)
236  {
237  if(freq>_FreqBounds[i] && freq<=_FreqBounds[i+1])
238  return i;
239  }
240  return -1;
241  }
242 
243  IntArray& getKIndices(const int fBin) {return *_BinKpts[fBin];}
244  IntArray& getMIndices(const int fBin) {return *_BinModes[fBin];}
247  TArray& getModeFractions(const int fBin) {return *_ModeFractions[fBin];}
248 
249  T sumOutgoing(const VectorT3& n, const int fBin, const T Temp)
250  {
251  T outSum(0.);
252 
253  if(fBin>=0)
254  {
255  const IntArray& Kpts=getKIndices(fBin);
256  const IntArray& Mpts=getMIndices(fBin);
257  for(int i=0;i<Kpts.getLength();i++)
258  {
259  const int k=Kpts[i];
260  const int m=Mpts[i];
261  const VectorT3 vg=_kspace.getkvol(k).getmode(m).getv();
262  const T vdot=vg[0]*n[0]+vg[1]*n[1]+vg[2]*n[2];
263  if(vdot>0.)
264  {
265  const T dk3=_kspace.getkvol(k).getdk3();
266  outSum+=dk3*vdot*_kspace.getkvol(k).getmode(m).calce0(Temp);
267  }
268  }
269  }
270 
271  return outSum;
272  }
273 
274  /*
275  T sumOutgoingGray(const VectorT3& n, const int fBin, const T Temp)
276  {
277  T outSum(0.);
278 
279  if(fBin>=0)
280  {
281  const IntArray& Kpts=getKIndices(fBin);
282  const IntArray& Mpts=getMIndices(fBin);
283  for(int i=0;i<Kpts.getLength();i++)
284  {
285  const int k=Kpts[i];
286  const int m=Mpts[i];
287  const VectorT3 vg=_kspace.getkvol(k).getmode(m).getv();
288  const T vdot=vg[0]*n[0]+vg[1]*n[1]+vg[2]*n[2];
289  if(vdot>0.)
290  {
291  const T dk3=_kspace.getkvol(k).getdk3();
292  outSum+=dk3*vdot*_kspace.getkvol(k).getmode(m).calce0gray(Temp);
293  }
294  }
295  }
296 
297  return outSum;
298  }*/
299 
300  ArrayBase* makeDMMtransmission(DensityOfStates& otherDOS, const T Temp, const bool merge)
301  {
302  if(merge)
303  mergeBins(otherDOS, true);
304 
305  const int freqCount=_FreqMids.getLength();
306  TArray* trans=new TArray(freqCount);
307  VectorT3 n;
308 
309  n[0]=1.;
310  n[1]=0.;
311  n[2]=0.;
312 
313  for(int f0=0;f0<freqCount;f0++)
314  {
315  T w0=_FreqMids[f0];
316  const int f1=otherDOS.findBin(w0);
317  const T mat0sum=sumOutgoing(n,f0,Temp);
318  const T mat1sum=otherDOS.sumOutgoing(-n,f1,Temp);
319  if(mat1sum==0. && mat0sum==0.)
320  (*trans)[f0]=0.;
321  else
322  (*trans)[f0]=1./(1.+mat0sum/mat1sum);
323  }
324  return trans;
325  }
326 
327  T calcBinFlux(const T Temp, const int fBin, const T tau)
328  {
329  T outSum(0.);
330  VectorT3 n;
331  n[0]=1.;
332  n[1]=0.;
333  n[2]=0.;
334 
335  if(fBin>=0)
336  {
337  const IntArray& Kpts=getKIndices(fBin);
338  const IntArray& Mpts=getMIndices(fBin);
339 
340  for(int i=0;i<Kpts.getLength();i++)
341  {
342  const int k=Kpts[i];
343  const int m=Mpts[i];
344  const VectorT3 vg=_kspace.getkvol(k).getmode(m).getv();
345  const T vdot=vg[0]*n[0]+vg[1]*n[1]+vg[2]*n[2];
346  const T e0=_kspace.getkvol(k).getmode(m).calce0(Temp);
347  if(vdot>0.)
348  {
349  const T dk3=_kspace.getkvol(k).getdk3();
350  outSum+=dk3*vdot*e0*tau;
351  }
352  }
353  }
354 
355  return outSum;
356  }
357 
358  void mergeBins(DensityOfStates &otherDOS, const bool original)
359  {
360  DensityOfStates oldSelf(getKspace());
361  oldSelf.copyDOS(*this);
363  TArray& mBounds=otherDOS.getFreqBinsT();
364  old.copyFrom(_FreqBounds);
365  int newBinCount(0);
366 
367  int i(0), j(0);
368  T ceil=min(old[0], mBounds[0]);
369  T o,m;
370 
371  while(i<old.getLength() || j<mBounds.getLength())
372  {
373  if(i<old.getLength())
374  o=old[i];
375  else
376  o=mBounds[j]+1.;
377 
378  if(j<mBounds.getLength())
379  m=mBounds[j];
380  else
381  m=old[i]+1.;
382 
383  if(o==m)
384  {
385  if(o>ceil)
386  {
387  newBinCount++;
388  ceil=o;
389  }
390  i++;
391  j++;
392  }
393  else if( o>=ceil && o<m)
394  {
395  if(o>ceil)
396  {
397  ceil=o;
398  newBinCount++;
399  }
400  i++;
401  }
402  else if(m>=ceil && m<o)
403  {
404  if(m>ceil)
405  {
406  ceil=m;
407  newBinCount++;
408  }
409  j++;
410  }
411  }
412 
413  TArray newBounds(newBinCount+1);
414  ceil=min(old[0], mBounds[0]);
415  i=0;
416  j=0;
417  newBinCount=1;
418  newBounds[0]=ceil;
419 
420  while(i<old.getLength() || j<mBounds.getLength())
421  {
422  if(i<old.getLength())
423  o=old[i];
424  else
425  o=mBounds[j]+1.;
426 
427  if(j<mBounds.getLength())
428  m=mBounds[j];
429  else
430  m=old[i]+1.;
431 
432  if(o==m)
433  {
434  if(o>ceil)
435  {
436  newBounds[newBinCount]=o;
437  newBinCount++;
438  }
439  i++;
440  j++;
441  }
442  else if( o>=ceil && o<m)
443  {
444  if(o>ceil)
445  {
446  ceil=o;
447  newBounds[newBinCount]=o;
448  newBinCount++;
449  }
450  i++;
451  }
452  else if(m>=ceil && m<o)
453  {
454  if(m>ceil)
455  {
456  ceil=m;
457  newBounds[newBinCount]=m;
458  newBinCount++;
459  }
460  j++;
461  }
462  }
463 
464  _FreqBounds.resize(newBounds.getLength());
465  _FreqBounds.copyFrom(newBounds);
466  //refineBins();
467  setMids();
468 
469  IntArray BinPop(_FreqMids.getLength());
470  BinPop.zero();
471  //int searchStart(0);
472 
473  const int klen=_kspace.getlength();
474 
475  for(int k=0;k<klen;k++)
476  {
478  const int modenum=kvol.getmodenum();
479  for(int mode=0;mode<modenum;mode++)
480  {
481  T omega=_kspace.getkvol(k).getmode(mode).getomega();
482  int bin=findBin(_FreqBounds, omega);
483  BinPop[bin]++;
484  }
485  }
486 
487  _BinKpts.resize(_FreqMids.getLength());
488  _BinModes.resize(_FreqMids.getLength());
490 
491  for(int fInd=0;fInd<_FreqMids.getLength();fInd++)
492  {
493  const int len=BinPop[fInd];
494  IntArrayPtr newKArray=IntArrayPtr(new IntArray(len));
495  IntArrayPtr newMArray=IntArrayPtr(new IntArray(len));
496  TArrPtr newFArray=TArrPtr(new TArray(len));
497  _BinKpts[fInd]=newKArray;
498  _BinModes[fInd]=newMArray;
499  _ModeFractions[fInd]=newFArray;
500  }
501 
502  BinPop.zero();
503  for(int k=0;k<klen;k++)
504  {
506  const int modenum=kvol.getmodenum();
507  for(int mode=0;mode<modenum;mode++)
508  {
509  T omega=_kspace.getkvol(k).getmode(mode).getomega();
510  int bin=findBin(_FreqBounds, omega);
511  IntArray& binKArray=*_BinKpts[bin];
512  IntArray& binMArray=*_BinModes[bin];
513  binKArray[BinPop[bin]]=k;
514  binMArray[BinPop[bin]]=mode;
515  BinPop[bin]++;
516  }
517  }
518 
519  setDensity();
520  if(original)
521  otherDOS.mergeBins(oldSelf,false);
522 
523  }
524 
525  void refineBins()
526  {
527  int newBinCount(0);
528  const T eps=1.e-9;
530  old.copyFrom(_FreqBounds);
531  int i(0);
532 
533  while(i<_FreqBounds.getLength()-1)
534  {
535  T dif=1.-_FreqBounds[i+1]/_FreqBounds[i];
536  if(dif<eps)
537  {
538  old[newBinCount]=_FreqBounds[i];
539  newBinCount++;
540  i+=2;
541  }
542  else
543  {
544  old[newBinCount]=_FreqBounds[i];
545  newBinCount++;
546  i++;
547  }
548  }
549  old[newBinCount]=_FreqBounds[_FreqBounds.getLength()-1];
550 
551  _FreqBounds.resize(newBinCount+1);
552  for(int j=0;j<newBinCount+1;j++)
553  _FreqBounds[j]=old[j];
554  }
555 
557  {
558  TArray* Ttrans=dynamic_cast<TArray*>(trans);
559  TArray* refl=new TArray(Ttrans->getLength());
560  for(int i=0;i<Ttrans->getLength();i++)
561  (*refl)[i]=1.-(*Ttrans)[i];
562  return refl;
563  }
564 
565  private:
566 
567  void addMode(const TArray& mBounds, const TArray& mMids, const IntArrList& mKlist, const int mode)
568  {
569  if(_BinKpts.empty())
570  {
571  _FreqMids.resize(mMids.getLength());
572  _FreqMids.copyFrom(mMids);
573  _FreqBounds.resize(mBounds.getLength());
574  _FreqBounds.copyFrom(mBounds);
575  _BinKpts=mKlist;
576  _BinModes.resize(mMids.getLength());
577  _ModeFractions.resize(mMids.getLength());
578  for(int i=0;i<mMids.getLength();i++)
579  {
580  IntArray& Karray=*_BinKpts[i];
581  IntArrayPtr MarrayPtr=IntArrayPtr(new IntArray(Karray.getLength()));
582  TArrPtr FracArrPtr=TArrPtr(new TArray(Karray.getLength()));
583  *MarrayPtr=mode;
584  *FracArrPtr=1.;
585  _BinModes[i]=MarrayPtr;
586  _ModeFractions[i]=FracArrPtr;
587  }
588  }
589  else
590  {
592  old.copyFrom(_FreqBounds);
593  int newBinCount(0);
594 
595  int i(0), j(0);
596  T ceil=min(old[0], mBounds[0]);
597  T o,m;
598 
599  while(i<old.getLength() || j<mBounds.getLength())
600  {
601  if(i<old.getLength())
602  o=old[i];
603  else
604  o=mBounds[j]+1.;
605 
606  if(j<mBounds.getLength())
607  m=mBounds[j];
608  else
609  m=old[i]+1.;
610 
611  if(o==m)
612  {
613  if(o>ceil)
614  {
615  newBinCount++;
616  ceil=o;
617  }
618  i++;
619  j++;
620  }
621  else if( o>=ceil && o<m)
622  {
623  if(o>ceil)
624  {
625  ceil=o;
626  newBinCount++;
627  }
628  i++;
629  }
630  else if(m>=ceil && m<o)
631  {
632  if(m>ceil)
633  {
634  ceil=m;
635  newBinCount++;
636  }
637  j++;
638  }
639  }
640 
641  TArray newBounds(newBinCount+1);
642  ceil=min(old[0], mBounds[0]);
643  i=0;
644  j=0;
645  newBinCount=1;
646  newBounds[0]=ceil;
647 
648  while(i<old.getLength() || j<mBounds.getLength())
649  {
650  if(i<old.getLength())
651  o=old[i];
652  else
653  o=mBounds[j]+1.;
654 
655  if(j<mBounds.getLength())
656  m=mBounds[j];
657  else
658  m=old[i]+1.;
659 
660  if(o==m)
661  {
662  if(o>ceil)
663  {
664  newBounds[newBinCount]=o;
665  newBinCount++;
666  }
667  i++;
668  j++;
669  }
670  else if( o>=ceil && o<m)
671  {
672  if(o>ceil)
673  {
674  ceil=o;
675  newBounds[newBinCount]=o;
676  newBinCount++;
677  }
678  i++;
679  }
680  else if(m>=ceil && m<o)
681  {
682  if(m>ceil)
683  {
684  ceil=m;
685  newBounds[newBinCount]=m;
686  newBinCount++;
687  }
688  j++;
689  }
690  }
691 
692  _FreqBounds.resize(newBounds.getLength());
693  _FreqBounds.copyFrom(newBounds);
694  setMids();
695 
696  IntArray BinPop(_FreqMids.getLength());
697  BinPop.zero();
698  int searchStart(0);
699  for(int k=0; k<mBounds.getLength()-1;k++)
700  {
701  const T mTop=mBounds[k+1];
702  const T mBot=mBounds[k];
703  IntArray& klist=*mKlist[k];
704  const int plusKs=klist.getLength();
705 
706  for(int l=searchStart;l<_FreqBounds.getLength();l++)
707  {
708  if(_FreqBounds[l]>=mBot && _FreqBounds[l]<mTop)
709  BinPop[l]+=plusKs;
710  if(_FreqBounds[l]==mTop)
711  {
712  searchStart=l;
713  break;
714  }
715  }
716  }
717 
718  searchStart=0;
719  for(int k=0; k<old.getLength()-1;k++)
720  {
721  const T oTop=old[k+1];
722  const T oBot=old[k];
723  IntArray& klist=*_BinKpts[k];
724  const int plusKs=klist.getLength();
725 
726  for(int l=searchStart;l<_FreqBounds.getLength();l++)
727  {
728  if(_FreqBounds[l]>=oBot && _FreqBounds[l]<oTop)
729  BinPop[l]+=plusKs;
730  if(_FreqBounds[l]>=oTop)
731  {
732  searchStart=l;
733  break;
734  }
735  }
736  }
737 
738  IntArrList oldBinKpts=_BinKpts;
739  IntArrList oldBinModes=_BinModes;
740  TArrList oldModeFractions=_ModeFractions;
741  _BinKpts.resize(_FreqMids.getLength());
742  _BinModes.resize(_FreqMids.getLength());
744 
745  for(int fInd=0;fInd<_FreqMids.getLength();fInd++)
746  {
747  const int len=BinPop[fInd];
748  IntArrayPtr newKArray=IntArrayPtr(new IntArray(len));
749  IntArrayPtr newMArray=IntArrayPtr(new IntArray(len));
750  TArrPtr newFArray=TArrPtr(new TArray(len));
751  _BinKpts[fInd]=newKArray;
752  _BinModes[fInd]=newMArray;
753  _ModeFractions[fInd]=newFArray;
754  }
755 
756  searchStart=0;
757  BinPop.zero();
758  for(int k=0; k<mBounds.getLength()-1;k++)
759  {
760  const T mTop=mBounds[k+1];
761  const T mBot=mBounds[k];
762  const T dif=mTop-mBot;
763  IntArray& klist=*mKlist[k];
764 
765  for(int l=searchStart;l<_FreqBounds.getLength();l++)
766  {
767  if(_FreqBounds[l]>=mBot && _FreqBounds[l]<mTop)
768  {
769  const T masterDif=_FreqBounds[l+1]-_FreqBounds[l];
770  const T coeff=masterDif/dif;
771  IntArray& newKArray=*_BinKpts[l];
772  IntArray& newMArray=*_BinModes[l];
773  TArray& newFArray=*_ModeFractions[l];
774 
775  for(int addInd=0;addInd<klist.getLength();addInd++)
776  {
777  newKArray[BinPop[l]]=klist[addInd];
778  newMArray[BinPop[l]]=mode;
779  newFArray[BinPop[l]]=coeff;
780  BinPop[l]++;
781  }
782 
783  }
784  if(_FreqBounds[l]==mTop)
785  {
786  searchStart=l;
787  break;
788  }
789  }
790  }
791 
792  searchStart=0;
793  for(int k=0; k<old.getLength()-1;k++)
794  {
795  const T oTop=old[k+1];
796  const T oBot=old[k];
797  const T dif=oTop-oBot;
798  IntArray& klist=*oldBinKpts[k];
799  IntArray& mlist=*oldBinModes[k];
800  TArray& fraclist=*oldModeFractions[k];
801 
802  for(int l=searchStart;l<_FreqBounds.getLength();l++)
803  {
804  if(_FreqBounds[l]>=oBot && _FreqBounds[l]<oTop)
805  {
806  const T masterDif=_FreqBounds[l+1]-_FreqBounds[l];
807  const T coeff=masterDif/dif;
808  IntArray& newKArray=*_BinKpts[l];
809  IntArray& newMArray=*_BinModes[l];
810  TArray& newFArray=*_ModeFractions[l];
811 
812  for(int addInd=0;addInd<klist.getLength();addInd++)
813  {
814  newKArray[BinPop[l]]=klist[addInd];
815  newMArray[BinPop[l]]=mlist[addInd];
816  newFArray[BinPop[l]]=coeff*fraclist[addInd];
817  BinPop[l]++;
818  }
819  }
820  if(_FreqBounds[l]==oTop)
821  {
822  searchStart=l;
823  break;
824  }
825  }
826  }
827 
828  }
829  }
830 
831  void setMids()
832  {
834  for(int i=0;i<_FreqBounds.getLength()-1;i++)
835  _FreqMids[i]=(_FreqBounds[i]+_FreqBounds[i+1])/2.;
836  }
837 
844  const Tkspace& _kspace;
845 
846 };
847 
848 
849 
850 #endif
virtual void zero()
Definition: Array.h:281
TArray & getModeFractions(const int fBin)
void binMode(const int mode, const int noBins, const T minw, const T maxw)
Kspace< T > Tkspace
Array< int > IntArray
Tvec getv()
Definition: pmode.h:59
Definition: Kspace.h:28
vector< TArrPtr > TArrList
void copyDOS(DensityOfStates &otherDOS)
int findBin(const TArray &bounds, const T freq)
T calce0(T Tl)
Definition: pmode.h:88
Tkvol & getkvol(int n) const
Definition: Kspace.h:390
Tmode & getmode(int n) const
Definition: kvol.h:44
int getlength() const
Definition: Kspace.h:391
int getmodenum()
Definition: kvol.h:43
pmode< T > Tmode
Array< T > TArray
ArrayBase * makeDMMreflection(ArrayBase *trans)
const Tkspace & getKspace()
ArrayBase * getFreqMids()
T sumOutgoing(const VectorT3 &n, const int fBin, const T Temp)
T calcBinFlux(const T Temp, const int fBin, const T tau)
void resize(const int newLength)
Definition: Array.h:56
shared_ptr< TArray > TArrPtr
IntArray & getMIndices(const int fBin)
IntArrList _BinModes
void saveNormDOS(const char *filename)
ArrayBase * getFreqBins()
const Tkspace & _kspace
TArray & getFreqMidsT()
TArray & getFreqBinsT()
IntArrList _BinKpts
void addMode(const TArray &mBounds, const TArray &mMids, const IntArrList &mKlist, const int mode)
IntArrList & getKptsList()
Definition: Array.h:14
const int findBin(const T freq) const
DensityOfStates(const Tkspace &kspace)
T getomega()
Definition: pmode.h:63
shared_ptr< IntArray > IntArrayPtr
void binEntireKspace(const int noBins, const T minw, const T maxw)
IntArray & getKIndices(const int fBin)
TArrList _ModeFractions
double min(double x, double y)
Definition: Octree.cpp:23
Definition: pmode.h:18
Vector< T, 3 > VectorT3
virtual void copyFrom(const IContainer &oc)
Definition: Array.h:383
Definition: kvol.h:14
void mergeBins(DensityOfStates &otherDOS, const bool original)
IntArrList & getMList()
ArrayBase * makeDMMtransmission(DensityOfStates &otherDOS, const T Temp, const bool merge)
T getdk3()
Definition: kvol.h:42
int getLength() const
Definition: Array.h:87
vector< IntArrayPtr > IntArrList