Gyoto
GyotoAstrobj.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011 Thibaut Paumard, Frederic Vincent
10 
11  This file is part of Gyoto.
12 
13  Gyoto is free software: you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  Gyoto is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 
28 #ifndef __GyotoAstrobj_H_
29 #define __GyotoAstrobj_H_
30 
31 #include <iostream>
32 #include <fstream>
33 #include <iomanip>
34 #include <string>
35 
36 #include <GyotoDefs.h>
37 #include <GyotoSmartPointer.h>
38 
39 namespace Gyoto{
40  class Photon;
41  namespace Register { class Entry; }
42  namespace Metric { class Generic; }
43  class FactoryMessenger;
44  namespace Astrobj {
45  class Generic;
46  class Properties;
47 
60 
67  SmartPointer<T> ao = new T();
68  ao -> setParameters(fmp);
69  return ao;
70  }
72 
83 
91 
95  void initRegister();
97 
109  void Register(std::string name, Gyoto::Astrobj::Subcontractor_t* scp);
111  }
112 }
113 
174  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Generic>;
175 
176 
177  // Data :
178  // -----
179  protected:
180 
184  SmartPointer<Gyoto::Metric::Generic> gg_;
185 
186 
199  double rmax_;
200 
209  int rmax_set_;
210 
215  const std::string kind_;
216 
218 
219  // Constructors - Destructor
220  // -------------------------
221  public:
225  Generic();
226 
230  Generic(double radmax);
231 
235  Generic(std::string kind);
236 
240  Generic(const Generic& ) ;
241 
255  virtual Generic* clone() const = 0 ;
256 
257  virtual ~Generic() ;
258 
259  // Accessors
260  // ---------
261  public:
265  virtual SmartPointer<Metric::Generic> getMetric() const;
266 
270  virtual void setMetric(SmartPointer<Metric::Generic>) ;
271 
281  virtual double getRmax();
282 
283  const std::string getKind() const;
284 
291  virtual void setRmax(double val);
292 
298  virtual void unsetRmax() ;
299 
305  void setFlag_radtransf(int flag);
307 
310  int getFlag_radtransf() const ;
312 
320 
321  //XML I/O
322  public:
343  virtual int setParameter(std::string name, std::string content) ;
345 
346 #ifdef GYOTO_USE_XERCES
347 
353  virtual void fillElement(FactoryMessenger *fmp) const ;
355 
374  virtual void setParameters(FactoryMessenger *fmp);
376 
377 
378 #endif
379 
380  // Outputs
381  // -------
382  public:
414  virtual int Impact(Gyoto::Photon* ph, size_t index,
415  Astrobj::Properties *data=NULL) = 0 ;
417 
428  virtual void processHitQuantities(Photon* ph, double* coord_ph_hit,
429  double* coord_obj_hit, double dt,
430  Astrobj::Properties* data) const;
431 
470  virtual double emission(double nu_em, double dsem, double coord_ph[8],
471  double coord_obj[8]=NULL)
472  const ;
473 
484  virtual double integrateEmission(double nu1, double nu2, double dsem,
485  double c_ph[8], double c_obj[8]=NULL) const;
487 
497  virtual double transmission(double nuem, double dsem, double coord[8]) const ;
499 
506  void checkPhiTheta(double coord[8]) const;
507 
508 
509 };
510 
519  friend class Gyoto::SmartPointer<Gyoto::Astrobj::Properties>;
520  public:
521  double *intensity;
522  double *time;
523  double *distance;
524  double * first_dmin;
525  int first_dmin_found;
526  double *redshift;
527  double *spectrum;
528  double *binspectrum;
529  int offset;
530  double * impactcoords;
531  double *user1, *user2, *user3, *user4, *user5;
532  public:
533  Properties();
534  Properties (double*, double*);
535  void init(size_t nbnuobs=0);
536  Properties operator++();
537 };
538 
539 #endif