commit ac505bc03d32ba51513ec93fd1b35d44d44f1c74
parent 6457a43f42b7387fcca95a30269eb8156daa5b12
Author: Benjamin Piaud <benjamin.piaud@meso-star.com>
Date: Wed, 9 May 2018 14:19:30 +0200
déplacement de emissivity et specular_fraction de material à boundary
Diffstat:
3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/src/stardis-app.c b/src/stardis-app.c
@@ -114,19 +114,6 @@ parse_medium_line(char* line, char** stl_filename, struct material* mat)
fprintf(stderr,"invalid delta\n");
goto error;
}
- tk = strtok(NULL," ");
- res = cstr_to_double(tk, &mat->emissivity);
- if (res != RES_OK || mat->emissivity < 0.0 || mat->emissivity > 1.0){
- fprintf(stderr,"invalid emissivity\n");
- goto error;
- }
- tk = strtok(NULL," ");
- res = cstr_to_double(tk, &mat->specular_fraction);
- if (res != RES_OK ||
- mat->specular_fraction < 0.0 || mat->specular_fraction > 1.0){
- fprintf(stderr,"invalid specular_fraction\n");
- goto error;
- }
tk = strtok(NULL,"\"");
tk = strtok(NULL,"\"");
mat->Tinit = malloc(strlen(tk) + 1);
@@ -154,6 +141,20 @@ parse_boundary_line(char* line, char** stl_filename, struct boundary* bound)
strcpy(*stl_filename,tk);
tk = strtok(NULL," ");
+ res = cstr_to_double(tk, &bound->emissivity);
+ if (res != RES_OK || bound->emissivity < 0.0 || bound->emissivity > 1.0){
+ fprintf(stderr,"invalid emissivity\n");
+ goto error;
+ }
+ tk = strtok(NULL," ");
+ res = cstr_to_double(tk, &bound->specular_fraction);
+ if (res != RES_OK ||
+ bound->specular_fraction < 0.0 || bound->specular_fraction > 1.0){
+ fprintf(stderr,"invalid specular_fraction\n");
+ goto error;
+ }
+
+ tk = strtok(NULL," ");
if (strcmp(tk,"h")==0 || strcmp(tk,"H")==0 ){
tk = strtok(NULL," ");
res = cstr_to_double(tk, &bound->hc);
diff --git a/src/stardis-app.h b/src/stardis-app.h
@@ -99,20 +99,20 @@ struct material{
double rho;
double cp;
double delta;
- double emissivity;
- double specular_fraction;
char* Tinit;
char* power;
};
-#define NULL_MATERIAL__ {0.0 ,0.0 ,0.0, 0.0, 0.0, 0.0, NULL, NULL}
+#define NULL_MATERIAL__ {0.0 ,0.0 ,0.0, 0.0, NULL, NULL}
static const struct material NULL_MATERIAL = NULL_MATERIAL__;
struct boundary{
double hc;
char* T;
char* flux;
+ double emissivity;
+ double specular_fraction;
};
-#define NULL_BOUNDARY__ {-1, NULL, NULL}
+#define NULL_BOUNDARY__ {-1, NULL, NULL, 0.0 , 0.0}
static const struct boundary NULL_BOUNDARY = NULL_BOUNDARY__;
struct camera{
@@ -123,7 +123,7 @@ struct camera{
unsigned spp;
unsigned img[2];
};
-#define NULL_CAMERA__ {{1,1,1},{0,0,0},{0,0,1},70,4,{640,480}}
+#define NULL_CAMERA__ {{1,1,1},{0,0,0},{0,0,1},30,4,{640,480}}
static const struct camera NULL_CAMERA = NULL_CAMERA__;
struct stardis{
diff --git a/src/stardis-compute.c b/src/stardis-compute.c
@@ -473,10 +473,13 @@ stardis_compute(struct stardis* stardis, enum stardis_mode mode)
/* Setup the interface shader */
interface_shader_front.temperature = interface_get_temperature;
interface_shader_front.flux = interface_get_flux;
- interface_shader_front.emissivity = interface_get_emissivity;
- interface_shader_front.specular_fraction = interface_get_alpha;
+ interface_shader_front.emissivity = NULL;
+ interface_shader_front.specular_fraction = NULL;
- interface_shader_back = interface_shader_front;
+ interface_shader_back.temperature = interface_get_temperature;
+ interface_shader_back.flux = NULL;
+ interface_shader_back.emissivity = interface_get_emissivity;
+ interface_shader_back.specular_fraction = interface_get_alpha;
interface_shader_boundary.convection_coef = interface_get_convection_coef;
interface_shader_boundary.front = interface_shader_front;
@@ -490,9 +493,9 @@ stardis_compute(struct stardis* stardis, enum stardis_mode mode)
char* T = stardis->boundary[bound_id].T;
char* flux = stardis->boundary[bound_id].flux;
double emissivity =
- stardis->material[stardis->geometry.triangle[i].medium_front].emissivity;
+ stardis->boundary[stardis->geometry.triangle[i].bound_id].emissivity;
double alpha =
- stardis->material[stardis->geometry.triangle[i].medium_front].specular_fraction;
+ stardis->boundary[stardis->geometry.triangle[i].bound_id].specular_fraction;
SDIS(data_create(dev, sizeof(struct interface), ALIGNOF(struct interface), NULL, &data));
interface_props = sdis_data_get(data);