|
[Sponsors] |
August 21, 2019, 08:45 |
Cannot use Foam defined types in local class
|
#1 |
Member
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 10 |
Hello,
I am trying to build a class locally with interFoam. I tried to follow this example : How to add a new class locally However, the issues discussed were not resolved in that thread. I will paste the code here, and try to explain what are the difficulties. .H file Code:
#ifndef chnl_H #define chnl_H #include<list> namespace Foam{ class chnl { private: int chNo; Foam::labelList locProc; public: chnl(int a); int disp(); Foam::labelList getlocProc (Foam::labelList& gL); }; } Code:
#include "chnl.H" #include<list> //CONSTRUCTER Foam::chnl::chnl(int b) : chNo(b) {} int Foam::chnl::disp() { return chNo; } Foam::labelList Foam::chnl::getlocProc (Foam::labelList& gL) { locProc = gL; return locProc; } Code:
chnl.H:11:9: error: ‘labelList’ in namespace ‘Foam’ does not name a type Foam::labelList locProc; ^~~~~~~~~ chnl.H:17:9: error: ‘labelList’ in namespace ‘Foam’ does not name a type Foam::labelList getlocProc (Foam::labelList& gL); ^~~~~~~~~ chnl.C:10:7: error: ‘labelList’ in namespace ‘Foam’ does not name a type Foam::labelList Foam::chnl::getlocProc (Foam::labelList& gL) ^~~~~~~~~ Can anyone point out what am I missing here? Thanks |
|
August 21, 2019, 12:06 |
|
#2 |
Senior Member
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 16 |
Did you include the appropriate OpenFOAM headers?
|
|
August 22, 2019, 03:05 |
[solved]
|
#3 |
Member
Ashish Magar
Join Date: Jul 2016
Location: Mumbai, India
Posts: 81
Rep Power: 10 |
Thanks a lot.
I thought using "Foam::type" would do the thing, but after your suggestion, I check Doxygen how they have used any class with "Foam::labelList". I found out I was missing Code:
#include "ListOps.H" #include "labelRange.H" Thanks. |
|
September 16, 2022, 05:33 |
|
#4 | |
New Member
Mostafa
Join Date: Oct 2021
Posts: 22
Rep Power: 5 |
Quote:
Hello ashishmagar600, could you help me I'm facing similar problem , however i tried to search for headers ,but all of them failed , when i implement the following code const volScalarField::GeometricBoundaryField& pbf = p.boundaryField(); i got the similar error does not name a type createFields.H:19:23: error: ‘GeometricBoundaryField’ in ‘Foam::volScalarField {aka class Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>}’ does not name a type const volScalarField::GeometricBoundaryField& pbf = p.boundaryField(); |
||
Tags |
class, foam namespace, types |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[CGNS] CGNS converters available | mbeaudoin | OpenFOAM Meshing & Mesh Conversion | 137 | December 14, 2018 05:20 |
[mesh manipulation] RefineMesh Error and Foam warning | jiahui_93 | OpenFOAM Meshing & Mesh Conversion | 4 | March 3, 2018 12:32 |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 16:33 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 15:11 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |