... | @@ -8,18 +8,76 @@ |
... | @@ -8,18 +8,76 @@ |
|
|
|
|
|
[[_TOC_]]
|
|
[[_TOC_]]
|
|
|
|
|
|
## Deprecation and Removal
|
|
<!-- ## Deprecation and Removal -->
|
|
|
|
|
|
### Deprecated Methods
|
|
<!-- ### Deprecated Methods -->
|
|
|
|
|
|
### Removed Methods
|
|
<!-- ### Removed Methods -->
|
|
|
|
|
|
### Removed Items
|
|
<!-- ### Removed Items -->
|
|
|
|
|
|
## Changes in definition
|
|
## Potential Breaking Changes
|
|
|
|
|
|
## Changes in behaviour
|
|
As part of the updates to the runTime selection mechanism, the
|
|
|
|
previous typedef has been changed to provide a better distinction
|
|
|
|
between content and storage type by appending `Type` to the old
|
|
|
|
typedef name.
|
|
|
|
This seemingly cosmetic change was useful since it freed up the old
|
|
|
|
name for use as a singleton method. However, this will potentially
|
|
|
|
cause issues if derived code still uses the old typedef.
|
|
|
|
|
|
## Namespace changes
|
|
An example of broken code:
|
|
|
|
```
|
|
|
|
dictionaryConstructorTable::iterator cstrIter =
|
|
|
|
dictionaryConstructorTablePtr_->find(modelType);
|
|
|
|
```
|
|
|
|
The trivial _"upgrade"_ is to simply replace the iterator type with
|
|
|
|
the c++11 `auto` keyword. For example,
|
|
|
|
```
|
|
|
|
auto cstrIter = dictionaryConstructorTablePtr_->find(modelType);
|
|
|
|
```
|
|
|
|
|
|
|
|
NOTE: This change is valid for _any_ OpenFOAM version/variant from the last
|
|
|
|
5+ years.
|
|
|
|
|
|
|
|
|
|
|
|
## Simplified handling of runTime selection tables
|
|
|
|
|
|
|
|
To streamline handling of runTime selection (eg, the `New` factory
|
|
|
|
method), the selection tables now provide a singleton accessor that
|
|
|
|
supports use of compatibility aliases and greatly simplifies handling.
|
|
|
|
|
|
|
|
Example of the new access method. Here we use the `ctor` prefix
|
|
|
|
to denote constructor:
|
|
|
|
```
|
|
|
|
auto* ctorPtr = dictionaryConstructorTable(modelType);
|
|
|
|
|
|
|
|
if (!ctorPtr)
|
|
|
|
{
|
|
|
|
... error handling
|
|
|
|
}
|
|
|
|
|
|
|
|
return autoPtr<myModel>(ctorPtr(dict, ...));
|
|
|
|
```
|
|
|
|
|
|
|
|
This is less cluttered than the older style, which still works, but
|
|
|
|
without any compatibility (alias) handling:
|
|
|
|
```
|
|
|
|
auto ctorIter = dictionaryConstructorTablePtr_->cfind(modelType);
|
|
|
|
|
|
|
|
if (!ctorIter.found())
|
|
|
|
{
|
|
|
|
... error handling
|
|
|
|
}
|
|
|
|
|
|
|
|
return autoPtr<myModel>(ctorIter()(dict, ...));
|
|
|
|
```
|
|
|
|
|
|
|
|
<!-- ## Changes in behaviour -->
|
|
|
|
|
|
|
|
<!-- ## Namespace changes -->
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
[code-patterns]: /coding/patterns/patterns
|
|
[code-patterns]: /coding/patterns/patterns
|
|
|
|
[upgrade-guide]: /upgrade/upgrade |