CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   List of volScalarField (http://www.cfd-online.com/Forums/openfoam-programming-development/117727-list-volscalarfield.html)

seiji_adachi May 14, 2013 06:39

List of volScalarField
 
Hello,

I'd like to create a list of volScalarField. I have made testListField.C but
the compilation results in an error at the line highlighted in red.
What's wrong with this?

Code:

#include "fvCFD.H"

int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"

  int N = 10; // size of the list
  List<volScalarField> X(N);

  Info<< "End\n" << endl;
 
  return(0);
}

Quote:

SOURCE=testListField.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/finiteVolume/lnInclude -I/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/meshTools/lnInclude -IlnInclude -I. -I/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude -I/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/testListField.o
In file included from /home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/List.H:259:0,
from /home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/labelList.H:48,
from /home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/UPstream.H:43,
from /home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Pstream.H:42,
from /home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/parRun.H:35,
from /home/sea/OpenFOAM/OpenFOAM-2.2.0/src/finiteVolume/lnInclude/fvCFD.H:4,
from testListField.C:33:
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/List.C: In constructor ‘Foam::List<T>::List(Foam::label) [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Foam::label = int]’:
testListField.C:42:27: instantiated from here
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/List.C:56:9: error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’

/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/List.C:56:9: note: candidates are:
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::wordList = Foam::List<Foam::word>]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:605:1: note: candidate expects 4 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:570:1: note: candidate expects 3 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:540:1: note: candidate expects 2 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:507:1: note: candidate expects 2 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:475:1: note: candidate expects 2 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:444:1: note: candidate expects 1 argument, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:412:1: note: candidate expects 1 argument, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dictionary&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:371:1: note: candidate expects 3 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:331:1: note: candidate expects 2 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::Field<TypeR>&, const Foam::PtrList<PatchField<Type> >&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:304:1: note: candidate expects 5 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:274:1: note: candidate expects 5 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensioned<Form>&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:245:1: note: candidate expects 4 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const wordList&, const wordList&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh, Foam::wordList = Foam::List<Foam::word>]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:217:1: note: candidate expects 5 arguments, 0 provided
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/home/sea/OpenFOAM/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/GeometricField.C:187:1: note: candidate expects 4 arguments, 0 provided
make: *** [Make/linux64GccDPOpt/testListField.o] Error 1

wyldckat May 14, 2013 17:45

Greetings Seiji,

I think this has been asked a few times in the past... here's one thread on this topic: http://www.cfd-online.com/Forums/ope...alarfield.html

In essence, the problem is that you're trying to use the list as the traditional/simpler kind of lists in C++. But OpenFOAM uses a far more complex operator overload mechanisms, which leads you're attempt to fail.
As I wrote above, you can find more examples on the forum, if you search for:
Code:

List<volScalarField>
Best regards,
Bruno

seiji_adachi May 16, 2013 06:03

Hello Bruno,

By referring to the thread you showed, this problem has been
solved. Thanks a lot!

Seiji


All times are GMT -4. The time now is 18:08.