Diffraction analysis of materials in a state of stress: elastic loading and phase transformations