![]() ![]() ![]() ![]() Next: Periodic Output of Grid Up: I/O Methods Previous: I/O Methods Contents I/O Method RegistrationAll I/O methods have to be registered with the flesh before they can be used.The flesh I/O registration API provides a routine CCTK_RegisterIOMethod() to create a handle for a new I/O method which is identified by its name (this name must be unique for all I/O methods). With such a handle, a thorn can then register a set of functions (using the CCTK_RegisterIOMethod*() routines from the flesh) for doing periodic, triggered, and/or unconditional output. The following example shows how a thorn would register an I/O method, SimpleIO, with routines to provide all these different types of output. void SimpleIO_Startup (void) { int handle = CCTK_RegisterIOMethod ("SimpleIO"); if (handle >= 0) { CCTK_RegisterIOMethodOutputGH (handle, SimpleIO_OutputGH); CCTK_RegisterIOMethodTimeToOutput (handle, SimpleIO_TimeToOutput); CCTK_RegisterIOMethodTriggerOutput (handle, SimpleIO_TriggerOutput); CCTK_RegisterIOMethodOutputVarAs (handle, SimpleIO_OutputVarAs); } } |