CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   SU2 (https://www.cfd-online.com/Forums/su2/)
-   -   Option_Structure.hpp (https://www.cfd-online.com/Forums/su2/182330-option_structure-hpp.html)

mlooti January 6, 2017 22:36

Option_Structure.hpp
 
Hi

Can anyone give me an explanation about Option_Structure.hpp file?

I want to know the reason of all those "enum" type definitions and also the main idea behind the "map" construction. (it is more a c++ question)

since when I want to add new feature to the config file I just define that as data member in config_structure.hpp and then put the definition in config_structure.cpp

It would be great if one can explain the whole "config file reading" style which I believe is related to the following files:

Option_Structure.hpp
config_structure.hpp
config_structure.cpp
config_structure.inl

hlk January 11, 2017 14:57

Quote:

Originally Posted by mlooti (Post 632350)
Hi

Can anyone give me an explanation about Option_Structure.hpp file?

I want to know the reason of all those "enum" type definitions and also the main idea behind the "map" construction. (it is more a c++ question)

since when I want to add new feature to the config file I just define that as data member in config_structure.hpp and then put the definition in config_structure.cpp

It would be great if one can explain the whole "config file reading" style which I believe is related to the following files:

Option_Structure.hpp
config_structure.hpp
config_structure.cpp
config_structure.inl


The enum/map structure allows options to be specified using strings in the config file, and referred to by name in the code. From the C++ side this means that the options read in as strings are stored using very little memory, and referred to by human-readable variable names in the code.
If you are creating a new option, you only need to add the enum/map structure if you are introducing an option that chooses something from a list (ie, DV_KIND). If you are adding an option that sets a numerical value, the enum/map is not needed (ie, CFL number).

When adding an option, you need to define the option in config_structure.cpp such that it can be read from the config file, declare the variable in config_structure.hpp such that the variable will exist in the config class, and define the getter function in config_structure.inl such that the value can be accessed from outside the config class.
In C++, *.inl files are the preferred location for functions that take up only one or two lines.

vishu343 November 7, 2019 17:42

New Option in SU2 for DV_KIND
 
Hello,


I just read this post about adding new option for DV_KIND. I am also trying to do same i.e. adding new option similar to FFD_CONTROL_POINT and so on. I was wondering which files needs to be modified in such cases!!


I have modified following files already:


1) config_structure.hpp
1) config_structure.cpp
3) option_structure.hpp
4) grid_movement_structure.cpp


While running SU2_CFD "name_of_file.cfg" I got following error.


-----------------------------------------------*****------------------------------------------------



DV_KIND: invalid option value XXXXXX. Check current SU2 options in config_template.cfg.
DV_PARAM: Design_Variable array has not been allocated. Check that DV_KIND appears before DV_PARAM in configuration file.
DV_VALUE: Design_Variable array has not been allocated. Check that DV_KIND appears before DV_VALUE in configuration file.



----------------------------------------------******-----------------------------------------------


Here XXXXXX is the new option added. Due to contract reasons, I can not reveal the parameter.


Thanks a lot in advance.


All times are GMT -4. The time now is 21:40.