CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

#include directives?

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

LinkBack Thread Tools Display Modes
Old   May 14, 2013, 05:04
Default #include directives?
Join Date: Feb 2013
Posts: 30
Rep Power: 6
Natalie2210 is on a distinguished road

I'm sorry since this is a basic question, but I'm pretty much confused about finding #include - directives within function bodys in OpenFOAM. What do they do there - I always thought #includes were preprocessor directives?

Thanks a lot,
Natalie2210 is offline   Reply With Quote

Old   May 14, 2013, 05:18
Senior Member
akidess's Avatar
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,261
Rep Power: 23
akidess will become famous soon enough
They are preprocessor directives indeed. You still retain the freedom to place them anywhere you want.
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
akidess is offline   Reply With Quote

Old   May 14, 2013, 05:50
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,754
Rep Power: 29
ngj will become famous soon enoughngj will become famous soon enough
Hi Natalie,

Yes, it is a bit confusing at first.

In OF you have the standard inclusion of header files, which tells the solver/utility/etc, which methods can be used in the program. These are those placed before "main".

Secondly, a considerable amount of source code is used several places throughout different solver, e.g. createMesh.H or createDynamicFvMesh.H. These are not conventional header files, but merely bits of source code, which construct different types of finite volume meshes. These are also included into the solvers/utilities using include statements, and I suppose this approach has been adopted in order to avoid duplicating source code and thereby reducing the risk of bugs.

Kind regards

ngj is offline   Reply With Quote

Old   May 14, 2013, 06:09
Join Date: Feb 2013
Posts: 30
Rep Power: 6
Natalie2210 is on a distinguished road
ah ok. I have had a look at the header files and they actually contain code which is, it seems, pasted by the preprocessor into the source. Thank you!

Natalie2210 is offline   Reply With Quote


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
cyclic boundary conditions for FSI kanuk OpenFOAM Programming & Development 10 April 25, 2014 02:52
OpenFoam install script Error during paraFoam installation SePe OpenFOAM Installation 10 June 19, 2010 15:15
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 03:01
Problems in compiling paraview in Suse 10.3 platform chiven OpenFOAM Installation 3 December 1, 2009 08:21
OpenFOAM15 paraFoam bug koen OpenFOAM Bugs 19 June 30, 2009 10:46

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