|
[Sponsors] |
April 23, 2024, 04:26 |
Preprocessing code wmake
|
#1 |
New Member
Join Date: Jan 2024
Posts: 11
Rep Power: 2 |
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. |
|
April 23, 2024, 11:21 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40 |
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! |
|
April 23, 2024, 11:57 |
|
#3 |
New Member
Join Date: Jan 2024
Posts: 11
Rep Power: 2 |
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 |
|
April 26, 2024, 11:53 |
|
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,695
Rep Power: 40 |
Quote:
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. |
||
April 29, 2024, 03:34 |
|
#5 | |
New Member
Join Date: Jan 2024
Posts: 11
Rep Power: 2 |
Quote:
The only way I see is to study the code, I'll read it during the night, thank you very much. |
||
|
|
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 |