commit 9851bba0078c59829c7c40193c7c00b7004a8f9f
parent 48bfe7b4003b65fa52f5e4c78c02b6e9a0efee00
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 9 Dec 2022 09:38:42 +0100
Coding style
Diffstat:
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/src/scad_geometry.c b/src/scad_geometry.c
@@ -346,10 +346,10 @@ scad_geometry_get_mass
dim = data[0];
*mass = 0;
- for (i=0; i<count; ++i) {
+ for(i=0; i<count; ++i) {
double geom_mass = 0;
int ierr = 0;
- if (data[2*i] != dim) goto error;
+ if(data[2*i] != dim) goto error;
gmshModelOccGetMass(data[2*i], data[2*i + 1], &geom_mass, &ierr);
ERR(gmsh_err_to_res_T(ierr));
*mass += geom_mass;
@@ -385,7 +385,7 @@ scad_geometry_get_centerofmass
ERR(gather_tags(&geom, 1, &data, &sz));
- for (i=0; i<*center_n; ++i) {
+ for(i=0; i<*center_n; ++i) {
double x, y, z;
int ierr = 0;
gmshModelOccGetCenterOfMass(data[2*i], data[2*i + 1], &x, &y, &z, &ierr);
@@ -400,7 +400,7 @@ exit:
return res;
error:
res = RES_BAD_ARG;
- if (*center) free(*center);
+ if(*center) free(*center);
goto exit;
}
@@ -523,7 +523,7 @@ scad_add_polygon
res = RES_MEM_ERR;
goto error;
}
- for (i=0; i<count; ++i) {
+ for(i=0; i<count; ++i) {
double pos[2];
get_position(i, pos, data);
points[i] = gmshModelOccAddPoint(pos[0], pos[1], z, -1, -1, &ierr);
@@ -535,7 +535,7 @@ scad_add_polygon
res = RES_MEM_ERR;
goto error;
}
- for (i=0; i<count-1; ++i) {
+ for(i=0; i<count-1; ++i) {
lines[i] = gmshModelOccAddLine(points[i], points[i+1], -1, &ierr);
ERR(gmsh_err_to_res_T(ierr));
}
@@ -991,7 +991,7 @@ scad_geometry_rotate
int ierr = 0;
res_T res = RES_OK;
- if(!geom || !pt || !axis){
+ if(!geom || !pt || !axis) {
res = RES_BAD_ARG;
goto error;
}
@@ -1050,8 +1050,8 @@ scad_geometry_extrude
ERR(scad_geometry_create(name, &extrude_geom));
/* keep only 3D entities */
/* TODO : NOT SURE OF THE CONCEPT */
- for (i=0; i<tagoutn/2; ++i) {
- if (tagout[2*i] == 3) extrude_sz += 2;
+ for(i=0; i<tagoutn/2; ++i) {
+ if(tagout[2*i] == 3) extrude_sz += 2;
}
extrude_data = malloc(extrude_sz * sizeof(*extrude_data));
if(!extrude_data) {
@@ -1059,8 +1059,8 @@ scad_geometry_extrude
goto error;
}
j = 0;
- for (i=0; i<tagoutn/2; ++i) {
- if (tagout[2*i] == 3) {
+ for(i=0; i<tagoutn/2; ++i) {
+ if(tagout[2*i] == 3) {
extrude_data[2*j] = 3;
extrude_data[2*j+1] = tagout[2*i+1];
++j;
@@ -1118,12 +1118,12 @@ scad_geometry_explode
goto error;
}
- if (prefix_name) {
+ if(prefix_name) {
str_init(get_device()->allocator, &name);
name_initialized = 1;
}
- for (i=0; i<sz/2; ++i) {
- if (prefix_name) {
+ for(i=0; i<sz/2; ++i) {
+ if(prefix_name) {
ERR(str_set(&name, prefix_name));
ERR(str_append_printf(&name,"_%lu", (unsigned long)i));
ERR(scad_geometry_create(str_cget(&name), geom_array+i));
@@ -1240,7 +1240,7 @@ scad_geometry_translate
int ierr = 0;
res_T res = RES_OK;
- if(!geom || !dxdydz){
+ if(!geom || !dxdydz) {
res = RES_BAD_ARG;
goto error;
}
@@ -1326,7 +1326,7 @@ scad_geometries_partition
}
/* Additionally, with the delete flag ON we expect the tags to remain
* unchanged in the non-overlapping case. */
- /*ASSERT(res != RES_OK || map[i][1] == data[2*i+1]);*/
+ ASSERT(res != RES_OK || allow_overlapping || map[i][1] == data[2*i+1]);
}
if(ucount) {
log_error(get_device(), "%lu unamed overlapping geometries.\n", ucount);
@@ -1594,7 +1594,7 @@ scad_step_import
str_init(get_device()->allocator, &strname);
name_initialized = 1;
- for (i=0; i<ga_sz; ++i) {
+ for(i=0; i<ga_sz; ++i) {
ERR(str_set(&strname, name));
ERR(str_append_printf(&strname,"_%lu", (unsigned long)i));
@@ -1654,10 +1654,10 @@ scad_geometry_normal
ERR(check_device(FUNC_NAME));
- if (geom->gmsh_dimTags[0] == 2) {
+ if(geom->gmsh_dimTags[0] == 2) {
ERR(scad_geometry_copy(geom, NULL, &surface));
ERR(scad_synchronize());
- } else if (geom->gmsh_dimTags[0] == 3) {
+ } else if(geom->gmsh_dimTags[0] == 3) {
ERR(scad_geometry_boundary(NULL, &geom, 1, &surface));
} else {
res = RES_BAD_ARG;
@@ -1666,7 +1666,7 @@ scad_geometry_normal
ERR(gather_tags(&surface, 1, &data, &sz));
- for (i=0; sz/2; ++i) {
+ for(i=0; sz/2; ++i) {
double* coord;
double* pcoord;
size_t pcoord_n;
@@ -1684,7 +1684,7 @@ scad_geometry_normal
&ierr);
ERR(gmsh_err_to_res_T(ierr));
- if (d3_eq_eps(p, coord, 1e-6)) {
+ if(d3_eq_eps(p, coord, 1e-6)) {
gmshModelGetNormal(data[2*i + 1], pcoord, pcoord_n,
&normals, &normals_n, &ierr);
ERR(gmsh_err_to_res_T(ierr));
@@ -1697,9 +1697,9 @@ scad_geometry_normal
ERR(device_register_tags(out));
d3_set(N, normals);
- if (coord) free(coord);
- if (pcoord) free(pcoord);
- if (normals) free(normals);
+ if(coord) free(coord);
+ if(pcoord) free(pcoord);
+ if(normals) free(normals);
break;
}
}
@@ -1707,7 +1707,7 @@ scad_geometry_normal
exit:
if(out_geometry) *out_geometry = out;
free(data);
- if (surface) scad_geometry_delete(surface);
+ if(surface) scad_geometry_delete(surface);
return res;
error:
goto exit;
@@ -1737,7 +1737,7 @@ scad_geometry_dilate
ERR(gmsh_err_to_res_T(ierr));
exit:
- if (data) free(data);
+ if(data) free(data);
return res;
error:
goto exit;