From e8f9d6a7fed8f44cfca0886fe2fb5846bfeeb5d7 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 10 May 2017 16:07:45 +0100 Subject: [PATCH] Replacing const_cast lookupObject to lookupObjectRef --- src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C | 4 +--- .../dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C | 6 ++---- .../dynamicMotionSolverListFvMesh.C | 5 ++--- .../field/turbulenceFields/turbulenceFieldsTemplates.C | 6 ++---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C index 737e27877e..b05475fcdd 100644 --- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C +++ b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C @@ -117,9 +117,7 @@ bool Foam::dynamicInkJetFvMesh::update() fvMesh::movePoints(newPoints); - volVectorField& U = - const_cast(lookupObject("U")); - U.correctBoundaryConditions(); + lookupObjectRef("U").correctBoundaryConditions(); return true; } diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C index cc7405fa68..5bb05ca6d7 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C +++ b/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,9 +65,7 @@ bool Foam::dynamicMotionSolverFvMesh::update() if (foundObject("U")) { - volVectorField& U = - const_cast(lookupObject("U")); - U.correctBoundaryConditions(); + lookupObjectRef("U").correctBoundaryConditions(); } return true; diff --git a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C index 2b75caa5fc..b8ae0c7880 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C +++ b/src/dynamicFvMesh/dynamicMotionSolverListFvMesh/dynamicMotionSolverListFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -93,8 +93,7 @@ bool Foam::dynamicMotionSolverListFvMesh::update() if (foundObject("U")) { - const_cast(lookupObject("U")) - .correctBoundaryConditions(); + lookupObjectRef("U").correctBoundaryConditions(); } } diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C index 248fcbf2a0..89c65d98dc 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,9 +40,7 @@ void Foam::functionObjects::turbulenceFields::processField if (obr_.foundObject(scopedName)) { - FieldType& fld = - const_cast(obr_.lookupObject(scopedName)); - fld == tvalue(); + obr_.lookupObjectRef(scopedName) == tvalue(); } else if (obr_.found(scopedName)) {