2
submitted 1 year ago* (last edited 1 year ago) by FlightSimEnjoyer@vlemmy.net to c/programming@beehaw.org

Hello there, fellow programmers! I am an Aeronautical Engineering student who is doing research on Multidisciplinary Optimization (MDO) since the beginning of this year.

All the code I've written so far is in Python, but I want to move it to C so I can learn more about low level programming and so I can have more control over what my code actually does (since it is an MDO code, it needs to be very optimized because every 0.5 seconds added to each iteration add 500 seconds over 1000 iterations (9 minutes!)). I am taking an online course on C from edX, but I still cannot understand how to actually substitute objects for C compliant code. The main problem is that my original code uses lots of objects, and I simply do not know how to eliminate objects from my code.

Can someone help me? Any help is welcomed.

[edit] Thanks for all your answers, I think I'm getting it now.

top 1 comments
sorted by: hot top controversial new old
[-] Saixos@beehaw.org 1 points 1 year ago

If your goal is to rewrite your python code in C with minimal hassle, start thinking of objects as structs with functions attached to them. If you detach the functions from the structs, instead having them take structs as an argument, then you can obtain something which is C-like but likely very unoptimised.

Personally, I think I would steer you towards Rust or C++ instead - both can run just as quickly, but have more OOP features and modern features which may make moving easier. Learning C is still a very good thing to do, but I'm not sure this project would be the best project to do that with.

this post was submitted on 18 Jun 2023
2 points (100.0% liked)

Programming

13361 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS