View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002602 | OpenFOAM | Patch | public | 2017-07-04 12:52 | 2017-07-05 17:29 |
Reporter | handrake0724 | Assigned To | will | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Linux64 | OS | Linux | OS Version | Arch |
Summary | 0002602: error in foamyHexMeshBackground.C | ||||
Description | compiling foamyHexMeshBackground.C produces the following errors: foamyHexMeshBackgroundMesh.C:314:28: error: binding 'const Foam::Field<double>' to reference of type 'Foam::scalarField& {aka Foam::Field<double>&}' discards qualifiers scalarField& fld = tfld(); foamyHexMeshBackgroundMesh.C:650:78: error: binding 'const Foam::fvPatchField<double>' to reference of type 'Foam::fvPatchScalarField& {aka Foam::fvPatchField<double>&}' discards qualifiers fvPatchScalarField& fld = cellDistance.boundaryField()[patchi]; it is caused by the binding of const object to non-const object. For a workaround, removing ampersand fix the problem. a patch is attached. | ||||
Tags | No tags attached. | ||||
|
patch.diff (810 bytes)
--- foamyHexMeshBackgroundMesh.C.old 2017-07-04 20:36:32.243096326 +0900 +++ foamyHexMeshBackgroundMesh.C 2017-07-04 20:32:07.826438328 +0900 @@ -311,7 +311,7 @@ ) { tmp<scalarField> tfld(new scalarField(points.size(), Foam::sqr(GREAT))); - scalarField& fld = tfld(); + scalarField fld = tfld(); // Find nearest List<pointIndexHit> nearest; @@ -647,7 +647,7 @@ forAll(fvm.C().boundaryField(), patchi) { const pointField& cc = fvm.C().boundaryField()[patchi]; - fvPatchScalarField& fld = cellDistance.boundaryField()[patchi]; + fvPatchScalarField fld = cellDistance.boundaryField()[patchi]; scalarField patchDistSqr ( fld.patch().patchInternalField(distSqr) |
|
Questions: 1. With which GCC version does this happen? 2. With which OpenFOAM version is this happening? |
|
I am using GCC 6.3.0 with OpenFOAM 4.x |
|
Again, confirmed. Both errors are caused by the explicit addition of "Ref" to the names of non-const access methods. The change doesn't seem to have been propagated to this specific bit of foamyHexMesh. |
|
...probably because it's not being built by default. The build command in Allwmake has been commented out. |
|
@will: See the following report and comments from when this was last looked into (as far as I know): https://bugs.openfoam.org/view.php?id=1205 This to say that I suspect that even if the code might now compile, I'm not so certain it will work properly :( |
|
@wyldckat You might be right about the possibility of it not working, but the compilation is easy to fix, so I might as well do it now that it has been noticed. |
|
@handrake0724 Thanks for the report. Resolved by commit 1ff57870007ac317d95a1756b41fd76c5a1e8f26 in dev, and 53b4b3fc2dfcaad06e3595993094cebe14d9aa55 in 4.x. |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-07-04 12:52 | handrake0724 | New Issue | |
2017-07-04 12:52 | handrake0724 | File Added: patch.diff | |
2017-07-04 14:58 | wyldckat | Note Added: 0008330 | |
2017-07-04 15:08 | handrake0724 | Note Added: 0008333 | |
2017-07-05 16:43 | will | Note Added: 0008338 | |
2017-07-05 17:03 | will | Note Added: 0008339 | |
2017-07-05 17:12 | wyldckat | Note Added: 0008340 | |
2017-07-05 17:27 | will | Note Added: 0008341 | |
2017-07-05 17:29 | will | Assigned To | => will |
2017-07-05 17:29 | will | Status | new => resolved |
2017-07-05 17:29 | will | Resolution | open => fixed |
2017-07-05 17:29 | will | Note Added: 0008342 |