commit bee17936fa4518df079c00e5077ea21d58c2449c
parent 516b7908bc85efeb55ef1b0cf4e582eeb4b48556
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 20 Oct 2015 16:43:14 +0200
Fix the merging of the loaded/submitted optical properties
Diffstat:
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/sbox_schiff.c b/src/sbox_schiff.c
@@ -190,15 +190,15 @@ merge_properties
while(isrc0 < nsrc0 && isrc1 < nsrc1) {
if(src0[isrc0].W < src1[isrc1].W) {
- memcpy(sa_add(dst, 4), src0 + isrc0, sizeof_prop);
- isrc0 += 4;
+ sa_push(dst, src0[isrc0]);
+ ++isrc0;
} else if(src1[isrc1].W < src0[isrc0].W) {
- memcpy(sa_add(dst, 4), src1 + isrc1, sizeof_prop);
- isrc1 += 4;
+ sa_push(dst, src1[isrc1]);
+ ++isrc1;
} else { /* src0[isrc0].W == src1[isrc1].W */
- memcpy(sa_add(dst, 4), src0 + isrc0, sizeof_prop);
- isrc0 += 4;
- isrc1 += 4;
+ sa_push(dst, src0[isrc0]);
+ ++isrc0;
+ ++isrc1;
}
if(isrc0 >= nsrc0 && isrc1 < nsrc1) {
@@ -237,6 +237,7 @@ cmd_func_schiff_sphere(struct sbox* sbox, const int argc, char** argv, void* ctx
struct schiff_sphere_args args = SCHIFF_SPHERE_ARGS_NULL;
struct sbox_schiff_optical_properties* mtl_props = NULL;
const size_t sizeof_prop = sizeof(struct sbox_schiff_optical_properties);
+ size_t i;
res_T res = RES_OK;
(void)ctx;
@@ -269,6 +270,7 @@ cmd_func_schiff_sphere(struct sbox* sbox, const int argc, char** argv, void* ctx
mtl_props = NULL;
} else if(args.props && mtl_props) {
merge_properties(&args.props, mtl_props);
+ sa_release(mtl_props);
mtl_props = NULL;
}
@@ -279,6 +281,11 @@ cmd_func_schiff_sphere(struct sbox* sbox, const int argc, char** argv, void* ctx
goto error;
}
+ FOR_EACH(i, 0, sa_size(args.props)) {
+ printf("%g %g %g %g\n",
+ args.props[i].W, args.props[i].Nr, args.props[i].Kr, args.props[i].Ne);
+ }
+
exit:
sa_release(args.props);
sa_release(args.wavelengths);