@@ -222,17 +222,22 @@ volume GDSII_vol(const char *fname, int layer, double zmin, double zmax) {
222222 return meep_geom::get_GDSII_volume (fname, layer, zmin, zmax);
223223}
224224
225- ctlio::simple_prism_list get_GDSII_prisms (const char *GDSIIFile, int Layer, double zmin, double zmax) {
225+ /* We have to jump through some hoops here because the geometric_object data type used
226+ in meepgeom (from libctlgeom) is different from the generated ctlio::geometric_object.
227+ So we take the list of prisms from meep_geom::get_GDSII_prisms and return a simple
228+ Scheme list of triples (vertices height axis). meep.scm then defines a higher-level
229+ function get-GDSII-prisms that constructs the actual prism objects again */
230+ SCM get_GDSII_prism_data (const char *GDSIIFile, int Layer, double zmin, double zmax) {
226231 geometric_object_list go = meep_geom::get_GDSII_prisms (NULL , GDSIIFile, Layer, zmin, zmax);
227- ctlio::simple_prism_list res;
228- res.num_items = go.num_items ;
229- res.items = new ctlio::simple_prism[res.num_items ];
230- for (int i = 0 ; i < res.num_items ; ++i) {
232+ SCM res = SCM_EOL ;
233+ for (int i = go.num_items - 1 ; i >= 0 ; --i) {
231234 prism *p = go.items [i].subclass .prism_data ;
232- res.items [i].vertices .num_items = p->vertices .num_items ;
233- res.items [i].vertices .items = p->vertices .items ;
234- res.items [i].height = p->height ;
235- res.items [i].axis = p->axis ;
235+ res = scm_cons (scm_list_3 (ctl_convert_list_to_scm (make_vector3_list (p->vertices .num_items , p->vertices .items )),
236+ ctl_convert_number_to_scm (p->height ),
237+ ctl_convert_vector3_to_scm (p->axis )),
238+ res);
239+ free (p->vertices .items );
240+ // fixme: free the rest of the prism data
236241 free (p);
237242 }
238243 delete[] go.items ;
0 commit comments