STL import breaks serialization; O.load; Facet must have exactly 3 vertices (not 6)

Bug #1796883 reported by Alexander Eulitz [Eugen] on 2018-10-09
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Ubuntu 16.04 in virtual machine on windows host
affects yade package and yadedaily 2018.02b-201447edfd~xenial

there is a problem when you import an stl file to your simulation, save the simulation via and O.load afterwards.
You will get a
RuntimeError: Facet must have exactly 3 vertices (not 6)

Here is the example (stl file from some example is attached, I tried different stls):
# -*- coding: utf-8 -*-
from yade import ymport
        [Ig2_Sphere_Sphere_ScGeom()], # collision geometry
        [Ip2_FrictMat_FrictMat_FrictPhys()], # collision "physics"
        [Law2_ScGeom_FrictPhys_CundallStrack()] # contact law -- apply forces
    # Apply gravity force to particles. damping: numerical dissipation of energy.
print "loaded before successfully"
print "loaded after successfully"

Cheers Alex

In the Facet.cpp I found the following comment. Maybe this rings a bell for somebody?

void Facet::postLoad(Facet&)
 // if this fails, it means someone did vertices push_back, but they are resized to 3 at Facet initialization already
 // in the future, a fixed-size array should be used instead of vector<Vector3r> for vertices
 // this is prevented by yade::serialization now IIRC
 if(vertices.size()!=3){ throw runtime_error(("Facet must have exactly 3 vertices (not "+boost::lexical_cast<string>(vertices.size())+")").c_str()); }

Bruno Chareyre (bruno-chareyre) wrote :

Hi Alex,
It sounds relevant indeed, however the possible "push_back" would have to be done inside boost serialization, and I doubt we need to dig that deep to understand the problem.

I can't reproduce the problem on ubuntu 16.04 actually (2018-09-26.git-0a2abea or yadedaily), your script gives:
loaded before successfully
loaded after successfully


To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments