This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Unable to read surface from file. Polyhedron is not valid.

0 votes

Dear All,

I would appreciate to be enlightened why I can't get "Surface3D" to mesh my .off file. It seems like the polyhedron is not valid inside CSGCGALDomain3D.cpp but as far as I can tell there should be no mistakes with the .off file. With Matlab functions triangulation, trisurf and faceNormal the correct geometry is displayed. I have tried both left- and right-handed systems for the definitions of triangular facets. The geometry is a box with an inverted smaller box extending the from bottom face, for wind-field calculations over a city with a single building. Anything that might put me on the right direction is appreciated.

Thank you,
Christian

FEniCS:
from fenics import *
from dolfin import *
from mshr import *
mesh = Mesh() #empty mesh
domain = Surface3D("oklahoma_single_building_lh.off")
mesh = generate_mesh(domain,10)
plot(mesh, interactive=True)

*** Error: Unable to read surface from file.
*** Reason: Polyhedron is not valid. If you are sure your file is valid, please file a bug report.
*** Where: This error was encountered inside CSGCGALDomain3D.cpp.
*** Process: 0

Below I paste the .off file I am working with:
OFF
16 28 24
634614.3 3926117 0
634614.6 3926148 0
634690.9 3926147 0
634690.5 3926116 0
634614.3 3926117 55
634614.6 3926148 55
634690.9 3926147 55
634690.5 3926116 55
634578 3926062 0
634578 3926437 0
634953 3926437 0
634953 3926062 0
634578 3926062 146.5000
634953 3926062 146.5000
634953 3926437 146.5000
634578 3926437 146.5000
3 0 4 7
3 0 7 3
3 3 7 6
3 2 3 6
3 2 6 5
3 1 2 5
3 1 5 4
3 0 1 4
3 4 5 7
3 5 6 7
3 0 3 8
3 3 11 8
3 2 11 3
3 2 10 11
3 1 10 2
3 1 9 10
3 0 9 1
3 0 8 9
3 8 11 13
3 8 13 12
3 11 14 13
3 11 10 14
3 10 15 14
3 9 15 10
3 9 12 15
3 8 12 9
3 12 13 15
3 13 14 15

asked Nov 28, 2016 by Christian Lejon FEniCS Novice (120 points)

This works fine for me with FEniCS version 2016.1.0 and also with the laster master from the git repositories. Which version are you using and how did you install it?

johannr, thanks for the quick reply. Indeed the geometry that you produced looks familiar to me.

How may this information help?:

Linux system Ubuntu 16.04.1
Installed via the instructions on https://fenicsproject.org/download/

When listing the package information with dpkg -s fenics I get:

Package: fenics
Status: install ok installed
Priority: extra
Section: math
Installed-Size: 12
Maintainer: Johannes Ring johannr@simula.no
Architecture: all
Version: 1:2016.1.0.1~ppa3~xenial1
Depends: libdolfin-dev (>= 2016.1.0), python-dolfin (>= 2016.1.0), dolfin-doc (>= 2016.1.0), dolfin-bin (>= 2016.1.0), python-ffc (>= 2016.1.0), python-fiat (>= 2016.1.0), python-instant (>= 2016.1.0), python-ufl (>= 2016.1.0), python-ufl-doc (>= 2016.1.0), libmshr-dev (>= 2016.1.0), python-mshr (>= 2016.1.0), mshr-demos (>= 2016.1.0)
Recommends: python-scitools
Description: Automated Solution of Differential Equations FEniCS is a collection of free software for automated, efficient solution of differential equations.
.
FEniCS has an extensive list of features, including automated solution of variational problems, automated error control and adaptivity, a comprehensive library of finite elements, high performance linear algebra and many more.
.
FEniCS is organized as a collection of interoperable components, including the problem-solving environment DOLFIN, the form compiler FFC, the finite element tabulator FIAT, the just-in-time compiler Instant, the code generation interface UFC, the form language UFL and a range of additional components.
Homepage: http://fenicsproject.org
Original-Maintainer: Debian Science Team debian-science-maintainers@lists.alioth.debian.org

Installed via the instructions on https://fenicsproject.org/download/ with these commands:
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install fenics
sudo apt-get dist-upgrade

Sorry, I don't know. I tested again on a clean Ubuntu 16.04 with the packages from the FEniCS PPA and it works fine.

Thanks anyway. The error was caused by tab separators in my .off file.
Changing row 88 in OFFFileReader.cpp from

 const boost::char_separator<char> sep(" ");

to

const boost::char_separator<char> sep(" \t");

solves the problem. Or using space as separators in the .off file.

Christian

...