CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

#include directives?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 14, 2013, 05:04
Default #include directives?
  #1
Member
 
Join Date: Feb 2013
Posts: 30
Rep Power: 13
Natalie2210 is on a distinguished road
Hi!

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,
Natalie
Natalie2210 is offline   Reply With Quote

Old   May 14, 2013, 05:18
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
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
Default
  #3
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
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

Niels
ngj is offline   Reply With Quote

Old   May 14, 2013, 06:09
Default
  #4
Member
 
Join Date: Feb 2013
Posts: 30
Rep Power: 13
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!

Natalie
Natalie2210 is offline   Reply With Quote

Reply


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 Off
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 07:21
OpenFOAM15 paraFoam bug koen OpenFOAM Bugs 19 June 30, 2009 10:46


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