Commit 26a224f4 authored by Sergey Kireev's avatar Sergey Kireev
Browse files

obsolete code deleted

parent 0a69c4ec
......@@ -70,41 +70,6 @@ int main(int argc,char *argv[]) {
else
count<NLE_sqr_CA>(p);
/*
auto hood = ca2d::hood_default;
if (p.is_hex()) hood = ca2d::hood_hex;
NLE_CA<NLE> ca(nx,ny,p.get_nsize(),hood);
ca.set_parameters(p.get_en(),p.get_el(),p.get_enl(),p.get_kT(),p.get_mu(),p.get_evap(),p.get_cond());
if (p.load_from_file()) {
if (!ca.load_binary(p.load_filename())) exit(-1);
}
else
ca.fill(p.get_initial_n(),p.get_initial_e());
{
auto time_start = std::chrono::high_resolution_clock::now();
if (longout && np != 0) { printf("%9d : ",nt0); print_ca_counts(ca); printf("\n"); fflush(stdout); }
if (!longout) { printf(" "); print_ca_counts(ca); printf(" |"); fflush(stdout); }
if (ns != 0) ca.save_binary(prefix,nt0,suffix);
for (int it=0;it<nt;it++) {
ca.iterate();
if (ns != 0 && (it+1)%ns == 0) ca.save_binary(prefix,nt0+it+1,suffix);
if (np != 0 && (it+1)%np == 0) {
if (longout && np != 0) { printf("%9d : ",nt0+it+1); print_ca_counts(ca); printf("\n"); fflush(stdout); }
else { printf("."); fflush(stdout); }
}
}
if (!longout) { if (np != 0) printf("|"); printf(" "); print_ca_counts(ca); printf(" "); fflush(stdout); }
auto time_end = std::chrono::high_resolution_clock::now();
printf("Time: %.3lf s\n",(time_end - time_start)/std::chrono::milliseconds(1)*1e-3); fflush(stdout);
}
*/
return 0;
}
......
......@@ -390,7 +390,7 @@ class NLE_hex_CA : public NLE_CA_base<hood_hex> {
XY r(b);
for (int j=0;j<2*ns-1;j++) {
if (i+j >= ns-1) {
xN[k] = r.x;
xN[k] = r.x;
yN[k] = r.y;
sN[k] = xy2s(r.x,r.y);
k++;
......@@ -402,7 +402,7 @@ class NLE_hex_CA : public NLE_CA_base<hood_hex> {
for (int i=0;i<ns;i++) {
XY r(b);
for (int j=0;j<2*ns-1-i;j++) {
xN[k] = r.x;
xN[k] = r.x;
yN[k] = r.y;
sN[k] = xy2s(r.x,r.y);
k++;
......@@ -522,7 +522,7 @@ class NLE_hex_CA : public NLE_CA_base<hood_hex> {
{ // corner: dir1
int s = ca::getfix(nb.x+corner[dir1].x,nb.y+corner[dir1].y);
if (isL(s)) sll++; else if (s == soppdir0 || s == soppdir1) sln++;
}
}
{ // side dir1-dir2: first cell
int s = ca::getfix(nb.x+side[dir1][0].x,nb.y+side[dir1][0].y);
if (isL(s)) sll++; else if (s == soppdir1) sln++;
......@@ -598,42 +598,3 @@ class NLE_hex_CA : public NLE_CA_base<hood_hex> {
};
////////////////////////////////////////////////////////////////////////////////////////////////////
class NLE_CA {
NLE_sqr_CA *sqrca;
NLE_hex_CA *hexca;
public:
const int nx,ny;
NLE_CA(int nx_,int ny_,int ns,ca2d::Neighborhood_type hood_type):sqrca(nullptr),hexca(nullptr),nx(nx_),ny(ny_) {
if (hood_type == ca2d::hood_hex) hexca = new NLE_hex_CA(nx,ny,ns);
if (hood_type == ca2d::hood_vonNeumann || hood_type == ca2d::hood_default) sqrca = new NLE_sqr_CA(nx,ny,ns);
}
void set_parameters(double en_,double el_,double enl_,double kT_,double mu_,double evap_,double cond_) {
if (sqrca != nullptr) { sqrca->set_parameters(en_,el_,enl_,kT_,mu_,evap_,cond_); return; }
if (hexca != nullptr) { hexca->set_parameters(en_,el_,enl_,kT_,mu_,evap_,cond_); return; }
}
bool load_binary(const std::string &filename) {
if (sqrca != nullptr) return sqrca->load_binary(filename);
if (hexca != nullptr) return hexca->load_binary(filename);
return false;
}
void save_binary(const std::string &fn,int it=-1,const std::string &ext="") const {
if (sqrca != nullptr) { sqrca->save_binary(fn,it,ext); return; }
if (hexca != nullptr) { hexca->save_binary(fn,it,ext); return; }
}
void fill(double fracn,double frace) {
if (sqrca != nullptr) { sqrca->fill(fracn,frace); return; }
if (hexca != nullptr) { hexca->fill(fracn,frace); return; }
}
std::map<int,int> count() const {
if (sqrca != nullptr) return sqrca->count();
if (hexca != nullptr) return hexca->count();
return std::map<int,int>();
}
void iterate() {
if (sqrca != nullptr) { sqrca->iterate(); return; }
if (hexca != nullptr) { hexca->iterate(); return; }
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment