Skip to content

Pass pulsar-specific data through extraData field in LALInferenceIFOModel

Description

The LALInferenceIFOModel struct in LALInference currently contains pointers to a number of pulsar-specific structs, which are passed through to the model functions in the known pulsar code (src/pulsar/HeterodyneSearch). Aside from these struct pointers, no other LALPulsar code is used in LALInference (e.g. no LALPulsar functions are called from LALInference functions). Nevertheless these structs create a dependence on LALPulsar from LALInference.

This MR replaces the pulsar-specific struct pointers in LALInferenceIFOModel with a generic pointer void *extraData, which can point to any arbitrary data. Within the known pulsar code, extraData is used to point to a struct IFOModelExtraData, which now contains the pulsar-specific struct pointers previously in LALInferenceIFOModel. The extraData pointer is allocated to a new IFOModelExtraData struct every time a new LALInferenceIFOModel is allocated in the known pulsar code. A convenience macro IFO_XTRA_DATA() is used to cast LALInferenceIFOModel->extraData to type IFOModelExtraData* so that the pulsar-specific struct pointers can then be accessed, e.g. IFO_XTRA_DATA( ifo_model )->times.

With this change, LALInference no longer depends on any code in LALPulsar, which will allow the formal dependencies (in configure.ac, packaging, etc.) to be removed in a future MR.

API Changes and Justification

Backwards Compatible Changes

  • This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions
  • This change adds new classes/functions/structs/types to a public C header file or Python module

Backwards Incompatible Changes

  • This change modifies an existing class/function/struct/type definition in a public C header file or Python module
  • This change removes an existing class/function/struct/type from a public C header file or Python module

Modifies the LALInferenceIFOModel struct in lalinference/lib/LALInference.h to remove pointers to structs in LALPulsar. This is necessary to remove the LALInference dependence on LALPulsar.

Review Status

@matthew-pitkin This will need a careful look at. I'm not sure the test suite under src/pulsar/HeterodyneSearch covers all the codes, so you might want to run your own tests as well.

Merge request reports