Commit Graph

120 Commits

Author SHA1 Message Date
f7c7fa94a3 ENH: add Function1 constant() member
- marks if the value is considered to be independent of 'x'.
  Propagate into PatchFunction1 instead ad hoc checks there.

- adjust method name in PatchFunction1 to 'whichDb()' to reflect
  final changes in Function1 method names.

ENH: add a Function1 'none' placeholder function

- This is principally useful for interfaces that expect a Function1
  but where it is not necessarily used by a particular submodel.

TUT: update Function1 creation to use objectRegistry
2021-12-03 15:32:37 +01:00
adcf41bd13 ENH: add Function1 wrapping for functionObject trigger
Returns a 0/1 value corresponding to function object trigger levels.

    Usage:
    \verbatim
        <entryName> functionObjectTrigger;
        <entryName>Coeffs
        {
            triggers        (1 3 5);
            defaultValue    false;  // Default when no triggers activated
        }
    \endverbatim

ENH: add reset() method for Constant Function1

ENH: allow forced change of trigger index

- the triggers are normally increase only,
  but can now override this optionally
2021-11-26 11:22:36 +00:00
89ddc271c7 ENH: LimitRange Function1 - extended and renamed
Description
    Function1 wrapper that maps the input value prior to it being used by
    another Function1.

    Example usage for limiting a polynomial:
    \verbatim
        <entryName>
        {
            type            inputValueMapper;
            mode            minMax;

            min             0.4;
            max             1.4;

            value polynomial
            (
                (5 1)
                (-2 2)
                (-2 3)
                (1 4)
            );
        }
    \endverbatim

    Here the return value will be:
    - poly(0.4) for x <= 0.4;
    - poly(1.4) for x >= 1.4; and
    - poly(x) for 0.4 < x < 1.4.

    Example usage for supplying a patch mass flux for a table lookup:
    \verbatim
        <entryName>
        {
            type            inputValueMapper;
            mode            function;

            function
            {
                type            functionObjectValue;
                functionObject  surfaceFieldValue1;
                functionObjectResult sum(outlet,phi);
            }

            value
            {
                type        table;
                file        "<system>/fanCurve.txt";
            }
        }
    \endverbatim

    Where:
    \table
        Property | Description                                  | Required
        mode     | Mapping mode (see below)                     | yes
        function | Mapping Function1                            | no*
        min      | Minimum input value                          | no*
        max      | Maximum input value                          | no*
        value    | Function of type Function1<Type>             | yes
    \endtable

    Mapping modes include
    - none     : the input value is simply passed to the 'value' Function1
    - function : the input value is passed through the 'function' Function1
                 before being passed to the 'value' Function1
    - minMax   : limits the input value to 'min' and 'max' values before being
                 passed to the 'value' Function1

Note
    Replaces the LimitRange Function1 (v2106 and earlier)
2021-11-26 11:22:36 +00:00
ba45fb2cba ENH: Function1 - updated time-based Function1 usage 2021-11-26 11:22:36 +00:00
f6ee1811e7 STYLE: renamed convertTimeBase to more descriptive userTimeToTime 2021-11-26 11:22:36 +00:00
098aec4962 ENH: Function1's - added objectRegistry access 2021-11-26 11:22:36 +00:00
9194cd5203 ENH: Deprecated TimeFunction1 usage in favour of Function1 2021-11-26 11:22:36 +00:00
f29eb55cee ENH: Refactored TimeFunction1 - now possible using Function1 directly 2021-11-26 11:22:36 +00:00
bc2b469f9d ENH: Added new Function1: FunctionObjectValue
Returns a value retrieved from a function object result.

Usage:
    <entryName> functionObjectValue;
    <entryName>Coeffs
    {
        functionObject          <name>;
        functionObjectResult    <function object result field name>
    }
2021-11-26 11:22:36 +00:00
70b55be684 COMP: Function1 - propagated API change resulting from new objectRegistry access 2021-11-26 11:22:36 +00:00
c1a04abd96 ENH: Function1 - added optional objectRegistry reference
Function1 can now be created with an object registry, e.g. time or mesh
database. This enables access to other stored objects, e.g. fields,
dictionaries etc. making Function1 much more flexible.

Note: will allow TimeFunction1 to be deprecated
2021-11-26 11:22:36 +00:00
ba95b89e5f ENH: add Function1 caching selector 2021-11-10 17:28:45 +01:00
8638d82325 ENH: additional dictionary controls, methods
STYLE: declaration order of topoSet, resize_nocopy for sortedOrder

STYLE: remove cstring dependency from SHA1

STYLE: use Ostream endEntry()
2021-11-09 21:33:32 +01:00
ba8d6bddcc ENH: use singleton method for accessing runtime selection
STYLE: use alias to mark partialFaceAreaWeightAMI deprecation after v2012
2021-11-05 17:21:27 +01:00
9ce5aa2136 BUG: Function1 Table: disallow wildcards. See #2223 2021-09-30 13:35:06 +01:00
399c21d76c ENH: adjustments for Function1/PatchFunction1
- additional debug information

- improve support for dictionary specification of constant, polynomial
  and table entries. These previously only worked properly for
  primitiveEntry, which causes confusion.

- extend table Function1 to include TableFile functionality.
  Simplifies switching and modifying content.
2021-04-26 17:09:39 +02:00
eb01cab052 ENH: failsafe version of Istream peek()
- return undefinedToken on error

STYLE: fix slicing of ITstream from dictionary lookup
2021-04-26 17:09:38 +02:00
7ff603d496 ENH: refactor Function1 to enable fields 2021-03-29 13:35:55 +00:00
e8cf2a2c62 ENH: more consistent use of IOstreamOption
- improves interface and data consistency.
  Older signatures are still active (via the Foam_IOstream_extras
  define).

- refine internals for IOstreamOption streamFormat, versionNumber

ENH: improve data alignment for IOstream and IOobject

- fit sizeof label/scalar into unsigned char

STYLE: remove dead code
2021-03-16 08:47:59 +00:00
a4dc2cc94b ENH: Added new LimitRange Function1 wrapper
Function1 wrapper that limits the input range of another Function1

Example usage for limiting a polynomial:

    limitedPolyTest        limitRange;
    limitedPolyTestCoeffs
    {
        min         0.4;
        max         1.4;

        value       polynomial
        (
            (5 1)
            (-2 2)
            (-2 3)
            (1 4)
        );
    }

Here the return value will be:
- poly(0.4) for x <= 0.4;
- poly(1.4) for x >= 1.4; and
- poly(x) for 0.4 < x < 1.4.
2020-12-16 15:24:50 +00:00
9f5b8d0ebb ENH: polynomial - added clone() 2020-12-16 15:24:50 +00:00
373d88a4c4 ENH: Function1 - added some missing time conversions 2020-12-15 21:46:57 +00:00
024d22cb64 BUG: missing nullptr check in Function1/PatchFunction1 fallback logic 2020-11-26 01:53:15 +01:00
8d2d894ae0 ENH: support frequency or period for Sine/Square Function1 (#1917)
- For slow oscillations it can be more intuitive to specify the
  period.

ENH: separate mark/space for Square

- makes it easier to tailor the desired intervals.

BUG: incorrect square wave fraction with negative phase shifts

ENH: additional cosine Function1

STYLE: avoid code duplication by inheriting Cosine/Square from Sine.
2020-11-19 16:57:45 +01:00
2f2dcdcf6f ENH: Function1 and PatchFunction1 improvements (#1917)
- easier support for non-mandatory functions.

  In some boundary conditions it can be desirable to support
  additional functions, but not necessarily require them. Make this
  easier to support with a Function1, PatchFunction1 NewIfPresent()
  selector.

- support for compatibility lookups

- harmonize branching logic and error handling between Function1 and
  PatchFunction1.

ENH: refactor a base class for Function1, PatchFunction1

- includes base characteristics, patch or scalar information

ENH: additional creation macros

- makeConcreteFunction1, makeConcretePatchFunction1Type for adding a
  non-templated function into the correct templated selection table.
  makeScalarPatchFunction1 for similarity with makeScalarFunction1
2020-11-19 16:57:45 +01:00
245ac07312 COMP: add missing include and clone() method to TableFile 2020-09-28 11:08:32 +02:00
bb3660b9a5 ENH: add construct ConstantField with uniform value 2020-09-25 15:30:50 +02:00
1c71c7cb23 Merge remote-tracking branch 'origin/master' into develop 2020-09-03 12:04:45 +02:00
fa364eda12 BUG: inconsistency between constructor and output (fixes #1816)
- slipped in with changes to csvTableReader (commit 59ed3ba18d) so
  only affects the 2006 version.

- adjust constructor to expect "componentColumns", but also accept
  "valueColumns" as 1912 and earlier-compatibility. This not only
  fixes the reported bug, but also ensure proper compatibility with
  older files.

ENH: use "refColumn" instead of "timeColumn" for csvTableReader

- consistent with the CSV Function1.
  Support 'timeColumn' as 1912 and earlier-compatibility.

TUT: remove unused table-reader entry
2020-08-31 15:17:32 +02:00
ae76b38270 BUG: TableBase: illegal reference. Fixes #1753 2020-07-01 14:53:26 +01:00
3e43edf056 ENH: unify use of dictionary method names
- previously introduced `getOrDefault` as a dictionary _get_ method,
  now complete the transition and use it everywhere instead of
  `lookupOrDefault`. This avoids mixed usage of the two methods that
  are identical in behaviour, makes for shorter names, and promotes
  the distinction between "lookup" access (ie, return a token stream,
  locate and return an entry) and "get" access (ie, the above with
  conversion to concrete types such as scalar, label etc).
2020-06-02 17:26:03 +02:00
51c2329f97 ENH: additional step function, cleanup autoPtr use in Function1 2020-05-23 18:42:41 +02:00
5f93f20652 ENH: add stringOps::inplaceRemoveSpace()
Style changes:
  - use std algorithm for some stringOps internals
  - pass SubStrings iterators by const reference

ENH: special nullptr handling for ISstream getLine
  - pass through to istream::ignore to support read and discard
2020-02-19 23:36:46 +01:00
b2713d2324 ENH: declare generated methods for lagrangian and thermo/functions 2020-01-30 12:38:27 +00:00
59ed3ba18d ENH: consistency improvements for interpolationTable, table readers
- avoid stealing autoPtr in interpolationTable copy operations

- improve local memory requirements of readers

- make OpenFOAM table reader default constructible

- more code alignment between csvTableReader and Function1::CSV
  (fix #1498 for csvTableReader as well)
2020-01-21 15:17:04 +01:00
9a7adf3606 Merge branch 'master' into develop-v1906 2019-12-06 12:05:32 +00:00
7c2ad98834 ENH: improve missing entry message for Function1 or PatchFunction1
- now indicate that the dictionary entry is missing, not that it is
  an unknown function type.

STYLE: adjust PatchFunction1New.C to have logic structure look similar
2019-11-18 15:34:52 +01:00
27956330ac COMP: declare template specialisation (gcc 4.8.5) 2019-11-19 06:58:38 +01:00
b40d1d8e4f BUG: decomposePar fails with csv table in binary (fixes #1498) 2019-11-18 16:59:51 +01:00
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
5e50800e2f ENH: improve missing entry message for Function1 or PatchFunction1
- now indicate that the dictionary entry is missing, not that it is
  an unknown function type.
2019-11-09 16:39:15 +01:00
87330972d8 ENH: interpolationTable improvements
- reduce code duplication, support returning multiple interpolations
  as a Field
2019-08-23 15:57:22 +02:00
fdf8d10ab4 Merge commit 'e9219558d7' into develop-v1906 2019-12-05 11:47:19 +00:00
fb09f56aba ENH: use FatalErrorInLookup macros (#1362) 2019-07-12 18:00:00 +02:00
3800ed8dd7 GIT: Removed unused file 2019-06-25 13:20:44 +01:00
c4a13897a1 STYLE: minor adjustments for fan tables (#1229) 2019-03-26 08:17:53 +01:00
12d9a159dc ENH: Function1: better error message. Fixes #1200. 2019-02-11 12:10:47 +00:00
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
e596377179 STYLE: avoid flush when dictionary {} closing (issue #1145)
- a holdover from introducing the endBlock() method
2019-01-03 19:12:12 +01:00
1d85fecf4d ENH: use Zero when zero-initializing types
- makes the intent clearer and avoids the need for additional
  constructor casting. Eg,

      labelList(10, Zero)    vs.  labelList(10, 0)
      scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
      vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
2018-12-11 23:50:15 +01:00