2.1.1.1. C++ Development¶
The underlying design philosophy of C and C++ can be summed up as “trust the programmer” – which is both wonderful and dangerous. Therefore there are three concepts that the programmer must trust:
Rule: instructions that you must do (generates errors)
Warning: instructions you should not do (generates warnings)
Best practice: instructions you should do (people will be puzzled otherwise or its superior to alternatives)
C++ excels in situations where high performance and precise control over memory and other resources is needed.
The steps in the development are as follows:
2.1.1.1.1. Define the problem¶
Create a new CFD code
2.1.1.1.2. How you are going to solve the problem¶
Break the problem into parts, e.g.
create data structures
read in mesh data
process mesh data
2.1.1.1.3. Write the program¶
.cpp file. Need to:
Know programming language
Have a good editor e.g. VIM
2.1.1.1.4. Compile source code¶
Check that rules are being followed
Generates object file .o from .cpp
2.1.1.1.5. Link object files and libraries¶
Create executable .exe from .o
Link library files
Check dependencies
Makefiles used to compile and link
2.1.1.1.6. Testing and Debugging¶
Test for:
Functionality - input-output (parts of program)
Application - user interface, integration (whole program)
Regression - backwards compatibility
Performance - CPU time, scalability