star-gf

Compute Gebhart factors
git clone git://git.meso-star.fr/star-gf.git
Log | Files | Refs | README | LICENSE

commit 98d2cae91d6da5083aca2d6f82f363573fa620ab
parent 30986fe80dc77b1cd2f83dffcc7a1fff18cfc90e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 22 Jul 2015 15:43:40 +0200

Fix a test_sgf bug

The sgf_integrate function was invoked without defining the indentifier of the
primitive on which the Gebhart factor would have been computed.

Diffstat:
Msrc/test_sgf.c | 32++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/test_sgf.c b/src/test_sgf.c @@ -35,7 +35,18 @@ #include <star/s3d.h> #include <star/smc.h> -#define NSTEPS 100000 +#define NSTEPS 100000L + +/* + * Matrix of Gebhart factors + * + * 0.065871765 0.245053213 0.281090450 0.210375872 0.0838339939 0.113774706 + * 0.183789910 0.100632183 0.291901621 0.218467251 0.0870583783 0.118150656 + * 0.187393634 0.259468108 0.121154594 0.222750923 0.0887654054 0.120467336 + * 0.180322176 0.249676859 0.286394044 0.082269756 0.0854157674 0.115921399 + * 0.167667988 0.232155676 0.266296216 0.199303457 0.0267900995 0.107786564 + * 0.170662059 0.236301313 0.271051506 0.202862448 0.0808399227 0.038282752 + */ static const float vertices[] = { 0.f, 0.f, 0.f, @@ -219,6 +230,7 @@ main(int argc, char** argv) CHECK(s3d_scene_begin_trace(scn), RES_OK); FOR_EACH(iprim, 0, 12) { struct sgf_accum* row = gfacc + iprim*12; + ctx.primitive_id = iprim; CHECK(sgf_integrate(smc, &ctx, NSTEPS, row), RES_OK); } @@ -252,11 +264,27 @@ main(int argc, char** argv) } } + /* Estimated value */ + FOR_EACH(iprim, 0, 6) { + const struct sgf_accum* row = gfacc + iprim * 12; + int icol; + FOR_EACH(icol, 0, 6) { + const double E = row[icol].radiative_flux / NSTEPS; + printf("%.6f ", E); + } + printf("\n"); + } + + printf("\n"); + /* Standard error */ FOR_EACH(iprim, 0, 6) { const struct sgf_accum* row = gfacc + iprim * 12; int icol; FOR_EACH(icol, 0, 6) { - printf("%.6f ", row[icol].radiative_flux / NSTEPS); + const double V = row[icol].sqr_radiative_flux / NSTEPS + - (row[icol].radiative_flux*row[icol].radiative_flux) / (NSTEPS*NSTEPS); + const double SE = sqrt(V / NSTEPS); + printf("%.6f ", SE); } printf("\n"); }