distributions: Generalise usage

The distributions have been extended in various ways to permit usage in
a greater variety of situations...

The distributions now have write methods which allow a distribution to
be written into a field file for restart, therby permitting their usage
in boundary conditions and similar. Their read methods now also support
dimension-checked unit conversions for all their parameters.

An additional selector has been added that allows a distribution to be
re-constructed with a different sample size exponent.

The distributions now own their random generator, thereby simplifying
their usage and preventing the need for a (potentially dangling)
reference member. This makes sense now as the random generators do not
rely on global state; individual sub-models can and should own their own
random generator and manage its initialisation and restart. This
principle should be extended to other parts of the code in future.
This commit is contained in:
Will Bainbridge
2024-06-11 10:46:59 +01:00
parent 125902a872
commit e1e0e258c8
55 changed files with 695 additions and 244 deletions

View File

@ -24,17 +24,7 @@
mkDir(pdfPath);
randomGenerator rndGen(label(0));
autoPtr<distribution> p
(
distribution::New
(
pdfDictionary,
rndGen,
0
)
);
autoPtr<distribution> p(distribution::New(unitAny, pdfDictionary, 0, 0));
const scalar xMin = p->min();
const scalar xMax = p->max();