COMP: references to temporaries

COMP: include <limits>
This commit is contained in:
Mark Olesen 2022-06-03 10:04:38 +02:00
parent 2d8870a878
commit 50420f755c
9 changed files with 35 additions and 20 deletions

View File

@ -675,7 +675,7 @@ int main(int argc, char *argv[])
{
for
(
const word& opt
const char * const opt
: { "cellSet", "cellZone", "faceSet", "pointSet" }
)
{

View File

@ -92,7 +92,7 @@ bool setCellFieldType
fieldType field(fieldHeader, mesh, false);
const Type& value = pTraits<Type>(fieldValueStream);
const Type value = pTraits<Type>(fieldValueStream);
if (selectedCells.size() == field.size())
{
@ -244,7 +244,7 @@ bool setFaceFieldType
fieldType field(fieldHeader, mesh);
const Type& value = pTraits<Type>(fieldValueStream);
const Type value = pTraits<Type>(fieldValueStream);
// Create flat list of selected faces and their value.
Field<Type> allBoundaryValues(mesh.nBoundaryFaces());

View File

@ -45,6 +45,9 @@ Description
\*---------------------------------------------------------------------------*/
#include "mathematicalConstants.H"
#include "error.H"
#include <cmath>
#include <limits>
using namespace Foam::constant::mathematical;

View File

@ -43,6 +43,10 @@ Description
\*---------------------------------------------------------------------------*/
#include "mathematicalConstants.H"
#include "error.H"
#include <cmath>
#include <limits>
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -161,38 +161,38 @@ Foam::turbulentDigitalFilterInletFvPatchVectorField::indexPairs()
void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
{
const vectorField& faceCentres = this->patch().patch().faceCentres();
label badFacei = -1;
forAll(R_, facei)
{
if (R_[facei].xx() <= 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor component Rxx cannot be negative"
<< " or zero, where Rxx = " << R_[facei].xx()
<< " at the face centre = " << faceCentres[facei]
<< exit(FatalError);
<< " or zero, where Rxx = " << R_[facei].xx();
break;
}
if (R_[facei].yy() < 0 || R_[facei].zz() < 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor components Ryy or Rzz cannot be"
<< " negative where Ryy = " << R_[facei].yy()
<< ", and Rzz = " << R_[facei].zz()
<< " at the face centre = " << faceCentres[facei]
<< exit(FatalError);
<< ", and Rzz = " << R_[facei].zz();
break;
}
const scalar x0 = R_[facei].xx()*R_[facei].yy() - sqr(R_[facei].xy());
if (x0 <= 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor component group, Rxx*Ryy - Rxy^2"
<< " cannot be negative or zero"
<< " at the face centre = " << faceCentres[facei]
<< exit(FatalError);
<< " cannot be negative or zero";
break;
}
const scalar x1 = R_[facei].zz() - sqr(R_[facei].xz())/R_[facei].xx();
@ -202,15 +202,23 @@ void Foam::turbulentDigitalFilterInletFvPatchVectorField::checkR() const
if (x3 < 0)
{
badFacei = facei;
FatalErrorInFunction
<< "Reynolds stress tensor component group, "
<< "Rzz - Rxz^2/Rxx - (Ryz - Rxy*Rxz/(Rxx*(Rxx*Ryy - Rxy^2)))^2"
<< " cannot be negative at the face centre = "
<< faceCentres[facei]
<< exit(FatalError);
<< " cannot be negative";
break;
}
}
if (badFacei >= 0)
{
FatalError
<< " at the face centre = "
<< this->patch().patch().faceCentres()[badFacei]
<< exit(FatalError);
}
Info<< " # Reynolds stress tensor on patch is consistent #" << endl;
}

View File

@ -79,7 +79,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
const vectorField nf(patch.nf());
const vectorField faceCellCentres(patch.patch().faceCellCentres());
const labelUList& faceCells = patch.patch().faceCells();
const vectorField::subField& faceCentres = patch.patch().faceCentres();
const vectorField::subField faceCentres = patch.patch().faceCentres();
forAll(patch, patchFacei)
{

View File

@ -37,7 +37,7 @@ Description
Typical use might be to e.g. average face centres to points on a patch
const labelListList& pointFaces = pp.pointFaces();
const pointField& faceCentres = pp.faceCentres();
const vectorField::subField faceCentres = pp.faceCentres();
Field<weightedPosition> avgBoundary(pointFaces.size());

View File

@ -136,7 +136,7 @@ void Foam::faceReflecting::initialise(const dictionary& coeffs)
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres();
const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{

View File

@ -155,7 +155,7 @@ void Foam::faceShading::calculate()
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
const pointField& cf = pp.faceCentres();
const vectorField::subField cf = pp.faceCentres();
if (!pp.coupled() && !isA<cyclicAMIPolyPatch>(pp))
{