Closed solin closed 14 years ago
How would that be done?
The vector knows whether it is real or complex, so why should the user control this by calling either get_c_array() or get_c_array_cplx() ? Imho the user should just call get_c_array() that would return a pointer to scalar.
Because then you would have to compile hermes_common twice, once for real and once for complex numbers. Which I think is a step back, as I think we want to combine real and complex numbers in one project.
Maybe I am missing some other option how this would be done. I tried to do this for example:
double *get_c_array(); cplx *get_c_array();
but C++ doesn't allow such code -- it can only overload the methods if they have different arguments, not return values.
So why not make it
void get_c_array(double *c_array); void get_c_array(cplx *c_array);
Nice idea, that should work. Well, probably something like this:
void get_c_array(double * &c_array); void get_c_array(cplx * &c_array);
This is a good question. In order to avoid segfaults, I would almost prefer to copy the vectors into user-supplied allocated structures rather than exposing the pointers.
Well, we will use RPC anyways, and then you don't need to worry about this.
Hi, this has been done I think, is that right?
Yes, I am closing this. However, we have another issue in front ot us, which is to allow multiphysics problems where part is real and part complex. The resulting stiffness matrix must be real. I created an issue for this recently.
We should avoid having separate methods such as get_c_array() and get_c_array_cplc(), get() and get_cplx() etc. This makes the code complicated.