Commit 080a6318 authored by Sergey Kireev's avatar Sergey Kireev
Browse files

-fd parameter added

parent 87106c29
......@@ -35,8 +35,12 @@ void count(const Parameters &p) {
if (p.is_load_from_file()) {
if (!ca->load_binary(p.get_load_filename())) exit(-1);
}
else {
if (p.is_fill_debug())
ca->fill_debug();
else
ca->fill(p.get_initial_n(),p.get_initial_e());
}
std::ofstream mgsf;
if (p.is_maxgroupsize()) {
......
......@@ -138,6 +138,8 @@ class NLE_CA_base : public CA2D<int,hood_type> {
if (isL(ca::get(k)) && ca::rnd01() < fe) ca::get(k) = E;
}
virtual void fill_debug() { ca::fill(L); }
virtual bool try_swap_LE(int lx,int ly,int ex,int ey) {
int sll=0,sel=0,sln=0,sen=0;
for (int d=0;d<ca::hood.count;d++)
......@@ -385,6 +387,14 @@ class NLE_sqr_CA : public NLE_CA_base<hood_type> {
protected:
using ca = CA2D<int,hood_type>;
public:
using ca::nx;
using ca::ny;
protected:
using nle = NLE_CA_base<hood_type>;
using nle::nsize;
using nle::nnsize;
......@@ -454,6 +464,31 @@ class NLE_sqr_CA : public NLE_CA_base<hood_type> {
}
}
public:
virtual void fill_debug() {
ca::fill(nle::L);
const int bx = nx/2;
const int by = ny/2;
const int n = 5;
for (int i=-n;i<=n;i++) {
nle::put_N(bx+i*nsize,by+i*nsize);
nle::put_N(bx+i*nsize,by-i*nsize);
}
for (int i=0;i<n;i++) {
nle::put_N(bx-(n-i)*nsize,by-n*nsize);
nle::put_N(bx-n*nsize,by-(n-i)*nsize);
nle::put_N(bx-(n-i)*nsize,by+n*nsize);
nle::put_N(bx-n*nsize,by+(n-i)*nsize);
nle::put_N(bx+(n-i)*nsize,by-n*nsize);
nle::put_N(bx+n*nsize,by-(n-i)*nsize);
nle::put_N(bx+(n-i)*nsize,by+n*nsize);
nle::put_N(bx+n*nsize,by+(n-i)*nsize);
}
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -1084,6 +1119,7 @@ class NLE_sqr8_CA : public NLE_sqr_CA<hood_Moore> {
nle->setData();
return nle;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -113,6 +113,10 @@
#define CHECK 0
#endif
#ifndef FILL_DEBUG
#define FILL_DEBUG 0
#endif
Parameters::Parameters():
default_nx(NX),
default_ny(NY),
......@@ -139,7 +143,8 @@ Parameters::Parameters():
default_save_groups(SAVE_GROUPS),
default_file_maxgroupsize(FILE_MAXGROUPSIZE),
default_squhex(SQUHEX),
default_check(CHECK) {
default_check(CHECK),
default_fill_debug(FILL_DEBUG) {
reset();
}
......@@ -176,6 +181,7 @@ void Parameters::reset() {
squhex = default_squhex;
check = default_check;
fill_debug = default_fill_debug;
//optimization_level = 0;
//check = false;
......@@ -244,15 +250,15 @@ bool Parameters::read_from_cmdline(int argc,char *argv[]) {
cnt++;
long_output = 0;
}
else if (strcmp("-square",argv[cnt])==0 || strcmp("-squ",argv[cnt])==0 || strcmp("-sqr",argv[cnt])==0 || strcmp("-sqr4",argv[cnt])==0) {
else if (strcmp("-square",argv[cnt])==0 || strcmp("-squ",argv[cnt])==0 || strcmp("-sqr",argv[cnt])==0 || strcmp("-sqr4",argv[cnt])==0 || strcmp("-squ4",argv[cnt])==0 || strcmp("-sq4",argv[cnt])==0) {
cnt++;
squhex = 4;
}
else if (strcmp("-squ8",argv[cnt])==0 || strcmp("-sqr8",argv[cnt])==0) {
else if (strcmp("-squ8",argv[cnt])==0 || strcmp("-sqr8",argv[cnt])==0 || strcmp("-sq8",argv[cnt])==0) {
cnt++;
squhex = 8;
}
else if (strcmp("-hex",argv[cnt])==0) {
else if (strcmp("-hex",argv[cnt])==0 || strcmp("-hex6",argv[cnt])==0) {
cnt++;
squhex = 6;
}
......@@ -260,6 +266,10 @@ bool Parameters::read_from_cmdline(int argc,char *argv[]) {
cnt++;
check = 1;
}
else if (strcmp("-fd",argv[cnt])==0) {
cnt++;
fill_debug = 1;
}
else if (strcmp("-sg",argv[cnt])==0) {
cnt++;
save_groups = 1;
......
......@@ -13,6 +13,7 @@ class Parameters {
int default_squhex;
int default_save_groups;
int default_check;
int default_fill_debug;
double default_fraction_n;
double default_fraction_l;
......@@ -58,6 +59,7 @@ class Parameters {
std::string input_filename;
bool load_file;
bool check;
bool fill_debug;
//int optimization_level;
//bool check;
......@@ -114,5 +116,5 @@ public:
bool is_square8() const { return squhex == 8; }
bool is_hex() const { return squhex == 6; }
bool is_check() const { return check; }
bool is_fill_debug() const { return fill_debug; }
};
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