Sender | Message | Time |
---|---|---|
26 Jun 2022 | ||
mosullivan93 | read("\0") | 16:11:02 |
mosullivan93 | Will also throw the same error | 16:11:10 |
acxz | yep, the binary file includes NULs which read can't handle | 16:11:47 |
acxz | In reply to @mosullivan93:matrix.orgI believe I'm passing in the String at that point. | 16:12:29 |
mosullivan93 | Yes, that's what I mean, your intention seems to be to simply store these bytes though, so you don't need to pass it back through readagain | 16:13:34 |
mosullivan93 | * Yes, that's what I mean, your intention seems to be to simply store these bytes though, so you don't need to pass it back through read again | 16:13:40 |
acxz | In the end I'd like a Vector{Int32} from these bytes. So I guess instead of going from bytes to string to vector, i should go from bytes to vector? | 16:15:31 |
mosullivan93 | You can convert the string like so Vector{Int32}(Vector{UInt8}(line[2:end])) , I can't seem to find a more succinct way | 16:24:36 |
mosullivan93 | But, the code doesn't detect the ")" at the moment and throws an error later on anyway | 16:24:50 |
mosullivan93 | I have to go to bed for now, but hopefully that helps. You could use readline until the "(", and presumably some of the information in the header tells you how many bytes will follow. | 16:28:17 |
acxz | thanks so much for your help!!! Really appreciate the time, enjoy ur sleep! 💤 | 16:28:59 |
mosullivan93 | Actually, another thing just came to mind, if you mean to internet four consecutive bytes as being part of an Int32, then the sample code I have doesn’t do that. Also since you’re in the binary region of the file, be careful your code isn’t gobbling up any control characters (i.e. '\r' or '\n'). I think you should refactor the code if you can learn more about the structure of the file, because it seems rather convoluted at the moment and can probably be simplified if you make assumptions about the structure. | 17:11:12 |
mosullivan93 | * (null) | 17:11:24 |
mosullivan93 | * (null) | 17:11:37 |
mosullivan93 | * (null) | 17:11:57 |
27 Jun 2022 | ||
acxz | thx for the tips I finally was able to parse my file! Here is the finally snippet I ended up with:
Def one of the weirdest files I've had to parse haha | 03:36:55 |
acxz | The use case for this is to visualize the mesh matrix from openfoam. The final script now at https://github.com/acxz/openfoam-mesh-matrix reproduces the plots shown on the following blog: https://blog.pointwise.com/2020/08/26/its-all-in-the-numbering-mesh-renumbering-may-improve-simulation-speed/ | 03:50:38 |
mosullivan93 | I see from the file spec that there's quite a few types of structures that could appear in the output of OpenFOAM, but it looks like it's working on the sample files you provided. | 03:51:27 |
acxz | Yeah I'm only going to be parsing the polyMesh/neighbour and polyMesh/owner files, which my script seems to be working and displaying the plots properly. | 03:53:06 |
acxz | * Yeah I'm only going to be parsing the polyMesh/neighbour and polyMesh/owner files, which my script seems to be working on and displaying the plots properly. | 03:53:15 |
mosullivan93 | Sounds good, glad you got it working | 03:53:21 |
andrewellis changed their profile picture. | 10:07:16 | |
neoabs joined the room. | 12:49:07 | |
@chepyrka:nitro.chat | 🔵 Welcome to the new Julia space! 🔴🟢🟣 https://matrix.to/#/#julia:nitro.chat | 13:36:53 |
neoabs | it consolidates all spaces. Maybe we can jumpstart julia on matrix this time | 13:46:10 |
neoabs | It would be nice to have some functional community on matrix | 13:46:22 |
28 Jun 2022 | ||
mosullivan93 changed their profile picture. | 00:41:25 | |
29 Jun 2022 | ||
Johny R joined the room. | 01:49:43 | |
Vincent Laporte joined the room. | 06:51:55 |