Using FileIO/MeshIO to save a HomogenousMesh

bug
meshio

#1

I wasn’t able to find a documented function in FileIO or MeshIO that takes in a file name and a HomogenousMesh and writes an obj, ply or svg file. After some digging, I found the following function which simply crashes Julia with an extremely long error, the last part of which is given below. My mesh is made of Face{3,UInt32,-1} cells. Any idea what I am doing wrong, or how to proceed with what I want to do?

f = File{format"PLY"}("testply")
save(f, hmesh)
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
anonymous at .\<missing> (unknown line)
unknown function (ip: 00000000154A44F3)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:569 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
anonymous at .\<missing> (unknown line)
unknown function (ip: 00000000154A3FD3)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:569 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
anonymous at .\<missing> (unknown line)
unknown function (ip: 00000000154A3AB3)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:569 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
anonymous at .\<missing> (unknown line)
unknown function (ip: 00000000154A3593)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:569 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
anonymous at .\<missing> (unknown line)
unknown function (ip: 00000000154A3073)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:569 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
anonymous at .\<missing> (unknown line)
unknown function (ip: 00000000154A2B53)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:569 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
anonymous at .\<missing> (unknown line)
unknown function (ip: 00000000154A2323)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:569 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
#save#21 at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:108
save at C:\Users\mohd\.julia\v0.5\FileIO\src\loadsave.jl:99
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
do_call at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/
Administrator/buildbot/slave/package_win6_2-x64/build/src\interpreter.c:66
eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/Adm
inistrator/buildbot/slave/package_win6_2-x64/build/src\interpreter.c:190
jl_toplevel_eval_flex at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel
.c:558 [inlined]
jl_toplevel_eval at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\toplevel.c:58
0
jl_toplevel_eval_in_warn at /home/Administrator/buildbot/slave/package_win6_2-x6
4/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\built
ins.c:590
eval at .\boot.jl:234
unknown function (ip: 0000000061C4C015)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
eval_user_input at .\REPL.jl:64
unknown function (ip: 00000000153FA05A)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
macro expansion at .\REPL.jl:95 [inlined]
#3 at .\event.jl:68
unknown function (ip: 00000000153F1053)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
jl_apply at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home
/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia.h:1388 [inlined
]
start_task at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/ho
me/Administrator/buildbot/slave/package_win6_2-x64/build/src\task.c:254
Allocations: 19742209 (Pool: 19740800; Big: 1409); GC: 36

Please submit a bug report with steps to reproduce this fault, and any error mes
sages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x12217d5 -- ZNK4llvm5Value7getNameEv a
t C:\Users\mohd\AppData\Local\Julia-0.5.2\bin\LLVM-3.7.dll (unknown line)
while loading no file, in expression starting on line 0
ZNK4llvm5Value7getNameEv at C:\Users\mohd\AppData\Local\Julia-0.5.2\bin\LLVM-3.7
.dll (unknown line)
ZN4llvm13LPPassManager13runOnFunctionERNS_8FunctionE at C:\Users\mohd\AppData\Lo
cal\Julia-0.5.2\bin\LLVM-3.7.dll (unknown line)
ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at C:\Users\mohd\AppData\Lo
cal\Julia-0.5.2\bin\LLVM-3.7.dll (unknown line)
ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at C:\Users\mohd\AppData\Local\
Julia-0.5.2\bin\LLVM-3.7.dll (unknown line)
ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at C:\Users\mohd\AppData\Local\
Julia-0.5.2\bin\LLVM-3.7.dll (unknown line)
operator() at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/ho
me/Administrator/buildbot/slave/package_win6_2-x64/build/src\jitlayers.cpp:411 [
inlined]
_M_invoke at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/usr
/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++\functional:2025
operator() at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/us
r/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++\functional:2439 [inlined]
addModuleSet<llvm::SmallVector<std::unique_ptr<llvm::Module>, 1u>, llvm::RTDyldM
emoryManager*, std::unique_ptr<llvm::orc::LambdaResolver<JuliaOJIT::addModule(st
d::unique_ptr<llvm::Module>)::<lambda(const string&)>, JuliaOJIT::addModule(std:
:unique_ptr<llvm::Module>)::<lambda(const string&)> >, std::default_delete<llvm:
:orc::LambdaResolver<JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambd
a(const string&)>, JuliaOJIT::addModule(std::unique_ptr<llvm::Module>)::<lambda(
const string&)> > > > > at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/usr/includ
e/llvm/ExecutionEngine/Orc\IRCompileLayer.h:76 [inlined]
addModule at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/hom
e/Administrator/buildbot/slave/package_win6_2-x64/build/src\jitlayers.cpp:521
jl_finalize_function at /home/Administrator/buildbot/slave/package_win6_2-x64/bu
ild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\jitlayers
.cpp:769
jl_finalize_function at /home/Administrator/buildbot/slave/package_win6_2-x64/bu
ild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\jitlayers
.cpp:778
getAddressForFunction at /home/Administrator/buildbot/slave/package_win6_2-x64/b
uild/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\codegen.
cpp:933
jl_generate_fptr at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\codegen.cpp:9
66
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:208 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
_atexit at .\initdefs.jl:114
unknown function (ip: 0000000061C82CFE)
jl_call_method_internal at /home/Administrator/buildbot/slave/package_win6_2-x64
/build/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia_
internal.h:211 [inlined]
jl_apply_generic at /home/Administrator/buildbot/slave/package_win6_2-x64/build/
src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\gf.c:1950
jl_apply at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home
/Administrator/buildbot/slave/package_win6_2-x64/build/src\julia.h:1388 [inlined
]
jl_atexit_hook at /home/Administrator/buildbot/slave/package_win6_2-x64/build/sr
c/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\init.c:244
jl_exit at /home/Administrator/buildbot/slave/package_win6_2-x64/build/src/home/
Administrator/buildbot/slave/package_win6_2-x64/build/src\jl_uv.c:550
_exception_handler at /home/Administrator/buildbot/slave/package_win6_2-x64/buil
d/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\signals-win
.c:281 [inlined]
__julia_personality at /home/Administrator/buildbot/slave/package_win6_2-x64/bui
ld/src/home/Administrator/buildbot/slave/package_win6_2-x64/build/src\signals-wi
n.c:303
_chkstk at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
RtlRaiseException at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
KiUserExceptionDispatcher at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
Allocations: 19742360 (Pool: 19740951; Big: 1409); GC: 36

#2

Just doing

save("test.ply", mesh)

should work. If you want control over the format, you should use format"PLY_ASCII" or format"PLY_BINARY". (I think we might only support loading PLY_ASCII, so probably prefer that).

I’m not sure why format"PLY" crashes with an endless stack trace like that. It seems to happen for any non-existent format code for any kind of data. For example:

save(File{format"ASDFSDFSDFA"}("test.ply"), 1.0)

which means this is a FileIO issue, not a MeshIO problem. I’ll open an issue.


#3

#4

Great, thank you. It seems that the colors are ignored by default, does any option allow colors to be exported?

ETA: after taking a look at the src, seems not. Thanks anyways.


#5

Yeah, as far as I know they’re not currently supported.