Jan-13-2017, 01:19 AM
(Jan-12-2017, 04:35 PM)micseydel Wrote:(Jan-11-2017, 11:07 PM)Felipe Wrote: You can give me a short example from what you mean with "import the variable into the other file"? It's different from use arguments into functions?They are different, but looking more closely, you can't do it because the files would have to import from each other.
Is I a variable or a constant? Things are hairy if it's a variable. If it's just a constant, you can keep it in a separate file for constants if it's needed by multiple things (or needs to be easy to change) and if it's just needed in one place, that's probably where it should live unless there's a good reason to put it somewhere else.
Hi,
The values are constants. Some like I are constants with integer values, others are vectors with N positions and float values.
For example, I = 90 is a constant that means the inclination of the magnetic field in degrees, X = 1, 1.2, 1.4, 1.6, 1.8... is a vector with positions of measure in kilometers.
If I can write something like a function or structure, which I can call in the main program to access the values and do the math that I need, it's fine.
The problem of use arguments is because some functions call another functions. It obligate me to write functions that have many arguments. I'm concerning about the efficiency too, because my program invert a problem with many dimension using PSO. So the computational cost can be a problem.