- following Andy's idea to return values as label whenever possible
eg, 1.2e6 -> 1200000
but left it commented out
- avoid buffer overflow in ISstream::read(word&).
Is the 'if (fail())' check itself actually in the correct place??
- other minor cosmetic changes
- allow construct with Xfer container for the addressing
- Replaced non-const addressing() method in BiIndirectList with
resetAddressing() method as per IndirectList
- could also move to utilities/miscellaneous
- the dictionary compare contents might be useful enough to move
into dictionary code.
- usage example (w/o -rewrite):
for i in $(find -name fvSolution)
do
fvSolutionCombine -case "${i%/system/fvSolution}"
done
- use shift-right instead of shift-left formulation to avoid wrong behaviour
with non-optimized compilation when the packed items fit exactly in the
available number of bits.
- use shift-right instead of shift-left formulation to avoid wrong behaviour
with non-optimized compilation when the packed items fit exactly in the
available number of bits.
- similar to the #include directive, but does not generate an error if the
file does not exist.
Note: opted for an explicit naming #includeIfPresent rather than #cinclude
Oriented somewhat on dictionary methods.
Return the argument string associated with the named option:
Info<< "-foo: " << args.option("foo") << nl;
Return true if the named option is found
if (args.optionFound("foo")) ...
Return an IStringStream to the named option
old: value = readScalar(IStringStream(args.options()["foo"])());
newer: value = readScalar(args.optionLookup("foo")());
also: List<scalar> lst(args.optionLookup("foo")());
Read a value from the named option
newest: value = args.optionRead<scalar>("foo");
Read a value from the named option if present.
old: if (args.options().found("foo"))
{
value = readScalar(IStringStream(args.options()["foo"])());
}
new: args.optionReadIfPresent("foo", value);
Read a List of values from the named option
patches = args.optionReadList<word>("patches");
Didn't bother adding optionReadListIfPresent<T>(const word&), since it
probably wouldn't be common anyhow.
- Read a bracket-delimited list, or handle a single value as list of size 1.
Mostly useful for handling command-line arguments.
eg,
if (args.options().found("patches"))
{
patches = readList<word>(IStringStream(args.options()["patches"])());
}
can handle both of these:
-patches patch0
-patches \( patch1 patch2 patch3 \)
- added constructor dictionary(const dictionary*) that also handles NULL
pointers and makes it convenient to construct from a possibly nonexistent
sub-dictionary:
eg,
dictionary dict2(dict1.subDictPtr("someDict"));
- make some of the turbulence Coeffs sub-dictionary optional.
Their contents are all 'lookupOrAddDefault' anyhow.
- in turbulentMixingLength BCs, skip namespace qualifier in template
(eg, <RASModel> vs. <compressible::RASModel>)
- change comments from 'turbulenceProperties' to RASProperties/LESProperties
- consistency between compressible/incompressible - no separate file for
'New' selector etc
- consistency in accessing the model coefficients.
Use method coeffDict() for const access.
Use protected data member coeffDict_ for read/write access.
- document model coefficients in etc/constant/RASProperties.
Need the same for LESProperties before we can prune these from the
tutorials.
- #inputMode error
now issues a FatalError on duplicate entries
- #inputMode warn
issues a warning on duplicate entries, corresponds to the
old behaviour of 'error'
- #inputMode protect
prevents overwriting existing entries
The 'protect' mode provides a simple mechanism for supplying default values.
eg,
in file1:
#inputMode protect
intensity 0.1;
mixingLength 0.005;
#inputMode merge
inlet
{
type turbulentIntensityKineticEnergyInlet;
intensity $intensity;
}
which is included from file2:
intensity 0.05;
#include "file1"
- objectRegistry gets a rename() that also adjusts the dbDir
- cloud reworked to use static variables subInstance and defaultName.
This avoids writing "lagrangian" everywhere
string fixes
- avoid masking of std::string::replace in string.H
- avoid old strstream in PV3FoamReader
- regIOobject: don't re-register an unregister object on rename/assignment
- Hasher: split-off HasherInt with uint32_t specializations
- IOobject: writeBanner/writeDivider return Stream for easier chaining.
... also dropped some namespace bracketing while I was at it.
- If the underlying type is contiguous, FixedList hashes its storage directly.
- Drop labelPairHash (non-commutative) from fvMeshDistribute since
FixedList::Hash does the right thing anyhow.
- Hash<edge> specialization is commutative, without multiplication.
- Hash<triFace> specialization kept multiplication (but now uLabel).
There's not much point optimizing it, since it's not used much anyhow.
Misc. changes
- added StaticAssert to NamedEnum.H
- label.H / uLabel.H : define FOAM_LABEL_MAX, FOAM_ULABEL_MAX with the
values finally used for the storage. These can be useful for pre-processor
checks elsewhere (although I stopped needing them in the meantime).
- not much speed difference between SuperFastHash and Jenkin's lookup3 but
both are 5-10% faster than what is currently implemented in Foam::string,
albeit inlining probably helps there.
- TODO: integration with existing infrastructure
- compare iteratorBase == iteratorBase by value, not position
thus this works
list[a] == list[b] ...
- compare iterator == iteratorBase and const_iterator == iteratorBase
by position, not value. The inheritance rules means that this works:
iter == list.end() ...
this will compare positions:
iter == list[5];
Of course, this will still compare values:
*iter == list[5];