| 1 | /* |
| 2 | Copyright 2011-2015, 2018-2020 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 <float.h> |
| 21 | #include <GyotoScenery.h>cxx . . $ `<file>/include/GyotoScenery.h`/ |
| 22 | #ifdef GYOTO_USE_XERCEScxx . . $ `include/GyotoConfig.h:161:9`! |
| 23 | #include <GyotoFactory.h>cxx . . $ `<file>/include/GyotoFactory.h`/ |
| 24 | #endif |
| 25 | #include <GyotoAstrobj.h>cxx . . $ `<file>/include/GyotoAstrobj.h`/ |
| 26 | #include <GyotoUtils.h>cxx . . $ `<file>/include/GyotoUtils.h`/ |
| 27 | #include "yapi.h" |
| 28 | #include "pstdlib.h" |
| 29 | #include "ygyoto.h"cxx . . $ `<file>/yorick/ygyoto.h`/ |
| 30 | #include "ygyoto_private.h"cxx . . $ `<file>/yorick/ygyoto_private.h`/ |
| 31 | |
| 32 | #include <iostream> |
| 33 | #include <cstring> |
| 34 | #include "ygyoto_idx.h"cxx . . $ `<file>/yorick/ygyoto_idx.h`/ |
| 35 | |
| 36 | #ifdef HAVE_PTHREADcxx . . $ `include/GyotoConfig.h:224:9`! |
| 37 | #include <pthread.h> |
| 38 | #endif |
| 39 | |
| 40 | using namespace std; |
| 41 | using namespace Gyoto; |
| 42 | using namespace YGyoto; |
| 43 | |
| 44 | YGYOTO_YUSEROBJcxx . . $ `yorick/ygyoto_private.h:63:9`!(Scenery, Scenery) |
| 45 | |
| 46 | extern "C" { |
| 47 | |
| 48 | void Y_gyoto_Scenery(int); |
| 49 | |
| 50 | void gyoto_Scenery_eval(void *obj, int argc) { |
| 51 | SmartPointercxx . . $ Gyoto/SmartPointer#<Scenerycxx . . $ Gyoto/Scenery#> *OBJ_ = &(((gyoto_Scenery*)obj)->smptr); |
| 52 | |
| 53 | double * impactcoords = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 54 | bool precompute = 0; |
| 55 | |
| 56 | static char const *knames[] = { |
| 57 | "get_pointer", |
| 58 | "unit", |
| 59 | "metric", "screen", "astrobj", "delta", "tmin", "quantities", "adaptive", |
| 60 | "maxiter", "integrator", "deltamin", "deltamax", "deltamaxoverr", |
| 61 | "abstol", "reltol", |
| 62 | "xmlwrite", "clone", "help", "clonephoton", |
| 63 | "impactcoords", "nthreads", "nprocesses", |
| 64 | "mpispawn", "mpiclone", |
| 65 | 0 |
| 66 | }; |
| 67 | |
| 68 | YGYOTO_WORKER_INIT1cxx . . $ `yorick/ygyoto.h:256:9`!(Scenery, Scenery, knames, 25) |
| 69 | |
| 70 | // Get pointer |
| 71 | if (yarg_true(kiargs[++k])) { |
| 72 | if ((*rvset)++) y_error("Only one return value possible"); |
| 73 | ypush_long((long)((*OBJ)(cxx . . $ Gyoto/SmartPointer#`operator()`(1016ee5406d91ab9).))); |
| 74 | } |
| 75 | |
| 76 | YGYOTO_WORKER_SET_UNITcxx . . $ `yorick/ygyoto.h:439:9`!; |
| 77 | YGYOTO_WORKER_GETSET_OBJECT2cxx . . $ `yorick/ygyoto.h:436:9`!(metric,Metric); |
| 78 | YGYOTO_WORKER_GETSET_OBJECT2cxx . . $ `yorick/ygyoto.h:436:9`!(screen,Screen); |
| 79 | YGYOTO_WORKER_GETSET_OBJECT2cxx . . $ `yorick/ygyoto.h:436:9`!(astrobj,Astrobj); |
| 80 | YGYOTO_WORKER_GETSET_DOUBLE2_UNITcxx . . $ `yorick/ygyoto.h:342:9`!(delta); |
| 81 | YGYOTO_WORKER_GETSET_DOUBLE2_UNITcxx . . $ `yorick/ygyoto.h:342:9`!(tMin); |
| 82 | |
| 83 | /* QUANTITIES */ |
| 84 | if ((iarg=kiargs[++k])>=0) { |
| 85 | iarg+=*rvset; |
| 86 | if (yarg_nil(iarg)) { // quantities= : Getting |
| 87 | if ((*rvset)++) y_error("Only one return value possible"); |
| 88 | long nk = long((*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).getScalarQuantitiesCountcxx . . $ Gyoto/Scenery#getScalarQuantitiesCount(d278acf02cde7007).()); |
| 89 | long rquant = nk>1?1:0; |
| 90 | long dims[2] = { rquant, nk }; |
| 91 | ystring_tcxx . . $ ystring_t# *squant = ypush_q(dims); |
| 92 | long k = 0; |
| 93 | stringcxx . . $ std/string# requested=(*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).requestedQuantitiesStringcxx . . $ Gyoto/Scenery#requestedQuantitiesString(219584694fe2b248).(); |
| 94 | char *tk = strtok(const_cast<char*>(requested.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()), " \n\t"); |
| 95 | while (tk!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 96 | if (k>=nk) y_error("BUG: too many tokens in quantity list"); |
| 97 | squant[k++] = p_strcpy(tk); |
| 98 | tk = strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, " \n\t"); |
| 99 | } |
| 100 | }else { // quantities=["Q1", "Q2"...]: Setting |
| 101 | long k, nk; |
| 102 | ystring_tcxx . . $ ystring_t# * squant = ygeta_q(iarg, &nk, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 103 | stringcxx . . $ std/string# quants = squantcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).[0]; |
| 104 | for (k=1; k<nk; ++k) { |
| 105 | quants +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). " "; |
| 106 | quants +=cxx . . $ std/__cxx11/basic_string#`operator+=`(978ca1133b5f6e74). squant[k]; |
| 107 | } |
| 108 | (*OBJ) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). requestedQuantitiesStringcxx . . $ Gyoto/Scenery#requestedQuantitiesString(9c546c94e5fcce4e).(quants); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | YGYOTO_WORKER_GETSET_LONG2cxx . . $ `yorick/ygyoto.h:402:9`!( adaptive ); |
| 113 | YGYOTO_WORKER_GETSET_LONG2cxx . . $ `yorick/ygyoto.h:402:9`!( maxiter ); |
| 114 | YGYOTO_WORKER_GETSET_STRING2cxx . . $ `yorick/ygyoto.h:382:9`!( integrator ); |
| 115 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( deltaMin ); |
| 116 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( deltaMax ); |
| 117 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( deltaMaxOverR ); |
| 118 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( absTol ); |
| 119 | YGYOTO_WORKER_GETSET_DOUBLE2cxx . . $ `yorick/ygyoto.h:372:9`!( relTol ); |
| 120 | YGYOTO_WORKER_XMLWRITEcxx . . $ `yorick/ygyoto.h:459:10`!; |
| 121 | YGYOTO_WORKER_CLONEcxx . . $ `yorick/ygyoto.h:472:9`!(Scenery); |
| 122 | YGYOTO_WORKER_HELPcxx . . $ `yorick/ygyoto.h:485:9`!; |
| 123 | |
| 124 | /* CLONEPHOTON */ |
| 125 | if ((iarg=kiargs[++k])>=0) { |
| 126 | if ((*rvset)++) y_error(rmsg); |
| 127 | int nb=0; |
| 128 | if (yarg_nil(iarg)) |
| 129 | *ypush_Photoncxx . . $ ypush_Photon(7eead4ac53495a82).() =cxx . . $ Gyoto/SmartPointer#`operator=`(f9ef321adc27b1be). (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).clonePhotoncxx . . $ Gyoto/Scenery#clonePhoton(8a627747f798ba92).(); |
| 130 | else if ((nb=yarg_number(iarg))==1) { |
| 131 | size_t i=ygets_l(iarg); |
| 132 | size_t j=ygets_l(piargs[0]); |
| 133 | if ((*paUsed)++) y_error(pmsg); |
| 134 | *ypush_Photoncxx . . $ ypush_Photon(7eead4ac53495a82).() =cxx . . $ Gyoto/SmartPointer#`operator=`(f9ef321adc27b1be). (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).clonePhotoncxx . . $ Gyoto/Scenery#clonePhoton(e7ea793496b3d8de).(i, j); |
| 135 | } |
| 136 | else if (nb==2) { |
| 137 | double a=ygets_d(iarg); |
| 138 | double d=ygets_d(piargs[0]); |
| 139 | if ((*paUsed)++) y_error(pmsg); |
| 140 | *ypush_Photoncxx . . $ ypush_Photon(7eead4ac53495a82).() =cxx . . $ Gyoto/SmartPointer#`operator=`(f9ef321adc27b1be). (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).clonePhotoncxx . . $ Gyoto/Scenery#clonePhoton(936ec9b320dbdd6c).(a, d); |
| 141 | } else y_error("unsupported argument for clonephoton"); |
| 142 | } |
| 143 | |
| 144 | /* IMPACTCOORDS */ |
| 145 | if ((iarg=kiargs[++k])>=0) { |
| 146 | iarg+=*rvset; |
| 147 | if (yarg_nil(iarg)) { // impactcoords= : Getting |
| 148 | precompute = 1; |
| 149 | } else { // impaccoords=double(16,res,res): Setting |
| 150 | long ntot; |
| 151 | long dims[Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!]; |
| 152 | size_t res=(*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).screencxx . . $ Gyoto/Scenery#screen(bbd292041e1b1507).()->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).resolutioncxx . . $ Gyoto/Screen#resolution(fe4d2d262d4164a8).(); |
| 153 | impactcoords = ygeta_d(iarg, &ntot, dims); |
| 154 | if (dims[0] != 3 || dims[1] != 16 || dims[2] != long(res) || dims[3] != long(res)) |
| 155 | y_error("dimsof(impactcoords) != [3,16,res,res]"); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | YGYOTO_WORKER_GETSET_LONG2cxx . . $ `yorick/ygyoto.h:402:9`!(nThreads); |
| 160 | YGYOTO_WORKER_GETSET_LONG2cxx . . $ `yorick/ygyoto.h:402:9`!(nProcesses); |
| 161 | #ifdef HAVE_MPIcxx . . $ `include/GyotoConfig.h:212:9`! |
| 162 | YGYOTO_WORKER_RUNcxx . . $ `yorick/ygyoto.h:478:9`!( mpiSpawn(ygets_l(iarg)) ); |
| 163 | YGYOTO_WORKER_RUNcxx . . $ `yorick/ygyoto.h:478:9`!( mpiClone() ); |
| 164 | #else |
| 165 | if ((iarg=kiargs[++k])>=0) GYOTO_WARNING << "No MPI in this GYOTO" << endl; |
| 166 | if ((iarg=kiargs[++k])>=0) GYOTO_WARNING << "No MPI in this GYOTO" << endl; |
| 167 | #endif |
| 168 | |
| 169 | |
| 170 | // Get ray-traced image if there is a supplementary positional argument |
| 171 | if ( |
| 172 | !*rvset && // has a return value already been set? |
| 173 | (((argc>0 && argc<=3 && piargs[argc-1]>=0) || (piargs[1]>=0)) // positional argument? |
| 174 | || precompute || impactcoords) |
| 175 | ) { |
| 176 | size_t res=(*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).screencxx . . $ Gyoto/Scenery#screen(bbd292041e1b1507).()->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).resolutioncxx . . $ Gyoto/Screen#resolution(fe4d2d262d4164a8).(); |
| 177 | if ((*rvset)++) y_error("Only one return value possible"); |
| 178 | if ((*paUsed)++) y_error("Only one keyword may use positional arguments"); |
| 179 | GYOTO_DEBUGcxx . . $ `include/GyotoDefs.h:341:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "rank: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). yarg_rank(piargs[0]) <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 180 | |
| 181 | SmartPointercxx . . $ Gyoto/SmartPointer#<Spectrometercxx . . $ Gyoto/Spectrometer/::Genericcxx . . $ Gyoto/Spectrometer/Generic#> spr = (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).screencxx . . $ Gyoto/Scenery#screen(bbd292041e1b1507).()->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).spectrometercxx . . $ Gyoto/Screen#spectrometer(b72e4c28278d202).(); |
| 182 | size_t nbnuobs = spr(cxx . . $ Gyoto/SmartPointer#`operator()`(1016ee5406d91ab9).)? spr->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).nSamplescxx . . $ Gyoto/Spectrometer/Generic#nSamples(fe4d2d262d4164a8).() : 0; |
| 183 | |
| 184 | Idxcxx . . $ YGyoto/Idx# i_idxcxx . . $ YGyoto/Idx#Idx(3e454b8ccf442868). (piargs[0], res); |
| 185 | if (i_idx.isNullercxx . . $ YGyoto/Idx#isNuller(455f465bc33b4cdf).()) return; |
| 186 | Idxcxx . . $ YGyoto/Idx# j_idxcxx . . $ YGyoto/Idx#Idx(3e454b8ccf442868). (piargs[1], res); |
| 187 | if (j_idx.isNullercxx . . $ YGyoto/Idx#isNuller(455f465bc33b4cdf).()) return; |
| 188 | |
| 189 | bool is_double=false; |
| 190 | |
| 191 | long dims[Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!]={0}; |
| 192 | long nelem; |
| 193 | |
| 194 | dims[0]=0; |
| 195 | if (precompute) dims[++dims[0]]=16; |
| 196 | |
| 197 | if (i_idx.isDoublecxx . . $ YGyoto/Idx#isDouble(455f465bc33b4cdf).() || j_idx.isDoublecxx . . $ YGyoto/Idx#isDouble(455f465bc33b4cdf).()) { |
| 198 | if (!i_idx.isDoublecxx . . $ YGyoto/Idx#isDouble(455f465bc33b4cdf).() || !j_idx.isDoublecxx . . $ YGyoto/Idx#isDouble(455f465bc33b4cdf).()) |
| 199 | GYOTO_ERRORcxx . . $ `include/GyotoError.h:196:9`!("i and j must be of same type (double or long)"); |
| 200 | is_double=true; |
| 201 | nelem=i_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).(); |
| 202 | long const *idims=i_idx.getDimscxx . . $ YGyoto/Idx#getDims(3ab49b861b332b22).(); |
| 203 | if (j_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).() != nelem) { |
| 204 | if (nelem==1) { |
| 205 | nelem=j_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).(); |
| 206 | idims=j_idx.getDimscxx . . $ YGyoto/Idx#getDims(3ab49b861b332b22).(); |
| 207 | } |
| 208 | else GYOTO_ERRORcxx . . $ `include/GyotoError.h:196:9`!("alpha and delta must be conformable"); |
| 209 | } |
| 210 | for (int m=1; m<=idims[0]; ++m) dims[++dims[0]]=idims[m]; |
| 211 | } else { |
| 212 | nelem=i_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).()*j_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).(); |
| 213 | if ( (precompute + i_idx.getDimscxx . . $ YGyoto/Idx#getDims(3ab49b861b332b22).()[0]+j_idx.getDimscxx . . $ YGyoto/Idx#getDims(3ab49b861b332b22).()[0]) >= Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`! ) |
| 214 | GYOTO_ERRORcxx . . $ `include/GyotoError.h:196:9`!("Too many dimensions"); |
| 215 | long const *idims=i_idx.getDimscxx . . $ YGyoto/Idx#getDims(3ab49b861b332b22).(); |
| 216 | for (int m=1; m<=idims[0];++m) dims[++dims[0]]=idims[m]; |
| 217 | idims=j_idx.getDimscxx . . $ YGyoto/Idx#getDims(3ab49b861b332b22).(); |
| 218 | for (int m=1; m<=idims[0];++m) dims[++dims[0]]=idims[m]; |
| 219 | } |
| 220 | |
| 221 | size_t nk = 0; int rquant = 0; ystring_tcxx . . $ ystring_t# * squant = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 222 | |
| 223 | if (piargs[2] < 0 || yarg_nil(piargs[2])) { |
| 224 | Quantity_tcxx . . $ Gyoto/Quantity_t# quant = (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).getRequestedQuantitiescxx . . $ Gyoto/Scenery#getRequestedQuantities(ddd8539a2fcdd4ce).(); |
| 225 | nk = (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).getScalarQuantitiesCountcxx . . $ Gyoto/Scenery#getScalarQuantitiesCount(d278acf02cde7007).(); |
| 226 | if (quant & GYOTO_QUANTITY_SPECTRUMcxx . . $ `include/GyotoDefs.h:101:9`!) nk += 1; |
| 227 | if (quant & GYOTO_QUANTITY_BINSPECTRUMcxx . . $ `include/GyotoDefs.h:109:9`!) nk += 1; |
| 228 | rquant = nk>1?1:0; |
| 229 | long dims[2] = { 1, long(nk) }; |
| 230 | squant = ypush_q(dims); |
| 231 | size_t k = 0; |
| 232 | char *tk = |
| 233 | strtok(const_cast<char*>((*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).requestedQuantitiesStringcxx . . $ Gyoto/Scenery#requestedQuantitiesString(219584694fe2b248).().c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()), |
| 234 | " \n\t"); |
| 235 | while (tk!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) { |
| 236 | if (k>=nk) y_error("BUG: too many tokens in quantity list"); |
| 237 | squant[k++] = p_strcpy(tk); |
| 238 | tk = strtok(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, " \n\t"); |
| 239 | } |
| 240 | } else { |
| 241 | GYOTO_DEBUGcxx . . $ `include/GyotoDefs.h:341:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "quantities provided online"<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a).endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 242 | rquant = yarg_rank(piargs[2]); |
| 243 | long ntot; |
| 244 | squant = ygeta_q(piargs[2], &ntot, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 245 | nk=ntot; |
| 246 | GYOTO_DEBUGcxx . . $ `include/GyotoDefs.h:341:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "nk="<<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed).nk<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a).endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 247 | |
| 248 | } |
| 249 | |
| 250 | size_t k; int has_sp=0, has_bsp=0; |
| 251 | stringcxx . . $ std/string# tkk=""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., qunit=""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., quantity=""cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d)., intucxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391)., spucxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391)., bspucxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).; |
| 252 | size_t first = 0, last = 0; |
| 253 | if (nbnuobs) |
| 254 | for (k=0; k<nk; ++k) { |
| 255 | GYOTO_DEBUGcxx . . $ `include/GyotoDefs.h:341:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "k=" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). k<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7).", nk="<<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed).nk |
| 256 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", squant[k]="<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7).squant[k]<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a).endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 257 | tkk =cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74). squant[k]; |
| 258 | first = tkk.findcxx . . $ std/__cxx11/basic_string#find(b733e800f6f8fb8b).("["); |
| 259 | last = tkk.sizecxx . . $ std/__cxx11/basic_string#size(6f8bd5c0ea8fb29a).() - 1; |
| 260 | if (first < last) { |
| 261 | qunit =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). tkk.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(first+1, last-first-1); |
| 262 | quantity =cxx . . $ std/__cxx11/basic_string#`operator=`(36befb0d0c9f966). tkk.substrcxx . . $ std/__cxx11/basic_string#substr(149c655009c9bbd2).(0, first); |
| 263 | squant[k][first]=0; |
| 264 | } else { |
| 265 | qunit=cxx . . $ std/__cxx11/basic_string#`operator=`(978ca1133b5f6e74).""; |
| 266 | quantity=cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75).tkk; |
| 267 | } |
| 268 | GYOTO_DEBUGcxx . . $ `include/GyotoDefs.h:341:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "quantity=" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). quantity <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", qunit=" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). qunit <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 269 | # ifndef HAVE_UDUNITScxx . . $ `include/GyotoConfig.h:152:10`! |
| 270 | if (qunit != "") |
| 271 | GYOTO_WARNING << "gyoto_Scenery(): unit \""<< qunit |
| 272 | << "\" ignored, try recompiling Gyoto --with-udunits" |
| 273 | << endl; |
| 274 | # endif |
| 275 | if (quantity==cxx . . $ std/`operator==`(4b17aa87c9f300c6)."Spectrum") { |
| 276 | has_sp=1; |
| 277 | spu=cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75).qunit; |
| 278 | } else if (quantity==cxx . . $ std/`operator==`(4b17aa87c9f300c6)."BinSpectrum") { |
| 279 | has_bsp=1; |
| 280 | bspu=cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75).qunit; |
| 281 | } else if (quantity==cxx . . $ std/`operator==`(4b17aa87c9f300c6)."Intensity") { |
| 282 | intu=cxx . . $ std/__cxx11/basic_string#`operator=`(c0b47be1fddc0e75).qunit; |
| 283 | } |
| 284 | } |
| 285 | if (has_sp) nk+=nbnuobs-1; |
| 286 | if (has_bsp) nk+=nbnuobs-1; |
| 287 | if (!has_sp && !has_bsp) nbnuobs=0; |
| 288 | |
| 289 | if ( !precompute && ((rquant>=1)||has_sp||has_bsp) ) { |
| 290 | ++dims[0]; |
| 291 | if (dims[0] >=Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!) GYOTO_ERRORcxx . . $ `include/GyotoError.h:196:9`!("Too many dimensions"); |
| 292 | dims[dims[0]]=nk; |
| 293 | } |
| 294 | |
| 295 | GYOTO_DEBUGcxx . . $ `include/GyotoDefs.h:341:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "precompute=" <<cxx . . $ std/basic_ostream#`operator<<`(511cbee2d2e28827). precompute <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", nk=" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). nk |
| 296 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", nbnuobs="<<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed).nbnuobs <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", data=ypush_d({"<<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). dims[0] |
| 297 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). dims[1] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). dims[2] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). dims[3] |
| 298 | <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "})\n"; |
| 299 | |
| 300 | GYOTO_DEBUG_ARRAYcxx . . $ `include/GyotoDefs.h:313:9`!(dims, Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!); |
| 301 | |
| 302 | double * data=ypush_d(dims); |
| 303 | |
| 304 | Astrobjcxx . . $ Gyoto/Astrobj/::Propertiescxx . . $ Gyoto/Astrobj/Properties# propcxx . . $ Gyoto/Astrobj/Properties#Properties(49f6e7a06ebc5aa8).; |
| 305 | prop.alloccxx . . $ Gyoto/Astrobj/Properties#alloc.=false; |
| 306 | SmartPointercxx . . $ Gyoto/SmartPointer#<Screencxx . . $ Gyoto/Screen#> screen = (*OBJ) ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). screencxx . . $ Gyoto/Scenery#screen(bbd292041e1b1507).(); |
| 307 | # ifdef HAVE_UDUNITScxx . . $ `include/GyotoConfig.h:152:10`! |
| 308 | if (data) (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).setPropertyConverterscxx . . $ Gyoto/Scenery#setPropertyConverters(a34cefeb8181f13c).(&prop); |
| 309 | screen->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).mapPixUnitcxx . . $ Gyoto/Screen#mapPixUnit(49f6e7a06ebc5aa8).(); |
| 310 | if (intu !=cxx . . $ std/`operator!=`(4b17aa87c9f300c6). "") prop.intensityConvertercxx . . $ Gyoto/Astrobj/Properties#intensityConverter(8d4ab0a187bf9331).(intucxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).); |
| 311 | if (spu !=cxx . . $ std/`operator!=`(4b17aa87c9f300c6). "") prop.spectrumConvertercxx . . $ Gyoto/Astrobj/Properties#spectrumConverter(8d4ab0a187bf9331).(spucxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).); |
| 312 | if (bspu !=cxx . . $ std/`operator!=`(4b17aa87c9f300c6). "") prop.binSpectrumConvertercxx . . $ Gyoto/Astrobj/Properties#binSpectrumConverter(8d4ab0a187bf9331).(bspucxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).); |
| 313 | screen->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).unmapPixUnitcxx . . $ Gyoto/Screen#unmapPixUnit(49f6e7a06ebc5aa8).(); |
| 314 | # endif |
| 315 | |
| 316 | if (precompute) prop.impactcoordscxx . . $ Gyoto/Astrobj/Properties#impactcoords.=data; |
| 317 | else { |
| 318 | for ( k=0; k<nk-nbnuobs+has_sp+has_bsp; ++k ) { |
| 319 | GYOTO_DEBUGcxx . . $ `include/GyotoDefs.h:341:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "new quantity '" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). squant[k] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7)."'"<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a).endlcxx . . $ std/endl(345bf97a19cc83a9).; |
| 320 | if (!strcmp(squant[k], "Intensity")) { |
| 321 | if (prop.intensitycxx . . $ Gyoto/Astrobj/Properties#intensity.) y_error("can retrieve property only once"); |
| 322 | prop.intensitycxx . . $ Gyoto/Astrobj/Properties#intensity.=data; |
| 323 | data+=nelem; |
| 324 | } else if (!strcmp(squant[k], "EmissionTime")) { |
| 325 | if (prop.timecxx . . $ Gyoto/Astrobj/Properties#time.) y_error("can retrieve property only once"); |
| 326 | prop.timecxx . . $ Gyoto/Astrobj/Properties#time.=data; |
| 327 | data+=nelem; |
| 328 | } else if (!strcmp(squant[k], "MinDistance")) { |
| 329 | if (prop.distancecxx . . $ Gyoto/Astrobj/Properties#distance.) y_error("can retrieve property only once"); |
| 330 | prop.distancecxx . . $ Gyoto/Astrobj/Properties#distance.=data; |
| 331 | data+=nelem; |
| 332 | } else if (!strcmp(squant[k], "FirstDistMin")) { |
| 333 | if (prop.first_dmincxx . . $ Gyoto/Astrobj/Properties#first_dmin.) y_error("can retrieve property only once"); |
| 334 | prop.first_dmincxx . . $ Gyoto/Astrobj/Properties#first_dmin.=data; |
| 335 | data+=nelem; |
| 336 | } else if (!strcmp(squant[k], "Redshift")) { |
| 337 | if (prop.redshiftcxx . . $ Gyoto/Astrobj/Properties#redshift.) y_error("can retrieve property only once"); |
| 338 | prop.redshiftcxx . . $ Gyoto/Astrobj/Properties#redshift.=data; |
| 339 | data+=nelem; |
| 340 | } else if (!strcmp(squant[k], "Spectrum")) { |
| 341 | if (prop.spectrumcxx . . $ Gyoto/Astrobj/Properties#spectrum.) y_error("can retrieve property only once"); |
| 342 | prop.spectrumcxx . . $ Gyoto/Astrobj/Properties#spectrum.=data; |
| 343 | prop.offsetcxx . . $ Gyoto/Astrobj/Properties#offset.=nelem; |
| 344 | data+=nelem*nbnuobs; |
| 345 | } else if (!strcmp(squant[k], "BinSpectrum")) { |
| 346 | if (prop.binspectrumcxx . . $ Gyoto/Astrobj/Properties#binspectrum.) y_error("can retrieve property only once"); |
| 347 | prop.binspectrumcxx . . $ Gyoto/Astrobj/Properties#binspectrum.=data; |
| 348 | prop.offsetcxx . . $ Gyoto/Astrobj/Properties#offset.=nelem; |
| 349 | data+=nelem*nbnuobs; |
| 350 | } else if (!strcmp(squant[k], "User1")) { |
| 351 | if (prop.user1cxx . . $ Gyoto/Astrobj/Properties#user1.) y_error("can retrieve property only once"); |
| 352 | prop.user1cxx . . $ Gyoto/Astrobj/Properties#user1.=data; |
| 353 | data+=nelem; |
| 354 | } else if (!strcmp(squant[k], "User2")) { |
| 355 | if (prop.user2cxx . . $ Gyoto/Astrobj/Properties#user2.) y_error("can retrieve property only once"); |
| 356 | prop.user2cxx . . $ Gyoto/Astrobj/Properties#user2.=data; |
| 357 | data+=nelem; |
| 358 | } else if (!strcmp(squant[k], "User3")) { |
| 359 | if (prop.user3cxx . . $ Gyoto/Astrobj/Properties#user3.) y_error("can retrieve property only once"); |
| 360 | prop.user3cxx . . $ Gyoto/Astrobj/Properties#user3.=data; |
| 361 | data+=nelem; |
| 362 | } else if (!strcmp(squant[k], "User4")) { |
| 363 | if (prop.user4cxx . . $ Gyoto/Astrobj/Properties#user4.) y_error("can retrieve property only once"); |
| 364 | prop.user4cxx . . $ Gyoto/Astrobj/Properties#user4.=data; |
| 365 | data+=nelem; |
| 366 | } else if (!strcmp(squant[k], "User5")) { |
| 367 | if (prop.user5cxx . . $ Gyoto/Astrobj/Properties#user5.) y_error("can retrieve property only once"); |
| 368 | prop.user5cxx . . $ Gyoto/Astrobj/Properties#user5.=data; |
| 369 | data+=nelem; |
| 370 | } else y_errorq("unknown quantity: %s", squant[k]); |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | Screencxx . . $ Gyoto/Screen#::Coord2dSetcxx . . $ Gyoto/Screen#Coord2dSet# *ijspec=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 375 | Screencxx . . $ Gyoto/Screen#::Coord1dSetcxx . . $ Gyoto/Screen#Coord1dSet# *ispec=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, *jspec=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 376 | |
| 377 | if (is_double) { |
| 378 | size_t sz = i_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).() >= j_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).()? |
| 379 | i_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).():j_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).(); |
| 380 | if (i_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).()==1) |
| 381 | ispec = new Screencxx . . $ Gyoto/Screen#RepeatAngle#RepeatAngle(6f27f19e3b5a2ad1).::RepeatAnglecxx . . $ Gyoto/Screen#RepeatAngle#(i_idx.getDValcxx . . $ YGyoto/Idx#getDVal(21b6c25e127938e2).(), sz); |
| 382 | else |
| 383 | ispec = new Screencxx . . $ Gyoto/Screen#Angles#Angles(d405a9b7eb7c1f7b).::Anglescxx . . $ Gyoto/Screen#Angles#(i_idx.getDoubleBuffercxx . . $ YGyoto/Idx#getDoubleBuffer(d06acfa185f8726d).(), sz); |
| 384 | if (j_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).()==1) |
| 385 | jspec = new Screencxx . . $ Gyoto/Screen#RepeatAngle#RepeatAngle(6f27f19e3b5a2ad1).::RepeatAnglecxx . . $ Gyoto/Screen#RepeatAngle#(j_idx.getDValcxx . . $ YGyoto/Idx#getDVal(21b6c25e127938e2).(), sz); |
| 386 | else |
| 387 | jspec = new Screencxx . . $ Gyoto/Screen#Angles#Angles(d405a9b7eb7c1f7b).::Anglescxx . . $ Gyoto/Screen#Angles#(j_idx.getDoubleBuffercxx . . $ YGyoto/Idx#getDoubleBuffer(d06acfa185f8726d).(), sz); |
| 388 | ijspec = new Screencxx . . $ Gyoto/Screen#Bucket#Bucket(8e39d09cb4be3fa4).::Bucketcxx . . $ Gyoto/Screen#Bucket#(*ispec, *jspec); |
| 389 | } else { |
| 390 | |
| 391 | if (i_idx.isRangeOrScalarcxx . . $ YGyoto/Idx#isRangeOrScalar(455f465bc33b4cdf).()) |
| 392 | ispec = new Screencxx . . $ Gyoto/Screen#Range#Range(2a492a608c24fe66).::Rangecxx . . $ Gyoto/Screen#Range# |
| 393 | (i_idx.range_mincxx . . $ YGyoto/Idx#range_min(57a65ae535d7db84).(), i_idx.range_maxcxx . . $ YGyoto/Idx#range_max(57a65ae535d7db84).(), i_idx.range_dltcxx . . $ YGyoto/Idx#range_dlt(57a65ae535d7db84).()); |
| 394 | else |
| 395 | ispec = new Screencxx . . $ Gyoto/Screen#Indices#Indices(bae21de31eaa1b86).::Indicescxx . . $ Gyoto/Screen#Indices# |
| 396 | (reinterpret_cast<size_t const*const>(i_idx.getBuffercxx . . $ YGyoto/Idx#getBuffer(3ab49b861b332b22).()), |
| 397 | i_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).()); |
| 398 | |
| 399 | if (j_idx.isRangeOrScalarcxx . . $ YGyoto/Idx#isRangeOrScalar(455f465bc33b4cdf).()) |
| 400 | jspec = new Screencxx . . $ Gyoto/Screen#Range#Range(2a492a608c24fe66).::Rangecxx . . $ Gyoto/Screen#Range# |
| 401 | (j_idx.range_mincxx . . $ YGyoto/Idx#range_min(57a65ae535d7db84).(), j_idx.range_maxcxx . . $ YGyoto/Idx#range_max(57a65ae535d7db84).(), j_idx.range_dltcxx . . $ YGyoto/Idx#range_dlt(57a65ae535d7db84).()); |
| 402 | else |
| 403 | jspec = new Screencxx . . $ Gyoto/Screen#Indices#Indices(bae21de31eaa1b86).::Indicescxx . . $ Gyoto/Screen#Indices# |
| 404 | (reinterpret_cast<size_t const*const>(j_idx.getBuffercxx . . $ YGyoto/Idx#getBuffer(3ab49b861b332b22).()), |
| 405 | j_idx.getNElementscxx . . $ YGyoto/Idx#getNElements(57a65ae535d7db84).()); |
| 406 | |
| 407 | ijspec = new Screencxx . . $ Gyoto/Screen#Grid#Grid(4b04bc054b256ee2).::Gridcxx . . $ Gyoto/Screen#Grid#(*ispec, *jspec, "\rj = "); |
| 408 | if (verbosecxx . . $ Gyoto/verbose(b126dc7c1de90089).() >= GYOTO_QUIET_VERBOSITYcxx . . $ `include/GyotoDefs.h:155:9`!) |
| 409 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nj = 1/" <<cxx . . $ std/basic_ostream#`operator<<`(b09cd8ec4365c7ed). jspec->sizecxx . . $ Gyoto/Screen#Coord1dSet#size(f708dce9a8856c70).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). flushcxx . . $ std/flush(345bf97a19cc83a9).; |
| 410 | } |
| 411 | |
| 412 | (*OBJ)->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).rayTracecxx . . $ Gyoto/Scenery#rayTrace(654880165b2921c3).(*ijspec, &prop, impactcoords); |
| 413 | |
| 414 | delete ispec; |
| 415 | delete jspec; |
| 416 | delete ijspec; |
| 417 | } // if (conditions for ray-tracing) |
| 418 | } // void gyoto_Scenery_eval(void *obj, int argc); |
| 419 | |
| 420 | // Constructor |
| 421 | void Y_gyoto_Scenery(int argc) { |
| 422 | YGYOTO_CONSTRUCTOR_INIT2cxx . . $ `yorick/ygyoto.h:230:9`!(Scenery, Scenery, Scenery, scenery); |
| 423 | gyoto_Scenery_eval(OBJ, argc); |
| 424 | } |
| 425 | |
| 426 | void Y_gyoto_Scenery_rayTrace(int argc) { |
| 427 | size_t imin=1, imax=-1, jmin=1, jmax=-1; |
| 428 | if (argc<1) y_error("gyoto_Scenery_rayTrace takes at least 1 argument"); |
| 429 | gyoto_Scenery * s_obj=(gyoto_Scenery*)yget_obj(argc-1, &gyoto_Scenery_obj); |
| 430 | Scenerycxx . . $ Gyoto/Scenery# * scenery = s_obj->smptr; |
| 431 | if (argc>=2 && !yarg_nil(argc-2)) imin=ygets_l(argc-2); |
| 432 | if (argc>=3 && !yarg_nil(argc-3)) imax=ygets_l(argc-3); |
| 433 | if (argc>=4 && !yarg_nil(argc-4)) jmin=ygets_l(argc-4); |
| 434 | if (argc>=5 && !yarg_nil(argc-5)) jmax=ygets_l(argc-5); |
| 435 | |
| 436 | size_t res=0; |
| 437 | try {res=scenery->screencxx . . $ Gyoto/Scenery#screen(bbd292041e1b1507).()->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).resolutioncxx . . $ Gyoto/Screen#resolution(fe4d2d262d4164a8).();} |
| 438 | YGYOTO_STD_CATCHcxx . . $ `yorick/ygyoto.h:37:9`!; |
| 439 | |
| 440 | if (imax>res) imax=res; |
| 441 | if (jmax>res) jmax=res; |
| 442 | |
| 443 | Screencxx . . $ Gyoto/Screen#::Rangecxx . . $ Gyoto/Screen#Range# irangecxx . . $ Gyoto/Screen#Range#Range(2a492a608c24fe66).(imin, imax, 1); |
| 444 | Screencxx . . $ Gyoto/Screen#::Rangecxx . . $ Gyoto/Screen#Range# jrangecxx . . $ Gyoto/Screen#Range#Range(2a492a608c24fe66).(jmin, jmax, 1); |
| 445 | Screencxx . . $ Gyoto/Screen#::Gridcxx . . $ Gyoto/Screen#Grid# gridcxx . . $ Gyoto/Screen#Grid#Grid(4b04bc054b256ee2).(irange, jrange, "\r j = "); |
| 446 | |
| 447 | double * impactcoords = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 448 | int ipctout = 0; |
| 449 | if (argc>=6) { |
| 450 | int iarg = argc-6; |
| 451 | long ref = yget_ref(iarg); |
| 452 | long dims[Y_DIMSIZEcxx . . $ `<external>/13312585737040429147/yapi.h:133:9`!] = {3, 16, long(res), long(res)}; |
| 453 | if (ref >= 0 && yarg_nil(iarg)) { |
| 454 | impactcoords = ypush_d(dims); |
| 455 | yput_global(ref, 0); |
| 456 | ipctout = 1; |
| 457 | } else { |
| 458 | long ntot = 0; |
| 459 | impactcoords = ygeta_d(iarg, &ntot, dims); |
| 460 | if (dims[0]!=3 || dims[1]!=16 || dims[2]!=long(res) || dims[3]!=long(res)) |
| 461 | y_error("Wrong dims for impactcoords"); |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | long nbnuobs=0, nbdata=0; |
| 466 | Quantity_tcxx . . $ Gyoto/Quantity_t# quantities=0; |
| 467 | try { |
| 468 | quantities = scenery -> getRequestedQuantitiescxx . . $ Gyoto/Scenery#getRequestedQuantities(ddd8539a2fcdd4ce).(); |
| 469 | if (quantities & (GYOTO_QUANTITY_SPECTRUMcxx . . $ `include/GyotoDefs.h:101:9`! | GYOTO_QUANTITY_BINSPECTRUMcxx . . $ `include/GyotoDefs.h:109:9`!)) { |
| 470 | SmartPointercxx . . $ Gyoto/SmartPointer#<Spectrometercxx . . $ Gyoto/Spectrometer/::Genericcxx . . $ Gyoto/Spectrometer/Generic#> spr=scenery->screencxx . . $ Gyoto/Scenery#screen(bbd292041e1b1507).()->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db).spectrometercxx . . $ Gyoto/Screen#spectrometer(b72e4c28278d202).(); |
| 471 | if (!spr) GYOTO_ERRORcxx . . $ `include/GyotoError.h:196:9`!("Spectral quantity requested but " |
| 472 | "no spectrometer specified!"); |
| 473 | nbnuobs = long(spr ->cxx . . $ Gyoto/SmartPointer#`operator->`(155dc7f103cdb9db). nSamplescxx . . $ Gyoto/Spectrometer/Generic#nSamples(fe4d2d262d4164a8).()); |
| 474 | } |
| 475 | nbdata= long(scenery->getScalarQuantitiesCountcxx . . $ Gyoto/Scenery#getScalarQuantitiesCount(d278acf02cde7007).()); |
| 476 | } YGYOTO_STD_CATCHcxx . . $ `yorick/ygyoto.h:37:9`!; |
| 477 | |
| 478 | long dims[4]={(nbdata+nbnuobs) > 1 ? 3 : 2, long(res), long(res), nbdata+nbnuobs}; |
| 479 | double * vect=ypush_d(dims); |
| 480 | |
| 481 | Astrobjcxx . . $ Gyoto/Astrobj/::Propertiescxx . . $ Gyoto/Astrobj/Properties# datacxx . . $ Gyoto/Astrobj/Properties#Properties(49f6e7a06ebc5aa8).; |
| 482 | |
| 483 | size_t curquant=0; |
| 484 | size_t offset=res*res; |
| 485 | |
| 486 | if (ipctout) data.impactcoordscxx . . $ Gyoto/Astrobj/Properties#impactcoords. = impactcoords; |
| 487 | |
| 488 | if (quantities & GYOTO_QUANTITY_INTENSITYcxx . . $ `include/GyotoDefs.h:83:9`!) |
| 489 | data.intensitycxx . . $ Gyoto/Astrobj/Properties#intensity.=vect+offset*(curquant++); |
| 490 | if (quantities & GYOTO_QUANTITY_EMISSIONTIMEcxx . . $ `include/GyotoDefs.h:85:9`!) |
| 491 | data.timecxx . . $ Gyoto/Astrobj/Properties#time.=vect+offset*(curquant++); |
| 492 | if (quantities & GYOTO_QUANTITY_MIN_DISTANCEcxx . . $ `include/GyotoDefs.h:90:9`!) |
| 493 | data.distancecxx . . $ Gyoto/Astrobj/Properties#distance.=vect+offset*(curquant++); |
| 494 | if (quantities & GYOTO_QUANTITY_FIRST_DMINcxx . . $ `include/GyotoDefs.h:92:9`!) |
| 495 | data.first_dmincxx . . $ Gyoto/Astrobj/Properties#first_dmin.=vect+offset*(curquant++); |
| 496 | if (quantities & GYOTO_QUANTITY_REDSHIFTcxx . . $ `include/GyotoDefs.h:94:9`!) |
| 497 | data.redshiftcxx . . $ Gyoto/Astrobj/Properties#redshift.=vect+offset*(curquant++); |
| 498 | if (quantities & GYOTO_QUANTITY_NBCROSSEQPLANEcxx . . $ `include/GyotoDefs.h:111:9`!) |
| 499 | data.nbcrosseqplanecxx . . $ Gyoto/Astrobj/Properties#nbcrosseqplane.=vect+offset*(curquant++); |
| 500 | if (quantities & GYOTO_QUANTITY_USER1cxx . . $ `include/GyotoDefs.h:114:9`!) |
| 501 | data.user1cxx . . $ Gyoto/Astrobj/Properties#user1.=vect+offset*(curquant++); |
| 502 | if (quantities & GYOTO_QUANTITY_USER2cxx . . $ `include/GyotoDefs.h:116:9`!) |
| 503 | data.user2cxx . . $ Gyoto/Astrobj/Properties#user2.=vect+offset*(curquant++); |
| 504 | if (quantities & GYOTO_QUANTITY_USER3cxx . . $ `include/GyotoDefs.h:118:9`!) |
| 505 | data.user3cxx . . $ Gyoto/Astrobj/Properties#user3.=vect+offset*(curquant++); |
| 506 | if (quantities & GYOTO_QUANTITY_USER4cxx . . $ `include/GyotoDefs.h:120:9`!) |
| 507 | data.user4cxx . . $ Gyoto/Astrobj/Properties#user4.=vect+offset*(curquant++); |
| 508 | if (quantities & GYOTO_QUANTITY_USER5cxx . . $ `include/GyotoDefs.h:122:9`!) |
| 509 | data.user5cxx . . $ Gyoto/Astrobj/Properties#user5.=vect+offset*(curquant++); |
| 510 | if (quantities & GYOTO_QUANTITY_SPECTRUMcxx . . $ `include/GyotoDefs.h:101:9`!) { |
| 511 | data.spectrumcxx . . $ Gyoto/Astrobj/Properties#spectrum.=vect+offset*(curquant++); |
| 512 | data.offsetcxx . . $ Gyoto/Astrobj/Properties#offset.=offset; |
| 513 | } |
| 514 | if (quantities & GYOTO_QUANTITY_BINSPECTRUMcxx . . $ `include/GyotoDefs.h:109:9`!) { |
| 515 | data.binspectrumcxx . . $ Gyoto/Astrobj/Properties#binspectrum.=vect+offset*(curquant++); |
| 516 | data.offsetcxx . . $ Gyoto/Astrobj/Properties#offset.=offset; |
| 517 | } |
| 518 | |
| 519 | data.intensitycxx . . $ Gyoto/Astrobj/Properties#intensity.=vect; |
| 520 | |
| 521 | if (verbosecxx . . $ Gyoto/verbose(b126dc7c1de90089).() >= GYOTO_QUIET_VERBOSITYcxx . . $ `include/GyotoDefs.h:155:9`!) |
| 522 | coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ std/endl(345bf97a19cc83a9). <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). flushcxx . . $ std/flush(345bf97a19cc83a9).; |
| 523 | |
| 524 | try {scenery -> rayTracecxx . . $ Gyoto/Scenery#rayTrace(654880165b2921c3).(grid, &data, ipctout?NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!:impactcoords);} |
| 525 | YGYOTO_STD_CATCHcxx . . $ `yorick/ygyoto.h:37:9`!; |
| 526 | |
| 527 | } |
| 528 | |
| 529 | } |
| 530 | |
| 531 |