CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

namespace Foam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   October 27, 2011, 20:10
Question namespace Foam
  #1
Member
 
Join Date: Jan 2010
Posts: 44
Rep Power: 7
Argen is on a distinguished road
namespace Foam
{
namespace radiation
{
defineTypeNameAndDebug(P1, 0);

addToRunTimeSelectionTable
(
radiationModel,
P1,
dictionary
);
}
}

Anyone can explain the above code line by line?
Argen is offline   Reply With Quote

Old   October 28, 2011, 02:55
Default
  #2
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8
kathrin_kissling is on a distinguished road
your within namespace Foam
namespace radiation

a typeName is defined

the P1 model is added to the runTime selection table

What is your question? Can you please clarify what is unclear?

Best

Kathrin
kathrin_kissling is offline   Reply With Quote

Old   October 28, 2011, 10:53
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
The first two lines are namespaces, as kathrin mentioned. If you don't know what those are, they are basic components of C++ created recently to avoid name collisions. If your book is old, it won't mention them - try googling it.

The next two are macros. OpenFOAM is full of macros. Many coding standards forbid all macros (except includes and include guards), but not in OpenFOAM. These make the code more difficult to read for a new-comer... but they also make it easier to work with. Many pros and cons. Anyways...

defineTypeNameAndDebug
OpenFOAM has a type naming convention to help keep track of the types of classes. These macros are in one of the files in src/OpenFOAM/db/typeInfo. Basically, just holds a word with the name of the class.

addToRunTimeSelectionTable
This is part of OpenFOAM's runTime selection mechanism. This is described here: http://openfoamwiki.net/index.php/Op...tion_mechanism
You probably don't want to go too deep into figuring it out - rather, just know it is part of the underlying machinery that other objects use to call its constructors.

Hope that helps.
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   October 31, 2011, 03:34
Default
  #4
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8
kathrin_kissling is on a distinguished road
Hi David,

thank you for the typeInfo information. This is very helpful. I really searched for them but it was very hard to find!

Best

Kathrin
kathrin_kissling is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using starToFoam clo OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 33 September 26, 2012 04:04
BlockMesh FOAM warning gaottino OpenFOAM Native Meshers: blockMesh 7 July 19, 2010 14:11
Import problem ARC Open Source Meshers: Gmsh, Netgen, CGNS, ... 0 February 27, 2010 11:56
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00
Import gmsh msh to Foam adorean Open Source Meshers: Gmsh, Netgen, CGNS, ... 24 April 27, 2005 08:19


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