View Issue Details

IDProjectCategoryView StatusLast Update
0002163OpenFOAMPatchpublic2016-07-28 18:01
ReporterbgschaidAssigned Tohenry 
PrioritynormalSeveritymajorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version4.0 
Fixed in Version4.x 
Summary0002163: New .ref() for constant references not used everywhere
DescriptionSeems like the new .ref() was not propagated to all relevant sources (probably because the relevant templates were not instantiated in the OpenFOAM sources. But may be used in other software based on OF)

The attached patch fixes this problem in two places (maybe more will come when I finished porting my stuff)
TagsNo tags attached.

Activities

bgschaid

2016-07-28 16:17

reporter  

fvcD2dt2NeedsRef.patch (1,113 bytes)
# HG changeset patch
# Parent  caf7ae07147d278fce48e5bb542bd8d492678039

diff --git a/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C b/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C
--- a/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C
+++ b/src/finiteVolume/finiteVolume/fvc/fvcD2dt2.C
@@ -50,7 +50,7 @@
     (
         vf.mesh(),
         vf.mesh().ddtScheme("d2dt2(" + vf.name() + ')')
-    )().fvcD2dt2(vf);
+    ).ref().fvcD2dt2(vf);
 }
 
 
@@ -66,7 +66,7 @@
     (
         vf.mesh(),
         vf.mesh().ddtScheme("d2dt2(" + rho.name() + ',' + vf.name() + ')')
-    )().fvcD2dt2(rho, vf);
+    ).ref().fvcD2dt2(rho, vf);
 }
 
 
diff --git a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C
--- a/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C
+++ b/src/finiteVolume/fvMatrices/fvMatrix/fvMatrixSolve.C
@@ -333,7 +333,7 @@
 Foam::tmp<Foam::Field<Type>> Foam::fvMatrix<Type>::residual() const
 {
     tmp<Field<Type>> tres(new Field<Type>(source_));
-    Field<Type>& res = tres();
+    Field<Type>& res = tres.ref();
 
     addBoundarySource(res);
 
fvcD2dt2NeedsRef.patch (1,113 bytes)

henry

2016-07-28 16:29

manager   ~0006579

Have you pulled the latest OpenFOAM-4.x/dev:

OpenFOAM-4.x:

commit 90f400ead5e806c062e14cec973fdbb2d78ebe3e
Author: Henry Weller <http://cfd.direct>
Date: Wed Jun 29 21:54:19 2016 +0100

    fvcD2dt2: Updated non-const dereferencing to use '.ref()'
    Resolves bug-report http://bugs.openfoam.org/view.php?id=2133

OpenFOAM-dev:

commit 9fa1756565a6a1c407f575e64ab759e096886336
Author: Henry Weller <http://cfd.direct>
Date: Wed Jun 29 21:55:57 2016 +0100

    fvcD2dt2: Updated non-const dereferencing to use '.ref()'
    Resolves bug-report http://bugs.openfoam.org/view.php?id=2133

I will also make the change to fvMatrixSolve.C

henry

2016-07-28 18:01

manager   ~0006580

Resolved in OpenFOAM-4.x by commit 6a92285b9b60beaa93ec60e535787a33907cf41f
Resolved in OpenFOAM-dev by commit c8f8a6c16213026af278c010abc687ffbd4bfb66

Issue History

Date Modified Username Field Change
2016-07-28 16:17 bgschaid New Issue
2016-07-28 16:17 bgschaid File Added: fvcD2dt2NeedsRef.patch
2016-07-28 16:29 henry Note Added: 0006579
2016-07-28 18:01 henry Note Added: 0006580
2016-07-28 18:01 henry Status new => resolved
2016-07-28 18:01 henry Fixed in Version => 4.x
2016-07-28 18:01 henry Resolution open => fixed
2016-07-28 18:01 henry Assigned To => henry