Gyoto
GyotoGridData2D.h
Go to the documentation of this file.
1 
8 /*
9  Copyright (c) 2019-2021 Frederic Vincent, Thibaut Paumard, Nicolas Aimar
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 #ifndef __GyotoGridData2D_H_
28 #define __GyotoGridData2D_H_
29 
30 #include <iostream>
31 #include <fstream>
32 #include <iomanip>
33 #ifdef GYOTO_USE_CFITSIO
34 #include <fitsio.h>
35 #endif
36 
37 namespace Gyoto {
38  class GridData2D;
39 }
40 
41 #ifdef GYOTO_USE_XERCES
42 #include <GyotoRegister.h>
43 #endif
44 
52 {
53  private:
54  double phimin_;
55  double phimax_;
56  double dphi_;
57  size_t nphi_;
58  double dr_;
59  size_t nr_;
60  double rmin_;
61  double rmax_;
62  double dt_;
63  size_t nt_;
64  double tmin_;
65  double tmax_;
66  //NB: phimin, phimax are always assumed to be 0, 2pi
67 
68  public:
69  GridData2D();
70  GridData2D(const GridData2D&);
71  virtual GridData2D* clone() const ;
72  virtual ~GridData2D() ;
73 
74  // Accessors
75  void rmin(double rmn);
76  double rmin() const;
77  void rmax(double rmx);
78  double rmax() const;
79  void nr(size_t nn);
80  size_t nr() const;
81  void dr(double dd);
82  double dr() const;
83  void phimin(double phimn);
84  double phimin() const;
85  void phimax(double phimx);
86  double phimax() const;
87  void dphi(double dd);
88  double dphi() const;
89  void tmin(double tmn);
90  double tmin() const;
91  void tmax(double tmx);
92  double tmax() const;
93  void nt(size_t nn);
94  size_t nt() const;
95  void nphi(size_t nn);
96  size_t nphi() const;
97 
98 #ifdef GYOTO_USE_CFITSIO
99 
100 
101  virtual std::vector<size_t> fitsReadHDU(fitsfile* fptr,
102  std::string extname,
103  double *& dest,
104  size_t length = 0);
105 
117  fitsfile* fitsCreate(std::string filename);
118 
126  void fitsClose(fitsfile* fptr);
127 
141  void fitsWriteHDU(fitsfile* fptr,
142  std::string extname,
143  double* src,
144  size_t length = 0) ;
145 
146 
147 #endif
148 
149  void getIndices(size_t i[3], double const tt, double const phi, double const rr, double* const time_array=NULL) const ;
150  double interpolate(double tt, double phi, double rr,
151  double* const array, double* const time_array=NULL) const ;
152 
153 
154 
155 };
156 
157 #endif
double phimin_
Minimum phi in grid.
Definition: GyotoGridData2D.h:54
double dt_
Time step, if not constant would be ignored.
Definition: GyotoGridData2D.h:62
GridData2D()
Constructor.
virtual ~GridData2D()
Destructor.
Gyoto registers.
void fitsWriteHDU(fitsfile *fptr, std::string extname, double *src, size_t length=0)
Writes specific HDU in FITS files.
double tmax_
Maximum t in grid.
Definition: GyotoGridData2D.h:65
size_t nphi_
Grid size in the φ direction.
Definition: GyotoGridData2D.h:57
double dr_
Radius step.
Definition: GyotoGridData2D.h:58
fitsfile * fitsCreate(std::string filename)
Creates a FITS file with dummy primary HDU.
Class for reading data stored in a 2D grid.
Definition: GyotoGridData2D.h:51
double tmin_
Minimum t in grid.
Definition: GyotoGridData2D.h:64
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
double dphi_
δφ between two grid columns
Definition: GyotoGridData2D.h:56
size_t nt_
Grid size in the t direction.
Definition: GyotoGridData2D.h:63
void fitsClose(fitsfile *fptr)
Closes a fits file referred to by a fitsfile pointer.
double rmax_
Maximum r in grid.
Definition: GyotoGridData2D.h:61
size_t nr_
Grid size in the r direction.
Definition: GyotoGridData2D.h:59
double rmin_
Minimum r in grid.
Definition: GyotoGridData2D.h:60
double phimax_
Maximum phi in grid.
Definition: GyotoGridData2D.h:55