|
[Sponsors] |
January 20, 2017, 09:16 |
gSum: no matching function call
|
#1 |
New Member
Gunther
Join Date: Jan 2017
Posts: 2
Rep Power: 0 |
Hey,
I try to compile a code which used to compile in OF 2.3, but in version 4.1 it doesn't do so any more. I receive the error: no matching function for call to gSum... (see below) Does anyone know if a gSum function is relocated or removed in the latest OF? Many thanks in advance! The piece of the code which the error is called from is as follows: Code:
#include "pollutant.H" #include "fvCFD.H" #include "IOmanip.H" void pollutant::balance() { forAllConstIter(HashTable<isotope*>, isotopes_, iter) { const isotope& nuclide = *iter(); const volScalarField& Ci = nuclide.C(); Info << "Total amount of " << Ci.name() << " in the system: " << gSum(Ci.internalField()*mesh_.V()) << endl; } } HTML Code:
pollutant.C: In member function ‘void Foam::pollutant::balance()’: pollutant/pollutant.C:443:72: error: no matching function for call to ‘gSum(Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >)’ << " in the system: " << gSum(Ci.internalField()*mesh_.V()) ^ pollutant/pollutant.C:443:72: note: candidates are: In file included from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/Field.C:870:0, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/Field.H:405, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/scalarField.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionSet.H:46, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionedType.H:40, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionedScalar.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionedTypes.H:31, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricField.H:43, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricScalarField.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricFields.H:34, from OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/volFields.H:37, from pollutant/pollutant.H:37, from pollutant/pollutant.C:26: OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:543:24: note: template<class Type> Type Foam::gSum(const Foam::UList<T>&, Foam::label) G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:533:12: note: in definition of macro ‘G_UNARY_FUNCTION’ ReturnType gFunc(const UList<Type>& f, const label comm) \ ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:543:24: note: template argument deduction/substitution failed: G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:533:12: note: in definition of macro ‘G_UNARY_FUNCTION’ ReturnType gFunc(const UList<Type>& f, const label comm) \ ^ pollutant/pollutant.C:443:72: note: ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’ is not derived from ‘const Foam::UList<T>’ << " in the system: " << gSum(Ci.internalField()*mesh_.V()) ^ In file included from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/Field.C:870:0, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/Field.H:405, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/scalarField.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionSet.H:46, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionedType.H:40, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionedScalar.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/dimensionedTypes.H:31, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricField.H:43, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricScalarField.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricFields.H:34, from OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/volFields.H:37, from pollutant/pollutant.H:37, from pollutant/pollutant.C:26: OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:543:24: note: template<class Type> Type Foam::gSum(const Foam::tmp<Foam::Field<Type> >&) G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:303:12: note: in definition of macro ‘TMP_UNARY_FUNCTION’ ReturnType Func(const tmp<Field<Type>>& tf1) \ ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:543:1: note: in expansion of macro ‘G_UNARY_FUNCTION’ G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:543:24: note: template argument deduction/substitution failed: G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:303:12: note: in definition of macro ‘TMP_UNARY_FUNCTION’ ReturnType Func(const tmp<Field<Type>>& tf1) \ ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFunctions.C:543:1: note: in expansion of macro ‘G_UNARY_FUNCTION’ G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ pollutant/pollutant.C:443:72: note: mismatched types ‘Foam::Field<Type>’ and ‘Foam::DimensionedField<double, Foam::volMesh>’ << " in the system: " << gSum(Ci.internalField()*mesh_.V()) ^ pollutant/pollutant.C:443:72: note: ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’ is not derived from ‘const Foam::tmp<Foam::Field<Type> >’ In file included from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldField.C:390:0, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldField.H:198, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricField.H:45, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricScalarField.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricFields.H:34, from OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/volFields.H:37, from pollutant/pollutant.H:37, from pollutant/pollutant.C:26: OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:559:24: note: template<template<class> class Field, class Type> Type Foam::gSum(const Foam::FieldField<Field, Type>&) G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:549:12: note: in definition of macro ‘G_UNARY_FUNCTION’ returnType gFunc(const FieldField<Field, Type>& f) \ ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:559:24: note: template argument deduction/substitution failed: G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:549:12: note: in definition of macro ‘G_UNARY_FUNCTION’ returnType gFunc(const FieldField<Field, Type>& f) \ ^ pollutant/pollutant.C:443:72: note: ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’ is not derived from ‘const Foam::FieldField<Field, Type>’ << " in the system: " << gSum(Ci.internalField()*mesh_.V()) ^ In file included from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldField.C:390:0, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldField.H:198, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricField.H:45, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricScalarField.H:38, from OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/GeometricFields.H:34, from OpenFOAM/OpenFOAM-4.1/src/finiteVolume/lnInclude/volFields.H:37, from pollutant/pollutant.H:37, from pollutant/pollutant.C:26: OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:559:24: note: template<template<class> class Field, class Type> Type Foam::gSum(const Foam::tmp<Foam::FieldField<Field, Type> >&) G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:400:12: note: in definition of macro ‘TMP_UNARY_FUNCTION’ returnType func(const tmp<FieldField<Field, Type>>& tf1) \ ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:559:1: note: in expansion of macro ‘G_UNARY_FUNCTION’ G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:559:24: note: template argument deduction/substitution failed: G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:400:12: note: in definition of macro ‘TMP_UNARY_FUNCTION’ returnType func(const tmp<FieldField<Field, Type>>& tf1) \ ^ OpenFOAM/OpenFOAM-4.1/src/OpenFOAM/lnInclude/FieldFieldFunctions.C:559:1: note: in expansion of macro ‘G_UNARY_FUNCTION’ G_UNARY_FUNCTION(Type, gSum, sum, sum) ^ pollutant/pollutant.C:443:72: note: mismatched types ‘Foam::FieldField<Field, Type>’ and ‘Foam::DimensionedField<double, Foam::volMesh>’ << " in the system: " << gSum(Ci.internalField()*mesh_.V()) ^ pollutant/pollutant.C:443:72: note: ‘Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >’ is not derived from ‘const Foam::tmp<Foam::FieldField<Field, Type> >’ make: *** [Make/linux64GccDPInt32Opt/pollutant/pollutant.o] Error 1 Last edited by Gunther; January 21, 2017 at 11:24. |
|
January 23, 2017, 04:36 |
|
#2 |
Senior Member
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 342
Rep Power: 28 |
If you run
Code:
git grep gSum I assume that the necessary headers changed, have a look on current code which uses gSum(). |
|
January 23, 2017, 04:43 |
|
#3 |
Senior Member
|
Hi,
Code:
pollutant/pollutant.C:443:72: error: no matching function for call to ‘gSum(Foam::tmp<Foam::DimensionedField<double, Foam::volMesh> >)’ Code:
gSum((Ci.internalField()*mesh_.V())()) |
|
January 24, 2017, 17:38 |
|
#4 |
New Member
Gunther
Join Date: Jan 2017
Posts: 2
Rep Power: 0 |
Hey Alexey and Gerhard,
Thank you both for your answers. The dereferencing with the () operator worked. So, special thanks to you Alexey! Nice solution |
|
Tags |
error, gsum, incompatible code |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] refineWallLayer Error | Yuby | OpenFOAM Meshing & Mesh Conversion | 2 | November 11, 2021 12:04 |
Elementwise multiplication operator | johndeas | OpenFOAM Running, Solving & CFD | 3 | March 9, 2019 14:03 |
Compiling User Fortran with CFX 14.0 on Win64 | Raijin Thunderkeg | CFX | 29 | March 9, 2016 12:45 |
latest OpenFOAM-1.6.x from git failed to compile | phsieh2005 | OpenFOAM Bugs | 25 | February 9, 2010 05:37 |
Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 07:27 |