|
[Sponsors] |
June 22, 2015, 12:39 |
Use "std::vector<double>" in a openfoam code
|
#1 |
New Member
Join Date: Feb 2015
Posts: 2
Rep Power: 0 |
I have a utility which compiles and runs fine. But, I wish to make a few changes in it. In order to do that I want to use the standard c++ vectors as I am not very familiar with the OpenFOAM architecture. So the code looks like,
............ ............ #include<vector> std::vector<double> abc; ........... ........... I am getting the following error message when I try to compile it using "wmake". I am not sure what's going wrong here. Any help will be appreciated! Making dependency list for source file perturbU.C SOURCE=perturbU.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/meshTools/lnInclude -I/home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/perturbU.o perturbU.C: In function ‘int main(int, char**)’: perturbU.C:220:2: error: ‘vector’ is not a member of ‘std’ std::vector<double> abc; ^ perturbU.C:220:2: note: suggested alternatives: In file included from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/point.H:35:0, from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/pointField.H:35, from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/edge.H:40, from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/edgeList.H:32, from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/primitiveMesh.H:54, from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/polyMesh.H:45, from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvMesh.H:50, from /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvCFD.H:7, from perturbU.C:40: /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/vector.H:49:24: note: ‘Foam::vector’ typedef Vector<scalar> vector; ^ /home/siddhesh/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/vector.H:49:24: note: ‘Foam::vector’ perturbU.C:220:14: error: expected primary-expression before ‘double’ std::vector<double> abc; ^ perturbU.C:220:14: error: expected ‘;’ before ‘double’ perturbU.C:217:9: warning: unused variable ‘zcoordinate’ [-Wunused-variable] double zcoordinate = (cCentre & zDir); ^ perturbU.C:218:9: warning: unused variable ‘ycoordinate’ [-Wunused-variable] double ycoordinate = yw[celli]; ^ make: *** [Make/linux64GccDPOpt/perturbU.o] Error 1 |
|
August 10, 2023, 06:33 |
|
#2 |
New Member
Join Date: Sep 2022
Posts: 2
Rep Power: 0 |
I know it has been a while and i hope your problem has been resolved. But just to have this as a tip, I think it might be because you haven't declared vector (#include <vector>) in the main solver file ie. icofoam.C
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Frequently Asked Questions about Installing OpenFOAM | wyldckat | OpenFOAM Installation | 3 | November 14, 2023 12:58 |
Memory protection in OpenFOAM / combinig with FORTRAN | botp | OpenFOAM Programming & Development | 2 | February 15, 2016 13:25 |
OpenFOAM Foundation releases OpenFOAM 2.2.2 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 0 | October 14, 2013 08:18 |
How to code integral of (DU/Dt - 2000 ) in openFoam | erncyc | OpenFOAM | 5 | September 13, 2012 07:33 |
OpenFOAM for subsurface flow, or coupling with a subsurface flow code? | chljl | OpenFOAM Running, Solving & CFD | 0 | February 14, 2012 20:38 |