STL import breaks serialization; O.load; Facet must have exactly 3 vertices (not 6)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Yade |
New
|
Undecided
|
Unassigned |
Bug Description
Ubuntu 16.04 in virtual machine on windows host
affects yade package and yadedaily 2018.02b-
Hi,
there is a problem when you import an stl file to your simulation, save the simulation via O.save 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):
#!/usr/bin/python
# -*- coding: utf-8 -*-
from yade import ymport
O.engines=[
ForceResett
InsertionSo
Interaction
),
# Apply gravity force to particles. damping: numerical dissipation of energy.
NewtonInteg
]
O.save(
O.bodies.
O.save(
O.load(
print "loaded before successfully"
O.load(
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&) size()! =3){ throw runtime_ error(( "Facet must have exactly 3 vertices (not "+boost: :lexical_ cast<string> (vertices. size()) +")").c_ str()); }
{
// 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.