1 | #include "machdefs.h"
|
---|
2 | #include "sopnamsp.h"
|
---|
3 | #include <iostream>
|
---|
4 | #include <string>
|
---|
5 | #include <math.h>
|
---|
6 |
|
---|
7 | #include <typeinfo>
|
---|
8 |
|
---|
9 | #include "mdish.h"
|
---|
10 | #include "specpk.h"
|
---|
11 | #include "histinit.h"
|
---|
12 | // #include "fiosinit.h"
|
---|
13 | // #include "fitsioserver.h"
|
---|
14 |
|
---|
15 | #include "randr48.h"
|
---|
16 |
|
---|
17 | #include "timing.h"
|
---|
18 | #include "ctimer.h"
|
---|
19 |
|
---|
20 | typedef DR48RandGen RandomGenerator ;
|
---|
21 |
|
---|
22 | // ---------------------------------------------------------------------
|
---|
23 | // Test main program for computing interferometer noise power spectrum
|
---|
24 | // R. Ansari - Avril 2010
|
---|
25 | // ---------------------------------------------------------------------
|
---|
26 |
|
---|
27 | class PkNoiseCalculator
|
---|
28 | {
|
---|
29 | public:
|
---|
30 | PkNoiseCalculator(Four3DPk& pk3, Four2DResponse& rep,
|
---|
31 | double s2cut=100., int ngen=1, const char* tit="PkNoise")
|
---|
32 | : pkn3d(pk3), frep(rep), S2CUT(s2cut), NGEN(ngen), title(tit)
|
---|
33 | { }
|
---|
34 | inline void SetS2Cut(double s2cut=100.)
|
---|
35 | { S2CUT=s2cut; }
|
---|
36 | HProf Compute()
|
---|
37 | {
|
---|
38 | Timer tm(title.c_str());
|
---|
39 | tm.Nop();
|
---|
40 | HProf hnd;
|
---|
41 | cout << "PkNoiseCalculator::Compute() " << title << " NGEN=" << NGEN << " S2CUT=" << S2CUT << endl;
|
---|
42 | for(int igen=0; igen<NGEN; igen++) {
|
---|
43 | pkn3d.ComputeNoiseFourierAmp(frep);
|
---|
44 | if (igen==0) hnd = pkn3d.ComputePk(S2CUT);
|
---|
45 | else pkn3d.ComputePkCumul(hnd,S2CUT);
|
---|
46 | }
|
---|
47 | return hnd;
|
---|
48 | }
|
---|
49 |
|
---|
50 | Four3DPk& pkn3d;
|
---|
51 | Four2DResponse& frep;
|
---|
52 | double S2CUT;
|
---|
53 | int NGEN;
|
---|
54 | string title;
|
---|
55 | };
|
---|
56 |
|
---|
57 | //-----------------------------------------------------------------------------------
|
---|
58 | // Fonctions de creation de configuration d'interfero avec des dishs
|
---|
59 | //-----------------------------------------------------------------------------------
|
---|
60 |
|
---|
61 | vector<Dish> CreateFilledSqConfig(int nd, double Ddish=5., double Eta=0.9);
|
---|
62 | vector<Dish> CreateSemiFilledSqConfig(int nd, double Ddish=5., double Eta=0.9);
|
---|
63 | vector<Dish> CreateConfigA(double Ddish=5., double Eta=0.9);
|
---|
64 | vector<Dish> CreateConfigB(double Ddish=5., double Eta=0.9);
|
---|
65 | vector<Dish> CreateConfigC(double Ddish=5., double Eta=0.9);
|
---|
66 | vector<Dish> CreateConfigD(double Ddish=5., double Eta=0.9);
|
---|
67 |
|
---|
68 |
|
---|
69 | vector<Dish> CreateFilledCylConfig(int ncyl, int nRL, double cylW=10., double cylRL=0.5,
|
---|
70 | double etaW=0.9, double etaRL=0.9, bool fgscid=true);
|
---|
71 |
|
---|
72 |
|
---|
73 | //-------------------------------------------------------------------------
|
---|
74 | // ------------------ MAIN PROGRAM ------------------------------
|
---|
75 | //-------------------------------------------------------------------------
|
---|
76 | int main(int narg, const char* arg[])
|
---|
77 | {
|
---|
78 | if ((narg>1)&&(strcmp(arg[1],"-h")==0)) {
|
---|
79 | cout<< " Usage: pknoise [OutPPFName NGen S2Cut Lambda] " << endl;
|
---|
80 | cout<< " Default: OutPPFName=pknoise.ppf, NGen=1 " << endl;
|
---|
81 | cout<< " S2CUT=0. , Lambda=0.357 \n" << endl;
|
---|
82 |
|
---|
83 | return 1;
|
---|
84 | }
|
---|
85 | cout << " ==== pknoise.cc program , test of SpectralShape and MassDist2D classes ==== " << endl;
|
---|
86 | // make sure SOPHYA modules are initialized
|
---|
87 | SophyaInit();
|
---|
88 | // FitsIOServerInit();
|
---|
89 | InitTim();
|
---|
90 | //--- decoding command line arguments
|
---|
91 | string outfile = "pknoise.ppf";
|
---|
92 | if (narg>1) outfile = arg[1];
|
---|
93 | if (outfile==".") outfile = "pknoise.ppf";
|
---|
94 | int NMAX = 1;
|
---|
95 | if (narg>2) NMAX = atoi(arg[2]);
|
---|
96 | double SCut=0.;
|
---|
97 | if (narg>3) SCut = atof(arg[3]);
|
---|
98 | double LAMBDA=0.357 ; // 21 cm at z=0.7
|
---|
99 | if (narg>4) LAMBDA = atof(arg[4]);
|
---|
100 |
|
---|
101 | //-- end command line arguments
|
---|
102 |
|
---|
103 | int rc = 1;
|
---|
104 | try { // exception handling try bloc at top level
|
---|
105 | cout << "0/ pknoise.cc: Executing, output file= " << outfile << endl;
|
---|
106 | POutPersist po(outfile);
|
---|
107 | cout << " 1.a/ Instanciating object type SpectralShape " << endl;
|
---|
108 | SpectralShape spec(2);
|
---|
109 | cout << " 1.b/ Wrinting spectral shape vector (name= Pk) to output PPF " << endl;
|
---|
110 | Histo hpk = spec.GetPk(1024);
|
---|
111 | po << PPFNameTag("Pk") << hpk;
|
---|
112 |
|
---|
113 | double D = 100.;
|
---|
114 | double lambda = LAMBDA;
|
---|
115 | double Dol = D/lambda;
|
---|
116 | cout << " 2.a/ Instanciating Four2DResponse(1/2/3...) " << endl;
|
---|
117 | Four2DResponse dishg(1,Dol,Dol);
|
---|
118 | Four2DResponse dish(2,Dol,Dol);
|
---|
119 | Four2DResponse dish2(2,Dol*2.,Dol*2.);
|
---|
120 | Four2DResponse dishsq(3,Dol,Dol/5.);
|
---|
121 | cout << " 2.b/ Writing Four2DResponse Histo2D to output ppf " << endl;
|
---|
122 | Histo2D hdg = dishg.GetResponse();
|
---|
123 | Histo2D hd = dish.GetResponse();
|
---|
124 | Histo2D hd2 = dish2.GetResponse();
|
---|
125 | Histo2D hdsq = dishsq.GetResponse();
|
---|
126 | po << PPFNameTag("dishg") << hdg;
|
---|
127 | po << PPFNameTag("dish") << hd;
|
---|
128 | po << PPFNameTag("dish2") << hd2;
|
---|
129 | po << PPFNameTag("dishsq") << hdsq;
|
---|
130 |
|
---|
131 | cout << " 2.c/ Creating MultiDish Filled Array " << endl;
|
---|
132 | double Ddish = 5.;
|
---|
133 | double Ddish2 = 7.5;
|
---|
134 | double Eta=0.95;
|
---|
135 | int cnt=0;
|
---|
136 | vector<Dish> vdplein = CreateFilledSqConfig(20, Ddish, Eta);
|
---|
137 | vector<Dish> vdpl64 = CreateFilledSqConfig(8, Ddish, Eta);
|
---|
138 |
|
---|
139 | vector<Dish> vdsparse = CreateConfigA(Ddish, Eta);
|
---|
140 | vector<Dish> vdsparseD7 = CreateConfigA(Ddish2, Eta);
|
---|
141 | // vector<Dish> vdsparseB = CreateConfigB(Ddish, Eta);
|
---|
142 | vector<Dish> vdsparseB = CreateConfigB(Ddish, Eta);
|
---|
143 | vector<Dish> vdsparseC = CreateConfigC(Ddish, Eta);
|
---|
144 |
|
---|
145 |
|
---|
146 | double cylW=12.; // Largeur des cylindres
|
---|
147 | double cylRL=0.5; // Longeur des elements de reception le long du cylindre
|
---|
148 | double etaW=0.95; // Efficacite de couverture en largeur
|
---|
149 | double etaRL=0.9; // Efficacite de couverture le long du cylindre
|
---|
150 | vector<Dish> vcylplein = CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, true);
|
---|
151 | vector<Dish> vcylplP = CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, false);
|
---|
152 |
|
---|
153 | cylW=10.;
|
---|
154 | cylRL=0.5;
|
---|
155 | vector<Dish> v3cyl = CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, true);
|
---|
156 | vector<Dish> v3cylP = CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, false);
|
---|
157 | cylW=25.;
|
---|
158 | cylRL=0.5;
|
---|
159 | etaW=0.3;
|
---|
160 | etaRL=0.9;
|
---|
161 | vector<Dish> v2cyl = CreateFilledCylConfig(2, 32, cylW, cylRL, etaW, etaRL, true);
|
---|
162 | vector<Dish> v2cylP = CreateFilledCylConfig(2, 32, cylW, cylRL, etaW, etaRL, false);
|
---|
163 |
|
---|
164 | double LMAX = D;
|
---|
165 | bool fgnoauto = true;
|
---|
166 | int NRX=100;
|
---|
167 | int NRY=100;
|
---|
168 |
|
---|
169 | MultiDish mdfill(lambda, LMAX, vdplein, fgnoauto);
|
---|
170 | mdfill.SetRespHisNBins(NRX,NRY);
|
---|
171 | Histo2D hrfill = mdfill.GetResponse();
|
---|
172 | PrtTim("Apres mdfill.GetResponse()");
|
---|
173 |
|
---|
174 | MultiDish mdfill64(lambda, LMAX, vdpl64, fgnoauto);
|
---|
175 | mdfill64.SetRespHisNBins(NRX,NRY);
|
---|
176 | {
|
---|
177 | Histo2D hpos=mdfill64.PosDist(10,10,10.*Ddish);
|
---|
178 | po << PPFNameTag("posf64") << hpos;
|
---|
179 | }
|
---|
180 | Histo2D hrf64 = mdfill64.GetResponse();
|
---|
181 | PrtTim("Apres mdfill64.GetResponse()");
|
---|
182 |
|
---|
183 | MultiDish mdsparse(lambda, LMAX, vdsparse, fgnoauto);
|
---|
184 | mdsparse.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
|
---|
185 | mdsparse.SetRespHisNBins(NRX,NRY);
|
---|
186 | {
|
---|
187 | Histo2D hpos=mdsparse.PosDist(22,22,22.*Ddish);;
|
---|
188 | po << PPFNameTag("posspA") << hpos;
|
---|
189 | }
|
---|
190 | Histo2D hrsp = mdsparse.GetResponse();
|
---|
191 | PrtTim("Apres mdsparse.GetResponse()");
|
---|
192 |
|
---|
193 | /*
|
---|
194 | MultiDish mdsparseD7(lambda, LMAX, vdsparseD7, fgnoauto);
|
---|
195 | mdsparseD7.SetThetaPhiRange(M_PI/4.,16, M_PI/4., 16);
|
---|
196 | mdsparseD7.SetRespHisNBins(NRX,NRY);
|
---|
197 | Histo2D hrspd7 = mdsparseD7.GetResponse();
|
---|
198 | PrtTim("Apres mdsparseD7.GetResponse()");
|
---|
199 | */
|
---|
200 | MultiDish mdsparseB(lambda, LMAX, vdsparseB, fgnoauto);
|
---|
201 | mdsparseB.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
|
---|
202 | mdsparseB.SetRespHisNBins(NRX,NRY);
|
---|
203 | {
|
---|
204 | Histo2D hpos=mdsparseB.PosDist(15,15,15.*Ddish);
|
---|
205 | po << PPFNameTag("posspB") << hpos;
|
---|
206 | }
|
---|
207 | Histo2D hrspB = mdsparseB.GetResponse();
|
---|
208 | PrtTim("Apres mdsparseB.GetResponse()");
|
---|
209 |
|
---|
210 | MultiDish mdsparseC(lambda, LMAX, vdsparseC, fgnoauto);
|
---|
211 | mdsparseC.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
|
---|
212 | mdsparseC.SetRespHisNBins(NRX,NRY);
|
---|
213 | {
|
---|
214 | Histo2D hpos=mdsparseC.PosDist(20,20,20.*Ddish);
|
---|
215 | po << PPFNameTag("posspC") << hpos;
|
---|
216 | }
|
---|
217 | Histo2D hrspC = mdsparseC.GetResponse();
|
---|
218 | PrtTim("Apres mdsparseC.GetResponse()");
|
---|
219 |
|
---|
220 | MultiDish mdsparseBfp(lambda, LMAX, vdsparseB, fgnoauto);
|
---|
221 | mdsparseBfp.SetRespHisNBins(NRX,NRY);
|
---|
222 | Histo2D hrspBfp = mdsparseBfp.GetResponse();
|
---|
223 | PrtTim("Apres mdsparseBfp.GetResponse()");
|
---|
224 |
|
---|
225 |
|
---|
226 | MultiDish mcylfill(lambda, LMAX, vcylplein, fgnoauto);
|
---|
227 | mcylfill.SetRespHisNBins(NRX,NRY);
|
---|
228 | Histo2D hfcyl = mcylfill.GetResponse();
|
---|
229 | PrtTim("Apres mcylfill.GetResponse()");
|
---|
230 | MultiDish mcylfillP(lambda, LMAX, vcylplP, fgnoauto);
|
---|
231 | mcylfillP.SetRespHisNBins(NRX,NRY);
|
---|
232 | Histo2D hfcylP = mcylfillP.GetResponse();
|
---|
233 | PrtTim("Apres mcylfillP.GetResponse()");
|
---|
234 |
|
---|
235 | MultiDish md3cyl(lambda, LMAX, v3cyl, fgnoauto);
|
---|
236 | md3cyl.SetRespHisNBins(NRX,NRY);
|
---|
237 | Histo2D h3cyl = md3cyl.GetResponse();
|
---|
238 | PrtTim("Apres md3cyl.GetResponse()");
|
---|
239 | MultiDish md3cylP(lambda, LMAX, v3cylP, fgnoauto);
|
---|
240 | md3cylP.SetRespHisNBins(NRX,NRY);
|
---|
241 | Histo2D h3cylP = md3cylP.GetResponse();
|
---|
242 | PrtTim("Apres md3cylP.GetResponse()");
|
---|
243 |
|
---|
244 | MultiDish md2cyl(lambda, LMAX, v2cyl, fgnoauto);
|
---|
245 | md2cyl.SetRespHisNBins(NRX,NRY);
|
---|
246 | Histo2D h2cyl = md2cyl.GetResponse();
|
---|
247 | PrtTim("Apres md2cyl.GetResponse()");
|
---|
248 | MultiDish md2cylP(lambda, LMAX, v2cylP, fgnoauto);
|
---|
249 | md2cylP.SetRespHisNBins(NRX,NRY);
|
---|
250 | Histo2D h2cylP = md2cylP.GetResponse();
|
---|
251 | PrtTim("Apres md2cylP.GetResponse()");
|
---|
252 |
|
---|
253 | po << PPFNameTag("mfill") << hrfill;
|
---|
254 | po << PPFNameTag("mfill64") << hrf64;
|
---|
255 | po << PPFNameTag("mspars") << hrsp;
|
---|
256 | // po << PPFNameTag("msparsd7") << hrspd7;
|
---|
257 | po << PPFNameTag("msparsB") << hrspB;
|
---|
258 | po << PPFNameTag("msparsC") << hrspC;
|
---|
259 | po << PPFNameTag("msparsBfp") << hrspBfp;
|
---|
260 | po << PPFNameTag("mcylf") << hfcyl;
|
---|
261 | po << PPFNameTag("m3cyl") << h3cyl;
|
---|
262 | po << PPFNameTag("m2cyl") << h2cyl;
|
---|
263 | po << PPFNameTag("mcylfP") << hfcylP;
|
---|
264 | po << PPFNameTag("m3cylP") << h3cylP;
|
---|
265 | po << PPFNameTag("m2cylP") << h2cylP;
|
---|
266 |
|
---|
267 | PrtTim("Done computing multi-dish response");
|
---|
268 |
|
---|
269 |
|
---|
270 | Four2DRespTable mdf(hrfill, Dol);
|
---|
271 | Four2DRespTable mdf64(hrf64, Dol);
|
---|
272 | Four2DRespTable mds(hrsp, Dol);
|
---|
273 | // Four2DRespTable mdsfp(hrspfp, Dol);
|
---|
274 | // Four2DRespTable mdsd7(hrspd7, Dol);
|
---|
275 | Four2DRespTable mdsB(hrspB, Dol);
|
---|
276 | Four2DRespTable mdsC(hrspC, Dol);
|
---|
277 | Four2DRespTable mdsBfp(hrspBfp, Dol);
|
---|
278 |
|
---|
279 | Four2DRespTable mcylf(hfcyl, Dol);
|
---|
280 | Four2DRespTable m3cyl(h3cyl, Dol);
|
---|
281 | Four2DRespTable m2cyl(h2cyl, Dol);
|
---|
282 | Four2DRespTable mcylfP(hfcylP, Dol);
|
---|
283 | Four2DRespTable m3cylP(h3cylP, Dol);
|
---|
284 | Four2DRespTable m2cylP(h2cylP, Dol);
|
---|
285 |
|
---|
286 |
|
---|
287 | cout << " 3.a/ Instanciating object type Four3DPk " << endl;
|
---|
288 | RandomGenerator rg;
|
---|
289 | Four3DPk m3d(rg);
|
---|
290 | m3d.SetCellSize(2.*DeuxPI, 2.*DeuxPI, 2.*DeuxPI);
|
---|
291 | cout << " 3.b/ call ComputeFourierAmp() NGEN=" << NMAX << endl;
|
---|
292 | HProf hrpk;
|
---|
293 | for(int igen=0; igen<NMAX; igen++) {
|
---|
294 | m3d.ComputeFourierAmp(spec);
|
---|
295 | if (igen==0) hrpk = m3d.ComputePk();
|
---|
296 | else m3d.ComputePkCumul(hrpk);
|
---|
297 | }
|
---|
298 | PrtTim("md.ComputeFourierAmp() done");
|
---|
299 | po << PPFNameTag("recPk") << hrpk;
|
---|
300 |
|
---|
301 | cout << " 4/ Computing Noise P(k) using PkNoiseCalculator ..." << endl;
|
---|
302 | #define NCONFIG 14
|
---|
303 | Four2DResponse* f2rep[NCONFIG]={&dish, &dish2, &mdf, &mdf64, &mds, &mdsB, &mdsC, &mdsBfp,
|
---|
304 | &mcylf, &mcylfP, &m3cyl, &m3cylP, &m2cyl, &m2cylP};
|
---|
305 | const char* tits[NCONFIG]={"Dish100m", "Dish200m","F20x20Dish5m","F8x8Dish5m",
|
---|
306 | "S68Dish5m","S72Dish5m","S129CDish5m","S72BDish5mFP",
|
---|
307 | "F8Cyl","F8CylP","F3Cyl","F3CylP","BiCyl","BiCylP"};
|
---|
308 | const char* tags[NCONFIG]={"noiseD", "noiseD2","noisemdf","noisemdf64","noisemds",
|
---|
309 | "noisemdsB","noisemdsC","noisemdsBfp",
|
---|
310 | "noisefcyl","noisefcylP","noise3cyl","noise3cylP", "noise2cyl","noise2cylP"};
|
---|
311 | vector<int> nbdishes;
|
---|
312 | nbdishes.push_back(1);
|
---|
313 | nbdishes.push_back(1);
|
---|
314 | nbdishes.push_back(vdplein.size());
|
---|
315 | nbdishes.push_back(vdpl64.size());
|
---|
316 | nbdishes.push_back(vdsparse.size());
|
---|
317 | // nbdishes.push_back(vdsparse.size());
|
---|
318 | nbdishes.push_back(vdsparseB.size());
|
---|
319 | nbdishes.push_back(vdsparseC.size());
|
---|
320 | nbdishes.push_back(vdsparseB.size());
|
---|
321 | nbdishes.push_back(vcylplein.size());
|
---|
322 | nbdishes.push_back(vcylplP.size());
|
---|
323 | nbdishes.push_back(v3cyl.size());
|
---|
324 | nbdishes.push_back(v3cylP.size());
|
---|
325 | nbdishes.push_back(v2cyl.size());
|
---|
326 | nbdishes.push_back(v2cylP.size());
|
---|
327 |
|
---|
328 | for(int lc=0; lc<NCONFIG; lc++) {
|
---|
329 | PkNoiseCalculator pkn(m3d, *(f2rep[lc]), SCut/(double)nbdishes[lc], NMAX, tits[lc]);
|
---|
330 | HProf hpn = pkn.Compute();
|
---|
331 | po << PPFNameTag(tags[lc]) << hpn;
|
---|
332 | }
|
---|
333 | rc = 0;
|
---|
334 | } // End of try bloc
|
---|
335 | catch (PThrowable & exc) { // catching SOPHYA exceptions
|
---|
336 | cerr << " pknoise.cc: Catched Exception (PThrowable)" << (string)typeid(exc).name()
|
---|
337 | << "\n...exc.Msg= " << exc.Msg() << endl;
|
---|
338 | rc = 99;
|
---|
339 | }
|
---|
340 | catch (std::exception & e) { // catching standard C++ exceptions
|
---|
341 | cerr << " pknoise.cc: Catched std::exception " << " - what()= " << e.what() << endl;
|
---|
342 | rc = 98;
|
---|
343 | }
|
---|
344 | catch (...) { // catching other exceptions
|
---|
345 | cerr << " pknoise.cc: some other exception (...) was caught ! " << endl;
|
---|
346 | rc = 97;
|
---|
347 | }
|
---|
348 | PrtTim("End-pknoise");
|
---|
349 | cout << " ==== End of pknoise.cc program Rc= " << rc << endl;
|
---|
350 | return rc;
|
---|
351 | }
|
---|
352 |
|
---|
353 |
|
---|
354 | //-----------------------------------------------------------------------------------
|
---|
355 | //-----------------------------------------------------------------------------------
|
---|
356 | // Fonctions de creation de configuration d'interfero avec des dishs
|
---|
357 | //-----------------------------------------------------------------------------------
|
---|
358 | /* --Fonction -- */
|
---|
359 | vector<Dish> CreateFilledSqConfig(int nd, double Ddish, double Eta)
|
---|
360 | {
|
---|
361 | vector<Dish> vd;
|
---|
362 | int cnt=0;
|
---|
363 | for(int i=0; i<nd; i++)
|
---|
364 | for(int j=0; j<nd; j++) {
|
---|
365 | cnt++;
|
---|
366 | vd.push_back(Dish(cnt, i*Ddish, j*Ddish, Eta*Ddish));
|
---|
367 | }
|
---|
368 | cout << ">>>CreateFilledSqConfig(" << nd << "," << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
|
---|
369 |
|
---|
370 | return vd;
|
---|
371 | }
|
---|
372 |
|
---|
373 | /* --Fonction -- */
|
---|
374 | vector<Dish> CreateSemiFilledSqConfig(int nd, double Ddish, double Eta)
|
---|
375 | {
|
---|
376 | vector<Dish> vd;
|
---|
377 | int cnt=0;
|
---|
378 | int fgst=1;
|
---|
379 | for(int i=0; i<nd; i++) {
|
---|
380 | fgst = (fgst+1)%2;
|
---|
381 | for(int j=0; j<nd; j++) {
|
---|
382 | if (j%2==fgst) continue;
|
---|
383 | cnt++;
|
---|
384 | vd.push_back(Dish(cnt, i*Ddish, j*Ddish, Eta*Ddish));
|
---|
385 | }
|
---|
386 | }
|
---|
387 | cout << ">>>CreateSemiFilledSqConfig(" << nd << "," << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
|
---|
388 |
|
---|
389 | return vd;
|
---|
390 | }
|
---|
391 |
|
---|
392 | /* --Fonction -- */
|
---|
393 | vector<Dish> CreateConfigA(double Ddish, double Eta)
|
---|
394 | {
|
---|
395 | vector<Dish> vd;
|
---|
396 | int cnt=0;
|
---|
397 | for(int i=0; i<18; i++) {
|
---|
398 | cnt++; vd.push_back(Dish(cnt, i*Ddish,0.,Eta*Ddish));
|
---|
399 | cnt++; vd.push_back(Dish(cnt, i*Ddish, 17.*Ddish,Eta*Ddish));
|
---|
400 | if ((i>0)&&(i<17)) {
|
---|
401 | cnt++; vd.push_back(Dish(cnt,0.,i*Ddish,Eta*Ddish));
|
---|
402 | cnt++; vd.push_back(Dish(cnt,17.*Ddish,i*Ddish,Eta*Ddish));
|
---|
403 | }
|
---|
404 | }
|
---|
405 | cout << ">>>CreateConfigA(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
|
---|
406 | return vd;
|
---|
407 | }
|
---|
408 |
|
---|
409 | /* --Fonction -- */
|
---|
410 | vector<Dish> CreateConfigB(double Ddish, double Eta)
|
---|
411 | {
|
---|
412 | vector<Dish> vd;
|
---|
413 | int cnt=0;
|
---|
414 | /*
|
---|
415 | for(int i=0; i<13; i++) {
|
---|
416 | cnt++; vd.push_back(Dish(cnt, i*Ddish,0.,Eta*Ddish));
|
---|
417 | cnt++; vd.push_back(Dish(cnt, i*Ddish, 12.*Ddish,Eta*Ddish));
|
---|
418 | if ((i>0)&&(i<12)) {
|
---|
419 | cnt++; vd.push_back(Dish(cnt,0.,i*Ddish,Eta*Ddish));
|
---|
420 | cnt++; vd.push_back(Dish(cnt,12.*Ddish,i*Ddish,Eta*Ddish));
|
---|
421 | }
|
---|
422 | }
|
---|
423 | for(int i=0; i<5; i++) {
|
---|
424 | cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish,4.*Ddish,Eta*Ddish));
|
---|
425 | cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish, 8.*Ddish,Eta*Ddish));
|
---|
426 | if ((i>0)&&(i<4)) {
|
---|
427 | cnt++; vd.push_back(Dish(cnt,4.*Ddish,(i+4)*Ddish,Eta*Ddish));
|
---|
428 | cnt++; vd.push_back(Dish(cnt,8.*Ddish,(i+4)*Ddish,Eta*Ddish));
|
---|
429 | }
|
---|
430 | }
|
---|
431 | */
|
---|
432 | for(int i=0; i<11; i++) {
|
---|
433 | cnt++; vd.push_back(Dish(cnt, i*Ddish,0.,Eta*Ddish));
|
---|
434 | cnt++; vd.push_back(Dish(cnt, i*Ddish, 10.*Ddish,Eta*Ddish));
|
---|
435 | if ((i>0)&&(i<10)) {
|
---|
436 | cnt++; vd.push_back(Dish(cnt,0.,i*Ddish,Eta*Ddish));
|
---|
437 | cnt++; vd.push_back(Dish(cnt,10.*Ddish,i*Ddish,Eta*Ddish));
|
---|
438 | }
|
---|
439 | }
|
---|
440 | for(int i=0; i<7; i++) {
|
---|
441 | cnt++; vd.push_back(Dish(cnt, (i+2)*Ddish, 2.*Ddish,Eta*Ddish));
|
---|
442 | cnt++; vd.push_back(Dish(cnt, (i+2)*Ddish, 8.*Ddish,Eta*Ddish));
|
---|
443 | if ((i>0)&&(i<6)) {
|
---|
444 | cnt++; vd.push_back(Dish(cnt,2.*Ddish,(i+2)*Ddish,Eta*Ddish));
|
---|
445 | cnt++; vd.push_back(Dish(cnt,8.*Ddish,(i+2)*Ddish,Eta*Ddish));
|
---|
446 | }
|
---|
447 | }
|
---|
448 | for(int i=0; i<3; i++) {
|
---|
449 | cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish, 4.*Ddish,Eta*Ddish));
|
---|
450 | cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish, 6.*Ddish,Eta*Ddish));
|
---|
451 | if ((i>0)&&(i<2)) {
|
---|
452 | cnt++; vd.push_back(Dish(cnt,4.*Ddish,(i+4)*Ddish,Eta*Ddish));
|
---|
453 | cnt++; vd.push_back(Dish(cnt,6.*Ddish,(i+4)*Ddish,Eta*Ddish));
|
---|
454 | }
|
---|
455 | }
|
---|
456 |
|
---|
457 |
|
---|
458 | cout << ">>>CreateConfigB(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
|
---|
459 | return vd;
|
---|
460 | }
|
---|
461 |
|
---|
462 |
|
---|
463 | /* --Fonction -- */
|
---|
464 | vector<Dish> CreateConfigC(double Ddish, double Eta)
|
---|
465 | {
|
---|
466 | vector<int_4> lesx, lesy;
|
---|
467 |
|
---|
468 | int max = 16;
|
---|
469 | for(int i=0; i<4; i++)
|
---|
470 | for(int j=0; j<4; j++) {
|
---|
471 | lesx.push_back(i); lesy.push_back(j);
|
---|
472 | lesx.push_back(max-i); lesy.push_back(max-j);
|
---|
473 | lesx.push_back(i); lesy.push_back(max-j);
|
---|
474 | lesx.push_back(max-i); lesy.push_back(j);
|
---|
475 | }
|
---|
476 |
|
---|
477 | for(int i=5; i<12; i+=2) {
|
---|
478 | lesx.push_back(i); lesy.push_back(0);
|
---|
479 | lesx.push_back(i); lesy.push_back(max);
|
---|
480 | lesx.push_back(0); lesy.push_back(i);
|
---|
481 | lesx.push_back(max); lesy.push_back(i);
|
---|
482 | }
|
---|
483 |
|
---|
484 | for(int i=4; i<=12; i+=2)
|
---|
485 | for(int j=4; j<=12; j+=2) {
|
---|
486 | lesx.push_back(i); lesy.push_back(j);
|
---|
487 | }
|
---|
488 |
|
---|
489 | for(int i=5; i<=11; i+=2) {
|
---|
490 | lesx.push_back(i); lesy.push_back(4);
|
---|
491 | lesx.push_back(i); lesy.push_back(max-4);
|
---|
492 | lesx.push_back(4); lesy.push_back(i);
|
---|
493 | lesx.push_back(max-4); lesy.push_back(i);
|
---|
494 | }
|
---|
495 |
|
---|
496 | EnumeratedSequence esx,esy;
|
---|
497 | esx = 2,5;
|
---|
498 | esy = 5,2;
|
---|
499 |
|
---|
500 | for(int k=0; k<esx.Size(); k++) {
|
---|
501 | int_4 ix=esx.Value(k);
|
---|
502 | int_4 iy=esy.Value(k);
|
---|
503 |
|
---|
504 | lesx.push_back(ix); lesy.push_back(iy);
|
---|
505 | lesx.push_back(max-ix); lesy.push_back(iy);
|
---|
506 | lesx.push_back(ix); lesy.push_back(max-iy);
|
---|
507 | lesx.push_back(max-ix); lesy.push_back(max-iy);
|
---|
508 | }
|
---|
509 | cout << "CreateConfigC/Debug: -checkSize/lesx=" << lesx.size() << " -Check/lesy=" << lesy.size() << endl;
|
---|
510 |
|
---|
511 | vector<Dish> vd;
|
---|
512 | int cnt=0;
|
---|
513 | for(size_t i=0; i<lesx.size(); i++) {
|
---|
514 | cnt++; vd.push_back(Dish(cnt, ((double)lesx[i])*Ddish,((double)lesy[i])*Ddish,Eta*Ddish));
|
---|
515 | }
|
---|
516 |
|
---|
517 | cout << ">>>CreateConfigC(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
|
---|
518 |
|
---|
519 | return vd;
|
---|
520 |
|
---|
521 | }
|
---|
522 | /* --Fonction -- */
|
---|
523 | vector<Dish> CreateConfigD(double Ddish, double Eta)
|
---|
524 | {
|
---|
525 | EnumeratedSequence es;
|
---|
526 | es = 0,1,3,4,6,8,10,12,14,16,18,20,22,24,25,27,28;
|
---|
527 | vector<int_4> lesx, lesy;
|
---|
528 | for(int k=0; k<es.Size(); k++) {
|
---|
529 | lesx.push_back(es.Value(k)); lesy.push_back(0);
|
---|
530 | lesx.push_back(es.Value(k)); lesy.push_back(28);
|
---|
531 | }
|
---|
532 | for(int k=1; k<es.Size()-1; k++) {
|
---|
533 | lesy.push_back(es.Value(k)); lesx.push_back(0);
|
---|
534 | lesy.push_back(es.Value(k)); lesx.push_back(28);
|
---|
535 | }
|
---|
536 | for(int k=1; k<=5; k++) {
|
---|
537 | lesy.push_back(k); lesx.push_back(5);
|
---|
538 | lesy.push_back(28-k); lesx.push_back(28-5);
|
---|
539 | if (k!=5) {
|
---|
540 | lesx.push_back(k); lesy.push_back(5);
|
---|
541 | lesx.push_back(28-k); lesy.push_back(28-5);
|
---|
542 | }
|
---|
543 |
|
---|
544 | lesy.push_back(k); lesx.push_back(28-5);
|
---|
545 | lesy.push_back(28-k); lesx.push_back(5);
|
---|
546 | if (k!=5) {
|
---|
547 | lesx.push_back(28-k); lesy.push_back(5);
|
---|
548 | lesx.push_back(k); lesy.push_back(28-5);
|
---|
549 | }
|
---|
550 | }
|
---|
551 |
|
---|
552 | for(int k=6; k<=13; k++) {
|
---|
553 | lesy.push_back(k); lesx.push_back(k);
|
---|
554 | lesy.push_back(28-k); lesx.push_back(28-k);
|
---|
555 | lesy.push_back(k); lesx.push_back(28-k);
|
---|
556 | lesy.push_back(28-k); lesx.push_back(k);
|
---|
557 | }
|
---|
558 |
|
---|
559 |
|
---|
560 | lesx.push_back(14); lesy.push_back(14);
|
---|
561 |
|
---|
562 | EnumeratedSequence esx,esy;
|
---|
563 | esx = 1,2,4;
|
---|
564 | esy = 12,11,13;
|
---|
565 |
|
---|
566 | for(int k=0; k<esx.Size(); k++) {
|
---|
567 | int_4 ix=esx.Value(k);
|
---|
568 | int_4 iy=esy.Value(k);
|
---|
569 | lesx.push_back(ix); lesy.push_back(iy);
|
---|
570 | lesx.push_back(28-ix); lesy.push_back(iy);
|
---|
571 | lesx.push_back(ix); lesy.push_back(28-iy);
|
---|
572 | lesx.push_back(28-ix); lesy.push_back(28-iy);
|
---|
573 |
|
---|
574 | lesy.push_back(ix); lesx.push_back(iy);
|
---|
575 | lesy.push_back(28-ix); lesx.push_back(iy);
|
---|
576 | lesy.push_back(ix); lesx.push_back(28-iy);
|
---|
577 | lesy.push_back(28-ix); lesx.push_back(28-iy);
|
---|
578 | }
|
---|
579 | for(int k=5; k<=13; k+=2) {
|
---|
580 | lesy.push_back(k); lesx.push_back(14);
|
---|
581 | lesy.push_back(28-k); lesx.push_back(14);
|
---|
582 | lesy.push_back(14); lesx.push_back(k);
|
---|
583 | lesy.push_back(14); lesx.push_back(28-k);
|
---|
584 | }
|
---|
585 |
|
---|
586 | cout << "CreateConfigB/Debug: -checkSize/lesx=" << lesx.size() << " -Check/lesy=" << lesy.size() << endl;
|
---|
587 |
|
---|
588 | vector<Dish> vd;
|
---|
589 | int cnt=0;
|
---|
590 | for(size_t i=0; i<lesx.size(); i++) {
|
---|
591 | cnt++; vd.push_back(Dish(cnt, ((double)lesx[i])*Ddish,((double)lesy[i])*Ddish,Eta*Ddish));
|
---|
592 | }
|
---|
593 |
|
---|
594 | cout << ">>>CreateConfigD(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
|
---|
595 |
|
---|
596 | return vd;
|
---|
597 | }
|
---|
598 |
|
---|
599 | /* --Fonction -- */
|
---|
600 | vector<Dish> CreateFilledCylConfig(int ncyl, int nRL, double cylW, double cylRL, double etaW, double etaRL, bool fgscid)
|
---|
601 | {
|
---|
602 | vector<Dish> vd;
|
---|
603 | int cnt=0;
|
---|
604 |
|
---|
605 | for(int i=0; i<ncyl; i++)
|
---|
606 | for(int j=0; j<nRL; j++) {
|
---|
607 | cnt++;
|
---|
608 | int rid = (fgscid) ? i+1 : cnt;
|
---|
609 | vd.push_back(Dish(rid, i*cylW, j*cylRL, etaW*cylW, etaRL*cylRL));
|
---|
610 | }
|
---|
611 | cout << ">>>CreateFilledCylConfig(" << ncyl << "," << nRL << "," << cylW << "," << cylRL << ","
|
---|
612 | << etaW << "," << etaRL << "," << ((fgscid)?" RId=CylNum":"Cnt")
|
---|
613 | << ") ---> NDishes=" << vd.size() << endl;
|
---|
614 |
|
---|
615 | return vd;
|
---|
616 | }
|
---|