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/)
-   -   'Info' does not name a type (http://www.cfd-online.com/Forums/openfoam-programming-development/96810-info-does-not-name-type.html)

Bufacchi February 1, 2012 14:13

'Info' does not name a type
 
When I insert in some .H and .C files a line such as:

Info<< "my text" << endl;

and then compile the file, I get the following error:

"error: 'Info' does not name a type"

In some other files, this works well.

Does anyone know how I can solve this problem?

Thanks,

Paulo

adhiraj February 1, 2012 16:54

There must be some error in the lines before the Info statement.
I suggest redirecting the output from Allwmake to a text file and search for "error" from the top.

niklas February 1, 2012 17:09

are you in the foam namespace?

Bufacchi February 1, 2012 17:17

Quote:

Originally Posted by adhiraj (Post 342340)
There must be some error in the lines before the Info statement.
I suggest redirecting the output from Allwmake to a text file and search for "error" from the top.


To isolate the problem, I made only one file change as below:

/*-----------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
--------------------------------------------------------------------
License
This file is part of OpenFOAM.

OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.

Class
Foam::solidChemistryModel

Description
Chemistry model for solid thermodynamics

SourceFiles
solidChemistryModelI.H
solidChemistryModel.C
newChemistrySolidModel.C

\*----------------------------------------------------------------*/

Info<< endl << "================================================= =="
<< endl << "Opening file: solidChemistryModel.H"
<< endl << "================================================= =="
<< endl;

#ifndef solidChemistryModel_H
#define solidChemistryModel_H

#include "basicChemistryModel.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "basicSolidThermo.H"


// * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * //


And the compilation result is as follows:

paulo@linux-f6wv:~/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/solidChemistryModel> wmake
Making dependency list for source file solidChemistrySolver/makeSolidChemistrySolvers.C
Making dependency list for source file solidChemistryModel/solidChemistryModels.C
Making dependency list for source file solidChemistryModel/solidChemistryModelNew.C
Making dependency list for source file solidChemistryModel/solidChemistryModel.C
SOURCE=solidChemistryModel/solidChemistryModel.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O0 -fdefault-inline -ggdb3 -DFULLDEBUG -DNoRepository -ftemplate-depth-100 -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/specie/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/ODE/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/chemistryModel/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/basic/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/solid/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/basicSolidThermo/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/reactionThermo/lnInclude -IlnInclude -I. -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude -I/home/paulo/OpenFOAM/OpenFOAM-2.1.x/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPDebug/solidChemistryModel.o
In file included from solidChemistryModel/solidChemistryModel.C:26:0:
solidChemistryModel/solidChemistryModel.H:167:1: error: ‘Info’ does not name a type
make: *** [Make/linux64GccDPDebug/solidChemistryModel.o] Error 1
paulo@linux-f6wv:~/OpenFOAM/OpenFOAM-2.1.x/src/thermophysicalModels/solidChemistryModel>


Bufacchi February 1, 2012 17:23

Quote:

Originally Posted by niklas (Post 342342)
are you in the foam namespace?

Hi Niklas,

The file I changed is solidChemistryModel.H.

I placed the info statement in many places of the file, from start to end. In all locations, I got the same error message.

This error happened when I inserted the info statement in other files too.

When I made this inclusion in the file fireFoam.C, it didn't give me the error when the insert point was after the #include statements after main. If I insert the info statement before that point, it would give me the error.

Thanks,

Paulo

mturcios777 February 1, 2012 17:40

If you are placeing it before the #ifndef then you could indeed be out of the foam namespace as Niklas suggests. It could be because you are trying to compile a library and are using wmake instead of wmake libso. You probably need to to address both issues before the library will compile.

Bufacchi February 1, 2012 17:58

Quote:

Originally Posted by mturcios777 (Post 342346)
If you are placeing it before the #ifndef then you could indeed be out of the foam namespace as Niklas suggests. It could be because you are trying to compile a library and are using wmake instead of wmake libso. You probably need to to address both issues before the library will compile.

Hi Marco,

I just placed the info statement after the #ifndef and compiled using wmake libso in the solidChemistryModel directory and got the same error. I tried using ./Allwmake from the thermophysicalModels directory and got the same error.

Thanks,

Paulo

mturcios777 February 1, 2012 18:30

You need to place the statement after the namespace foam, because that is where "Info" is defined. However, if you are placing it in solidChemistryModel.H you may be disappointed that you will likely never see that statement execute. That file is used to define the solidChemistryModel class, and unless there are functions in that file that are executed that have the Info statement.

Looking at some of your previous posts, I'm curious as to why you want to know which *.C and *.H files are entered/executed. Is there a specific feature you want to uncover, or behaviour you need clarified?

Bufacchi February 1, 2012 19:55

Quote:

Originally Posted by mturcios777 (Post 342355)
You need to place the statement after the namespace foam, because that is where "Info" is defined. However, if you are placing it in solidChemistryModel.H you may be disappointed that you will likely never see that statement execute. That file is used to define the solidChemistryModel class, and unless there are functions in that file that are executed that have the Info statement.

Looking at some of your previous posts, I'm curious as to why you want to know which *.C and *.H files are entered/executed. Is there a specific feature you want to uncover, or behaviour you need clarified?

Well Marco, I'm using fireFoam solver to simulate forest fires. This solver is very complex, as it uses combustion, radiation, turbulence, pyrolysis, and so on. It is very challenging to understand all the steps taken by the solvers and libraries. My guess was that if I could log all .C and .H files that are called in a specific order, that would make me better understand the whole thing. My previous post was a tentative to have that in place, but it seems I have to program the feature (which I thing I don't have enough skills to do). Akidess mentioned that creating a comment line to be written to the solver log file would be an option, so that's what I'm trying to do.

Do you happen to have another idea on how to better understand the solver?

Thanks,

Paulo

mturcios777 February 1, 2012 20:07

Looking at the source as you are doing is always helpful, but it can be difficult to keep track of when everything is executed. I would suggest looking at the source through the on-line Doxygen documentation:

http://www.openfoam.org/docs/cpp/

Do a search for fireFoam and it will allow you to go to the fireFoam.C file. From there, many of the source files will be linked in a way that you can click on them and get the Doxygen documentation that explains what they do. For the files that aren't linked (like UEqn.H), there may be multiple instances throughout OF, so you can search for them as well, or go to the fireFoam directory (in Doxygen) and see what local files are there.

Its a different approach than I was used to at first, but once I got the hang of the online documentation it became way faster than trying to do things in code or just looking at the code locally. If you want you can also build a local version of the Doxygen docs should you need them.

Bufacchi February 1, 2012 21:05

I'm already using Doxygen, but I was having a hard time to find out where some variables were defined or calculated. There are so many files in the execution chain that is almost impossible to follow all of them.

Then, I started checking fireFoam log file for the case, to understand what file was in use when some actions were taken. I thought that this would give me a hint on where to look for a specific information.

As an example, the log file presents the following info:

Creating pyrolysis model
Selecting pyrolysisModel reactingOneDim
Selecting solidChemistryModel "ODESolidChemistryModel<constSolidThermoPhysics>ga sThermoPhysics"
ODESolidChemistryModel: Number of solids = 2 and reactions = 1
Number of gases from pyrolysis = 1
Reaction 0
irreversibleSolidArrheniusReaction
v = char + gas
Reaction order: 4.86
(7.83e+10 15274.6 400)

The chemistryProperties dictionary in the constant directory of the case has the following sub-dictionary:

reactions
(
irreversibleSolidArrheniusReaction
v = gas + char
(7.83e10 15274.57 400 4.86)
);

And I already know that (7.83e+10 15274.6 400) is related to the protected variable k_

What I couldn't find yet is the place where k_ reads the info from the dictionary. I have made searches for dict lookups and many others, but couldn't find the info yet. If I had a way to log what file was used before the information was written to the log file, that would help me.

Thanks,

Paulo

kathrin_kissling February 2, 2012 08:50

Hi Paulo,

check the forum for Astrid Marlah's topic about eclipse. You can just dig in all files while executing. The thing you are doing by hand is automated there.

Hope this helps

Kathrin

Bufacchi February 2, 2012 14:19

Thank you Kathrin. I'll read all documentation and install Eclipse. For what I could get from the post this is what I'm looking for. :)

anon_a February 3, 2012 04:22

I have also found that stepping through the execution with nemiver (a GUI for gdb) helped me a lot to understand various details. But I am sure Eclipse has more advanced tools.

zcarral July 12, 2014 03:38

Dear Buraffi,

Have you solved your problem? I also need to implement Info into a thermophysical model and I have the same error “Info does name a type”


All times are GMT -4. The time now is 07:20.