|Status:||Rejected||Start date:||31 Aug 2016|
Descendants of ICompositeSample typically need one or more children to be defined before a simulation can be run. Presence of these children is currently not enforced: we do have constructors like Particle() that create a particle without material and with form factor, hence not immediately useable for simulation.
Therefore in the implementation of class Particle we never know whether mP_material or mP_form_factor isn't a null pointer, so we have to test, and react case by case. Such extra code is not nice, and typically it is not covered by functional tests.
Shall we forbid null pointer children for good?
This policy could be enforced in two different ways:
(1) Delete constructors that do not set all children.
(2) Equip constructors with default arguments, for instance: material=Air(), form_factor=FormFactorDot(), interference_function=InterferenceFunctionNone().