[2609] | 1 | #include <stdio.h>
|
---|
| 2 | #include <stdlib.h>
|
---|
[2615] | 3 | #include "sopnamsp.h"
|
---|
[2609] | 4 | #include "math.h"
|
---|
| 5 | #include <iostream>
|
---|
| 6 | #include <string>
|
---|
| 7 |
|
---|
| 8 | #include "sambainit.h"
|
---|
| 9 | #include "pexceptions.h"
|
---|
| 10 | #include <typeinfo>
|
---|
| 11 | #include "timing.h"
|
---|
| 12 | #include "sphereecp.h"
|
---|
| 13 | #include "fiosphereecp.h"
|
---|
| 14 | #include "array.h"
|
---|
| 15 | #include "samba.h"
|
---|
| 16 |
|
---|
| 17 | int main(int narg, char* arg[])
|
---|
| 18 | {
|
---|
| 19 | cout << " ---- Programme tsphereecp.cc - Test SphereECP --- " << endl;
|
---|
| 20 | int rc = 0;
|
---|
| 21 | try {
|
---|
| 22 | SophyaInit();
|
---|
| 23 |
|
---|
| 24 | InitTim();
|
---|
| 25 | SphereECP<r_8> ecp(M_PI/2.-0.05, M_PI/2.+0.05, 10, 0., 0.2, 10);
|
---|
| 26 | ecp.SetPixels(15.);
|
---|
| 27 | cout << ecp ;
|
---|
| 28 |
|
---|
| 29 | SphereECP<r_8> ecp2;
|
---|
| 30 | ecp2 = ecp;
|
---|
| 31 | ecp2 += 4.;
|
---|
| 32 | cout << " ecp2 = ecp+4. = \n " << ecp2 ;
|
---|
| 33 | {
|
---|
| 34 | cout << " Writing ecp ecp2 to POutPersist sphecp.ppf " << endl;
|
---|
| 35 | POutPersist po("sphecp.ppf");
|
---|
| 36 | po << ecp << ecp2;
|
---|
| 37 | }
|
---|
| 38 | {
|
---|
| 39 | SphereECP<r_8> recp, recp2;
|
---|
| 40 | cout << " Reading from sphecp.ppf " << endl;
|
---|
| 41 | PInPersist pi("sphecp.ppf");
|
---|
| 42 | pi >> recp >> recp2;
|
---|
| 43 | cout << " recp recp2 from PInPersist " << endl;
|
---|
| 44 | cout << recp;
|
---|
| 45 | cout << recp2;
|
---|
| 46 | }
|
---|
| 47 | // Test avec transforme Ylm
|
---|
| 48 | int lmax = 92;
|
---|
| 49 | Vector clin(lmax);
|
---|
| 50 | for(int l=0; l<lmax; l++) {
|
---|
| 51 | double xx = (l-50.)/10.;
|
---|
| 52 | clin(l) = 1.e-2 -1.e-4*l + 0.1*exp(-xx*xx);
|
---|
| 53 | }
|
---|
| 54 | // Compute map from spectra
|
---|
| 55 | SphericalTransformServer<r_8> ylmserver;
|
---|
| 56 | SphereECP<r_8> map(256);
|
---|
| 57 | cout << " Generating map from Cl " << endl;
|
---|
| 58 | ylmserver.GenerateFromCl(map, -1, clin, 0.);
|
---|
| 59 | cout << " Computing Cl from map " << endl;
|
---|
| 60 | Vector clout = ylmserver.DecomposeToCl(map, lmax, 0.);
|
---|
| 61 | SphereECP<r_8> mappar(0.25*M_PI, 0.75*M_PI, 128, 0.25*M_PI, 1.25*M_PI, 256);
|
---|
| 62 | cout << " Generating partial map from Cl " << endl;
|
---|
| 63 | ylmserver.GenerateFromCl(mappar, -1, clin, 0.);
|
---|
| 64 | cout << " Computing Cl from partialmap " << endl;
|
---|
| 65 | Vector cloutpar = ylmserver.DecomposeToCl(mappar, lmax, 0.);
|
---|
| 66 |
|
---|
| 67 | cout << " Writing clin, map, clout to ecpylm.ppf" << endl;
|
---|
| 68 | POutPersist so("ecpylm.ppf");
|
---|
| 69 | so << PPFNameTag("clin") << clin << PPFNameTag("map") << map
|
---|
| 70 | << PPFNameTag("clout") << clout ;
|
---|
| 71 | cout << " Writing mappar, cloutpar to ecpylm.ppf" << endl;
|
---|
| 72 | so << PPFNameTag("mappar") << mappar
|
---|
| 73 | << PPFNameTag("cloutpar") << cloutpar ;
|
---|
| 74 | }
|
---|
| 75 | catch (PThrowable & exc) {
|
---|
| 76 | cerr << " tsphereecp.cc: Catched Exception (PThrowable)" << (string)typeid(exc).name()
|
---|
| 77 | << " - Msg= " << exc.Msg() << endl;
|
---|
| 78 | rc = 99;
|
---|
| 79 | }
|
---|
| 80 | catch (std::exception & e) {
|
---|
| 81 | cerr << " tsphereecp.cc: Catched std::xception "
|
---|
| 82 | << " - what()= " << e.what() << endl;
|
---|
| 83 | rc = 98;
|
---|
| 84 | }
|
---|
| 85 | catch (...) {
|
---|
| 86 | cerr << " ssphereecp.cc: some other exception (...) was caught ! " << endl;
|
---|
| 87 | rc = 97;
|
---|
| 88 | }
|
---|
| 89 | PrtTim("End tsphereecp " );
|
---|
| 90 | cout << " ---- Programme tsphereecp.cc - FIN (Rc=" << rc << ") --- " << endl;
|
---|
| 91 | return rc;
|
---|
| 92 | }
|
---|