commit 83738eb1326404be7933accb4c3508cd9aa7a6c2
parent 83eee983fd8c4b25f0ef0f1ef9f6a13b7962ccf9
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Fri, 2 Sep 2022 11:41:36 +0200
Remove the scad group concept
Diffstat:
3 files changed, 1 insertion(+), 101 deletions(-)
diff --git a/src/scad.h b/src/scad.h
@@ -160,17 +160,6 @@ scad_add_sphere
const double rad,
struct scad_geometry** sphere); /* Can be NULL: no handler returned. */
-/* Create a group of geometries of dimension `dim' from an array of geometries.
- * All of the geometries must have been added to scene and must have dimension
- * dim. */
-SCAD_API res_T
-scad_create_group
- (const char* name, /* Can be NULL */
- const int dim,
- struct scad_geometry** geometries,
- const size_t count,
- struct scad_geometry** group);
-
SCAD_API res_T
scad_scene_mesh
(void);
diff --git a/src/scad_geometry.c b/src/scad_geometry.c
@@ -112,19 +112,7 @@ scad_geometry_release
sz = geom->gmsh_dimTags_n;
data = geom->gmsh_dimTags;
- if(geom->is_group) {
- int dimTag[2];
- dimTag[0] = geom->group_dim;
- dimTag[1] = geom->is_group;
- /* FIXME: not sure this remove is needed! */
- gmshModelGeoRemovePhysicalGroups(dimTag, 2, &ierr);
- ERR(gmsh_err_to_res_T(ierr));
- if(sz != 0) {
- ASSERT(data);
- free(data);
- }
- }
- else if(sz != 0) {
+ if(sz != 0) {
gmshModelOccRemove(data, sz, 1, &ierr);
ERR(gmsh_err_to_res_T(ierr));
ASSERT(data);
@@ -467,82 +455,6 @@ error:
}
res_T
-scad_create_group
- (const char* name,
- const int dim,
- struct scad_geometry** geometries,
- const size_t count,
- struct scad_geometry** out_geometry)
-{
- int ierr, gid;
- struct scad_geometry* geom = NULL;
- size_t sz, i, n;
- int* ids = NULL;
- res_T res = RES_OK;
-
- if(!geometries || (count == 0) || !out_geometry) {
- res = RES_BAD_ARG;
- goto error;
- }
-
- ERR(check_device());
-
- if(get_device()->need_synchro) {
- ERR(scad_synchronize());
- }
-
- sz = 0;
- for(i = 0; i < count; i++) {
- sz += geometries[i]->gmsh_dimTags_n / 2;
- }
- ids = malloc(sz * sizeof(int));
- if(! ids) {
- res = RES_MEM_ERR;
- goto error;
- }
- n = 0;
- for(i = 0; i < count; i++) {
- size_t j;
- for(j = 1; j < geometries[i]->gmsh_dimTags_n; j+=2) {
- ids[n++] = geometries[i]->gmsh_dimTags[j];
- }
- }
- ASSERT(n == sz);
- gid = gmshModelAddPhysicalGroup(dim, ids, count, -1, &ierr);
- ASSERT(gid > 0);
- ERR(gmsh_err_to_res_T(ierr));
-
- ERR(scad_geometry_create(name, &geom));
- geom->is_group = gid;
- geom->group_dim = dim;
- geom->gmsh_dimTags_n = 2 * sz;
- geom->gmsh_dimTags = malloc(geom->gmsh_dimTags_n * sizeof(int));
- if(! geom->gmsh_dimTags_n) {
- res = RES_MEM_ERR;
- goto error;
- }
- n = 0;
- for(i = 0; i < count; i++) {
- size_t j;
- for(j = 0; j < geometries[i]->gmsh_dimTags_n; j++) {
- geom->gmsh_dimTags[n++] = geometries[i]->gmsh_dimTags[j];
- }
- }
- ASSERT(n == geom->gmsh_dimTags_n);
-
-exit:
- if(out_geometry) *out_geometry = geom;
- if(ids) free(ids);
- return res;
-error:
- if(geom) {
- SCAD(geometry_release(geom));
- geom = NULL;
- }
- goto exit;
-}
-
-res_T
scad_fuse_geometries
(const char* name,
struct scad_geometry* geom1,
diff --git a/src/scad_geometry.h b/src/scad_geometry.h
@@ -25,7 +25,6 @@ struct scad_geometry {
int* gmsh_dimTags;
size_t gmsh_dimTags_n;
struct str name;
- int is_group, group_dim;
};
extern LOCAL_SYM res_T