solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

commit 10614f7eeafcb58d2d6a5012bb1488945a31a282
parent cd15037ed3399d07d77e1104fa030094f068ebef
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  4 Jan 2017 15:55:43 +0100

Rename the solstice_get_ssol_material in ssol_create_ssol_material

Diffstat:
Msrc/solstice_c.h | 2+-
Msrc/solstice_material.c | 5++++-
Msrc/solstice_object.c | 6++++--
3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/solstice_c.h b/src/solstice_c.h @@ -30,7 +30,7 @@ solstice_setup_entities (struct solstice* solstice); extern LOCAL_SYM res_T -solstice_get_ssol_material +solstice_create_ssol_material (struct solstice* solstice, const struct solparser_material_id mtl_id, struct ssol_material** mtl); diff --git a/src/solstice_material.c b/src/solstice_material.c @@ -203,7 +203,7 @@ error: * Local functions ******************************************************************************/ res_T -solstice_get_ssol_material +solstice_create_ssol_material (struct solstice* solstice, const struct solparser_material_id mtl_id, struct ssol_material** out_ssol_mtl) @@ -237,6 +237,7 @@ solstice_get_ssol_material } if(res != RES_OK) goto error; + /* Cache the created material for future use. */ res = htable_material_set(&solstice->materials, &mtl_id.i, &ssol_mtl); if(res != RES_OK) { fprintf(stderr, "Could not register the material into solstice.\n"); @@ -244,6 +245,8 @@ solstice_get_ssol_material } } + /* Get an additional reference onto the material in order to give to the + * caller an ownership onto the returned material. */ SSOL(material_ref_get(ssol_mtl)); exit: diff --git a/src/solstice_object.c b/src/solstice_object.c @@ -374,8 +374,8 @@ create_shaded_shape obj = solparser_get_object(solstice->parser, obj_id); mtl2 = solparser_get_material_double_sided(solstice->parser, obj->mtl2); - solstice_get_ssol_material(solstice, mtl2->front, ssol_front); - solstice_get_ssol_material(solstice, mtl2->back, ssol_back); + solstice_create_ssol_material(solstice, mtl2->front, ssol_front); + solstice_create_ssol_material(solstice, mtl2->back, ssol_back); /* Define the shape transformation */ d33_rotation(transform, obj->rotation[0], obj->rotation[1], obj->rotation[2]); @@ -468,6 +468,8 @@ solstice_instantiate_geometry goto error; } + /* Release the shape and its double sided material since they are now own + * by the object */ SSOL(shape_ref_put(shape)); SSOL(material_ref_put(front)); SSOL(material_ref_put(back));