This is my first attempt trying to store all the data I need
in a PointCache. There are two main problems in the current system:
- The number of attributes that is stored has to be somewhat static. Also it has to be fairly small, because every attribute has its own bit in a flag.
- PointCache expects the number of "points" to stay constant.
I do not think that the existing write_point and read_point
methods are a good fit for the data I'm working with.
In fact, I don't really think they are a good interface
for the other simulation types either. That is because it forces
you to do a lot of processing per point, that should really
only be done once. I think working with the arrays directly is a better
solution.
In my opinion, ideally PTCacheMem should just store a list of
arrays whereby each array has a size, data type and identifier.
Every simulation type then just has to implement functions that
convert between its state and the list-of-arrays representation.
I'm fairly sure that it is possible to update the other simulation
types to this storage type, but not without breaking existing files.
Therefore, I did not implement this yet.
Instead, I implemented it as a "hack" on top of the PTCacheExtra
"hack"... I reused the custom data types from CustomData, so that
we don't need another run-time type system. I did not implement
disk cache yet, because that makes more sense when I actually got
some ui for it. Without it, testing disk cache is a bit annoying.
I'll probably have to extend the interface of CustomData a bit,
so that I can access information about how a custom data type
is stored internally. This is necessary to avoid the use of MEM_dupalloc
and to get endianness handling correct.
Note: I store two attribute per particle now, but pointcache.c does not know these attributes at compile time. Also the number of particles changes dynamically now.