Commit Graph

23 Commits

Author SHA1 Message Date
Mark Olesen
07dafe7b0b STYLE: use range-for when looping dictionary entries.
- as part of the cleanup of dictionary access methods (c6520033c9)
  made the dictionary class single inheritance from IDLList<entry>.

  This eliminates any ambiguities for iterators and allows
  for simple use of range-for looping.

  Eg,
      for (const entry& e : topDict))
      {
          Info<< "entry:" << e.keyword() << " is dict:" << e.isDict() << nl;
      }

   vs

      forAllConstIter(dictionary, topDict, iter))
      {
          Info<< "entry:" << iter().keyword()
              << " is dict:" << iter().isDict() << nl;
      }
2018-10-19 13:08:24 +02:00
Mark Olesen
2f86cdc712 STYLE: more consistent use of dimensioned Zero
- when constructing dimensioned fields that are to be zero-initialized,
  it is preferrable to use a form such as

      dimensionedScalar(dims, Zero)
      dimensionedVector(dims, Zero)

  rather than

      dimensionedScalar("0", dims, 0)
      dimensionedVector("zero", dims, vector::zero)

  This reduces clutter and also avoids any suggestion that the name of
  the dimensioned quantity has any influence on the field's name.

  An even shorter version is possible. Eg,

      dimensionedScalar(dims)

  but reduces the clarity of meaning.

- NB: UniformDimensionedField is an exception to these style changes
  since it does use the name of the dimensioned type (instead of the
  regIOobject).
2018-03-16 10:24:03 +01:00
Mark Olesen
660f3e5492 ENH: cleanup autoPtr class (issue #639)
Improve alignment of its behaviour with std::unique_ptr

  - element_type typedef
  - release() method - identical to ptr() method
  - get() method to get the pointer without checking and without releasing it.
  - operator*() for dereferencing

Method name changes

  - renamed rawPtr() to get()
  - renamed rawRef() to ref(), removed unused const version.

Removed methods/operators

  - assignment from a raw pointer was deleted (was rarely used).
    Can be convenient, but uncontrolled and potentially unsafe.
    Do allow assignment from a literal nullptr though, since this
    can never leak (and also corresponds to the unique_ptr API).

Additional methods

  - clone() method: forwards to the clone() method of the underlying
    data object with argument forwarding.

  - reset(autoPtr&&) as an alternative to operator=(autoPtr&&)

STYLE: avoid implicit conversion from autoPtr to object type in many places

- existing implementation has the following:

     operator const T&() const { return operator*(); }

  which means that the following code works:

       autoPtr<mapPolyMesh> map = ...;
       updateMesh(*map);    // OK: explicit dereferencing
       updateMesh(map());   // OK: explicit dereferencing
       updateMesh(map);     // OK: implicit dereferencing

  for clarity it may preferable to avoid the implicit dereferencing

- prefer operator* to operator() when deferenced a return value
  so it is clearer that a pointer is involve and not a function call
  etc    Eg,   return *meshPtr_;  vs.  return meshPtr_();
2018-02-26 12:00:00 +01:00
Mark Olesen
37e248c74b STYLE: consistent use of wordHashSet instead of HashSet<word>
- the wordHashSet typedef is always available when HashSet has been
  included.

- use default HashTable key (word) instead of explicitly mentioning it
2018-02-22 11:19:47 +01:00
Henry Weller
e66e402976 Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev 2017-03-18 17:19:35 +00:00
Will Bainbridge
d401f1cfb4 reactingMultiphaseEulerFoam: Ensure that an unordered phase pair gets
generated whenever a BlendedInterfacialModel is created.

Resolves bug-report https://bugs.openfoam.org/view.php?id=2472
2017-03-17 11:26:24 +00:00
Henry Weller
5dd24f4968 Removed unhelpful clutter 2017-01-26 17:47:24 +00:00
Henry Weller
58f905ff70 C++11: Replaced the C NULL with the safer C++11 nullptr
Requires gcc version 4.7 or higher
2016-08-05 17:19:38 +01:00
Henry Weller
cb65ba71d7 Made all template declarations consistent using 'class' rather than 'typename' 2016-03-22 15:02:55 +00:00
Henry Weller
95d146ecdf Rationalized the indentation of C-preprocessor directives 2016-02-29 15:42:03 +00:00
Henry Weller
cd852be3da OpenFOAM: Updated all libraries, solvers and utilities to use the new const-safe tmp
The deprecated non-const tmp functionality is now on the compiler switch
NON_CONST_TMP which can be enabled by adding -DNON_CONST_TMP to EXE_INC
in the Make/options file.  However, it is recommended to upgrade all
code to the new safer tmp by using the '.ref()' member function rather
than the non-const '()' dereference operator when non-const access to
the temporary object is required.

Please report any problems on Mantis.

Henry G. Weller
CFD Direct.
2016-02-26 17:31:28 +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
Henry Weller
a52cae9102 reactingEulerFoam: Lookup fvOptions from the mesh rather than construct a local copy 2015-12-02 15:39:45 +00:00
Henry Weller
736621b945 fvOptions: Reorganized and updated to simplify use in sub-models and maintenance
fvOptions are transferred to the database on construction using
fv::options::New which returns a reference.  The same function can be
use for construction and lookup so that fvOptions are now entirely
demand-driven.

The abstract base-classes for fvOptions now reside in the finiteVolume
library simplifying compilation and linkage.  The concrete
implementations of fvOptions are still in the single monolithic
fvOptions library but in the future this will be separated into smaller
libraries based on application area which may be linked at run-time in
the same manner as functionObjects.
2015-12-02 11:49:52 +00:00
Henry Weller
56eb675679 reactingEulerFoam/phaseSystems/phasePair/orderedPhasePair: Correct lookup of the aspectRatio
Resolves bug-report http://openfoam.org/mantisbt/view.php?id=1899
2015-11-05 19:53:43 +00:00
Henry Weller
1c203d4116 Renamed reactingEulerFoam phaseSystemTemplates.H -> phaseSystemTemplates.C
This file contains definitions rather than declarations
2015-09-17 09:47:27 +01:00
Henry Weller
6672e64327 reactingEulerFoam: Updated phase loops 2015-09-17 09:19:03 +01:00
Henry Weller
c31789c34c reactingEulerFoam: Use PtrListDictionary for list/table of phases
This makes looping over the phases much simpler which maintaining
support for phase-name lookup.
2015-09-16 21:29:09 +01:00
Henry Weller
85b27f674f reactingMultiphaseEulerFoam: New Euler-Euler multiphase solver
Supporting any number of phases with heat and mass transfer, phase-change and reactions
2015-09-11 15:33:12 +01:00
Henry Weller
dd3f68b1fa reactingEulerFoam: Rationalize the phaseSystem base-class 2015-09-04 17:01:31 +01:00
Henry Weller
ffedbafee1 reactingEulerFoam/phaseSystem: Create an ordered container for phaseModels
The previous method using a HashTable required a separate ordered list
of names which is hard to work with and maintain.
2015-08-28 18:40:22 +01:00
Henry Weller
fb11bcc874 TurbulenceModels/compressible: Added correctEnergyTransport() function
to allow the turbulent energy transport properties to be updated for
every energy solution if required.

Added correctEnergyTransport() call to reactingTwoPhaseEulerFoam
2015-08-26 15:37:52 +01:00
Henry Weller
f5dc3eb8a7 reactingTwoPhaseEulerFoam: Moved into reactingEulerFoam
and two-phase functionality separated from multiphase functionality
2015-08-26 12:49:26 +01:00