| 1 | /* |
| 2 | Copyright 2011, 2013-2015, 2018 Thibaut Paumard & Frédéric Vincent |
| 3 | |
| 4 | This file is part of Gyoto. |
| 5 | |
| 6 | Gyoto is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation, either version 3 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | Gyoto is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with Gyoto. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include "GyotoPhoton.h"cxx . . $ `<file>/include/GyotoPhoton.h`/ |
| 21 | #include "GyotoFactory.h"cxx . . $ `<file>/include/GyotoFactory.h`/ |
| 22 | #include "GyotoDefs.h"cxx . . $ `<file>/include/GyotoDefs.h`/ |
| 23 | #include "ygyoto.h"cxx . . $ `<file>/yorick/ygyoto.h`/ |
| 24 | #include "ygyoto_private.h"cxx . . $ `<file>/yorick/ygyoto_private.h`/ |
| 25 | #include "yapi.h" |
| 26 | #include "pstdlib.h" |
| 27 | |
| 28 | #define OBJcxx . . $ `yorick/gyoto_Photon.C:28:9`! ph |
| 29 | |
| 30 | using namespace Gyoto; |
| 31 | using namespace std; |
| 32 | |
| 33 | #define YGYOTO_PHOTON_GENERIC_KWcxx . . $ `yorick/gyoto_Photon.C:33:9`! "unit", "metric", "initcoord", "astrobj", \ |
| 34 | "spectro", "tmin", "delta", "adaptive", "maxiter", \ |
| 35 | "integrator", "deltamin", "deltamax", "deltamaxoverr", "abstol", "reltol", \ |
| 36 | "setparameter", "reset", "xfill", "save_txyz", "xmlwrite", "is_hit", \ |
| 37 | "get_txyz", "get_coord", "get_cartesian", "clone", "help" |
| 38 | #define YGYOTO_PHOTON_GENERIC_KW_Ncxx . . $ `yorick/gyoto_Photon.C:38:9`! 26 |
| 39 | |
| 40 | void ygyoto_Photon_generic_evalcxx . . $ ygyoto_Photon_generic_eval(52d21937073b7931).(Gyotocxx . . $ Gyoto/::SmartPointercxx . . $ Gyoto/SmartPointer#<Gyotocxx . . $ Gyoto/::Photoncxx . . $ Gyoto/Photon#>* ph, |
| 41 | int *kiargs, int *piargs, int *rvset, int *paUsed) { |
| 42 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nDEBUG: In ygyoto_Photon_generic_eval: "; |
| 43 | int k=-1, iarg; |
| 44 | char const * rmsg="Cannot set return value more than once"; |
| 45 | char const * pmsg="Cannot use positional argument more than once"; |
| 46 | char * unit = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 47 | |
| 48 | YGYOTO_WORKER_SET_UNITcxx . . $ `yorick/ygyoto.h:439:9`!; |
| 49 | YGYOTO_WORKER_GETSET_OBJECT2cxx . . $ `yorick/ygyoto.h:436:9`!(metric,Metric); |
| 50 | |
| 51 | /* INITCOORD */ |
| 52 | if ((iarg=kiargs[++k])>=0) { |
| 53 | iarg+=*rvset; |
| 54 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "initcoord="; |
| 55 | if (yarg_nil(iarg)) { // Getting initcoord |
| 56 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " get_initcoord=1" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 57 | if ((*rvset)++) y_error(rmsg); |
| 58 | state_tcxx . . $ Gyoto/state_t# vcxx . . $ std/vector#vector(83fdeebbe0501a83).(8); |
| 59 | (*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).getInitialCoordcxx . . $ Gyoto/Worldline#getInitialCoord(e0b659792e89f658).(v); |
| 60 | long dims[]= {1, 8}; |
| 61 | double *coord = ypush_d(dims); |
| 62 | for (int i=0; i<8; ++i) coord[i]=v[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]; |
| 63 | //TODO: support polarization (v.size()==16) |
| 64 | } else { // Setting initcoord |
| 65 | long ptot=1; |
| 66 | double coord[8], Ephi[4], Etheta[4]; |
| 67 | bool compute_polar_basis=false; |
| 68 | |
| 69 | if (yarg_number(iarg)) { // initcoord=coord or initcoord=pos, vel |
| 70 | double *pos=ygeta_d(iarg, &ptot, 0); |
| 71 | if (ptot!=4 && ptot !=8) |
| 72 | y_error("POS should have either 4 or 8 elements."); |
| 73 | for (int ii=0; ii<ptot; ++ii) coord[ii]=pos[ii]; |
| 74 | if (ptot==4) { |
| 75 | if ((*paUsed)++) y_error(pmsg); |
| 76 | long vtot=1; |
| 77 | double *vel=ygeta_d(piargs[0]+*rvset, &vtot, 0); |
| 78 | if (vtot==4) for (int ii=0; ii<4; ++ii) coord[ii+4]=vel[ii]; |
| 79 | else if (vtot==3) { |
| 80 | for (int ii=0; ii<3; ++ii) coord[ii+5]=vel[ii]; |
| 81 | if (!(*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).metriccxx . . $ Gyoto/Worldline#metric(21e4ddd491389e4f).()) |
| 82 | y_error("METRIC should have been set already"); |
| 83 | (*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).metriccxx . . $ Gyoto/Worldline#metric(21e4ddd491389e4f).()->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).nullifyCoordcxx . . $ Gyoto/Metric/Generic#nullifyCoord(b0764271c3b728b7).(coord); |
| 84 | } else y_error("VEL should have 3 or 4 elements"); |
| 85 | } |
| 86 | } else { |
| 87 | SmartPointercxx . . $ Gyoto/SmartPointer#<Screencxx . . $ Gyoto/Screen#> sc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 88 | if (yarg_Scenerycxx . . $ yarg_Scenery(7864480464b09eea).(iarg)) { // initcoord=scenery,i,j or senery,da,dd |
| 89 | SmartPointercxx . . $ Gyoto/SmartPointer#<Scenerycxx . . $ Gyoto/Scenery#> *scenery = yget_Scenerycxx . . $ yget_Scenery(c16583ded4f0f347).(iarg); |
| 90 | (*ph) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). metriccxx . . $ Gyoto/Photon#metric(5223605a86374f04).((*scenery)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).metriccxx . . $ Gyoto/Scenery#metric(21e4ddd491389e4f).()); |
| 91 | (*ph) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). astrobjcxx . . $ Gyoto/Photon#astrobj(990284e8026d7d4e).((*scenery)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).astrobjcxx . . $ Gyoto/Scenery#astrobj(4dfd8a92ee1f31ba).()); |
| 92 | sc =cxx . . $ Gyoto/SmartPointer#`operator=`(f9ef321adc27b1be). (*scenery)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).screencxx . . $ Gyoto/Scenery#screen(bbd292041e1b1507).(); |
| 93 | } else sc =cxx . . $ Gyoto/SmartPointer#`operator=`(7c1f4ede6b168c36). *yget_Screencxx . . $ yget_Screen(9ed86900cf73e562).(iarg); //initcoord=screen,i,j or screen, da, dd |
| 94 | if (yarg_number(piargs[0]+*rvset)==2) { |
| 95 | double da = ygets_d(piargs[0]+*rvset); |
| 96 | double dd = ygets_d(piargs[1]+*rvset); |
| 97 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "screen, dalpha="<<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538).da <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7).", ddelta="<<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538).dd <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a).endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 98 | sc ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). getRayTriadcxx . . $ Gyoto/Screen#getRayTriad(248e96036b6d5c7).(da, dd, |
| 99 | coord, |
| 100 | compute_polar_basis, |
| 101 | Ephi, Etheta); |
| 102 | } else { |
| 103 | size_t i = ygets_l(piargs[0]+*rvset); |
| 104 | size_t j = ygets_l(piargs[1]+*rvset); |
| 105 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "screen, i="<<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed).i <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7).", j="<<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed).j <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 106 | sc ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). getRayTriadcxx . . $ Gyoto/Screen#getRayTriad(276fa963e1c93236).(i, j, |
| 107 | coord, |
| 108 | compute_polar_basis, |
| 109 | Ephi, Etheta); |
| 110 | } |
| 111 | (*ph) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). spectrometercxx . . $ Gyoto/Photon#spectrometer(4d6fd557e0232eb8).(sc->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).spectrometercxx . . $ Gyoto/Screen#spectrometer(b72e4c28278d202).()); |
| 112 | } |
| 113 | |
| 114 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) { |
| 115 | cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "DEBUG: initcoord=[" ; |
| 116 | for (int ii=0; ii<7; ++ii) cerrcxx . . $ std/cerr. <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). coord[ii] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", "; |
| 117 | cerrcxx . . $ std/cerr. <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). coord[7] ; |
| 118 | } |
| 119 | (*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).setInitCoordcxx . . $ Gyoto/Worldline#setInitCoord(5007b46494cc5089).(coord) ; |
| 120 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 121 | } |
| 122 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "... " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 123 | } |
| 124 | |
| 125 | YGYOTO_WORKER_GETSET_OBJECT2cxx . . $ `yorick/ygyoto.h:436:9`!(astrobj,Astrobj); |
| 126 | YGYOTO_WORKER_GETSET_OBJECT2cxx . . $ `yorick/ygyoto.h:436:9`!(spectrometer,Spectrometer); |
| 127 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!(tMin); |
| 128 | YGYOTO_WORKER_GETSET_DOUBLE2_UNITcxx . . $ `yorick/ygyoto.h:342:9`!(delta); |
| 129 | YGYOTO_WORKER_GETSET_LONG2cxx . . $ `yorick/ygyoto.h:402:9`!(adaptive); |
| 130 | YGYOTO_WORKER_GETSET_LONG2cxx . . $ `yorick/ygyoto.h:402:9`!( maxiter ); |
| 131 | YGYOTO_WORKER_GETSET_STRING2cxx . . $ `yorick/ygyoto.h:382:9`!( integrator ); |
| 132 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( deltaMin ); |
| 133 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( deltaMax ); |
| 134 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( deltaMaxOverR ); |
| 135 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( absTol ); |
| 136 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( relTol ); |
| 137 | YGYOTO_WORKER_SETPARAMETERcxx . . $ `yorick/ygyoto.h:446:9`!; |
| 138 | YGYOTO_WORKER_RUNcxx . . $ `yorick/ygyoto.h:478:9`!( reset() ); |
| 139 | YGYOTO_WORKER_RUNcxx . . $ `yorick/ygyoto.h:478:9`!( xFill(ygets_d(iarg), false) ); |
| 140 | |
| 141 | // save_txyz=filename, t1, mass_sun, distance_kpc, unit, screen |
| 142 | if ((iarg=kiargs[++k])>=0) { |
| 143 | iarg+=*rvset; |
| 144 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " save_txyz="; |
| 145 | int myarg=0; |
| 146 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "save_txyz="; |
| 147 | char* filename = ygets_q(iarg); |
| 148 | double t1 = 0.;//ygets_d(piargs[0]+*rvset); |
| 149 | double mass_sun = 1.;//ygets_d(piargs[1]+*rvset); |
| 150 | double distance_kpc = 1.;//ygets_d(piargs[2]+*rvset); |
| 151 | stringcxx . . $ std/string# unt = "geometrical"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).;//ygets_q(piargs[3]+*rvset); |
| 152 | SmartPointercxx . . $ Gyoto/SmartPointer#<Screencxx . . $ Gyoto/Screen#>* sc = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; //yget_Screen(piargs[4]+*rvset); |
| 153 | |
| 154 | if (yarg_number(piargs[myarg]+*rvset)) { |
| 155 | t1= ygets_d(piargs[myarg++]+*rvset); |
| 156 | if (yarg_number(piargs[myarg]+*rvset)) { |
| 157 | mass_sun= ygets_d(piargs[myarg++]+*rvset); |
| 158 | if (yarg_number(piargs[myarg]+*rvset)) { |
| 159 | distance_kpc= ygets_d(piargs[myarg++]+*rvset); |
| 160 | } |
| 161 | } |
| 162 | } |
| 163 | if (yarg_string(piargs[myarg]+*rvset)) |
| 164 | unt =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). ygets_q(piargs[myarg++]+*rvset); |
| 165 | if (yarg_Screencxx . . $ yarg_Screen(7864480464b09eea).(piargs[myarg]+*rvset)) |
| 166 | sc = yget_Screencxx . . $ yget_Screen(9ed86900cf73e562).(piargs[myarg++]+*rvset); |
| 167 | |
| 168 | (*ph) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). save_txyzcxx . . $ Gyoto/Worldline#save_txyz(7e16dd9e9d0d6ec1). ( filename, t1, mass_sun, distance_kpc, untcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5)., |
| 169 | (sc?*cxx . . $ Gyoto/SmartPointer#SmartPointer(bb0da33b8f69ab4e).sc:SmartPointercxx . . $ Gyoto/SmartPointer#<Screencxx . . $ Gyoto/Screen#>(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)) ); |
| 170 | |
| 171 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). filename <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9). ; |
| 172 | } |
| 173 | |
| 174 | YGYOTO_WORKER_XMLWRITEcxx . . $ `yorick/ygyoto.h:459:10`!; |
| 175 | |
| 176 | // FUNCTION-LIKE // |
| 177 | |
| 178 | /* IS_HIT= */ |
| 179 | if ((iarg=kiargs[++k])>=0) { // is_hit=whatever |
| 180 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " is_hit=" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 181 | if ((*rvset)++) y_error(rmsg); |
| 182 | Astrobjcxx . . $ Gyoto/Astrobj/::Propertiescxx . . $ Gyoto/Astrobj/Properties# junkcxx . . $ Gyoto/Astrobj/Properties#Properties(49f6e7a06ebc5aa8).; |
| 183 | ypush_int((*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).hitcxx . . $ Gyoto/Photon#hit(79eac45376a167d0).(&junk)); |
| 184 | } |
| 185 | |
| 186 | /* GET_TXYZ */ |
| 187 | if ((iarg=kiargs[++k])>=0) { // get_txyz= |
| 188 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " get_txyz=1" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 189 | if ((*rvset)++) y_error(rmsg); |
| 190 | long nel =(*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).get_nelementscxx . . $ Gyoto/Worldline#get_nelements(fe4d2d262d4164a8).(); |
| 191 | |
| 192 | long dims[] = {2, nel, 4}; |
| 193 | double * data=ypush_d(dims); |
| 194 | |
| 195 | (*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).get_tcxx . . $ Gyoto/Worldline#get_t(b0764271c3b728b7).(data); |
| 196 | (*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).get_xyzcxx . . $ Gyoto/Worldline#get_xyz(30336d5234936cd8).(data+nel, data+2*nel, data+3*nel); |
| 197 | } |
| 198 | |
| 199 | /* GET_COORD */ |
| 200 | if ((iarg=kiargs[++k])>=0) { |
| 201 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " get_coord=dates" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 202 | if ((*rvset)++) y_error(rmsg); |
| 203 | // Two cases : get_coord=1 or get_coord=dates. |
| 204 | // We will recognize the first case if the parameter is the |
| 205 | // integer scalar 1, any other type or value is a date |
| 206 | // specification. |
| 207 | int argt = 1;yarg_number(iarg); |
| 208 | long ntot[1] = {1}; |
| 209 | long dims[Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!] = {0}; |
| 210 | double * dates = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 211 | |
| 212 | if (!yarg_nil(iarg)) { |
| 213 | argt = yarg_number(iarg); |
| 214 | dates=ygeta_d(iarg, ntot, dims); |
| 215 | } else { |
| 216 | dates = ypush_d(dims); |
| 217 | dates[0]=1.; |
| 218 | } |
| 219 | |
| 220 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) |
| 221 | cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "DEBUG: gyoto_Photon(get_coord=array(" |
| 222 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). (yarg_number(iarg)==1?"long":"double") |
| 223 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). *ntot |
| 224 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ") (rank=" <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). dims[0] |
| 225 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", dates[0]=" <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). dates[0] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ")" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 226 | |
| 227 | if (dims[0] == 0 && argt == 1 && dates[0] == 1) { |
| 228 | if(debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) |
| 229 | cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "DEBUG: retrieving all already computed coordinates" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 230 | long nel =(*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).get_nelementscxx . . $ Gyoto/Worldline#get_nelements(fe4d2d262d4164a8).(); |
| 231 | long ddims[] = {2, nel, 8}; |
| 232 | double * data = ypush_d(ddims); |
| 233 | |
| 234 | (*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).getCoordcxx . . $ Gyoto/Worldline#getCoord(45fa17d1adb519cb).(data, data+nel, data+2*nel, data+3*nel); |
| 235 | (*ph)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).get_dotcxx . . $ Gyoto/Worldline#get_dot(45fa17d1adb519cb).(data+4*nel, data+5*nel, data+6*nel, data+7*nel); |
| 236 | } else { |
| 237 | if(debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) |
| 238 | cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "DEBUG: retrieving coordinates for specified date(s)"<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 239 | if (dims[0] > Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!-2) |
| 240 | y_errorn("gyoto_Star(get_coord=dates): DATES must have at most %ld " |
| 241 | "dimensions", Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!-2); |
| 242 | dims[0] += 1; |
| 243 | dims[dims[0]] = 7; |
| 244 | double * data = ypush_d(dims); |
| 245 | size_t nel = *ntot; |
| 246 | (*ph) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). getCoordcxx . . $ Gyoto/Worldline#getCoord(4dcb5e440908be16).(dates, nel, |
| 247 | data, data+ nel,data+2* nel,data+3* nel, |
| 248 | data+4* nel, data+5* nel, data+6* nel); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | if ((iarg=kiargs[++k])>=0) { // get_cartesian |
| 253 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " get_cartesian=dates" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 254 | if ((*rvset)++) y_error(rmsg); |
| 255 | long ntot[1] = {1}; |
| 256 | long dims[Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!]; |
| 257 | double* dates = ygeta_d(iarg, ntot, dims); |
| 258 | if (dims[0] > Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!-2) |
| 259 | y_errorn("gyoto_Star(get_cartesian=dates): DATES must have at most %ld " |
| 260 | "dimensions", Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!-2); |
| 261 | dims[0] += 1; |
| 262 | dims[dims[0]] = 6; |
| 263 | double * data = ypush_d(dims); |
| 264 | size_t nel = *ntot; |
| 265 | (*ph) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). getCartesiancxx . . $ Gyoto/Worldline#getCartesian(4e97f890ef1fbe57).(dates, nel, |
| 266 | data, data + nel, data + 2*nel, |
| 267 | data + 3*nel, data + 4*nel, data + 5*nel); |
| 268 | |
| 269 | } |
| 270 | |
| 271 | YGYOTO_WORKER_CLONEcxx . . $ `yorick/ygyoto.h:472:9`!(Photon); |
| 272 | YGYOTO_WORKER_HELPcxx . . $ `yorick/ygyoto.h:485:9`!; |
| 273 | |
| 274 | if (debugcxx . . $ Gyoto/debug(b126dc7c1de90089).()) cerrcxx . . $ std/cerr. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 275 | } |
| 276 | |
| 277 | YGYOTO_YUSEROBJcxx . . $ `yorick/ygyoto_private.h:63:9`!(Photon, Photon) |
| 278 | |
| 279 | extern "C" { |
| 280 | void gyoto_Photon_eval(void *obj, int argc) { |
| 281 | // If no parameters, return pointer |
| 282 | if (argc==1 && yarg_nil(0)) { |
| 283 | ypush_long((long)((gyoto_Photon*)obj)->smptr(cxx . . $ Gyoto/SmartPointer#`operator()`(1016ee5406d91ab9).)); |
| 284 | return; |
| 285 | } |
| 286 | |
| 287 | SmartPointercxx . . $ Gyoto/SmartPointer#<Photoncxx . . $ Gyoto/Photon#> *ph_ = &(((gyoto_Photon*)obj)->smptr); |
| 288 | |
| 289 | static char const * knames[]={ |
| 290 | YGYOTO_PHOTON_GENERIC_KWcxx . . $ `yorick/gyoto_Photon.C:33:9`!, 0 |
| 291 | }; |
| 292 | |
| 293 | YGYOTO_WORKER_INIT1cxx . . $ `yorick/ygyoto.h:256:9`!(Photon, Photon, knames, YGYOTO_PHOTON_GENERIC_KW_Ncxx . . $ `yorick/gyoto_Photon.C:38:9`!); |
| 294 | |
| 295 | ygyoto_Photon_generic_evalcxx . . $ ygyoto_Photon_generic_eval(52d21937073b7931).(ph_, kiargs, piargs, rvset, paUsed); |
| 296 | |
| 297 | } |
| 298 | |
| 299 | // Generic constructor/accessor |
| 300 | void |
| 301 | Y_gyoto_Photon(int argc) |
| 302 | { |
| 303 | YGYOTO_CONSTRUCTOR_INIT2cxx . . $ `yorick/ygyoto.h:230:9`!(Photon, Photon, Photon, photon); |
| 304 | gyoto_Photon_eval(OBJcxx . . $ `yorick/gyoto_Photon.C:28:9`!, argc); |
| 305 | } |
| 306 | |
| 307 | } |
| 308 | |
| 309 | |
| 310 |