This page contains useful drops of code. Well, actually I do not know if these lines are useful. Feel free to use these drops of code in your projects. But first...
This software is provided as-is, with all faults, without any express or implied warranty. In no event will the author(s)
be held liable for any damages arising from the use of this software. Nevertheless I hope some of the code snippets provided here
may be useful for someone.
For any information about errors or bugs, I am always grateful.
FFTW is an optimized Fast-Fourier-Library for many platforms written in C by Matteo Frigo and Steven G. Johnson (see www.fftw.org). However, it is quite laborious to call this library via P/Invokes (for example using C#). This short snippet of code is a wrapper for the FFTW library with the following features:
Description | Size/Type | Comment |
Magic Number | 1 byte | 0x79 |
Version | 1 byte | 0x02 |
Number of particles | 4 bytes, int | N |
Number of dimensions | 4 bytes, int | dim |
Size of each block | 4 bytes, int | |
Boundary box | dim x 8 bytes, double | |
Particle positions | N x dim * 8 bytes, double | for each particle the coordinates are stored in ascending order, e.g. Particle1.x, Particle1.y, Particle1.z, Particle2.x,... |
Particle data | N * 9 bytes, (byte, double) | for each particle a structure consisting of information about its species (byte) and description (double) is stored |