- changed status to open
- marked as
- removed comment
Multipole Thorn: Why is max_vars set to 10?
Issue #2195
duplicate
arrangements/EinsteinAnalysis/Multipole/src/multipole.cc , line 22 reads:
static const int max_vars = 10;
Occasionally I'd like to output a multipole decomposition, e.g., for 12 variables. When I attempt this, because of the above limit, I get the mysterious error message that appears due to the assert on line 42 of this same file.
First, I think this should be a freely specifiable parameter.
Second, the error message should be clearer about what is wrong.
Third, by just setting the above to 30, I was able to perform a run with 12 output variables. Is this the correct fix? (The run no longer errors out.)
Keyword: None
Comments (2)
-
-
- changed status to duplicate
Duplicate of
#1481. - Log in to comment
There should certainly be a nice error message if the user specified list of variables is longer than the maximum hard-coded in the source file.
I assume the error that you saw as the assert:
which at least in the source code shows what went wrong. Certainly not the nicest way of handling an error that can be triggered by user inpu.
This can be changed easily to something like:
for a nicer error message (since it contains the allowed maximum value).
As far as making that a runtime parameter goes, you can certainly give it a try and see what is required to make max_vars a CCTK_INT parameter, then propose a pull request. My guess is that technically you are leaving what C++ allows you to do, since at least "old" versions of C++ do not allow things like:
even if C99 does allow this but most compilers are fine with this. You may have to use std::vector to achieve the same effect in this case though since max_vars is used to size a static variable in Multipole_Calc.