Loading src/cluster/cluster.cpp +109 −8 Original line number Diff line number Diff line Loading @@ -94,18 +94,48 @@ void cluster() { const int ndi = c4->nsph * c4->nlim; C9 *c9 = new C9(ndi, c4->nlem, 2 * ndi, 2 * c4->nlem); double *gaps = new double[nsph](); double **tqse, **tqss; complex<double> **tqspe, **tqsps; double **tqse, **tqss, **tqce, **tqcs; complex<double> **tqspe, **tqsps, **tqcpe, **tqcps; tqse = new double*[2]; tqspe = new complex<double>*[2]; tqss = new double*[2]; tqsps = new complex<double>*[2]; tqce = new double*[2]; tqcpe = new complex<double>*[2]; tqcs = new double*[2]; tqcps = new complex<double>*[2]; for (int ti = 0; ti < 2; ti++) { tqse[ti] = new double[nsph](); tqspe[ti] = new complex<double>[nsph](); tqss[ti] = new double[nsph](); tqsps[ti] = new complex<double>[nsph](); tqce[ti] = new double[3](); tqcpe[ti] = new complex<double>[3](); tqcs[ti] = new double[3](); tqcps[ti] = new complex<double>[3](); } complex<double> **gapp, **gappm; double **gap, **gapm; gapp = new complex<double>*[3]; gappm = new complex<double>*[3]; gap = new double*[3]; gapm = new double*[3]; for (int gi = 0; gi < 3; gi++) { gapp[gi] = new complex<double>[2](); gappm[gi] = new complex<double>[2](); gap[gi] = new double[2](); gapm[gi] = new double[2](); } double *u = new double[3](); double *us = new double[3](); double *un = new double[3](); double *uns = new double[3](); double *up = new double[3](); double *ups = new double[3](); double *unmp = new double[3](); double *unsmp = new double[3](); double *upmp = new double[3](); double *upsmp = new double[3](); // End of global variables for CLU fprintf(output, " READ(IR,*)NSPH,LI,LE,MXNDM,INPOL,NPNT,NPNTTS,IAVM,ISAM\n"); fprintf(output, " %5d%5d%5d%5d%5d%5d%5d%5d%5d\n", Loading Loading @@ -289,7 +319,8 @@ void cluster() { } // label 160 double cs0 = 0.25 * vk * vk * vk / acos(0.0); double csch; double csch = 0.0, qschu = 0.0, pschu = 0.0, s0mag = 0.0; std::complex<double> s0(0.0, 0.0); scr0(vk, exri, c1, c1ao, c3, c4); printf("DEBUG: after SCR0 TFSAS = (%lE, %lE)\n", c3->tfsas.real(), c3->tfsas.imag()); double sqk = vk * vk * sconf->exdc; Loading @@ -316,10 +347,10 @@ void cluster() { fprintf(output, " %14.7lE%15.7lE%15.7lE\n", c1->sqscs[i], c1->sqabs[i], c1->sqexs[i]); fprintf(output, " FSAS=%15.7lE%15.7lE\n", c1->fsas[i].real(), c1->fsas[i].imag()); csch = 2.0 * vk * sqsfi / c1->gcsv[i]; std::complex<double> s0 = c1->fsas[i] * exri; double qschu = s0.imag() * csch; double pschu = s0.real() * csch; double s0mag = sqrt((s0.real() + s0.imag()) * (s0.real() - s0.imag())) * cs0; s0 = c1->fsas[i] * exri; qschu = s0.imag() * csch; pschu = s0.real() * csch; s0mag = sqrt((s0.real() + s0.imag()) * (s0.real() - s0.imag())) * cs0; fprintf(output, " QSCHU=%15.7lE, PSCHU=%15.7lE, S0MAG=%15.7lE\n", qschu, pschu, s0mag); double rapr = c1->sexs[i] - gaps[i]; double cosav = gaps[i] / c1->sscs[i]; Loading @@ -329,6 +360,48 @@ void cluster() { } } // i170 loop fprintf(output, " FSAT=%15.7lE%15.7lE\n", c3->tfsas.real(), c3->tfsas.imag()); csch = 2.0 * vk * sqsfi / c3->gcs; s0 = c3->tfsas * exri; qschu = s0.imag() * csch; pschu = s0.real() * csch; s0mag = sqrt((s0.real() + s0.imag()) * (s0.real() - s0.imag())) * cs0; fprintf(output, " QSCHU=%15.7lE, PSCHU=%15.7lE, S0MAG=%15.7lE\n", qschu, pschu, s0mag); tppoan.write(reinterpret_cast<char *>(&vk), sizeof(double)); pcrsm0(vk, exri, inpol, c1, c1ao, c4); apcra(zpv, c4->le, c1ao->am0m, inpol, sqk, gapm, gappm); th = th1; for (int jth486 = 1; jth486 <= nth; jth486++) { // OpenMP portable? ph = ph1; double cost = 0.0, sint = 0.0, cosp = 0.0, sinp = 0.0; // argi[NSPEF], with NSPEF=1 if IDOT=0, else NSPEF=NSPH double *argi; for (int jph484 = 1; jph484 <= nph; jph484++) { int jw = 0; if (nk != 1 || jxi488 <= 1) { upvmp(th, ph, 0, cost, sint, cosp, sinp, u, upmp, unmp); if (isam >= 0) { argi = new double[1]; wmamp( 0, cost, sint, cosp, sinp, inpol, c4->le, 0, nsph, argi, u, upmp, unmp, c1 ); // label 182 apc(zpv, c4->le, c1ao->am0m, c1->w, sqk, gap, gapp); raba(c4->le, c1ao->am0m, c1->w, tqce, tqcpe, tqcs, tqcps); jw = 1; } } else { // label 180, NK == 1 AND JXI488 == 1 if (isam >= 0) { // label 182 apc(zpv, c4->le, c1ao->am0m, c1->w, sqk, gap, gapp); raba(c4->le, c1ao->am0m, c1->w, tqce, tqcpe, tqcs, tqcps); jw = 1; } } // label 184 double thsl = ths1; } // jph484 loop } // jth486 loop printf("INFO: done jxi488 iteration.\n"); } // jxi488 loop tppoan.close(); Loading Loading @@ -360,11 +433,39 @@ void cluster() { delete[] tqss[ti]; delete[] tqspe[ti]; delete[] tqsps[ti]; delete[] tqce[ti]; delete[] tqcpe[ti]; delete[] tqcs[ti]; delete[] tqcps[ti]; } delete[] tqse; delete[] tqss; delete[] tqspe; delete[] tqsps; delete[] tqce; delete[] tqcpe; delete[] tqcs; delete[] tqcps; for (int gi = 2; gi > -1; gi--) { delete[] gapp[gi]; delete[] gappm[gi]; delete[] gap[gi]; delete[] gapm[gi]; } delete[] gapp; delete[] gappm; delete[] gap; delete[] gapm; delete[] u; delete[] us; delete[] un; delete[] uns; delete[] up; delete[] ups; delete[] unmp; delete[] unsmp; delete[] upmp; delete[] upsmp; } else { // NSPH mismatch between geometry and scatterer configurations. throw UnrecognizedConfigurationException( "Inconsistent geometry and scatterer configurations." Loading src/include/Commons.h +4 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,10 @@ public: //! \brief QUESTION: definition? std::complex<double> *scscp; //! \brief QUESTION: definition? double *ecscm; //! \brief QUESTION: definition? double *scscm; //! \brief QUESTION: definition? std::complex<double> *ecscp; //! \brief QUESTION: definition? std::complex<double> *scscpm; Loading src/include/clu_subs.h +585 −1 File changed.Preview size limit exceeded, changes collapsed. Show changes src/libnptm/Commons.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,8 @@ C1_AddOns::C1_AddOns(C4 *c4) { ecscpm = new complex<double>[2](); allocate_vectors(c4); sscs = new double[nsph](); ecscm = new double[2](); scscm = new double[2](); } C1_AddOns::~C1_AddOns() { Loading Loading @@ -153,6 +155,8 @@ C1_AddOns::~C1_AddOns() { delete[] ecscp; delete[] scscpm; delete[] ecscpm; delete[] ecscm; delete[] scscm; } void C1_AddOns::allocate_vectors(C4 *c4) { Loading src/np_cluster.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ using namespace std; extern void cluster(); extern void sphere(); /*! \brief Main program entry point. * Loading @@ -21,8 +20,6 @@ extern void sphere(); * the configuration and runs the main program. */ int main(int argc, char **argv) { bool is_sphere = false; if (is_sphere) sphere(); else cluster(); cluster(); return 0; } Loading
src/cluster/cluster.cpp +109 −8 Original line number Diff line number Diff line Loading @@ -94,18 +94,48 @@ void cluster() { const int ndi = c4->nsph * c4->nlim; C9 *c9 = new C9(ndi, c4->nlem, 2 * ndi, 2 * c4->nlem); double *gaps = new double[nsph](); double **tqse, **tqss; complex<double> **tqspe, **tqsps; double **tqse, **tqss, **tqce, **tqcs; complex<double> **tqspe, **tqsps, **tqcpe, **tqcps; tqse = new double*[2]; tqspe = new complex<double>*[2]; tqss = new double*[2]; tqsps = new complex<double>*[2]; tqce = new double*[2]; tqcpe = new complex<double>*[2]; tqcs = new double*[2]; tqcps = new complex<double>*[2]; for (int ti = 0; ti < 2; ti++) { tqse[ti] = new double[nsph](); tqspe[ti] = new complex<double>[nsph](); tqss[ti] = new double[nsph](); tqsps[ti] = new complex<double>[nsph](); tqce[ti] = new double[3](); tqcpe[ti] = new complex<double>[3](); tqcs[ti] = new double[3](); tqcps[ti] = new complex<double>[3](); } complex<double> **gapp, **gappm; double **gap, **gapm; gapp = new complex<double>*[3]; gappm = new complex<double>*[3]; gap = new double*[3]; gapm = new double*[3]; for (int gi = 0; gi < 3; gi++) { gapp[gi] = new complex<double>[2](); gappm[gi] = new complex<double>[2](); gap[gi] = new double[2](); gapm[gi] = new double[2](); } double *u = new double[3](); double *us = new double[3](); double *un = new double[3](); double *uns = new double[3](); double *up = new double[3](); double *ups = new double[3](); double *unmp = new double[3](); double *unsmp = new double[3](); double *upmp = new double[3](); double *upsmp = new double[3](); // End of global variables for CLU fprintf(output, " READ(IR,*)NSPH,LI,LE,MXNDM,INPOL,NPNT,NPNTTS,IAVM,ISAM\n"); fprintf(output, " %5d%5d%5d%5d%5d%5d%5d%5d%5d\n", Loading Loading @@ -289,7 +319,8 @@ void cluster() { } // label 160 double cs0 = 0.25 * vk * vk * vk / acos(0.0); double csch; double csch = 0.0, qschu = 0.0, pschu = 0.0, s0mag = 0.0; std::complex<double> s0(0.0, 0.0); scr0(vk, exri, c1, c1ao, c3, c4); printf("DEBUG: after SCR0 TFSAS = (%lE, %lE)\n", c3->tfsas.real(), c3->tfsas.imag()); double sqk = vk * vk * sconf->exdc; Loading @@ -316,10 +347,10 @@ void cluster() { fprintf(output, " %14.7lE%15.7lE%15.7lE\n", c1->sqscs[i], c1->sqabs[i], c1->sqexs[i]); fprintf(output, " FSAS=%15.7lE%15.7lE\n", c1->fsas[i].real(), c1->fsas[i].imag()); csch = 2.0 * vk * sqsfi / c1->gcsv[i]; std::complex<double> s0 = c1->fsas[i] * exri; double qschu = s0.imag() * csch; double pschu = s0.real() * csch; double s0mag = sqrt((s0.real() + s0.imag()) * (s0.real() - s0.imag())) * cs0; s0 = c1->fsas[i] * exri; qschu = s0.imag() * csch; pschu = s0.real() * csch; s0mag = sqrt((s0.real() + s0.imag()) * (s0.real() - s0.imag())) * cs0; fprintf(output, " QSCHU=%15.7lE, PSCHU=%15.7lE, S0MAG=%15.7lE\n", qschu, pschu, s0mag); double rapr = c1->sexs[i] - gaps[i]; double cosav = gaps[i] / c1->sscs[i]; Loading @@ -329,6 +360,48 @@ void cluster() { } } // i170 loop fprintf(output, " FSAT=%15.7lE%15.7lE\n", c3->tfsas.real(), c3->tfsas.imag()); csch = 2.0 * vk * sqsfi / c3->gcs; s0 = c3->tfsas * exri; qschu = s0.imag() * csch; pschu = s0.real() * csch; s0mag = sqrt((s0.real() + s0.imag()) * (s0.real() - s0.imag())) * cs0; fprintf(output, " QSCHU=%15.7lE, PSCHU=%15.7lE, S0MAG=%15.7lE\n", qschu, pschu, s0mag); tppoan.write(reinterpret_cast<char *>(&vk), sizeof(double)); pcrsm0(vk, exri, inpol, c1, c1ao, c4); apcra(zpv, c4->le, c1ao->am0m, inpol, sqk, gapm, gappm); th = th1; for (int jth486 = 1; jth486 <= nth; jth486++) { // OpenMP portable? ph = ph1; double cost = 0.0, sint = 0.0, cosp = 0.0, sinp = 0.0; // argi[NSPEF], with NSPEF=1 if IDOT=0, else NSPEF=NSPH double *argi; for (int jph484 = 1; jph484 <= nph; jph484++) { int jw = 0; if (nk != 1 || jxi488 <= 1) { upvmp(th, ph, 0, cost, sint, cosp, sinp, u, upmp, unmp); if (isam >= 0) { argi = new double[1]; wmamp( 0, cost, sint, cosp, sinp, inpol, c4->le, 0, nsph, argi, u, upmp, unmp, c1 ); // label 182 apc(zpv, c4->le, c1ao->am0m, c1->w, sqk, gap, gapp); raba(c4->le, c1ao->am0m, c1->w, tqce, tqcpe, tqcs, tqcps); jw = 1; } } else { // label 180, NK == 1 AND JXI488 == 1 if (isam >= 0) { // label 182 apc(zpv, c4->le, c1ao->am0m, c1->w, sqk, gap, gapp); raba(c4->le, c1ao->am0m, c1->w, tqce, tqcpe, tqcs, tqcps); jw = 1; } } // label 184 double thsl = ths1; } // jph484 loop } // jth486 loop printf("INFO: done jxi488 iteration.\n"); } // jxi488 loop tppoan.close(); Loading Loading @@ -360,11 +433,39 @@ void cluster() { delete[] tqss[ti]; delete[] tqspe[ti]; delete[] tqsps[ti]; delete[] tqce[ti]; delete[] tqcpe[ti]; delete[] tqcs[ti]; delete[] tqcps[ti]; } delete[] tqse; delete[] tqss; delete[] tqspe; delete[] tqsps; delete[] tqce; delete[] tqcpe; delete[] tqcs; delete[] tqcps; for (int gi = 2; gi > -1; gi--) { delete[] gapp[gi]; delete[] gappm[gi]; delete[] gap[gi]; delete[] gapm[gi]; } delete[] gapp; delete[] gappm; delete[] gap; delete[] gapm; delete[] u; delete[] us; delete[] un; delete[] uns; delete[] up; delete[] ups; delete[] unmp; delete[] unsmp; delete[] upmp; delete[] upsmp; } else { // NSPH mismatch between geometry and scatterer configurations. throw UnrecognizedConfigurationException( "Inconsistent geometry and scatterer configurations." Loading
src/include/Commons.h +4 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,10 @@ public: //! \brief QUESTION: definition? std::complex<double> *scscp; //! \brief QUESTION: definition? double *ecscm; //! \brief QUESTION: definition? double *scscm; //! \brief QUESTION: definition? std::complex<double> *ecscp; //! \brief QUESTION: definition? std::complex<double> *scscpm; Loading
src/include/clu_subs.h +585 −1 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/libnptm/Commons.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,8 @@ C1_AddOns::C1_AddOns(C4 *c4) { ecscpm = new complex<double>[2](); allocate_vectors(c4); sscs = new double[nsph](); ecscm = new double[2](); scscm = new double[2](); } C1_AddOns::~C1_AddOns() { Loading Loading @@ -153,6 +155,8 @@ C1_AddOns::~C1_AddOns() { delete[] ecscp; delete[] scscpm; delete[] ecscpm; delete[] ecscm; delete[] scscm; } void C1_AddOns::allocate_vectors(C4 *c4) { Loading
src/np_cluster.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ using namespace std; extern void cluster(); extern void sphere(); /*! \brief Main program entry point. * Loading @@ -21,8 +20,6 @@ extern void sphere(); * the configuration and runs the main program. */ int main(int argc, char **argv) { bool is_sphere = false; if (is_sphere) sphere(); else cluster(); cluster(); return 0; }