OpenFOAM-4.x/src
Henry Weller a4e2afa4b3 Completed boundaryField() -> boundaryFieldRef()
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1938

Because C++ does not support overloading based on the return-type there
is a problem defining both const and non-const member functions which
are resolved based on the const-ness of the object for which they are
called rather than the intent of the programmer declared via the
const-ness of the returned type.  The issue for the "boundaryField()"
member function is that the non-const version increments the
event-counter and checks the state of the stored old-time fields in case
the returned value is altered whereas the const version has no
side-effects and simply returns the reference.  If the the non-const
function is called within the patch-loop the event-counter may overflow.
To resolve this it in necessary to avoid calling the non-const form of
"boundaryField()" if the results is not altered and cache the reference
outside the patch-loop when mutation of the patch fields is needed.

The most straight forward way of resolving this problem is to name the
const and non-const forms of the member functions differently e.g. the
non-const form could be named:

    mutableBoundaryField()
    mutBoundaryField()
    nonConstBoundaryField()
    boundaryFieldRef()

Given that in C++ a reference is non-const unless specified as const:
"T&" vs "const T&" the logical convention would be

    boundaryFieldRef()
    boundaryFieldConstRef()

and given that the const form which is more commonly used is it could
simply be named "boundaryField()" then the logical convention is

    GeometricBoundaryField& boundaryFieldRef();

    inline const GeometricBoundaryField& boundaryField() const;

This is also consistent with the new "tmp" class for which non-const
access to the stored object is obtained using the ".ref()" member function.

This new convention for non-const access to the components of
GeometricField will be applied to "dimensionedInternalField()" and "internalField()" in the
future, i.e. "dimensionedInternalFieldRef()" and "internalFieldRef()".
2016-04-25 16:16:05 +01:00
..
combustionModels Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
conversion Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
dummyThirdParty scripts: Reformat with consistent section separators 2016-02-15 18:30:24 +00:00
dynamicFvMesh Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
dynamicMesh Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
edgeMesh vector::zero -> Zero 2016-04-16 18:34:41 +01:00
engine boundaryField() -> boundaryFieldRef() 2016-04-23 23:16:30 +01:00
fileFormats Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
finiteVolume Completed boundaryField() -> boundaryFieldRef() 2016-04-25 16:16:05 +01:00
fvAgglomerationMethods Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
fvMotionSolver Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
fvOptions Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
genericPatchFields Rationalized the indentation of C-preprocessor directives 2016-02-29 15:42:03 +00:00
lagrangian Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
mesh Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
meshTools Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
ODE SquareMatrix, SymmetricSquareMatrix: Changed the constructor from size to require only n 2016-03-22 14:13:48 +00:00
OpenFOAM Completed boundaryField() -> boundaryFieldRef() 2016-04-25 16:16:05 +01:00
OSspecific/POSIX Removed duplicate, inconsistent and spurious comments in .C files 2016-02-29 18:33:54 +00:00
parallel Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
postProcessing Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
Pstream src/Pstream/mpi/UPstream.C: Updated for Int64 2016-04-16 13:26:41 +01:00
randomProcesses OpenFOAM: Updated all libraries, solvers and utilities to use the new const-safe tmp 2016-02-26 17:31:28 +00:00
regionCoupled Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
regionModels Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
renumber Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
rigidBodyDynamics rigidBodyDynamics: Generalized the interface to the restraints 2016-04-19 21:58:10 +01:00
rigidBodyMeshMotion rigidBodyDynamics: Added support for running in parallel 2016-04-19 10:32:25 +01:00
sampling Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
sixDoFRigidBodyMotion Updated header 2016-04-18 15:40:57 +01:00
surfMesh Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
thermophysicalModels Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
topoChangerFvMesh Standardized cell, patch and face loop index names 2016-04-25 10:28:32 +01:00
transportModels boundaryField() -> boundaryFieldRef() 2016-04-24 22:07:37 +01:00
triSurface Standardized cell, patch, face and processor loop index names 2016-04-25 12:00:53 +01:00
TurbulenceModels Completed boundaryField() -> boundaryFieldRef() 2016-04-25 16:16:05 +01:00
Allwmake src/Allwmake: Added the new rigidBodyMeshMotion library 2016-04-19 11:11:22 +01:00