Gyoto
GyotoScreen.h
Go to the documentation of this file.
1 
7 /*
8  Copyright 2011-2013 Thibaut Paumard, Frederic Vincent
9 
10  This file is part of Gyoto.
11 
12  Gyoto is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  Gyoto is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef __GyotoScreen_H_
27 #define __GyotoScreen_H_
28 
29 #include <iostream>
30 #include <fstream>
31 #include <string>
32 
33 namespace Gyoto {
34  class Screen;
35 }
36 
37 #include <GyotoDefs.h>
38 #include <GyotoUtils.h>
39 #include <GyotoSmartPointer.h>
40 #include <GyotoMetric.h>
41 #include <GyotoSpectrometer.h>
42 
151  friend class Gyoto::SmartPointer<Gyoto::Screen>;
152 
153  private:
154  double tobs_;
155  double fov_;
156  // double tmin_;
158 
162  double * mask_;
163 
170  std::string mask_filename_;
171 
172  double distance_;
173  double dmax_;
174 
176 
182  double euler_[3];
183  double ex_[3];
184  double ey_[3];
185  double ez_[3];
186 
187  double fourvel_[4];
188  double screen1_[4];
189  double screen2_[4];
190  double screen3_[4];
191 
192  double alpha0_;
193  double delta0_;
194  SmartPointer<Metric::Generic> gg_;
195 
199  SmartPointer<Spectrometer::Generic> spectro_;
200 
206  double freq_obs_;
207 
208  public:
209 
210  // Constructors - Destructor
211  // -------------------------
212  Screen() ;
213  Screen(const Screen& ) ;
214  Screen * clone() const;
215 
216  virtual ~Screen() ;
217 
218  // Mutators / assignment
219  // ---------------------
220 
222  void setProjection(const double paln,
223  const double inclination,
224  const double argument);
226  void setProjection(const double distance,
227  const double paln,
228  const double inclination,
229  const double argument);
230 
232 
235  void distance(double dist);
236 
238 
241  void dMax(double dist);
242 
244 
248  void distance(double dist, const std::string unit);
249 
251 
255  void inclination(double);
256 
258 
262  void inclination(double, const std::string &unit);
263 
264  void PALN(double);
266  void PALN(double, const std::string &unit);
268  void argument(double);
270  void argument(double, const std::string &unit);
272  void spectrometer(SmartPointer<Spectrometer::Generic> spectro);
274  SmartPointer<Spectrometer::Generic> spectrometer() const ;
276 
281  void freqObs(double fo);
282 
283 
290  void freqObs(double fo, const std::string &unit);
291 
295  double freqObs() const ;
296 
302  double freqObs(const std::string &unit) const;
303 
305 
313  void setObserverPos(const double pos[4]);
314 
315  void setFourVel(const double coord[4]);
317  void setScreen1(const double coord[4]);
319  void setScreen2(const double coord[4]);
321  void setScreen3(const double coord[4]);
323 
324  // Accessors
325  // ---------
326 
328 
331  int coordKind() const;
332 
334 
337  double distance() const;
338 
340 
343  double distance(const std::string&) const;
344 
346 
349  double dMax() const;
350 
352 
356  double inclination() const;
357 
359 
363  double inclination(const std::string&) const;
364 
365  double PALN() const;
366  double PALN(const std::string&) const;
367  double argument() const;
368  double argument(const std::string&) const;
369 
370  SmartPointer<Metric::Generic> metric() const;
371  void metric(SmartPointer<Metric::Generic> gg);
372 
374  double time();
375 
377  double time(const std::string &);
378 
380  void time(double, const std::string &);
381 
383  void time(double);
384 
386  double fieldOfView();
387 
389  double fieldOfView(std::string unit);
390 
392  void fieldOfView(double);
393 
395  void fieldOfView(double, const std::string &unit);
396 
398  void alpha0(double);
400  void alpha0(double, const std::string &unit);
402  double alpha0() const;
404  double alpha0(std::string unit);
406  void delta0(double);
408  void delta0(double, const std::string &unit);
410  double delta0() const;
412  double delta0(std::string unit);
413 
415  void setAnglekind(int);
416 
418  size_t resolution();
420  void resolution(size_t);
421 
423 
427  void mask(double const * const mm, size_t resolution=0);
428 
430  double const * mask() const ;
431 # ifdef GYOTO_USE_CFITSIO
432 
434  void fitsReadMask(std::string fname);
435 
437  void fitsWriteMask(std::string fname);
438 # endif
439 
441 
445  bool operator()(size_t, size_t);
446 
447 
449 
460  void getObserverPos(double coord[]) const;
461 
463 
466  void getFourVel(double fourvel[]) const;
467 
469 
472  void getScreen1(double output[]) const;
473 
475 
478  void getScreen2(double output[]) const;
479 
481 
484  void getScreen3(double output[]) const;
485 
487 
496  void getRayCoord(double x, double y, double coord[]) const;
497 
499 
507  void getRayCoord(const size_t i, const size_t j, double coord[]) const;
508 
509  void coordToSky(const double pos[4], double skypos[3]) const;
511 
512  void coordToXYZ(const double pos[4], double xyz[3]) const;
514 
515  void computeBaseVectors() ;
517 
519  // friend std::ostream& operator<<(std::ostream& , const Screen& ) ;
520  std::ostream& print(std::ostream&) const ;
521  std::ostream& printBaseVectors(std::ostream&) const ;
522 
523  // UDUNITS
524 # ifdef HAVE_UDUNITS
525 
534  void mapPixUnit();
535 
537 
540  void unmapPixUnit();
541 # endif
542 
543 
544 #ifdef GYOTO_USE_XERCES
545  public:
546  void fillElement(FactoryMessenger *fmp);
547  static SmartPointer<Screen> Subcontractor(FactoryMessenger* fmp);
549 #endif
550 
551 
552 };
553 
554 #endif
double tobs_
Observing date in s.
Definition: GyotoScreen.h:154
double const * mask() const
Retrieve const pointer to mask_.
SmartPointer< Spectrometer::Generic > spectro_
Gyoto::Spectrometer::Generic subclass instance used for quantities Spectrum and BinSpectrum.
Definition: GyotoScreen.h:199
void unmapPixUnit()
Unmap "pix" and "pixel" from unit system.
Pointers performing reference counting.
Definition: GyotoSmartPointer.h:51
void getFourVel(double fourvel[]) const
Get copy of Screen::fourvel_.
double ey_[3]
Sky coordinate of base Y vector.
Definition: GyotoScreen.h:184
void setObserverPos(const double pos[4])
Alternative way to set projection.
double time()
Get observing date in seconds.
double alpha0() const
Get direction of the center of the field.
void setScreen1(const double coord[4])
Sets the screen vector e1.
double screen3_[4]
Screen e3 vector (normal)
Definition: GyotoScreen.h:190
double distance_
Distance to the observer in m.
Definition: GyotoScreen.h:172
void fitsWriteMask(std::string fname)
Save mask_ from FITS file.
void setScreen3(const double coord[4])
Sets the screen vector e3 (normal)
double fourvel_[4]
Observer's 4-velocity.
Definition: GyotoScreen.h:187
std::ostream & print(std::ostream &) const
Display.
double freq_obs_
Frequency at which the observer observes.
Definition: GyotoScreen.h:206
std::ostream & printBaseVectors(std::ostream &) const
Debug helper.
int coordKind() const
Get coordinate kind.
Reference-counting pointers.
double distance() const
Get distance from observer.
Screen * clone() const
Cloner.
void getRayCoord(double x, double y, double coord[]) const
Get 8-coordinate of Photon hitting screen from a given direction.
#define size_t
If not defined in .
Definition: GyotoConfig.h:305
double screen2_[4]
Screen e2 vector.
Definition: GyotoScreen.h:189
void coordToSky(const double pos[4], double skypos[3]) const
Convert 4-position to 3-sky position.
double fov_
Field-of-view in rad.
Definition: GyotoScreen.h:155
double euler_[3]
Euler angles.
Definition: GyotoScreen.h:182
void getScreen1(double output[]) const
Get copy of Screen::screen1_.
The camera with which the Astrobj is observed.
Definition: GyotoScreen.h:150
double dmax_
Maximum distance from which the photons are launched (geometrical units)
Definition: GyotoScreen.h:173
int anglekind_
Screen angles kind (0: equatorial, 1: spherical)
Definition: GyotoScreen.h:175
void setScreen2(const double coord[4])
Sets the screen vector e2.
void mapPixUnit()
Map "pix" and "pixel" to angular pixel width in unit system.
std::string mask_filename_
Last read or written FITS file.
Definition: GyotoScreen.h:170
double freqObs() const
Get freq_obs_.
size_t npix_
Resolution in pixels.
Definition: GyotoScreen.h:157
double argument() const
Get angle between line of nodes and X axis of object.
Gyoto ubiquitous macros and typedefs.
Base class for metric description.
double delta0() const
Get direction of the center of the field.
double ez_[3]
Sky coordinate of base Z vector.
Definition: GyotoScreen.h:185
void fitsReadMask(std::string fname)
Read mask_ from FITS file.
void setAnglekind(int)
Set Screen::anglekind_.
double dMax() const
Get maximum ray-tracing distance.
void setProjection(const double paln, const double inclination, const double argument)
Set inclination etc.
double PALN() const
Get position angle of the line of nodes.
void coordToXYZ(const double pos[4], double xyz[3]) const
Convert 4-position to 3-cartesian coordinates.
Spectroscopic capabilities of a Screen.
void computeBaseVectors()
Compute base vectors according to projection parameters.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:42
double inclination() const
Get inclination relative to line-of-sight.
SmartPointer< Metric::Generic > metric() const
Get Screen::gg_.
void getScreen2(double output[]) const
Get copy of Screen::screen2_.
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:79
double delta0_
Screen orientation (0,0) is right towards the BH.
Definition: GyotoScreen.h:193
GYOTO utilities.
double ex_[3]
Sky coordinate of base X vector.
Definition: GyotoScreen.h:183
SmartPointer< Spectrometer::Generic > spectrometer() const
Get Screen::spectro_.
double screen1_[4]
Screen e1 vector.
Definition: GyotoScreen.h:188
void getScreen3(double output[]) const
Get copy of Screen::screen3_.
void fillElement(FactoryMessenger *fmp)
SmartPointer< Metric::Generic > gg_
The Metric in this end of the Universe.
Definition: GyotoScreen.h:194
double fieldOfView()
Get Screen::fov_ in radians.
double alpha0_
Screen orientation (0,0) is right towards the BH.
Definition: GyotoScreen.h:192
void setFourVel(const double coord[4])
Sets the observer's 4-velocity.
static SmartPointer< Screen > Subcontractor(FactoryMessenger *fmp)
Instanciate a Screen from XML entity.
double * mask_
Mask with 0 where the ray-tracing should not be performed.
Definition: GyotoScreen.h:162
void getObserverPos(double coord[]) const
4-Position of the observer relative to the metric
size_t resolution()
Get Screen::npix_.