Suppose that I have a class like this one:
class SpinSystem{
private:
int L;
int L2;
const int k=1, J=1;
const int teq, tcorr;
const double TC=2/log(1+sqrt(2.0));//TC=2.269;
double Temp;
int Nmuestras;
int s[L][L]; int E,M;
int Cluster[L2][2]; int write;
public:
void set_values(int, double, int);
};
void SpinSystem::set_values(int length, double temperature, int nsamples){
L = length;
Temp = temperature;
Nmuestras = nsamples;
L2 = length*length;
teq = (int)(10*pow(length/8.0,0.58));
tcorr = (int)(1*pow(length/8.0,0.58));
}
The private variables L2, teq, tcorr depend on the value of L. This is why I set their values with the method set_values. However, I have to define some arrays, such as s[L][L] and Cluster[L2][2], whose sizes clearly depend on L. How can I achieve this? Thanks in advance.