Core code analysis: How the sample is reprocessed

Before reflectivity or GISAS can be computed, the user-defined sample is reprocessed through several steps, as introduced in simulation analysis:

  • (R1) Flatten the user-defined sample model by expanding periodic structures.
  • (R2) If there are embedded particles or rough interfaces, divide the user-defined sample layers into finer slices.
  • (R3) Replace particles by a coherent pile of particle slices.
  • (R4) Optionally, compute the average scattering-length density (SLD) of each slice.
  • (R5) Recalculate the full magnetic induction.

All reprocessing is launched through

  • ISimulation::simulate
    • ReSample::processedSample.

R1 Flatten the user-defined sample model

This is done by

  • Sample::unwrapped.

R2 Divide layers into slices

This is done by

  • ::Refine::subdivideLayers if SimulationOptions::useAvgMaterials returns true;
  • ::Refine::wrapLayers else.

R3 Replace particles by a coherent pile

This is done by

  • ::Refine::refineStructsWithAvg if useAvgMaterials;
  • ::Refine::refineStructsNoAvg else.

These are implemented in Resample/Refine/RefineStructsWithAvg.* and …NoAvg.*.

R4 Compute the average SLD per slice

This is done by

  • Resample.cpp::setAvgMaterials if useAvgMaterials.

R5 Recalculate the full magnetic induction

This is done by

  • Resample.cpp::setBField.