Commit Graph

272 Commits

Author SHA1 Message Date
Mark Olesen
3a1a160cbb ENH: refactor and extend handling of faSchemes/fvSchemes
- use common base for handling scheme lookups.
  Extended to support local injection of schemes into the dictionaries
  during runtime.
2021-05-13 15:27:24 +02:00
Mark Olesen
3bc8ab2839 ENH: improve PrimitivePatch access for edges
- return internalEdges() and boundaryEdges() sub lists directly

- calculate and return boundaryFaces() to identify faces attached to
  boundary edges.

- minor code cleanup, and add PrimitivePatchBase class for
  non-templated code.

STYLE: mark unused parameter in globalMeshData mergePoints
2021-05-12 11:24:57 +02:00
Mark Olesen
b62437081e ENH: support optional fallback content for IOdictionary 2021-04-26 17:09:38 +02:00
Mark Olesen
95cd8ee75c ENH: improve hashing overloads of string-types and HashTable/HashSet
- additional dummy template parameter to assist with supporting
  derived classes. Currently just used for string types, but can be
  extended.

- provide hash specialization for various integer types.
  Removes the need for any forwarding.

- change default hasher for HashSet/HashTable from 'string::hash'
  to `Hash<Key>`. This avoids questionable hashing calls and/or
  avoids compiler resolution problems.

  For example,
  HashSet<label>::hasher and labelHashSet::hasher now both properly
  map to Hash<label> whereas previously HashSet<label> would have
  persistently mapped to string::hash, which was incorrect.

- standardize internal hashing functors.

  Functor name is 'hasher', as per STL set/map and the OpenFOAM
  HashSet/HashTable definitions.

  Older code had a local templated name, which added unnecessary
  clutter and the template parameter was always defaulted.
  For example,

      Old:  `FixedList<label, 3>::Hash<>()`
      New:  `FixedList<label, 3>::hasher()`
      Unchanged:  `labelHashSet::hasher()`

  Existing `Hash<>` functor namings are still supported,
  but deprecated.

- define hasher and Hash specialization for bitSet and PackedList

- add symmetric hasher for 'face'.
  Starts with lowest vertex value and walks in the direction
  of the next lowest value. This ensures that the hash code is
  independent of face orientation and face rotation.

NB:
  - some of keys for multiphase handling (eg, phasePairKey)
    still use yet another function naming: `hash` and `symmHash`.
    This will be targeted for alignment in the future.
2021-04-19 16:33:42 +00:00
Mark Olesen
bb86eecdc4 ENH: add filtering version of dictionary copy
- can be useful when extracting portions of larger field files
2021-04-15 10:41:53 +02:00
Mark Olesen
da44c100f0 ENH: support additional output meta data in FoamFile header
- currently add to mesh zones to provide a table of contents
  of the zone names that allows downstream consumers quick access to
  the information without needing to parse the entire file.
2021-03-16 08:47:59 +00:00
Mark Olesen
0c985edfc8 ENH: additional routines for reading/writing/parsing IOObject headers
- support selective enable/disable of the file banner.

ENH: improve code isolation for decomposedBlockData

- use readBlockEntry/writeBlockEntry to encapsulate the IO handling,
  which ensures more consistency

- new decomposedBlockData::readHeader for chaining into the
  block header information.

- remove unused constructors for decomposedBlockData

ENH: minor cleanup of collated fileOperations
2021-03-16 08:47:59 +00:00
Mark Olesen
e3c8af0c8f ENH: add read/write specialization for lists of character data
- read/write lists of character data in binary only.
  This is the only means of preserving data.
  If character data are written as an ASCII list, there is no means of
  determining if spaces or newlines are content or separators.
2021-03-16 08:47:58 +00:00
Kutalmis Bercin
66d1b54a79 ENH: 'Math' namespace for mathematical functions
- centralises existing functions (erfInv, incGamma*, invIncGamma*).
  Provides a location for additional functions in the future.

- adjusted existing models to use these functions
  (e.g. distributionModels::normal)
2021-02-16 18:08:50 +01:00
Mark Olesen
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
Mark Olesen
833ee40904 ENH: add pTraits for uint8_t 2020-10-07 09:17:00 +02:00
Mark Olesen
d204d33c4e ENH: new IntRange class, enhancements to labelRange, sliceRange
- add reverse iterators and replace std::iterator
  (deprecated in C++17) with full definitions

- simplify construction of iterators

- construct labelRange from a single single parameter.
  This creates a (0,len) range.

- make basic constructors forms constexpr.
  Remove unused size checks.

- Derive labelRange from new IntRange template class.
  Allows reuse of base functionality with different integral sizes.

Deprecations:

  - deprecate labelRange::valid() in favour of using
    labelRange::empty() or the bool operator.
    For example,

        if (range) ...  vs older  if (range.valid()) ...

DEFEATURE: drop labelRange::null, scalarRange::null static variables

- turned out to be not particularly useful.
  Can simply use constexpr contructor forms

DEFEATURE: drop labelRange::identity static method

- simply use the single-parameter constructor
2020-09-23 10:45:57 +02:00
Mark Olesen
be99805986 ENH: isolate config/version information from regular globals
- slight speed gain for recompilation and provisions for future
  refactoring
2020-09-07 17:36:26 +02:00
Mark Olesen
6e2b7be983 ENH: direct access to wrapped ifstream/ofstream with compression (#1805)
- previously hidden as Detail::[IO]FstreamAllocator, now exposed
  directly as [io]fstreamPointer, which allows reuse for
  std::ifstream, std::ofstream wrapping, without the additional
  ISstream, OSstream layers.

  These stream pointers have some characteristics similar to a
  unique_ptr.

- restrict direct gzstream usage to two files (fstreamPointers.C,
  gzstream.C) which improves localization and makes it simpler to
  enable/disable with the `HAVE_LIBZ` define.

  The HAVE_LIBZ define is currently simply hard-coded in the
  Make/options.

  If compiled WITHOUT libz support:
    - reading gz files : FatalError
    - writing gz files : emit warning and downgrade to uncompressed
    - warn if compression is specified in the case controlDict
      and downgrade to uncompressed

ENH: minor updates to gzstream interface for C++11

- support construct/open with std::string for the file names.

CONFIG: provisioning for have_libz detection as wmake/script
2020-08-10 12:40:08 +02:00
Mark Olesen
e3367dbdc1 ENH: inline and extend clockValue, clockTime
- mostly wraps std::chrono so can inline much of it, which is potentially
  helpful when used for inner timings.

- add elapsedTime() method for direct cast to double and for
  naming similarity with wall-clock method.

Potential breaking change (minor):

- clockValue construct with a bool parameter is now simply tagged
  dispatch (value is ignored) and always queries the current clock
  value. This avoids needless branching.
  Since this constructor form has primarily been used internally (eg,
  clockTime), breakages in user code are not expected.
2020-05-29 15:48:21 +02:00
Mark Olesen
5105154b88 ENH: expression versions of Function1 and PatchFunction1 (#1709) 2020-05-23 18:42:47 +02:00
Mark Olesen
51c2329f97 ENH: additional step function, cleanup autoPtr use in Function1 2020-05-23 18:42:41 +02:00
Mattijs Janssens
ab4bfaeee3 ENH: lduMatrix: new matrix solvers: PPCG,PPCR
PPCG is pipelined version of PCG, PPCR is conjugate
residual version.
2020-03-11 13:53:03 +00:00
Mark Olesen
9dbf94777c GIT: relocate geometricSurfacePatch, geometricSurfacePatchList
- was in surfMesh/triSurface/patches/
  now in OpenFOAM/meshes/Identifiers/surface/

This places the code closer to other identifier classes,
which aids in maintaining consistency
2020-01-15 17:21:22 +01:00
Mark Olesen
c2123452b1 ENH: generalize string expression evaluation
- replace stringOps::toScalar with a more generic stringOps::evaluate
  method that handles scalars, vectors etc.

- improve #eval to handle various mathematical operations.
  Previously only handled scalars. Now produce vectors, tensors etc
  for the entries. These tokens are streamed directly into the entry.
2019-12-09 19:44:23 +01:00
Mark Olesen
f84ebb9ad3 ENH: driver/parser/scanner for plain field expressions 2019-12-09 19:44:22 +01:00
Mark Olesen
17f5560cb9 ENH: base driver for expressions 2019-12-09 19:44:21 +01:00
Mark Olesen
9fd696e1ae ENH: add ITstream append and seek methods.
- ITstream append() would previously have used the append from the
  underlying tokenList, which leaves the tokenIndex untouched and
  renders the freshly appended tokens effectively invisible if
  interspersed with primitiveEntry::read() that itself uses tokenIndex
  when building the list.

  The new append() method makes this hidden ITstream bi-directionality
  easier to manage. For efficiency, we only append lists
  (not individual tokens) and support a 'lazy' resizing that allows
  the final resizing to occur later when all tokens have been appended.

- The new ITstream seek() method provides a conveniently means to move
  to the end of the list or reposition to the middle.
  Using rewind() and using seek(0) are identical.

ENH: added OTstream to output directly to a list of tokens

---

BUG: List::newElem resized incorrectly

- had a simple doubling of the List size without checking that this
  would indeed be sufficient for the requested index.

  Bug was not triggered since primitiveEntry was the only class using
  this call, and it added the tokens sequentially.
2019-12-06 17:23:59 +01:00
Mark Olesen
daac96f165 ENH: addition of expressions::exprResult
- polymorphic field/result
2019-11-18 11:29:53 +01:00
Mark Olesen
fae91edd85 ENH: basics for expression string handling 2019-11-20 16:32:32 +01:00
Mark Olesen
9e6683f7bc ENH: add conditionals to #eval (string to scalar)
Example,

     ($radius > 10) ? sin(degToRad(45)) : cos(degToRad(30))

- protect division and modulo against zero-divide.

- add scanner/parser debugging switches in the namespace,
  selectable as "stringToScalar". For example,

    debug parser:  foamDictionary -debug-switch stringToScalar=2
    debug scanner: foamDictionary -debug-switch stringToScalar=4
    debug both:    foamDictionary -debug-switch stringToScalar=6
2019-11-19 14:22:03 +01:00
Mark Olesen
a23e8bf540 STYLE: remove unused vector 'zip' function and unused .C files 2019-11-15 10:41:00 +01:00
Mark Olesen
6798c61047 ENH: add boolIOField to allow registering 2019-11-13 18:54:10 +01:00
Mark Olesen
da33222970 ENH: add flexible command options for setting Debug and Info switches #1467
For example,

   $ someSolver -info-switch writeOptionalEntries

- note that values changed via the command-line are changed after the
  etc/controlDict entries, but *before* any case-local
  system/controlDict entries.

  However, in many testing cases the command-line options eliminate
  the need for such local file modifications.

ENH: cleanup handling of local debug switches in Time

- add as methods directly on simpleObjectRegistry to avoid code
  duplication

STYLE: adjust internal naming of ITstream parameters
2019-10-25 15:03:11 +02:00
Mark Olesen
28a9cde028 ENH: add boolField specializations: negate(), component()
ENH: added scalarField hypot() function
2019-10-10 13:13:20 +02:00
Mark Olesen
836d3a849f ENH: add stringOps::toScalar and dictionary #eval directive
- the #eval directive is similar to the #calc directive, but for evaluating
  string expressions into scalar values. It uses an internal parser for
  the evaluation instead of dynamic code compilation. This can make it
  more suitable for 'quick' evaluations.

  The evaluation supports the following:
    - operations:  - + * /
    - functions:  exp, log, log10, pow, sqrt, cbrt, sqr, mag, magSqr
    - trigonometric:  sin, cos, tan, asin, acos, atan, atan2, hypot
    - hyperbolic:  sinh, cosh, tanh
    - conversions:  degToRad, radToDeg
    - constants:  pi()
    - misc: rand(), rand(seed)
2019-09-30 16:40:32 +02:00
Mark Olesen
bbc2d4a8b0 ENH: HashTable and HashSet improvements
- unfriend HashSet, HashTable IO operators

- global min(), max(), minMax() functions taking a labelHashSet and an
  optional limit. For example,

      labelHashSet set = ...;

      Info<< "min is " << min(set) << nl;
      Info<< "max (non-negative) " << max(set, 0) << nl;

- make HashTable iterator '->' dereferencing more consistent by also
  supporting non-pointer types as well.

- read HashTable values in-situ to avoid copying
2019-07-12 18:00:00 +02:00
Sergio Ferraris
8170f2ad92 INT: Org integration of VOF, Euler phase solvers and models.
Integration of VOF MULES new interfaces. Update of VOF solvers and all instances
of MULES in the code.
Integration of reactingTwoPhaseEuler and reactingMultiphaseEuler solvers and sub-models
Updating reactingEuler tutorials accordingly (most of them tested)

New eRefConst thermo used in tutorials. Some modifications at thermo specie level
affecting mostly eThermo. hThermo mostly unaffected

New chtMultiRegionTwoPhaseEulerFoam solver for quenching and tutorial.

Phases sub-models for reactingTwoPhaseEuler and reactingMultiphaseEuler were moved
to src/phaseSystemModels/reactingEulerFoam in order to be used by BC for
chtMultiRegionTwoPhaseEulerFoam.

Update of interCondensatingEvaporatingFoam solver.
2019-06-07 09:38:35 +01:00
mattijs
46bc808261 ENH: add primitives support for mixed precision (#1086)
- add vsmall pTraits for scalars
- report the solve scalar in buildArch information
2019-02-03 16:54:25 +00:00
Mark Olesen
828f8e8504 ENH: add simple profiling of MPI communications 2019-04-25 15:33:51 +02:00
Mark Olesen
f76733711b ENH: reorganize cpuTime into C++ and POSIX versions (#1238) 2019-04-11 11:00:28 +02:00
Mark Olesen
b56fbc4377 ENH: replace OSspecific clockValue with std::chrono version (#1278)
- aids with portability and maintenance (#1238)
2019-04-11 10:07:54 +02:00
Mark Olesen
d4eb17a9ff ENH: new sliceRange class
- this is somewhat like labelRange, but with a stride.
  Can be used to define slices (of lists, fields, ..) or as a range specifier
  for a for-loop. For example,

      for (label i : sliceRange(0, 10, 3))
      {
          ...
      }
2019-04-06 15:07:53 +02:00
Mark Olesen
37819905c2 ENH: add some function support for complexField (#1247)
- operators are still incomplete, as are dimensioned fields,
  field-fields etc.

- split complexFields into separate complexField, complexVectorField files
2019-03-29 11:57:02 +01:00
Mark Olesen
487877377d ENH: reorganize regular expressions and add C++11 regex support
- new regExpCxx wrapper for C++11 regex support with drop-in
  compatibility with existing code.

- regExpPosix (was regExp), for future phase out in favour of regExpCxx.

- The regExp header will continue to be used for defining an
  appropriate typedef corresponding to the preferred implementation.
2019-03-14 13:24:23 +01:00
Mark Olesen
5de5ae35ba ENH: add labelVector2D definition
- can be useful for 2D mesh dimensioning or possibly for matrices
2019-02-22 18:11:00 +01:00
mattijs
e3008553e8 ENH: uniformFixedValue: adapt point bc. See #1046. 2019-02-07 14:08:03 +00:00
Mark Olesen
ad7f29466a ENH: added timeFunctionObject virtual class in inheritance hierarchy
- simply a functionObject with an additional Time reference, which is
  a combination frequently used by concrete functionObjects
2019-01-25 08:56:21 +01:00
Mark Olesen
f19150cd32 STYLE: relocate identity() declaration to List.H (was in ListOps.H)
- remove unused and deprecated emptyList() casting function.

  This function is disllowed by many modern compilers and is no longer
  used within OpenFOAM - was deprecated 2018-07.
2019-01-16 21:00:22 +01:00
Mattijs Janssens
e6f8dfecec Feature merge OpenFOAM.org 2019-01-10 10:10:06 +00:00
Mark Olesen
689db16064 ENH: add explicit doubleVector, doubleTensor typedefs
- the counterpart to floatVector, doubleTensor, which can be useful
  for connecting to programs that always expect double precision for
  the arguments, when using single-precision for OpenFOAM itself.

  Eg,
     doubleVector pos = ...;
     vtkcamera->SetPosition(pos.v_);
2018-12-09 17:44:12 +01:00
Mark Olesen
083e9e9665 ENH: isolate version information in foamVersion names instead of globals
- For compatibility, access to the old global names is provided via
  macros
        #define FOAMversion     foamVersion::version
        #define FOAMbuild       foamVersion::build
        #define FOAMbuildArch   foamVersion::buildArch

- this isolation makes it easier to provide additional scoped methods
  for dealing with version related information.  Eg, printBuildInfo()
2018-11-22 11:50:24 +01:00
Mark Olesen
5187aa13aa ENH: improve output formatting for usage information
- generalize output text wrapping, use for usage notes

- add -help-man option for generating manpage content for any OpenFOAM
  application or solver.

  bin/tools/foamCreateManpage as helper
2018-11-21 19:55:28 +01:00
Mark Olesen
4bf4b89af4 ENH: support scalar predicates and lists of scalar predicates (#1056) 2018-11-13 14:12:53 +01:00
mattijs
6d906e52d3 COMP: fieldTypes: add to link line after the static symbols it uses
This fixes the static-initialisation order problem - fieldTypes.C
referes to labelIOField etc. which are after it in Make/files and
hence the link order.
2018-11-08 13:28:46 +00:00