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

Preprocessing code wmake

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2024, 04:26
Default Preprocessing code wmake
  #1
New Member
 
Join Date: Jan 2024
Posts: 10
Rep Power: 2
gmax is on a distinguished road
Hi everyone, I'm trying to debug buoyantFoam for mesh switching (when the solution is mapped to another mesh it crashes). What I would like to do is observe what is placed inside the file when it is compiled.


Usually if I want to do this with g++ I can give a command like:
Code:
g++ -E code.C -o preproces.file

and get a pre process file. I'm not sure you can do this with wmake. Does anyone know if it can be done or if there is an alternative way to understand the code?
thanks for the replies.
gmax is offline   Reply With Quote

Old   April 23, 2024, 11:21
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Not the most convenient, since you have a number of include directories and defines to worry about but you could try doing the following:


Code:
cd your/directory

wmake > stderr

The stderr file will contain the full command-line used to compile. Will "only" need to edit this to add the '-E' option and replace the output name with your prepro.file .


This worked OK for me, but even a simple file quickly expands to 150k lines!
olesen is offline   Reply With Quote

Old   April 23, 2024, 11:57
Default
  #3
New Member
 
Join Date: Jan 2024
Posts: 10
Rep Power: 2
gmax is on a distinguished road
Perfect, thank you so much!, I hadn't thought of that.


I think it worked correctly, I generated a 190k file but having some keywords I hope to get by. It's the only way I could think of to understand what and how it is called within the code, maybe you could recommend some other method?


However I only used the first line to fill in the one where the buoyantFoam.o object was created
gmax is offline   Reply With Quote

Old   April 26, 2024, 11:53
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by gmax View Post
Perfect, thank you so much!, I hadn't thought of that.


I think it worked correctly, I generated a 190k file but having some keywords I hope to get by. It's the only way I could think of to understand what and how it is called within the code, maybe you could recommend some other method?


However I only used the first line to fill in the one where the buoyantFoam.o object was created

This benefit of C++ is that you can write code to solve complex problems that you'd mostly not otherwise be able so solve. The downside is that you may not actually understand the code since it becomes so complex. Seems to be normal enough.
For what it's worth, expanding code with the pre-processor will not get you very far. You'd also need to trace and understand which inheritances happen where, and which virtual methods are being called etc. Definitely non-trivial.
olesen is offline   Reply With Quote

Old   April 29, 2024, 03:34
Default
  #5
New Member
 
Join Date: Jan 2024
Posts: 10
Rep Power: 2
gmax is on a distinguished road
Quote:
Originally Posted by olesen View Post
This benefit of C++ is that you can write code to solve complex problems that you'd mostly not otherwise be able so solve. The downside is that you may not actually understand the code since it becomes so complex. Seems to be normal enough.
For what it's worth, expanding code with the pre-processor will not get you very far. You'd also need to trace and understand which inheritances happen where, and which virtual methods are being called etc. Definitely non-trivial.
thank you very much, yes in the end I didn't get very far with the preprocessing.

The only way I see is to study the code, I'll read it during the night, thank you very much.
gmax 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
Patankar CFD FORTRAN 90 Code FVM siddiquesil Main CFD Forum 19 October 25, 2022 05:21
[swak4Foam] swak4foam openfoam 7 installation problem Andrea23 OpenFOAM Community Contributions 1 February 17, 2020 18:11
The FOAM Documentation Project - SHUT-DOWN holger_marschall OpenFOAM 242 March 7, 2013 12:30
Problems about compiling OF1.5.x on Bluegene/P ywang OpenFOAM 1 August 25, 2011 05:22
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 02:32


All times are GMT -4. The time now is 12:56.