  Affine logic is a fragment of continuous logic, introduced by Bagheri, in
which only affine functions are allowed as connectives. This has the effect of
endowing type spaces with the structure of compact convex sets. We study
extremal models of affine theories (those that only realize extreme types), and
the ways and conditions under which all models can be described from the
extremal ones.
  We introduce and develop the general theory of measurable fields of metric
structures and their direct integrals. One of our main results is an extremal
decomposition theorem for models of simplicial theories, that is, affine
theories whose type spaces form Choquet simplices. We prove that every model of
a simplicial theory can be (uniquely) decomposed as a direct integral of
extremal models. This generalizes known decomposition results (ergodic
decomposition, tracial von Neumann factor decomposition), and moreover, holds
without any separability hypothesis.
  Two extreme kinds of simplicial theories are Bauer theories, whose extreme
types form a closed set, and Poulsen theories, whose extreme types form a dense
set. We show that Keisler randomizations of continuous theories are,
essentially, the same thing as affine Bauer theories. We establish a dichotomy
result: a complete simplicial theory is either Bauer or Poulsen.
  As part of our analysis, we adapt many results and tools from continuous
logic to the affine or extremal contexts (definability, saturation, type
isolation, categoricity, etc.). We also provide a detailed study of the
relations between continuous logic and affine logic.
  Finally, we present several examples of simplicial theories arising from
theories in discrete logic, Hilbert spaces, probability measure-preserving
systems, and tracial von Neumann algebras.
