Cloudy
Spectral Synthesis Code for Astrophysics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
emission.h
Go to the documentation of this file.
1 /* This file is part of Cloudy and is copyright (C)1978-2023 by Gary J. Ferland and
2  * others. For conditions of distribution and use see copyright notice in license.txt */
3 
4 #ifndef EMISSION_H_
5 #define EMISSION_H_
6 
7 #include "proxy_iterator.h"
8 #include "iter_track.h"
9 
10 class TransitionListImpl;
11 class TransitionProxy;
13 class EmissionList;
15 
16 //typedef iter_track_basic<realnum> tracker;
17 typedef secant_track tracker;
18 
20 {
21 public:
25 private:
28  int m_index;
29 public:
30  explicit EmissionProxy() : m_list(NULL), m_index(-1) {}
31  explicit EmissionProxy(EmissionList *list, int index) :
32  m_list(list), m_index(index) {}
33  void copy(const EmissionProxy& other);
34 
35  void check() const
36  {
37  ASSERT(ipTran() >= 0);
38  }
39 
48  int &iRedisFun() const;
49 
51  long int &ipFine() const;
52 
67  realnum &TauIn() const;
68 
73  realnum &TauInSpecific() const;
74 
85  realnum &TauTot() const;
86 
91  tracker& TauTrack() const;
92 
98  realnum &TauCon() const;
99 
101  realnum &FracInwd() const;
102 
105  double &pump() const;
106 
108  double &xIntensity() const;
109 
112  double &xObsIntensity() const;
113 
115  realnum &gf() const;
116 
118  realnum &Pesc() const;
119 
121  realnum &Pelec_esc() const;
122 
124  realnum &Pdest() const;
125 
127  realnum Pesc_total() const { return Pesc() + Pelec_esc(); }
128 
130  realnum Ploss() const { return Pesc_total()+Pdest(); }
131 
135  realnum &dampXvel() const;
136 
138  realnum &damp() const;
139 
141  double &ColOvTot() const;
142 
144  realnum &AutoIonizFrac() const;
145 
152  realnum &opacity() const;
153  // This is the summed opacity in a multiplet.
154  double &mult_opac() const;
155 
157  double &PopOpc() const;
158 
162  double &VoigtLineCen() const;
163 
165  realnum &Aul() const;
166 
168  double &ots() const;
169 
170  int &ipTran() const;
171 
172  TransitionProxy Tran() const;
173 };
175 {
176 public:
177  typedef const EmissionList list_type;
180 private:
183  int m_index;
184 public:
185  explicit EmissionConstProxy() : m_list(NULL), m_index(-1) {}
186  explicit EmissionConstProxy(const EmissionList *list, int index) :
187  m_list(list), m_index(index) {}
188  void copy(const EmissionConstProxy& other);
189 
190  void check() const
191  {
192  ASSERT(ipTran() >= 0);
193  }
194 
203  int iRedisFun() const;
204 
206  long int ipFine() const;
207 
222  realnum TauIn() const;
223 
228  realnum TauInSpecific() const;
229 
240  realnum TauTot() const;
241 
246  const tracker& TauTrack() const;
247 
253  realnum TauCon() const;
254 
256  realnum FracInwd() const;
257 
260  double pump() const;
261 
263  double xIntensity() const;
264 
267  double xObsIntensity() const;
268 
270  realnum gf() const;
271 
273  realnum Pesc() const;
274 
276  realnum Pelec_esc() const;
277 
279  realnum Pdest() const;
280 
282  realnum Pesc_total() const { return Pesc() + Pelec_esc(); }
283 
285  realnum Ploss() const { return Pesc_total()+Pdest(); }
286 
290  realnum dampXvel() const;
291 
293  realnum damp() const;
294 
296  double ColOvTot() const;
297 
299  realnum AutoIonizFrac() const;
300 
307  realnum opacity() const;
308  // This is the summed opacity in a multiplet.
309  double mult_opac() const;
310 
312  double PopOpc() const;
313 
317  double VoigtLineCen() const;
318 
320  realnum Aul() const;
321 
323  double ots() const;
324 
325  int ipTran() const;
326 
327  TransitionConstProxy Tran() const;
328 };
329 
331 {
333  vector<realnum> m_Aul;
334  vector<realnum> m_AutoIonizFrac;
335  vector<double> m_ColOvTot;
336  vector<realnum> m_damp;
337  vector<realnum> m_dampXvel;
338  vector<realnum> m_FracInwd;
339  vector<realnum> m_gf;
340  vector<int> m_iRedisFun;
341  vector<long> m_ipFine;
342  vector<realnum> m_opacity;
343  vector<double> m_mult_opac;
344  vector<double> m_ots;
345  vector<realnum> m_Pdest;
346  vector<realnum> m_Pesc;
347  vector<realnum> m_Pelec_esc;
348  vector<double> m_PopOpc;
349  vector<double> m_VoigtLineCen;
350  vector<double> m_pump;
351  vector<realnum> m_TauCon;
352  vector<realnum> m_TauIn;
353  vector<realnum> m_TauInSpecific;
354  vector<realnum> m_TauTot;
355  vector<tracker > m_TauTrack;
356  vector<double> m_xIntensity;
357  vector<double> m_xObsIntensity;
358  vector<int> m_ipTran;
359  friend class EmissionProxy;
360  friend class EmissionConstProxy;
361 public:
365  explicit EmissionList(TransitionListImpl *tlist, size_t i) : m_tlist(tlist)
366  {
367  resize(i);
368  }
369  explicit EmissionList(TransitionListImpl *tlist) : m_tlist(tlist) {}
371  {
372  return EmissionProxy(this,i);
373  }
374  size_t size(void) const
375  {
376  return m_Aul.size();
377  }
378  void resize(size_t i);
380  {
381  return iterator(this,0);
382  }
384  {
385  return const_iterator(this,0);
386  }
388  {
389  return iterator(this,size());
390  }
392  {
393  return const_iterator(this,size());
394  }
395 };
396 
410 
411 inline void EmissionList::resize(size_t i)
412 {
413  size_t oldsize = m_Aul.size();
414  m_Aul.resize(i);
415  m_AutoIonizFrac.resize(i);
416  m_ColOvTot.resize(i);
417  m_damp.resize(i);
418  m_dampXvel.resize(i);
419  m_gf.resize(i);
420  m_FracInwd.resize(i);
421  m_ipFine.resize(i);
422  m_iRedisFun.resize(i);
423  m_ots.resize(i);
424  m_opacity.resize(i);
425  m_mult_opac.resize(i);
426  m_Pdest.resize(i);
427  m_Pelec_esc.resize(i);
428  m_Pesc.resize(i);
429  m_PopOpc.resize(i);
430  m_VoigtLineCen.resize(i);
431  m_TauCon.resize(i);
432  m_TauIn.resize(i);
433  m_TauInSpecific.resize(i);
434  m_TauTot.resize(i);
435  m_TauTrack.resize(i);
436  m_pump.resize(i);
437  m_xIntensity.resize(i);
438  m_xObsIntensity.resize(i);
439  m_ipTran.resize(i,-1);
440  for (size_t newelem=oldsize; newelem < size(); ++newelem)
441  {
442  EmLineJunk((*this)[newelem]);
443  /*
444  \todo 2 Does doing EmLineZero here defeat the purpose of EmLineJunk?
445  * maybe we should pass full set of Emis components, fill everything in
446  * here, and THEN use EmLineZero? */
447  EmLineZero((*this)[newelem]);
448  TauZero((*this)[newelem]);
449  }
450 }
451 
452 inline int &EmissionProxy::iRedisFun() const
453 {
454  return m_list->m_iRedisFun[m_index];
455 }
456 
458 {
459  return m_list->m_iRedisFun[m_index];
460 }
461 
462 inline long int &EmissionProxy::ipFine() const
463 {
464  return m_list->m_ipFine[m_index];
465 }
466 
467 inline long int EmissionConstProxy::ipFine() const
468 {
469  return m_list->m_ipFine[m_index];
470 }
471 
473 {
474  return m_list->m_TauIn[m_index];
475 }
476 
478 {
479  return m_list->m_TauIn[m_index];
480 }
481 
483 {
484  return m_list->m_TauInSpecific[m_index];
485 }
486 
488 {
489  return m_list->m_TauInSpecific[m_index];
490 }
491 
493 {
494  return m_list->m_TauTot[m_index];
495 }
496 
498 {
499  return m_list->m_TauTot[m_index];
500 }
501 
503 {
504  return m_list->m_TauTrack[m_index];
505 }
506 
508 {
509  return m_list->m_TauTrack[m_index];
510 }
511 
513 {
514  return m_list->m_TauCon[m_index];
515 }
516 
518 {
519  return m_list->m_TauCon[m_index];
520 }
521 
523 {
524  return m_list->m_FracInwd[m_index];
525 }
526 
528 {
529  return m_list->m_FracInwd[m_index];
530 }
531 
532 inline double &EmissionProxy::pump() const
533 {
534  return m_list->m_pump[m_index];
535 }
536 
537 inline double EmissionConstProxy::pump() const
538 {
539  return m_list->m_pump[m_index];
540 }
541 
542 inline double &EmissionProxy::xIntensity() const
543 {
544  return m_list->m_xIntensity[m_index];
545 }
546 
547 inline double &EmissionProxy::xObsIntensity() const
548 {
549  return m_list->m_xObsIntensity[m_index];
550 }
551 
552 inline double EmissionConstProxy::xIntensity() const
553 {
554  return m_list->m_xIntensity[m_index];
555 }
556 
558 {
559  return m_list->m_xObsIntensity[m_index];
560 }
561 
562 inline int &EmissionProxy::ipTran() const
563 {
564  return m_list->m_ipTran[m_index];
565 }
566 
567 inline int EmissionConstProxy::ipTran() const
568 {
569  return m_list->m_ipTran[m_index];
570 }
571 
572 inline realnum &EmissionProxy::gf() const
573 {
574  return m_list->m_gf[m_index];
575 }
576 
578 {
579  return m_list->m_gf[m_index];
580 }
581 
583 {
584  return m_list->m_Pesc[m_index];
585 }
586 
588 {
589  return m_list->m_Pesc[m_index];
590 }
591 
593 {
594  return m_list->m_Pelec_esc[m_index];
595 }
596 
598 {
599  return m_list->m_Pelec_esc[m_index];
600 }
601 
603 {
604  return m_list->m_Pdest[m_index];
605 }
606 
608 {
609  return m_list->m_Pdest[m_index];
610 }
611 
613 {
614  return m_list->m_dampXvel[m_index];
615 }
616 
618 {
619  return m_list->m_dampXvel[m_index];
620 }
621 
623 {
624  return m_list->m_damp[m_index];
625 }
626 
628 {
629  return m_list->m_damp[m_index];
630 }
631 
632 inline double &EmissionProxy::ColOvTot() const
633 {
634  return m_list->m_ColOvTot[m_index];
635 }
636 
637 inline double EmissionConstProxy::ColOvTot() const
638 {
639  return m_list->m_ColOvTot[m_index];
640 }
641 
643 {
644  return m_list->m_AutoIonizFrac[m_index];
645 }
646 
648 {
649  return m_list->m_AutoIonizFrac[m_index];
650 }
651 
653 {
654  return m_list->m_opacity[m_index];
655 }
656 
658 {
659  return m_list->m_opacity[m_index];
660 }
661 
662 inline double &EmissionProxy::mult_opac() const
663 {
664  return m_list->m_mult_opac[m_index];
665 }
666 
667 inline double EmissionConstProxy::mult_opac() const
668 {
669  return m_list->m_mult_opac[m_index];
670 }
671 
672 inline double &EmissionProxy::PopOpc() const
673 {
674  return m_list->m_PopOpc[m_index];
675 }
676 
677 inline double EmissionConstProxy::PopOpc() const
678 {
679  return m_list->m_PopOpc[m_index];
680 }
681 
682 inline double &EmissionProxy::VoigtLineCen() const
683 {
684  return m_list->m_VoigtLineCen[m_index];
685 }
686 
687 inline double EmissionConstProxy::VoigtLineCen() const
688 {
689  return m_list->m_VoigtLineCen[m_index];
690 }
691 
693 {
694  return m_list->m_Aul[m_index];
695 }
696 
698 {
699  return m_list->m_Aul[m_index];
700 }
701 
702 inline double &EmissionProxy::ots() const
703 {
704  return m_list->m_ots[m_index];
705 }
706 
707 inline double EmissionConstProxy::ots() const
708 {
709  return m_list->m_ots[m_index];
710 }
711 
712 inline void EmissionProxy::copy(const EmissionProxy& other)
713 {
714  iRedisFun() = other.iRedisFun();
715  ipFine() = other.ipFine();
716  TauIn() = other.TauIn();
717  TauInSpecific() = other.TauInSpecific();
718  TauTot() = other.TauTot();
719  TauCon() = other.TauCon();
720  FracInwd() = other.FracInwd();
721  gf() = other.gf();
722  Pesc() = other.Pesc();
723  Pelec_esc() = other.Pelec_esc();
724  Pdest() = other.Pdest();
725  dampXvel() = other.dampXvel();
726  damp() = other.damp();
727  AutoIonizFrac() = other.AutoIonizFrac();
728  opacity() = other.opacity();
729  mult_opac() = other.mult_opac();
730  Aul() = other.Aul();
731  TauTrack() = other.TauTrack();
732  pump() = other.pump();
733  xIntensity() = other.xIntensity();
734  xObsIntensity() = other.xObsIntensity();
735  ColOvTot() = other.ColOvTot();
736  PopOpc() = other.PopOpc();
737  VoigtLineCen() = other.VoigtLineCen();
738  ots() = other.ots();
739  ipTran() = other.ipTran();
740 }
741 
742 #endif // EMISSION_H_
vector< realnum > m_gf
Definition: emission.h:339
void EmLineJunk(EmissionList::reference t)
Definition: emission.cpp:12
long int & ipFine() const
Definition: emission.h:462
vector< realnum > m_dampXvel
Definition: emission.h:337
realnum & TauInSpecific() const
Definition: emission.h:482
void copy(const EmissionProxy &other)
Definition: emission.h:712
double & ots() const
Definition: emission.h:702
EmissionProxy(EmissionList *list, int index)
Definition: emission.h:31
int & iRedisFun() const
Definition: emission.h:452
realnum & opacity() const
Definition: emission.h:652
const tracker & TauTrack() const
Definition: emission.h:507
realnum & Pelec_esc() const
Definition: emission.h:592
realnum TauInSpecific() const
Definition: emission.h:487
double mult_opac() const
Definition: emission.h:667
vector< int > m_iRedisFun
Definition: emission.h:340
secant_track tracker
Definition: emission.h:14
EmissionList * m_list
Definition: emission.h:27
realnum Aul() const
Definition: emission.h:697
vector< double > m_xObsIntensity
Definition: emission.h:357
Definition: emission.h:174
int m_index
Definition: emission.h:28
vector< double > m_VoigtLineCen
Definition: emission.h:349
realnum & TauTot() const
Definition: emission.h:492
long int ipFine() const
Definition: emission.h:467
vector< int > m_ipTran
Definition: emission.h:358
EmissionConstProxy(const EmissionList *list, int index)
Definition: emission.h:186
vector< long > m_ipFine
Definition: emission.h:341
double ColOvTot() const
Definition: emission.h:637
double ots() const
Definition: emission.h:707
vector< double > m_mult_opac
Definition: emission.h:343
Definition: transition.h:220
vector< realnum > m_TauTot
Definition: emission.h:354
realnum TauTot() const
Definition: emission.h:497
TransitionListImpl * m_tlist
Definition: emission.h:332
const EmissionList * m_list
Definition: emission.h:182
realnum TauCon() const
Definition: emission.h:517
void TauZero(EmissionList::reference t)
Definition: emission.cpp:75
Definition: iter_track.h:267
void check() const
Definition: emission.h:190
double pump() const
Definition: emission.h:537
vector< double > m_PopOpc
Definition: emission.h:348
TransitionProxy Tran() const
Definition: transition.h:503
int ipTran() const
Definition: emission.h:567
vector< realnum > m_TauIn
Definition: emission.h:352
ProxyIterator< EmissionConstProxy, EmissionConstProxy > const_iterator
Definition: emission.h:179
double xIntensity() const
Definition: emission.h:552
int & ipTran() const
Definition: emission.h:562
ProxyIterator< EmissionProxy, EmissionConstProxy > iterator
Definition: emission.h:23
size_t size(void) const
Definition: emission.h:374
EmissionProxy::iterator iterator
Definition: emission.h:363
EmissionConstProxy::iterator const_iterator
Definition: emission.h:364
vector< realnum > m_Pesc
Definition: emission.h:346
vector< double > m_ots
Definition: emission.h:344
realnum & gf() const
Definition: emission.h:572
realnum Pdest() const
Definition: emission.h:607
double & VoigtLineCen() const
Definition: emission.h:682
Definition: emission.h:19
vector< tracker > m_TauTrack
Definition: emission.h:355
realnum & dampXvel() const
Definition: emission.h:612
double VoigtLineCen() const
Definition: emission.h:687
EmissionList(TransitionListImpl *tlist, size_t i)
Definition: emission.h:365
double & xIntensity() const
Definition: emission.h:542
realnum Ploss() const
Definition: emission.h:130
Definition: proxy_iterator.h:58
const_iterator end() const
Definition: emission.h:391
iterator end()
Definition: emission.h:387
realnum TauIn() const
Definition: emission.h:477
EmissionProxy()
Definition: emission.h:30
realnum Pelec_esc() const
Definition: emission.h:597
float realnum
Definition: cddefines.h:127
realnum & Pesc() const
Definition: emission.h:582
vector< realnum > m_opacity
Definition: emission.h:342
vector< realnum > m_damp
Definition: emission.h:336
void check() const
Definition: emission.h:35
realnum AutoIonizFrac() const
Definition: emission.h:647
const EmissionList list_type
Definition: emission.h:177
realnum damp() const
Definition: emission.h:627
vector< double > m_pump
Definition: emission.h:350
realnum Pesc_total() const
Definition: emission.h:282
vector< realnum > m_FracInwd
Definition: emission.h:338
vector< double > m_ColOvTot
Definition: emission.h:335
#define NULL
Definition: cddefines.h:115
vector< realnum > m_TauInSpecific
Definition: emission.h:353
realnum Ploss() const
Definition: emission.h:285
void resize(size_t i)
Definition: emission.h:411
vector< realnum > m_AutoIonizFrac
Definition: emission.h:334
realnum dampXvel() const
Definition: emission.h:617
EmissionList list_type
Definition: emission.h:22
ProxyIterator< EmissionConstProxy, EmissionConstProxy > iterator
Definition: emission.h:178
realnum & Pdest() const
Definition: emission.h:602
int iRedisFun() const
Definition: emission.h:457
#define ASSERT(exp)
Definition: cddefines.h:637
realnum & TauCon() const
Definition: emission.h:512
vector< realnum > m_Pelec_esc
Definition: emission.h:347
realnum Pesc_total() const
Definition: emission.h:127
void EmLineZero(EmissionList::reference t)
Definition: emission.cpp:95
EmissionList(TransitionListImpl *tlist)
Definition: emission.h:369
tracker & TauTrack() const
Definition: emission.h:502
EmissionConstProxy()
Definition: emission.h:185
double xObsIntensity() const
Definition: emission.h:557
double & mult_opac() const
Definition: emission.h:662
double & PopOpc() const
Definition: emission.h:672
void copy(const EmissionConstProxy &other)
friend class EmissionProxy
Definition: emission.h:359
vector< realnum > m_TauCon
Definition: emission.h:351
vector< realnum > m_Aul
Definition: emission.h:333
Definition: transition.h:139
realnum & damp() const
Definition: emission.h:622
ProxyIterator< EmissionConstProxy, EmissionConstProxy > const_iterator
Definition: emission.h:24
double & ColOvTot() const
Definition: emission.h:632
double & xObsIntensity() const
Definition: emission.h:547
Definition: transition.h:23
TransitionConstProxy Tran() const
Definition: transition.h:509
realnum FracInwd() const
Definition: emission.h:527
realnum & AutoIonizFrac() const
Definition: emission.h:642
vector< realnum > m_Pdest
Definition: emission.h:345
reference operator[](size_t i)
Definition: emission.h:370
const_iterator begin() const
Definition: emission.h:383
realnum & FracInwd() const
Definition: emission.h:522
int m_index
Definition: emission.h:183
iterator begin()
Definition: emission.h:379
realnum Pesc() const
Definition: emission.h:587
realnum opacity() const
Definition: emission.h:657
Definition: emission.h:330
realnum & Aul() const
Definition: emission.h:692
EmissionProxy reference
Definition: emission.h:362
double PopOpc() const
Definition: emission.h:677
vector< double > m_xIntensity
Definition: emission.h:356
realnum gf() const
Definition: emission.h:577
realnum & TauIn() const
Definition: emission.h:472
double & pump() const
Definition: emission.h:532