Commit Graph

31 Commits

Author SHA1 Message Date
Mark Olesen
e96cbd9050 STYLE: remove deprecated non-const tmp() operator (deprecated since FEB-2016) 2017-11-22 18:10:25 +01:00
Henry Weller
14d2a1efcf tmpNrc: Updated to use clone 2017-07-14 09:32:02 +01:00
Henry Weller
2f431ffd3d made the clone function pure virtual
Avoids potential problems with derived classes which do not define a clone function.
2017-07-13 23:24:14 +01:00
Mark Olesen
2fe3a62057 STYLE: use nullptr instead of 0 in autoPtr, tmp etc. 2017-07-14 16:50:21 +02:00
Henry Weller
b57859269b tmp: Removed temporary global functions 2016-12-03 11:44:18 +00:00
Henry Weller
3565b5491f tmp: Added 'move' constructor to simplify return of unchanged 'tmp' arguments. 2016-05-23 12:01:36 +01:00
Henry Weller
8e04042137 tmp: Allow '.ref()' for const 'tmp'
const-ness of the stored object is checked at run-time.
2016-05-21 23:10:58 +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
0830ace954 tmp: Limit the number of references to a temporary object to 2
which reduces the number of potential problems with the reuse of
temporary objects.

In order to avoid unnecessary creation of tmp's referring to temporary
objects the assignment operator now transfers ownership of the object
and resets the argument.
2016-02-27 18:11:09 +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
e1405f2260 FieldField, DimensionedField, GeometricField: Simplified tmp reuse and cleanup 2016-02-25 18:29:00 +00:00
Henry Weller
dfa89cf8ee tmp: Improved diagnostics in case of inappropriate reuse 2016-02-25 11:48:15 +00:00
Henry Weller
c02bf70ea7 tmp: Improved reference count checks to provide better error diagnostics
in case of tmp misuse.

Simplified tmp reuse pattern in field algebra to use tmp copy and
assignment rather than the complex delayed call to 'ptr()'.

Removed support for unused non-const 'REF' storage of non-tmp objects due to C++
limitation in constructor overloading: if both tmp(T&) and tmp(const T&)
constructors are provided resolution is ambiguous.

The turbulence libraries have been upgraded and '-DCONST_TMP' option
specified in the 'options' file to switch to the new 'tmp' behavior.
2016-02-24 12:47:36 +00:00
Henry Weller
15b7e87da7 tmp: Updated to store and preserve the const-ness of the reference to a constant object
This change requires that the de-reference operator '()' returns a
const-reference to the object stored irrespective of the const-ness of
object stored and the new member function 'ref()' is provided to return
an non-const reference to stored object which throws a fatal error if the
stored object is const.

In order to smooth the transition to this new safer 'tmp' the now
deprecated and unsafe non-const de-reference operator '()' is still
provided by default but may be switched-off with the compilation switch
'CONST_TMP'.

The main OpenFOAM library has already been upgraded and '-DCONST_TMP'
option specified in the 'options' file to switch to the new 'tmp'
behavior.  The rest of OpenFOAM-dev will be upgraded over the following
few weeks.

Henry G. Weller
CFD Direct
2016-02-22 16:23:21 +00:00
Henry Weller
99a10ecea6 Boundary conditions: Added extrapolatedCalculatedFvPatchField
To be used instead of zeroGradientFvPatchField for temporary fields for
which zero-gradient extrapolation is use to evaluate the boundary field
but avoiding fields derived from temporary field using field algebra
inheriting the zeroGradient boundary condition by the reuse of the
temporary field storage.

zeroGradientFvPatchField should not be used as the default patch field
for any temporary fields and should be avoided for non-temporary fields
except where it is clearly appropriate;
extrapolatedCalculatedFvPatchField and calculatedFvPatchField are
generally more suitable defaults depending on the manner in which the
boundary values are specified or evaluated.

The entire OpenFOAM-dev code-base has been updated following the above
recommendations.

Henry G. Weller
CFD Direct
2016-02-20 22:44:37 +00:00
Henry Weller
6fde55cbd6 tmp: Added assignment to pointer operator to initialize null-tmp to an allocated object
This is a convenient method to set a null-constructed tmp in a
conditional statement.
2016-02-12 14:08:38 +00:00
Henry Weller
a4ab3f61db src/OpenFOAM: Update ...ErrorIn -> ...ErrorInFunction
Avoids the clutter and maintenance effort associated with providing the
function signature string.
2015-11-08 12:23:52 +00:00
mattijs
f115890dba ENH: autoPtr: added reUse flag, improved error message 2013-05-21 14:22:43 +01:00
Henry
df20892bf6 Updated headers 2012-10-11 18:10:55 +01:00
Henry
41dcf4abfb OpenFOAM: added "transfer" constructor to tmp
Needed for return of tmp argument in "absolute" meshPhi function
2012-10-11 18:10:39 +01:00
Henry
c2dd153a14 Copyright transfered to the OpenFOAM Foundation 2011-08-14 12:17:30 +01:00
andy
eaef8d482b STYLE: Updated 1991 start copyright year to 2004 2011-01-14 16:08:00 +00:00
andy
099cc39e2e Revert "STYLE: 2011 copyright date."
This reverts commit b18f6cc1ce.
2011-01-05 18:24:29 +00:00
graham
b18f6cc1ce STYLE: 2011 copyright date. 2011-01-05 11:14:26 +00:00
graham
d79237597e STYLE: Fixing code style requirements for all src. 2010-07-28 13:31:46 +01:00
Mark Olesen
c7267ed9ad STYLE: remove disabled methods from autoPtr
- (have been disabled for more than 1 year)
2010-04-21 15:36:10 +02:00
Mark Olesen
d29c438657 STYLE: use url for FSF license instead of postal address, switch to GPL v3 2010-03-29 14:07:56 +02:00
Mark Olesen
16aaf5b54e autoPtr gets "empty()" method that can be used instead of "! ...valid()" 2009-01-10 10:38:53 +01:00
Mark Olesen
28b200bcd9 update copyrights for 2009 2008-12-31 19:01:56 +01:00
Mark Olesen
2a3bb0f5c4 autoPtr, tmp cosmetics
- dropped non-const tmp::clear() in favour of the const version
2008-10-24 17:21:02 +02:00
Mark Olesen
dffbda287c src/OpenFOAM/memory for holding all the memory management bits 2008-10-14 18:47:27 +02:00