casa
$Rev:20696$
|
00001 //# SofaTest.h: Wrapping of IAU SOFA Fortran routines and test class 00002 //# Copyright (C) 2003 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: SofaTest.h 21285 2012-11-14 15:36:59Z gervandiepen $ 00027 00028 #ifndef MEASURES_SOFATEST_H 00029 #define MEASURES_SOFATEST_H 00030 00031 //# Include files 00032 #include <casa/aips.h> 00033 #include <casa/iosfwd.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 // <summary> Wrapping of IAU SOFA Fortran routines and test class</summary> 00038 // <use visibility=export> 00039 // 00040 // <reviewed reviewer="wbrouw" date="2003/09/08" tests="tIAU2000"> 00041 // </reviewed> 00042 // 00043 // <synopsis> 00044 // The definition in this file enable the use of the IAU SOFA Fortran routines 00045 // in the C++ test routines. 00046 // By using the provided macro <em>IAUR</em> care is taken of SOFA prefixes 00047 // and probable extra underscores given by some compilers. 00048 // 00049 // For information on SOFA see the SOFA page at 00050 // <a href="http://ww.iau.org">IAU</a> or at the currenthome of SOFA at 00051 // <a href="http://www.iau-sofa.rl.ac.uk/">Rutherford</a> 00052 // 00053 // The SofaTest class can be used to provide histogram of test data. 00054 // The resolution is defaulted to 500 steps, compressed to 40 in the output. 00055 // </synopsis> 00056 // 00057 // <example> 00058 // <srcblock> 00059 // SofaTest dpsi; // Create an histogram class 00060 // // Loop over the following two statements to fill histogram 00061 // // Calculate a Double dpsival 00062 // dpsi.put(dpsival); 00063 // // Show the result 00064 // cout.precision(4); 00065 // cout << "aips++ dpsi(mas):" << endl; 00066 // dpsi.show(cout); 00067 // dpsi.showHisto(cout); 00068 // </srcblock> 00069 // The result will look like: 00070 // <srcblock> 00071 // aips++ dpsi (mas): 00072 // 5001 points were accumulated 00073 // with max = 1.529e-09, and min = -1.61e-09 00074 // and an average of 5.066e-12 and a standard deviation of 2.42e-10 00075 // 00076 // 23 counts per step; 0.0004 value. 00077 // |* 00078 // |* 00079 // |* 00080 // |* 00081 // |* 00082 // |* 00083 // |* 00084 // |* 00085 // |* 00086 // |* 00087 // |* 00088 // |* 00089 // |* 00090 // |* 00091 // |* 00092 // |* 00093 // |-* 00094 // |-* 00095 // |---* 00096 // |---* 00097 // |-----* 00098 // |---------* 00099 // |---------------------* 00100 // _--------------------------------------------------------* 00101 // |---------------------------------------------------------* 00102 // |----------------------* 00103 // |------------* 00104 // |------* 00105 // |----* 00106 // |--* 00107 // |-* 00108 // |-* 00109 // |* 00110 // |* 00111 // |* 00112 // |* 00113 // |* 00114 // |* 00115 // |* 00116 // |* 00117 // |* 00118 // |* 00119 // |* 00120 // |* 00121 // |* 00122 // </srcblock> 00123 // </example> 00124 // 00125 // <motivation> 00126 // To enable in-line testing of the aips++ Measures conversion routines. 00127 // </motivation> 00128 // 00129 // <todo asof="2003/08/31"> 00130 // Nothing (I hope!) 00131 // </todo> 00132 // 00133 00134 class SofaTest { 00135 00136 public: 00137 // Constructors 00138 // Create an empty SofaTest class, ready for accumulation 00139 SofaTest(); 00140 // Copy 00141 SofaTest(const SofaTest &other); 00142 00143 // Destructor 00144 ~SofaTest(); 00145 00146 // Operators 00147 // Assign 00148 SofaTest &operator=(const SofaTest &other); 00149 00150 // Methods 00151 // Clear the test class 00152 void clear(); 00153 00154 // Accumulate statistics 00155 void put(const Double in); 00156 00157 // Show statistics 00158 void show(ostream &os); 00159 void showHisto(ostream &os); 00160 00161 private: 00162 // Histogram resolution 00163 static const uInt HISTO_WIDTH = 500; 00164 // Data 00165 // Count 00166 uInt n_p; 00167 // Sum values 00168 Double sum_p; 00169 // Sum squared 00170 Double sq_p; 00171 // Max found 00172 Double max_p; 00173 // Min found 00174 Double min_p; 00175 // Step in histogram 00176 Double hstep_p; 00177 // Histogram size (really (n-1)/2) 00178 uInt hsize_p; 00179 // Histogram width 00180 uInt hwidth_p; 00181 // Histogram 00182 Int *histo_p; 00183 00184 // Methods 00185 // Copy object 00186 void copy(const SofaTest &other); 00187 00188 }; 00189 00190 //# Global function wraps 00191 // <summary> Global Fortran function wraps </summary> 00192 // <group name=IAU_SOFA> 00193 00194 #if !defined(NEED_FORTRAN_UNDERSCORES) 00195 #define NEED_FORTRAN_UNDERSCORES 1 00196 #endif 00197 00198 #if NEED_FORTRAN_UNDERSCORES 00199 #define IAUR(x) iau_##x##_ 00200 #else 00201 #define IAUR(x) iau_##x## 00202 #endif 00203 extern "C" void 00204 IAUR(cal2jd)(const Int &iy, const Int &im, const Int &id, 00205 Double &djm0, Double &djm, Int &j); 00206 extern "C" void 00207 IAUR(epj2jd)(const Double &epj, Double &djm0, Double &djm); 00208 extern "C" void 00209 IAUR(prec76)(const Double &ep01, const Double &ep02, 00210 const Double &ep11, const Double &ep12, 00211 Double &zeta, Double &z, 00212 Double &theta); 00213 extern "C" void 00214 IAUR(pmat76)(const Double &epoch1, const Double &epoch2, 00215 Double *rmatp); 00216 extern "C" void 00217 IAUR(nut80)(const Double &epoch1, const Double &epoch2, 00218 Double &dpsi, Double &deps); 00219 extern "C" void 00220 IAUR(nutm80)(const Double &epoch1, const Double &epoch2, 00221 Double *rmatn); 00222 extern "C" Double 00223 IAUR(obl80)(const Double &epoch1, const Double &epoch2); 00224 extern "C" void 00225 IAUR(pr00)(const Double &epoch1, const Double &epoch2, 00226 Double &dpsi, Double &deps); 00227 extern "C" void 00228 IAUR(bi00)(Double &dpsi, Double &deps, Double &dra); 00229 extern "C" void 00230 IAUR(bp00)(const Double &epoch1, const Double &epoch2, 00231 Double *rb, Double *rp, Double *rbp); 00232 extern "C" void 00233 IAUR(pnm80)(const Double &epoch1, const Double &epoch2, 00234 Double *rmatpn); 00235 extern "C" void 00236 IAUR(pn00a)(const Double &epoch1, const Double &epoch2, 00237 Double &dpsi, Double &deps, Double &epsa, 00238 Double *rb, Double *rp, Double *rbp, 00239 Double *rn, Double *rnpn); 00240 extern "C" void 00241 IAUR(pn00b)(const Double &epoch1, const Double &epoch2, 00242 Double &dpsi, Double &deps, Double &epsa, 00243 Double *rb, Double *rp, Double *rbp, 00244 Double *rn, Double *rnpn); 00245 extern "C" void 00246 IAUR(pr00)(const Double &ep01, const Double &ep02, 00247 Double &dpsipr, Double &depspr); 00248 extern "C" void 00249 IAUR(nut00b)(const Double &epoch1, const Double &epoch2, 00250 Double &dpsi, Double &deps); 00251 extern "C" void 00252 IAUR(nut00a)(const Double &epoch1, const Double &epoch2, 00253 Double &dpsi, Double &deps); 00254 extern "C" void 00255 IAUR(num00a)(const Double &epoch1, const Double &epoch2, 00256 Double *rn); 00257 extern "C" void 00258 IAUR(num00b)(const Double &epoch1, const Double &epoch2, 00259 Double *rn); 00260 extern "C" void 00261 IAUR(c2t00a)(const Double &tta, const Double &ttb, const Double &uta, 00262 const Double &utb, const Double &xp, const Double &yp, 00263 Double *rc2t); 00264 extern "C" Double 00265 IAUR(sp00)(const Double &date1, const Double &date2); 00266 extern "C" void 00267 IAUR(pom00)(const Double &xp, const Double &yp, const Double &sp, 00268 Double *rpom); 00269 extern "C" Double 00270 IAUR(gmst00)(const Double &uta, const Double &utb, 00271 const Double &tta, const Double &ttb); 00272 extern "C" Double 00273 IAUR(era00)(const Double &uta, const Double &utb); 00274 extern "C" Double 00275 IAUR(gmst82)(const Double &dj1, const Double &dj2); 00276 extern "C" Double 00277 IAUR(ee00a)(const Double &date1, const Double &date2); 00278 extern "C" Double 00279 IAUR(eect00)(const Double &date1, const Double &date2); 00280 extern "C" Double 00281 IAUR(eqeq94)(const Double &date1, const Double &date2); 00282 extern "C" void 00283 IAUR(pnm00a)(const Double &date1, const Double &date2, Double *rbpn); 00284 extern "C" void 00285 IAUR(c2teqx)(Double *rbpn, const Double &gst, Double *rpom, Double *rc2t); 00286 extern "C" void 00287 IAUR(rz)(const Double &psi, Double *r); 00288 extern "C" void 00289 IAUR(cr)(Double *r, Double *c); 00290 00291 // </group> 00292 00293 00294 } //# NAMESPACE CASA - END 00295 00296 #endif