Hi AnyBody-Team!
While doing parameter analyses, all the data can be exported in the structure of *.h5 files, which is very nice However, to my knowledge, the name of the files must be set every time manually in order to avoid overwriting already existing ones. This is a bit inconvenient… Therefore it would be nice to have the option to export files with a timestamp, e.g., “2013-08-15-Simulation.h5”. I already tried to create a work-around by using the AnyFunExMonoC, but it did not really work. The files are in attachment. What do you think?
Best regards,
Klabauterjunge
Hi Malte,
I think you are missing some little details in your C++ function. It is probably a good idea to start from the example in the reference manual when you try to create a function like this. What is missing in your function is
- the header that defines the interfaces to AnyBody (IAnyBodyDefs.h);
- to set the right return value: The AnyFunExMonoC is not reading the result from the return value but from a class IAData, typically called pIADataReturn as a pointer to an IAnyBody::IAData, which should be the first argument in the function header. A value that should be returned has to be set in this IAData and is read from there into AnyBody.
With these modifications the function works fine. I attached the fixed .cpp file.
In general, I would think that a python function is more intuitive to handle for these kind of “simple” functions since python is able to handle more than one return value and does not need the definition of a structure of return values.
Please also have a look at the thread http://forum.anyscript.org/showthread.php?t=3172&highlight=filename which also handles this kind of problem.
Best regards
Daniel