commit 3a660ba7a83168ebd18642fb645f55225f7438df
parent 6ff8b7f43e1fc37aabd35fd9bb8b9019693492da
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 5 Mar 2021 09:28:56 +0100
Rollback radiative flux optimisation on self
Diffstat:
7 files changed, 6 insertions(+), 68 deletions(-)
diff --git a/src/sdis_Xd_begin.h b/src/sdis_Xd_begin.h
@@ -109,11 +109,10 @@ struct XD(temperature) {
struct XD(rwalk)* rwalk,
struct ssp_rng* rng,
struct XD(temperature)* temp);
- void* ctx;
double value; /* Current value of the temperature */
int done;
};
-static const struct XD(temperature) XD(TEMPERATURE_NULL) = { NULL, NULL, 0, 0 };
+static const struct XD(temperature) XD(TEMPERATURE_NULL) = { NULL, 0, 0 };
#endif /* SDIX_<2|3>D_H */
diff --git a/src/sdis_heat_path_radiative_Xd.h b/src/sdis_heat_path_radiative_Xd.h
@@ -75,7 +75,6 @@ XD(trace_radiative_path)
if(SXD_HIT_NONE(&rwalk->hit)) { /* Fetch the ambient radiative temperature */
rwalk->hit_side = SDIS_SIDE_NULL__;
if(ctx->Tarad >= 0) {
- struct radiative_path_ctx* rpctx = T->ctx;
T->value += ctx->Tarad;
T->done = 1;
@@ -95,9 +94,6 @@ XD(trace_radiative_path)
(ctx->heat_path, &vtx, T->value, SDIS_HEAT_VERTEX_RADIATIVE);
if(res != RES_OK) goto error;
}
- if(rpctx && rpctx->status == FIRST_ABS_NOT_DEF_YET) {
- rpctx->status = FIRST_ABS_OTHER;
- }
break;
} else {
log_err(scn->dev,
@@ -144,21 +140,8 @@ XD(trace_radiative_path)
/* Switch in boundary temperature ? */
r = ssp_rng_canonical(rng);
if(r < epsilon) {
- struct radiative_path_ctx* rpctx = T->ctx;
T->func = XD(boundary_path);
rwalk->mdm = NULL; /* The random walk is at an interface between 2 media */
- if(rpctx && rpctx->status == FIRST_ABS_NOT_DEF_YET) {
- /* Check if first absorption is with self or with other */
- int is_self = rpctx->self
- && htable_primitive_ids_find(rpctx->self, &rwalk->hit.prim.prim_id);
- rpctx->status = is_self ? FIRST_ABS_SELF : FIRST_ABS_OTHER;
- /* When computing radiative temperature and first absorption is with
- * self, the end-of-path temperature is not used: just don't compute it! */
- if(is_self) {
- T->value = -1;
- T->done = 1;
- }
- }
break;
}
diff --git a/src/sdis_misc.h b/src/sdis_misc.h
@@ -20,14 +20,6 @@
#include <rsys/float3.h>
#include <star/ssp.h>
-struct htable_primitive_ids;
-
-#include <rsys/hash_table.h>
-#define HTABLE_NAME primitive_ids
-#define HTABLE_KEY unsigned
-#define HTABLE_DATA char
-#include <rsys/hash_table.h>
-
struct bound_flux_result {
double Tradiative;
double Tboundary;
@@ -37,18 +29,6 @@ struct bound_flux_result {
static const struct bound_flux_result
BOUND_FLUX_RESULT_NULL = BOUND_FLUX_RESULT_NULL__;
-enum rad_path_first_abs {
- FIRST_ABS_NOT_DEF_YET,
- FIRST_ABS_SELF,
- FIRST_ABS_OTHER
-};
-
-struct radiative_path_ctx {
- struct htable_primitive_ids* self;
- enum rad_path_first_abs status;
-};
-#define RADIATIVE_PATH_CTX_NULL__ { NULL, FIRST_ABS_NOT_DEF_YET }
-
struct accum {
double sum; /* Sum of MC weights */
double sum2; /* Sum of square MC weights */
diff --git a/src/sdis_realisation.h b/src/sdis_realisation.h
@@ -26,7 +26,6 @@ struct green_path_handle;
struct sdis_heat_path;
struct sdis_scene;
struct ssp_rng;
-struct htable_primitive_ids;
struct bound_flux_result;
enum flux_flag {
@@ -94,7 +93,6 @@ boundary_flux_realisation_2d
(struct sdis_scene* scn,
struct ssp_rng* rng,
const size_t iprim,
- struct htable_primitive_ids* self,
const double uv[1],
const double time,
const enum sdis_side solid_side,
@@ -106,7 +104,6 @@ boundary_flux_realisation_3d
(struct sdis_scene* scn,
struct ssp_rng* rng,
const size_t iprim,
- struct htable_primitive_ids* self,
const double uv[2],
const double time,
const enum sdis_side solid_side,
diff --git a/src/sdis_realisation_Xd.h b/src/sdis_realisation_Xd.h
@@ -279,7 +279,6 @@ XD(boundary_flux_realisation)
(struct sdis_scene* scn,
struct ssp_rng* rng,
const size_t iprim,
- struct htable_primitive_ids* self, /* NULL for probe computations */
const double uv[DIM],
const double time,
const enum sdis_side solid_side,
@@ -293,7 +292,6 @@ XD(boundary_flux_realisation)
struct sXd(primitive) prim;
struct sdis_interface* interf = NULL;
struct sdis_medium* fluid_mdm = NULL;
- struct radiative_path_ctx rpctx = RADIATIVE_PATH_CTX_NULL__;
#if SDIS_XD_DIMENSION == 2
float st;
@@ -343,7 +341,6 @@ XD(boundary_flux_realisation)
dX(set)(rwalk.vtx.P, P); \
fX(set)(rwalk.hit.normal, N); \
T = XD(TEMPERATURE_NULL); \
- T.ctx = NULL; \
} (void)0
/* Compute boundary temperature */
@@ -360,18 +357,11 @@ XD(boundary_flux_realisation)
/* Compute radiative temperature */
if(compute_radiative) {
RESET_WALK(fluid_side, fluid_mdm);
- rpctx.self = self;
- T.ctx = &rpctx;
T.func = XD(radiative_path);
res = XD(compute_temperature)(scn, &ctx, &rwalk, rng, &T);
if(res != RES_OK) return res;
-
- if(rpctx.status == FIRST_ABS_SELF) {
- result->Tradiative = -1;
- } else {
- ASSERT(T.value >= 0);
- result->Tradiative = T.value;
- }
+ ASSERT(T.value >= 0);
+ result->Tradiative = T.value;
}
/* Compute fluid temperature */
diff --git a/src/sdis_solve_boundary_Xd.h b/src/sdis_solve_boundary_Xd.h
@@ -446,8 +446,6 @@ XD(solve_boundary_flux)
int64_t irealisation;
size_t i;
size_t view_nprims;
- struct htable_primitive_ids self;
- int self_initialized = 0;
int progress = 0;
ATOMIC nsolved_realisations = 0;
ATOMIC res = RES_OK;
@@ -472,12 +470,8 @@ XD(solve_boundary_flux)
if(scene_is_2d(scn) != 0) { res = RES_BAD_ARG; goto error; }
#endif
- htable_primitive_ids_init(scn->dev->allocator, &self);
- self_initialized = 1;
SXD(scene_view_primitives_count(scn->sXd(view), &view_nprims));
FOR_EACH(i, 0, args->nprimitives) {
- char one = 1;
- unsigned prim;
if(args->primitives[i] >= view_nprims) {
log_err(scn->dev,
"%s: invalid primitive identifier `%lu'. It must be in the [0 %lu] range.\n",
@@ -487,10 +481,6 @@ XD(solve_boundary_flux)
res = RES_BAD_ARG;
goto error;
}
- prim = (unsigned)args->primitives[i];
- /* We don't reject multiple occurences */
- res = htable_primitive_ids_set(&self, &prim, &one);
- if(res != RES_OK) goto error;
}
/* Create the Star-XD shape of the boundary */
@@ -665,7 +655,7 @@ XD(solve_boundary_flux)
flux_mask = 0;
if(hr > 0) flux_mask |= FLUX_FLAG_RADIATIVE;
if(hc > 0) flux_mask |= FLUX_FLAG_CONVECTIVE;
- res_simul = XD(boundary_flux_realisation)(scn, rng, iprim, &self, uv, time,
+ res_simul = XD(boundary_flux_realisation)(scn, rng, iprim, uv, time,
solid_side, flux_mask, &result);
/* Stop time registration */
@@ -762,7 +752,6 @@ exit:
if(view) SXD(scene_view_ref_put(view));
if(rng_proxy) SSP(rng_proxy_ref_put(rng_proxy));
if(out_estimator) *out_estimator = estimator;
- if(self_initialized) htable_primitive_ids_release(&self);
return (res_T)res;
error:
if(estimator) {
diff --git a/src/sdis_solve_probe_boundary_Xd.h b/src/sdis_solve_probe_boundary_Xd.h
@@ -513,8 +513,8 @@ XD(solve_probe_boundary_flux)
flux_mask = 0;
if(hr > 0) flux_mask |= FLUX_FLAG_RADIATIVE;
if(hc > 0) flux_mask |= FLUX_FLAG_CONVECTIVE;
- res_simul = XD(boundary_flux_realisation)(scn, rng, args->iprim, NULL,
- args->uv, time, solid_side, flux_mask, &result);
+ res_simul = XD(boundary_flux_realisation)(scn, rng, args->iprim, args->uv,
+ time, solid_side, flux_mask, &result);
/* Stop time registration */
time_sub(&t0, time_current(&t1), &t0);