Commit Graph

23 Commits

Author SHA1 Message Date
Mark Olesen
188e61af16 STYLE: use readValueEntry in BCs. Assign Zero for refValue/refGrad 2023-04-04 09:56:55 +02:00
Mark Olesen
70d526cd82 ENH: neg(x) instead of '1 - pos0(x)' for less-than 0 check
- fewer operations

ENH: replace 'neg(x)*a + pos0(x)*b' with 'lerp(a, b, pos0(x))'

- uses pos0 as a 0-1 selector. Fewer operations.
2023-02-21 10:05:27 +01:00
Mark Olesen
fe4688c27f ENH: patch fields writeValueEntry method (frequently used)
- add base-level readValueEntry, readMixedEntries methods
  that allow optional or mandatory reading.

STYLE: wording for patch fields comments
2023-02-20 11:13:43 +01:00
Mark Olesen
27a7ae2d1d ENH: use simpler lookupPatchField form 2023-02-13 20:08:48 +01:00
Andrew Heather
098aec4962 ENH: Function1's - added objectRegistry access 2021-11-26 11:22:36 +00:00
Mark Olesen
e11c072bc4 CONFIG: incorrect BC code templates (fixes #1885)
- autoPtr to Function requires clone() method, not optional copy/move
  argument.

- fix bad character range for 'sed'
2020-10-20 14:23:40 +02:00
Mark Olesen
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
OpenFOAM bot
e9219558d7 GIT: Header file updates 2019-10-31 14:48:44 +00:00
OpenFOAM bot
154029ddd0 BOT: Cleaned up header files 2019-02-06 12:28:23 +00:00
Mark Olesen
efdbeae27e ENH: use dictionary::get<> instead of pTraits (#762)
- check Istream in readBool in operator>> variant (#1033)
2018-11-20 10:10:39 +01:00
Mark Olesen
8eddcc072a ENH: avoid readScalar, readLabel etc from dictionary (#762, #1033)
- use the dictionary 'get' methods instead of readScalar for
  additional checking

     Unchecked:  readScalar(dict.lookup("key"));
     Checked:    dict.get<scalar>("key");

- In templated classes that also inherit from a dictionary, an additional
  'template' keyword will be required. Eg,

     this->coeffsDict().template get<scalar>("key");

  For this common use case, the predefined getXXX shortcuts may be
  useful. Eg,

     this->coeffsDict().getScalar("key");
2018-10-12 08:14:47 +02:00
Mark Olesen
c0ba7bf05a STYLE: use Ostream writeEntry when writing key/value entries
- makes for clearer code

ENH: make writeIfDifferent part of Ostream
2017-11-06 00:49:24 +01:00
Henry Weller
56bfc75949 Rationalize the "pos" function
"pos" now returns 1 if the argument is greater than 0, otherwise it returns 0.
This is consistent with the common mathematical definition of the "pos" function:

https://en.wikipedia.org/wiki/Sign_(mathematics)

However the previous implementation in which 1 was also returned for a 0
argument is useful in many situations so the "pos0" has been added which returns
1 if the argument is greater or equal to 0.  Additionally the "neg0" has been
added which returns 1 if if the argument is less than or equal to 0.
2017-06-22 14:32:18 +01:00
Mark Olesen
2b249e1ad3 STYLE: avoid default copyright assignment when generating from code templates 2017-07-11 08:58:52 +02:00
Will Bainbridge
ea257737df codeTemplates: The copyright year is now set automatically 2017-04-18 11:01:41 +01:00
Henry Weller
71fdcab771 Updated header documentation processed by Doxygen 2016-06-19 21:23:54 +01:00
Henry Weller
b3f3562d3c Doxygen documentation: Use the standard 'Usage' rather than the '\heading....' 2016-06-17 17:22:24 +01:00
Henry Weller
7e5d9982a7 etc/codeTemplates/BC: Use Use 'Zero' rather than 'pTraits<Type>::zero' to initialize to 0 2016-03-22 08:33:16 +00:00
Henry Weller
95d146ecdf Rationalized the indentation of C-preprocessor directives 2016-02-29 15:42:03 +00:00
Henry Weller
caed25f447 Code templates: Updated headers 2016-02-15 20:53:21 +00:00
Henry Weller
968c888fc4 Rename DataEntry -> Function1
Function1 is an abstract base-class of run-time selectable unary
functions which may be composed of other Function1's allowing the user
to specify complex functions of a single scalar variable, e.g. time.
The implementations need not be a simple or continuous functions;
interpolated tables and polynomials are also supported.  In fact form of
mapping between a single scalar input and a single primitive type output
is supportable.

The primary application of Function1 is in time-varying boundary
conditions, it also used for other functions of time, e.g. injected mass
is spray simulations but is not limited to functions of time.
2016-02-08 16:18:07 +00:00
Henry Weller
56fa7c0906 Update code to use the simpler C++11 template syntax removing spaces between closing ">"s 2016-01-10 22:41:16 +00:00
Chris Greenshields
a3e555e72c foamNewBC: script to create template code for a new boundary condition
Run foamNewBC -h for details
2015-12-04 14:33:56 +00:00