commit 8f0c06484abee2a53a1e250d9604f08c936fe802
parent be688d494a1d919d71f9683f1193386d1b9402ca
Author: Eduardo Fontana Lazzari <edufonlaz@gmail.com>
Date: Wed, 14 Jan 2026 17:43:58 +0100
Improve code style consistency
Standardize tabs, spaces, and includes across the codebase.
Ensure lines do not exceed 80 characters.
Diffstat:
16 files changed, 279 insertions(+), 235 deletions(-)
diff --git a/src/sphor.c b/src/sphor.c
@@ -37,6 +37,7 @@
#include <fcntl.h> /* open */
#include <unistd.h> /* close */
#include <sys/stat.h> /* S_IRUSR & S_IWUSR */
+
/*******************************************************************************
* Helper functions
******************************************************************************/
@@ -84,7 +85,7 @@ open_output_stream
FILE* fp = NULL;
int fd = -1;
- if(args->force) {
+ if (args->force) {
fp = fopen(args->output_filename, "w");
if (NULL == fp) {
ERROR
@@ -128,6 +129,7 @@ error:
}
goto exit;
}
+
/*******************************************************************************
* Exported functions
******************************************************************************/
@@ -225,4 +227,3 @@ exit:
error:
goto exit;
}
-
diff --git a/src/sphor_accum.c b/src/sphor_accum.c
@@ -22,9 +22,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "sphor.h"
#include "sphor_accum.h"
+#include <math.h>
+
+struct mem_allocator;
+
/*******************************************************************************
* Local functions
******************************************************************************/
@@ -97,11 +100,11 @@ accum_copy_and_release
extern LOCAL_SYM res_T
register_accum
- (struct mem_allocator* allocator,
- char* observable,
- char* sensor,
- char* component,
- struct darray_accum *accums)
+ (struct mem_allocator* allocator,
+ char* observable,
+ char* sensor,
+ char* component,
+ struct darray_accum *accums)
{
struct accum accum = ACCUM_NULL;
res_T res = RES_OK;
@@ -123,8 +126,8 @@ error:
extern LOCAL_SYM void
accum_compute_estim
- (const struct accum* accum,
- struct estim* estim)
+ (const struct accum* accum,
+ struct estim* estim)
{
double sum = 0;
double sum2 = 0;
@@ -151,8 +154,8 @@ accum_compute_estim
extern LOCAL_SYM void
write_accum_estim
- (const struct accum* accum,
- FILE* stream)
+ (const struct accum* accum,
+ FILE* stream)
{
struct estim estim = ESTIM_NULL;
@@ -161,7 +164,7 @@ write_accum_estim
accum_compute_estim(accum, &estim);
- if(0 != strcmp("\0", str_cget(&accum->component))){
+ if (0 != strcmp("\0", str_cget(&accum->component))){
fprintf
(stream, "%s:%s:%s:%lf:%lf\n",
str_cget(&accum->observable),
@@ -222,8 +225,8 @@ accums_add
extern LOCAL_SYM void
sum_accums
- (const struct darray_accum* accums,
- struct accum* tot_accum)
+ (const struct darray_accum* accums,
+ struct accum* tot_accum)
{
size_t j = 0;
size_t accum_count = 0;
@@ -262,10 +265,10 @@ sum_accum_lists
extern LOCAL_SYM void
update_accum
- (const struct htable_accum2id* accum2id,
- const struct accum_key* accum_key,
- const double weight,
- struct darray_accum* accums)
+ (const struct htable_accum2id* accum2id,
+ const struct accum_key* accum_key,
+ const double weight,
+ struct darray_accum* accums)
{
size_t* paccum_id = NULL;
struct accum* accum = NULL;
diff --git a/src/sphor_accum.h b/src/sphor_accum.h
@@ -28,9 +28,13 @@
#include "sphor_interface.h"
#include <rsys/dynamic_array.h>
+#include <rsys/hash.h> /* hash_fnv64 */
#include <rsys/hash_table.h>
+#include <rsys/rsys.h>
#include <rsys/str.h>
+struct mem_allocator;
+
struct accum {
struct str observable; /* Type of observable */
struct str sensor; /* Volume name or surface name */
@@ -86,13 +90,13 @@ accum_copy_and_release
extern LOCAL_SYM void
accum_compute_estim
- (const struct accum* accum,
- struct estim* estim);
+ (const struct accum* accum,
+ struct estim* estim);
extern LOCAL_SYM void
write_accum_estim
- (const struct accum* accum,
- FILE* stream);
+ (const struct accum* accum,
+ FILE* stream);
/* Add two accums and return it in result */
extern LOCAL_SYM void
@@ -121,8 +125,8 @@ accum_add
static INLINE char
accum_key_eq
- (const struct accum_key* a,
- const struct accum_key* b)
+ (const struct accum_key* a,
+ const struct accum_key* b)
{
ASSERT(NULL != a);
ASSERT(NULL != b);
@@ -140,7 +144,7 @@ accum_key_eq
* (see https://en.wikipedia.org/wiki/Data_structure_alignment). */
static INLINE size_t
accum_key_hash
- (const struct accum_key* accum_key)
+ (const struct accum_key* accum_key)
{
size_t key[3] = {0};
size_t hash = 0;
@@ -172,17 +176,17 @@ accum_key_hash
extern LOCAL_SYM res_T
register_accum
- (struct mem_allocator* allocator,
- char* observable,
- char* sensor,
- char* component,
- struct darray_accum *accums);
+ (struct mem_allocator* allocator,
+ char* observable,
+ char* sensor,
+ char* component,
+ struct darray_accum *accums);
/* Add all the elements (sum) of an accum list and return it in result */
extern LOCAL_SYM void
sum_accums
- (const struct darray_accum* accums,
- struct accum* result);
+ (const struct darray_accum* accums,
+ struct accum* result);
/* Add the elements of same index in two different accum lists and return it in
* result */
@@ -201,9 +205,9 @@ sum_accum_lists
extern LOCAL_SYM void
update_accum
- (const struct htable_accum2id* accum2id,
- const struct accum_key* accum_key,
- const double weight,
- struct darray_accum* accums);
+ (const struct htable_accum2id* accum2id,
+ const struct accum_key* accum_key,
+ const double weight,
+ struct darray_accum* accums);
#endif /* SPHOR_ACCUM_H */
diff --git a/src/sphor_c.h b/src/sphor_c.h
@@ -28,11 +28,11 @@
#include "sphor_interface.h"
#include "sphor_sources.h"
-#include <rsys/double3.h>
-#include <rsys/dynamic_array.h>
-#include <rsys/hash_table.h>
#include <rsys/logger.h>
#include <rsys/ref_count.h>
+#include <rsys/rsys.h>
+
+#include <stdio.h>
/* Helper macros for logging */
#define LOG__(Dev, Lvl, Type, ...) { \
@@ -44,10 +44,7 @@
#define INFO(Dev, ...) LOG__(Dev, 3, LOG_OUTPUT, __VA_ARGS__)
/* Forward declarations */
-struct logger;
-struct mem_allocator;
struct s3d_scene_view;
-struct sphin_config;
struct sphin_geometry_descriptor;
struct sphor_create_args;
struct suniq;
diff --git a/src/sphor_compute_mvrea.c b/src/sphor_compute_mvrea.c
@@ -22,20 +22,27 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "sphor.h"
#include "sphor_c.h"
#include "sphor_accum.h"
#include "sphor_compute_mvrea.h"
#include "sphor_interface.h"
#include "sphor_ran_source.h"
+#include <rsys/double3.h>
+#include <rsys/mem_allocator.h>
+#include <rsys/rsys.h>
#include <star/sphin.h>
-#include <star/s3d.h>
#include <star/ssp.h>
#include <star/ssf.h>
-#include <rsys/dynamic_array.h>
-#include <rsys/hash_table.h>
+
#include <omp.h>
+#include <limits.h>
+
+struct sphin_prop_rad;
+struct sphin_volume;
+struct ssf_bsdf;
+struct ssf_fresnel;
+struct ssp_rng;
/* Syntactic sugar */
#define ALL_COMPONENTS INVALID_ID
@@ -53,9 +60,9 @@ enum ray_interface_interaction_type {
******************************************************************************/
static res_T
setup_MVREA_surfaces_accum
- (struct sphor* sphor,
- struct htable_accum2id* accum2id,
- struct darray_accum* accums)
+ (struct sphor* sphor,
+ struct htable_accum2id* accum2id,
+ struct darray_accum* accums)
{
size_t accum_id = 0;
res_T res = RES_OK;
@@ -66,7 +73,7 @@ setup_MVREA_surfaces_accum
res = register_accum
(sphor->allocator, "LOSSES", "\0", "\0", accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
accum_id = darray_accum_size_get(accums) - 1;
/* Set corresponding entry in the accum2id hash table */
@@ -75,7 +82,7 @@ setup_MVREA_surfaces_accum
accum_key.sensor_id = INVALID_ID;
accum_key.component_id = INVALID_ID;
res = htable_accum2id_set(accum2id, &accum_key, &accum_id);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
exit:
return res;
@@ -85,9 +92,9 @@ error:
static res_T
setup_MVREA_per_surface_accums
- (struct sphor* sphor,
- struct htable_accum2id* accum2id,
- struct darray_accum* accums)
+ (struct sphor* sphor,
+ struct htable_accum2id* accum2id,
+ struct darray_accum* accums)
{
char* surface_name = NULL;
size_t accum_id = 0;
@@ -103,21 +110,21 @@ setup_MVREA_per_surface_accums
ASSERT(NULL != accums);
res = sphin_config_get_surface_count(config, &surface_count);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
FOR_EACH(i_surface, 0, surface_count){
res = sphin_config_get_surface(config, i_surface, &surface);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_surface_get_sensor(surface, &sensor);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != sensor) {
res = sphin_surface_get_name(surface, &surface_name);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = register_accum
(sphor->allocator, "LOSSES", surface_name, "\0", accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
accum_id = darray_accum_size_get(accums) - 1;
/* Set corresponding entry in the accum2id hash table */
@@ -125,7 +132,7 @@ setup_MVREA_per_surface_accums
accum_key.sensor_type = SPHOR_SENSOR_SURFACE;
accum_key.sensor_id = i_surface;
res = htable_accum2id_set(accum2id, &accum_key, &accum_id);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
}
@@ -150,7 +157,7 @@ setup_MVREA_volumes_accum
res = register_accum
(sphor->allocator, "MVREA", "\0", "\0", accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
accum_id = darray_accum_size_get(accums) - 1;
/* Set corresponding entry in the accum2id hash table */
@@ -186,21 +193,21 @@ setup_MVREA_per_volume_accums
ASSERT(NULL != accums);
res = sphin_config_get_volume_count(config, &volume_count);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
FOR_EACH(i_volume, 0, volume_count){
res = sphin_config_get_volume(config, i_volume, &volume);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_volume_get_sensor(volume, &sensor);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != sensor) {
res = sphin_volume_get_name(volume, &volume_name);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = register_accum
(sphor->allocator, "MVREA", volume_name, "\0", accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
accum_id = darray_accum_size_get(accums) - 1;
/* Set corresponding entry in the accum2id hash table */
@@ -209,7 +216,7 @@ setup_MVREA_per_volume_accums
accum_key.sensor_id = i_volume;
accum_key.component_id = INVALID_ID;
res = htable_accum2id_set(accum2id, &accum_key, &accum_id);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
}
@@ -222,9 +229,9 @@ error:
static res_T
setup_MVREA_per_volume_component_accums
- (struct sphor* sphor,
- struct htable_accum2id *accum2id,
- struct darray_accum* accums)
+ (struct sphor* sphor,
+ struct htable_accum2id *accum2id,
+ struct darray_accum* accums)
{
char* volume_name = NULL;
char* prop_rad_name = NULL;
@@ -243,32 +250,32 @@ setup_MVREA_per_volume_component_accums
ASSERT(NULL != accums);
res = sphin_config_get_volume_count(config, &volume_count);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
FOR_EACH(i_volume, 0, volume_count){
res = sphin_config_get_volume(config, i_volume, &volume);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_volume_get_sensor(volume, &sensor);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != sensor) {
res = sphin_volume_get_name(volume, &volume_name);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_volume_get_prop_rad_count(volume, &prop_rad_count);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
FOR_EACH(j_proprad, 0, prop_rad_count){
res = sphin_volume_get_prop_rad(volume, j_proprad, &prop_rad);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_prop_rad_get_name(prop_rad, &prop_rad_name);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = register_accum
(sphor->allocator, "MVREA", volume_name, prop_rad_name, accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
accum_id = darray_accum_size_get(accums) - 1;
/* Set corresponding entry in the accum2id hash table */
@@ -277,7 +284,7 @@ setup_MVREA_per_volume_component_accums
accum_key.sensor_id = i_volume;
accum_key.component_id = j_proprad;
res = htable_accum2id_set(accum2id, &accum_key, &accum_id);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
}
@@ -291,9 +298,9 @@ error:
static res_T
setup_MVREA_accums
- (struct sphor *sphor,
- struct htable_accum2id *accum2id,
- struct darray_accum *accums)
+ (struct sphor *sphor,
+ struct htable_accum2id *accum2id,
+ struct darray_accum *accums)
{
res_T res = RES_OK;
@@ -302,23 +309,24 @@ setup_MVREA_accums
/* Total MVREA in the scene */
res = setup_MVREA_volumes_accum(sphor, accum2id, accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
- /* One accum per sensor volume; all components of the volume contribute to the accum */
+ /* One accum per sensor volume; all components of the volume contribute
+ * to the accum */
res = setup_MVREA_per_volume_accums(sphor, accum2id, accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* One accum per component per sensor volume */
res = setup_MVREA_per_volume_component_accums(sphor, accum2id, accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* Total losses in the scene */
res = setup_MVREA_surfaces_accum(sphor, accum2id, accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* One accum per sensor surface */
res = setup_MVREA_per_surface_accums(sphor, accum2id, accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
exit:
return res;
error:
@@ -338,17 +346,17 @@ prop_rad_compute_ka
res_T res = RES_OK;
res = sphin_prop_rad_get_scatterer(prop_rad, &scatterer);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_scatterer_get_concentration(scatterer, &concentration);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_scatterer_get_abs_cross_sec(scatterer, &abs_cross_sec);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_spectral_property_interpolate_at_wavelength
(abs_cross_sec, wavelength, SPHIN_INTERPOLATION_LINEAR, &sigma_a);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
*ka = concentration * sigma_a;
exit:
@@ -384,15 +392,15 @@ volume_compute_total_ka
/* Get ka corresponding to the current wavelength */
res = sphin_volume_get_prop_rad_count
((struct sphin_volume*)volume, &prop_rad_count);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
FOR_EACH(j, 0, prop_rad_count) {
double ka_i = 0;
res = sphin_volume_get_prop_rad((struct sphin_volume*)volume, j, &prop_rad);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = prop_rad_compute_ka(prop_rad, wavelength, &ka_i);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
ka += ka_i;
}
@@ -417,7 +425,7 @@ volume_get_from_primitive
volume_id = primitive->interface->volumes[primitive->side];
- if(INVALID_ID != volume_id) {
+ if (INVALID_ID != volume_id) {
SPHIN(config_get_volume(sphor->config, volume_id, &volume));
}
@@ -449,42 +457,42 @@ setup_bsdf_from_sphin_brdf
primitive = (struct primitive*)&intersection->position.primitive;
res = primitive_get_brdf(sphor, primitive, &brdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL == brdf) { res = RES_BAD_ARG; goto error; }
res = sphin_brdf_get_type(brdf, &brdf_type);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
switch (brdf_type) {
case SPHIN_BRDF_LAMBERT:
res = sphin_brdf_lambertian_get_reflectivity(brdf, &reflectivity);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = ssf_bsdf_create
(sphor->allocator, &ssf_lambertian_reflection, &bsdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = ssf_lambertian_reflection_setup(bsdf, reflectivity);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
break;
case SPHIN_BRDF_SPECULAR:
res = sphin_brdf_specular_get_reflectivity(brdf, &reflectivity);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = ssf_bsdf_create
(sphor->allocator, &ssf_specular_reflection, &bsdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = ssf_fresnel_create
(sphor->allocator, &ssf_fresnel_constant, &fresnel);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = ssf_fresnel_constant_setup(fresnel, reflectivity);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = ssf_specular_reflection_setup(bsdf, fresnel);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
break;
case SPHIN_BRDF_NONE__:
@@ -524,21 +532,21 @@ setup_bsdf_from_refractive_indices
/* Get refractive index of the medium in the incident side */
res = primitive_get_in_refraction_index
(sphor, primitive, wavelength, &n_real_i, &n_imag_i);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* Get refractive index of the medium in the transmitted side */
res = primitive_get_out_refraction_index
(sphor, primitive, wavelength, &n_real_t, &n_imag_t);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* Sample an interaction type and a new direction using ssf */
res = ssf_bsdf_create
(sphor->allocator, &ssf_specular_dielectric_dielectric_interface, &bsdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = ssf_specular_dielectric_dielectric_interface_setup
(bsdf, n_real_i, n_real_t);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
exit:
*out_bsdf = bsdf;
@@ -550,13 +558,13 @@ error:
static res_T
sample_interface_ray_interaction
- (struct sphor* sphor,
- struct ssp_rng* rng,
- struct ray* ray,
- struct intersection* intersection,
- double wavelength,
- double dir[3],
- enum ray_interface_interaction_type* interaction_type)
+ (struct sphor* sphor,
+ struct ssp_rng* rng,
+ struct ray* ray,
+ struct intersection* intersection,
+ double wavelength,
+ double dir[3],
+ enum ray_interface_interaction_type* interaction_type)
{
double invert_normal = 0;
double normal[3] = {0};
@@ -588,15 +596,15 @@ sample_interface_ray_interaction
/* Verify if one of the surfaces defined in the intersected interface
* side has a BRDF defined */
res = primitive_get_brdf(sphor, primitive, &brdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
- if(NULL != brdf) {
+ if (NULL != brdf) {
/* If the interface side is a sphin_surface with a BRDF declared,
* verify if a reflection takes place based on the reflectivity of the
* surface */
res = setup_bsdf_from_sphin_brdf
(sphor, ray, intersection, &fresnel, &bsdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
@@ -606,7 +614,7 @@ sample_interface_ray_interaction
else {
res = setup_bsdf_from_refractive_indices
(sphor, intersection, wavelength, &bsdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
ssf_bsdf_sample(bsdf, rng, wo, normal, sample, &flag, &pdf);
@@ -634,9 +642,9 @@ error:
static res_T
MVREA_write_outputs
- (struct sphor* sphor,
- const struct darray_accum* accums,
- size_t nfailures)
+ (struct sphor* sphor,
+ const struct darray_accum* accums,
+ size_t nfailures)
{
size_t samples = 0;
size_t i = 0;
@@ -659,10 +667,10 @@ MVREA_write_outputs
static res_T
compute_MVREA_realization
- (struct sphor* sphor,
- struct ssp_rng* rng,
- struct htable_accum2id* accum2id,
- struct darray_accum* accums)
+ (struct sphor* sphor,
+ struct ssp_rng* rng,
+ struct htable_accum2id* accum2id,
+ struct darray_accum* accums)
{
/* Star-Phor Input */
struct sphin_sensor_volume* sensor_volume = NULL;
@@ -690,7 +698,7 @@ compute_MVREA_realization
res_T res = RES_OK;
#define CALL(Function) { \
res = Function; \
- if(RES_OK != res) goto error; \
+ if (RES_OK != res) goto error; \
} (void)0
/* Pre-conditions */
@@ -758,16 +766,16 @@ compute_MVREA_realization
/* Get the total three-dimensional space occupied by the volume */
res = sphin_volume_compute_total_size(volume, &vol_size/*[m^3]*/);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_config_get_total_surface_power(sphor->config, &tot_pow);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
mc_weight = tot_pow / vol_size;
res = sphin_sensor_volume_get_response_function
(sensor_volume, &response_function);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_volume_get_prop_rad_count(volume, &prop_rad_count);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
volume_id = intersection.position.primitive.interface->volumes
[intersection.position.primitive.side];
@@ -790,9 +798,9 @@ compute_MVREA_realization
double ka_i = 0;
struct sphin_prop_rad* prop_rad = NULL;
res = sphin_volume_get_prop_rad(volume, i_proprad, &prop_rad);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = prop_rad_compute_ka(prop_rad, wavelength, &ka_i);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
accum_key.component_id = i_proprad;
mc_weight = ka_i / ka * tot_pow / vol_size;
@@ -812,7 +820,9 @@ compute_MVREA_realization
/* in: */ rng, &ray, &intersection, wavelength,
/* out: */ dir, &ray_interface_interaction_type));
- if(RAY_INTERFACE_INTERACTION_ABSORPTION == ray_interface_interaction_type) {
+ if (RAY_INTERFACE_INTERACTION_ABSORPTION ==
+ ray_interface_interaction_type)
+ {
/* TODO: verify if surface is sensor and update its accum
res = primitive_get_sensor_surface(sphor,
&intersection.position.primitive, &sensor_surface); if (RES_OK !=
@@ -825,8 +835,10 @@ compute_MVREA_realization
/* Absorption => stop the path */
stop = 1;
-
- } else if(RAY_INTERFACE_INTERACTION_TRANSMISSION == ray_interface_interaction_type) {
+ }
+ else if (RAY_INTERFACE_INTERACTION_TRANSMISSION ==
+ ray_interface_interaction_type)
+ {
/* Continue the path on the other side of the primitive.*/
intersection.position.primitive.side =
!intersection.position.primitive.side;
@@ -838,8 +850,10 @@ compute_MVREA_realization
(sphor, &intersection.position.primitive);
CALL(volume_compute_total_ka(sphor, volume, wavelength, &ka));
-
- } else if(RAY_INTERFACE_INTERACTION_REFLECTION == ray_interface_interaction_type) {
+ }
+ else if (RAY_INTERFACE_INTERACTION_REFLECTION ==
+ ray_interface_interaction_type)
+ {
CALL(ray_update(/* in/out: */ &ray, /* in: */ &intersection, dir));
}
}
@@ -858,7 +872,7 @@ error:
******************************************************************************/
res_T
sphor_compute_MVREA
- (struct sphor* sphor)
+ (struct sphor* sphor)
{
res_T res = RES_OK;
size_t nthreads = 0;
@@ -884,12 +898,12 @@ sphor_compute_MVREA
/* Create and initialize dynamic array o accums (one per observable) */
res = setup_MVREA_accums(sphor, &accum2id, &accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* Create an array containing nthreads pointers to different accums lists */
darray_accum_list_init(sphor->allocator, &accums_threads);
res = darray_accum_list_resize(&accums_threads, nthreads);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* Mem allocation of the accummulator list of each one of the threads
* Each thread handles a copy of the global accum list just created */
@@ -897,7 +911,7 @@ sphor_compute_MVREA
struct darray_accum* accum_thread;
accum_thread = darray_accum_list_data_get(&accums_threads) + i;
res = darray_accum_copy(accum_thread, &accums);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
/* Create of the proxy generator RNG_MT19937_64 (Mersenne Twister) */
@@ -911,7 +925,7 @@ sphor_compute_MVREA
/* Set one generator per thread using the proxy generator */
FOR_EACH(i, 0, nthreads) {
res = ssp_rng_proxy_create_rng(rng_proxy, i, &rngs[i]);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
omp_set_num_threads((int)nthreads);
@@ -957,7 +971,7 @@ exit:
if (NULL != rng_proxy) ssp_rng_proxy_ref_put(rng_proxy);
if (NULL != rngs) {
FOR_EACH(i, 0, nthreads) {
- if(NULL != rngs[i]) ssp_rng_ref_put(rngs[i]);
+ if (NULL != rngs[i]) ssp_rng_ref_put(rngs[i]);
}
mem_rm(rngs);
}
diff --git a/src/sphor_compute_mvrea.h b/src/sphor_compute_mvrea.h
@@ -28,10 +28,9 @@
/* Forward declarations */
struct sphor;
-struct sphor_create_args;
extern LOCAL_SYM res_T
sphor_compute_MVREA
- (struct sphor* sphor);
+ (struct sphor* sphor);
#endif /* SPHOR_COMPUTE_MVREA_H */
diff --git a/src/sphor_config.c b/src/sphor_config.c
@@ -24,12 +24,18 @@
#include "sphor.h"
#include "sphor_c.h"
+#include "sphor_interface.h"
+#include "sphor_sources.h"
-#include <rsys/float3.h>
+#include <rsys/double3.h>
+#include <rsys/rsys.h>
#include <star/sphin.h>
#include <star/s3d.h>
#include <star/suniq.h>
+struct s3d_scene_view;
+struct suniq;
+
/*******************************************************************************
* Helper functions
******************************************************************************/
@@ -65,14 +71,14 @@ are_triangles_reversed
ASSERT(NULL != tri1);
FOR_EACH(i, 0, 3) {
- if(0 == vec3_cmp(tri0->vertices[0], tri1->vertices[i])) { break; }
+ if (0 == vec3_cmp(tri0->vertices[0], tri1->vertices[i])) { break; }
}
ASSERT(i<3);
/* Check the order of the next vertex:
* If tri0->v1 matches the next vertex in tri1 (cyclically),
* the triangles have the same orientation (not reversed).
* Otherwise, the vertex order has been reversed. */
- if(0 == vec3_cmp(tri0->vertices[1], tri1->vertices[(i+1)%3])) {
+ if (0 == vec3_cmp(tri0->vertices[1], tri1->vertices[(i+1)%3])) {
return 0; /* Same orientation */
} else {
ASSERT(0 == vec3_cmp(tri0->vertices[1], tri1->vertices[(i+2)%3]));
@@ -154,7 +160,7 @@ setup_interface_volume_geometry_triangle
side = (size_t) flip ^ geom_desc->side;
- if(INVALID_ID != interface->volumes[side]) {
+ if (INVALID_ID != interface->volumes[side]) {
ERROR(sphor,
"Redefinition of volume side in triangle from file '%s'.\n",
geom_desc->filename);
@@ -302,9 +308,10 @@ setup_interface_surface_geometry_triangle
surf_count = interface->surface_count[side];
- if(MAX_SURFACE_COUNT <= surf_count) {
+ if (MAX_SURFACE_COUNT <= surf_count) {
ERROR(sphor,
- "Too many surfaces on the same side of interface defined by triangle from file '%s'. "
+ "Too many surfaces on the same side of interface "
+ "defined by triangle from file '%s'. "
"Maximum allowed: %d\n",
geom_desc->filename, MAX_SURFACE_COUNT);
res = RES_MEM_ERR;
@@ -531,7 +538,7 @@ hit_filter_function
size_t* prim_id = primitive_id;
- if(hit->prim.prim_id == *prim_id) { return 1; }
+ if (hit->prim.prim_id == *prim_id) { return 1; }
return 0;
}
diff --git a/src/sphor_interface.c b/src/sphor_interface.c
@@ -23,20 +23,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sphor_interface.h"
+#include "sphor_sources.h"
#include "sphor_c.h"
-
#include <rsys/double3.h>
#include <rsys/double2.h>
#include <rsys/float3.h>
#include <rsys/float2.h>
+#include <rsys/rsys.h>
#include <star/s3d.h>
#include <star/sphin.h>
-/*******************************************************************************
- * Helper functions
- ******************************************************************************/
-
+struct sphin_brdf;
+struct sphin_sensor_surface;
+struct sphin_source_surface;
/*******************************************************************************
* Local functions
@@ -67,10 +67,13 @@ primitive_get_brdf
FOR_EACH(i, 0, (size_t)interface->surface_count[(size_t)primitive->side]) {
res = sphin_config_get_surface
- (sphor->config, interface->surfaces[(size_t)primitive->side][i], &surface);
- if (RES_OK != res){ goto error; }
+ (sphor->config,
+ interface->surfaces[(size_t)primitive->side][i],
+ &surface);
+ if (RES_OK != res) { goto error; }
+
res = sphin_surface_get_brdf(surface, &brdf);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != brdf){
if (NULL == found_brdf) {
sphin_surface_get_name(surface, &surface_name);
@@ -119,10 +122,12 @@ primitive_get_source
FOR_EACH(i, 0, (size_t)interface->surface_count[(size_t)primitive->side]) {
res = sphin_config_get_surface
- (sphor->config, interface->surfaces[(size_t)primitive->side][i], &surface);
- if (RES_OK != res){ goto error; }
+ (sphor->config,
+ interface->surfaces[(size_t)primitive->side][i],
+ &surface);
+ if (RES_OK != res) { goto error; }
res = sphin_surface_get_source(surface, &source);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != source){
if (NULL == found_source) {
sphin_surface_get_name(surface, &surface_name);
@@ -171,10 +176,12 @@ primitive_get_sensor_surface
FOR_EACH(i, 0, (size_t)interface->surface_count[(size_t)primitive->side]) {
res = sphin_config_get_surface
- (sphor->config, interface->surfaces[(size_t)primitive->side][i], &surface);
- if (RES_OK != res){ goto error; }
+ (sphor->config,
+ interface->surfaces[(size_t)primitive->side][i],
+ &surface);
+ if (RES_OK != res) { goto error; }
res = sphin_surface_get_sensor(surface, &sensor);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != sensor){
if (NULL == found_sensor) {
sphin_surface_get_name(surface, &surface_name);
@@ -235,10 +242,10 @@ primitive_get_in_refraction_index
res = sphin_config_get_volume
(sphor->config, primitive->interface->volumes[primitive->side], &volume);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_volume_get_refractive_index(volume, &refr_ind);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* If the volume is null, the refractive index
* receives the default value of 1 to the real part and 0 to the imaginary
@@ -251,29 +258,29 @@ primitive_get_in_refraction_index
/* Real part of the refractive index */
res = sphin_refractive_index_get_n_real(refr_ind, &spec_prop);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != spec_prop) {
res = sphin_spectral_property_get_desc(spec_prop, &spec_prop_desc);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_spectral_property_interpolate_at_wavelength
(spec_prop, wavelength, SPHIN_INTERPOLATION_LINEAR, n_real);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
else { *n_real = 1; }
/* Imag part of the refractive index */
res = sphin_refractive_index_get_n_imag(refr_ind, &spec_prop);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != spec_prop) {
res = sphin_spectral_property_get_desc(spec_prop, &spec_prop_desc);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_spectral_property_interpolate_at_wavelength
(spec_prop, wavelength, SPHIN_INTERPOLATION_LINEAR, n_imag);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
}
else { *n_imag = 0; }
exit:
@@ -338,7 +345,7 @@ trace_ray
/* Trace ray using s3d */
res = s3d_scene_view_trace_ray
(sphor->scene_view, pos, dir, rge, &prim_id, &hit);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
/* Construct sphor structure using sphor */
if (S3D_HIT_NONE(&hit)) {
diff --git a/src/sphor_interface.h b/src/sphor_interface.h
@@ -25,11 +25,15 @@
#ifndef SPHOR_INTERFACE_H
#define SPHOR_INTERFACE_H
-#include "sphor.h"
-
#include <rsys/dynamic_array.h>
+#include <rsys/rsys.h>
#include <star/sphin.h>
+struct sphin_brdf;
+struct sphin_sensor_surface;
+struct sphin_source_surface;
+struct sphor;
+
/* Maximum number of surfaces a single triangle can be part of (per side).
* We use a constant to avoid dynamic memory allocation.
* 4 is chosen as a good balance between efficiency and possibility.
@@ -37,9 +41,6 @@
#define MAX_SURFACE_COUNT 4
#define INVALID_ID SIZE_MAX
-/* Forward declarations */
-struct s3d_hit;
-
struct interface {
/* Interface side; FRONT and BACK */
size_t volumes[2/*#sides*/];
diff --git a/src/sphor_main.c b/src/sphor_main.c
@@ -28,6 +28,7 @@
#include <rsys/cstr.h>
#include <rsys/mem_allocator.h>
+#include <rsys/rsys.h>
#include <stdio.h>
#include <stdlib.h>
@@ -102,13 +103,13 @@ parse_args
/* Number of samples */
case 'n':
res = cstr_to_ulong(optarg, &nreal);
- if(res == RES_OK && nreal == 0) res = RES_BAD_ARG;
+ if (res == RES_OK && nreal == 0) res = RES_BAD_ARG;
args->samples = (size_t)nreal;
break;
/* Number of threads */
case 't':
res = cstr_to_uint(optarg, &nthreads);
- if(res == RES_OK && nthreads == 0) res = RES_BAD_ARG;
+ if (res == RES_OK && nthreads == 0) res = RES_BAD_ARG;
args->nthreads = nthreads;
break;
default:
diff --git a/src/sphor_ran_geometry.c b/src/sphor_ran_geometry.c
@@ -24,9 +24,13 @@
#include "sphor_ran_geometry.h"
+#include <rsys/double3.h>
+#include <rsys/rsys.h>
#include <star/s3d.h>
#include <star/ssp.h>
+#include <math.h>
+
/*******************************************************************************
* Local functions
******************************************************************************/
diff --git a/src/sphor_ran_source.c b/src/sphor_ran_source.c
@@ -23,18 +23,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "sphor_c.h"
-#include "sphor_sources.h"
-#include "sphor_ran_source.h"
+#include "sphor_interface.h"
#include "sphor_ran_geometry.h"
+#include "sphor_ran_source.h"
+#include "sphor_sources.h"
+#include <rsys/double3.h>
+#include <rsys/float3.h>
+#include <rsys/rsys.h>
+#include <star/s3d.h>
#include <star/sphin.h>
#include <star/ssp.h>
-#include <star/suniq.h>
-#include <rsys/dynamic_array_double.h>
-
-/*******************************************************************************
- * Helper functions
- ******************************************************************************/
/*******************************************************************************
* Local functions
@@ -54,12 +53,12 @@ source_surface_sample_direction
res_T res = RES_OK;
res = primitive_get_source(sphor, &prim_pos->primitive, &source);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL == source){ res = RES_BAD_ARG; goto error; }
/* Sample a direction according to the source direction distribution */
res = sphin_source_surface_get_direction_distribution(source, &src_dir_dist);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
d3_set(normal, prim_pos->primitive.normal);
@@ -138,12 +137,14 @@ sample_source_position
res = s3d_scene_view_get_primitive
(sphor->scene_view, (unsigned)scn_prim_id, &scn_prim);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
- res = s3d_primitive_get_attrib(&src_prim, S3D_GEOMETRY_NORMAL, st, &src_normal);
- if (RES_OK != res){ goto error; }
- res = s3d_primitive_get_attrib(&scn_prim, S3D_GEOMETRY_NORMAL, st, &scn_normal);
- if (RES_OK != res){ goto error; }
+ res = s3d_primitive_get_attrib
+ (&src_prim, S3D_GEOMETRY_NORMAL, st, &src_normal);
+ if (RES_OK != res) { goto error; }
+ res = s3d_primitive_get_attrib
+ (&scn_prim, S3D_GEOMETRY_NORMAL, st, &scn_normal);
+ if (RES_OK != res) { goto error; }
f3_normalize(src_normal.value, src_normal.value);
f3_normalize(scn_normal.value, scn_normal.value);
@@ -161,7 +162,7 @@ sample_source_position
position->primitive.normal[1] = scn_normal.value[1];
position->primitive.normal[2] = scn_normal.value[2];
- if(f3_dot(src_normal.value, scn_normal.value) > 0) {
+ if (f3_dot(src_normal.value, scn_normal.value) > 0) {
/* The scene normal points in the same direction of the source normal, that
* points on the emission direction, i.e., */
position->primitive.side = SPHIN_SIDE_FRONT;
@@ -170,7 +171,7 @@ sample_source_position
}
res = s3d_primitive_get_attrib(&scn_prim, S3D_POSITION, st, &scn_pos);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
d3_set_f3(pos, scn_pos.value);
*source_view = source_to_sample;
@@ -199,14 +200,14 @@ source_sample_wavelength
res = sphin_config_get_surface
(sphor->config, source_view->sphin_id, &surface);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
res = sphin_surface_get_source(surface, &source);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL == source){ res = RES_BAD_ARG; goto error; }
res = sphin_source_surface_get_flux_density(source, &flux_density);
- if (RES_OK != res){ goto error; }
+ if (RES_OK != res) { goto error; }
if (NULL != flux_density.emission_spectrum) {
*wavelength = ssp_ranst_piecewise_linear_get
diff --git a/src/sphor_ran_source.h b/src/sphor_ran_source.h
@@ -27,16 +27,17 @@
#include <rsys/rsys.h>
/* Forward declarations */
-struct sphin_source_surface;
+struct primitive_pos;
+struct source_view;
+struct sphor;
struct ssp_rng;
-struct s3d_primitive;
extern LOCAL_SYM res_T
source_surface_sample_direction
- (struct sphor* sphor,
- struct ssp_rng* rng,
- struct primitive_pos* prim_pos,
- double dir[3]);
+ (struct sphor* sphor,
+ struct ssp_rng* rng,
+ struct primitive_pos* prim_pos,
+ double dir[3]);
extern LOCAL_SYM res_T
source_sample_wavelength
diff --git a/src/sphor_sources.c b/src/sphor_sources.c
@@ -25,10 +25,15 @@
#include "sphor_c.h"
#include "sphor_sources.h"
+#include <rsys/double3.h>
+#include <rsys/dynamic_array_double.h>
+#include <star/s3d.h>
#include <star/sphin.h>
#include <star/ssp.h>
#include <star/suniq.h>
-#include <rsys/dynamic_array_double.h>
+
+struct sphin_geometry;
+struct sphin_surface;
/*******************************************************************************
* Helper functions
@@ -117,30 +122,29 @@ setup_emission_spectrum_pdf
ASSERT(NULL != source);
SPHIN(surface_get_source(surface, &sphin_source));
- if(NULL == sphin_source) { res = RES_BAD_ARG; goto error; }
+ if (NULL == sphin_source) { res = RES_BAD_ARG; goto error; }
SPHIN(source_surface_get_flux_density(sphin_source, &density));
- /* TODO Discuss what to do if the spectrum is not given in the config file */
- if (NULL == density.emission_spectrum) { goto exit; } /* Nothing to do */
+ if (NULL == density.emission_spectrum) { res = RES_BAD_ARG; goto error; }
SPHIN(spectral_property_get_desc(density.emission_spectrum, &spectrum));
res = ssp_ranst_piecewise_linear_create
(sphor->allocator, &source->emission_spectrum_pdf);
- if(RES_OK != res) { goto error; }
+ if (RES_OK != res) { goto error; }
res = ssp_ranst_piecewise_linear_setup
(source->emission_spectrum_pdf,
spectrum.wavelengths,
spectrum.values,
spectrum.data_count);
- if(RES_OK != res) { goto error; }
+ if (RES_OK != res) { goto error; }
exit:
return res;
error:
- if(source->emission_spectrum_pdf != NULL) {
+ if (source->emission_spectrum_pdf != NULL) {
SSP(ranst_piecewise_linear_ref_put(source->emission_spectrum_pdf));
}
goto exit;
@@ -172,7 +176,8 @@ setup_source_view
res = sphin_surface_get_geometry(surface, i_geometry, &geom);
if (RES_OK != res) { goto error; }
- res = register_surface_geometry(sphor, args, geom, suniq_scene, suniq, source);
+ res = register_surface_geometry
+ (sphor, args, geom, suniq_scene, suniq, source);
if (RES_OK != res) { goto error; }
}
@@ -304,18 +309,18 @@ setup_source_distrib_power
}
}
+ if (0 == darray_double_size_get(&powers)) {
+ ERROR(sphor,
+ "No sources defined in input file. "
+ "Nothing to do.\n");
+ res = RES_BAD_ARG;
+ goto error;
+ }
+
res = ssp_ranst_discrete_create
(sphor->allocator, &sphor->source_distrib_power);
if (RES_OK != res) { goto error; }
- /* TODO ssp does not allow an empty list as an argument to this function.
- * Currently, if an input file does not contain a source, the next function
- * call will return RES_BAD_ARG and the program will stop. In other words,
- * input files without sources are not allowed in star-phor, although they are
- * allowed in star-phor-input. The behavior of the function
- * `setup_source_distrib_power`, which is currently the same as
- * `ssp_ranst_discret_setup`, should be discussed, as we may want to be more
- * tolerant of input files with no sources. */
res = ssp_ranst_discrete_setup
(sphor->source_distrib_power,
darray_double_cdata_get(&powers),
diff --git a/src/sphor_sources.h b/src/sphor_sources.h
@@ -28,13 +28,12 @@
#include <star/ssp.h>
#include <rsys/dynamic_array.h>
#include <rsys/dynamic_array_size_t.h>
+#include <rsys/rsys.h>
-/* Forward declarations */
+struct mem_allocator;
struct sphor;
struct sphor_create_args;
struct suniq;
-struct s3d_scene_view;
-struct ssp_rng;
struct source_view {
struct s3d_scene_view* view; /* View of the source */
@@ -67,11 +66,11 @@ source_release
{
ASSERT(NULL != source);
- if(NULL != source->view) {
+ if (NULL != source->view) {
S3D(scene_view_ref_put(source->view));
source->view = NULL;
}
- if(NULL != source->emission_spectrum_pdf) {
+ if (NULL != source->emission_spectrum_pdf) {
SSP(ranst_piecewise_linear_ref_put(source->emission_spectrum_pdf));
source->emission_spectrum_pdf = NULL;
}
@@ -89,7 +88,7 @@ source_copy
dst->sphin_id = src->sphin_id;
S3D(scene_view_ref_get(src->view));
dst->view = src->view;
- if(src->emission_spectrum_pdf != NULL) {
+ if (src->emission_spectrum_pdf != NULL) {
SSP(ranst_piecewise_linear_ref_get(src->emission_spectrum_pdf));
dst->emission_spectrum_pdf = src->emission_spectrum_pdf;
}
diff --git a/src/test_sphor_utils.h b/src/test_sphor_utils.h
@@ -30,7 +30,7 @@
static INLINE void
check_memory_allocator(struct mem_allocator* allocator)
{
- if(MEM_ALLOCATED_SIZE(allocator)) {
+ if (MEM_ALLOCATED_SIZE(allocator)) {
char dump[512];
MEM_DUMP(allocator, dump, sizeof(dump)/sizeof(char));
fprintf(stderr, "%s\n", dump);