Commit 4d1fb2a4 authored by karius's avatar karius

first gridding efforts

parent ae37ac1e
......@@ -53,6 +53,8 @@
// The weights are normalized such that sum weight = ntot.
#include <cassert>
#include <cmath>
#include <list>
#include <vector>
#include <iostream>
#include <iomanip>
......@@ -254,16 +256,56 @@ double pind(double ind, double delta, double sigma) {
return (sigma == 0) ? ind * delta : sinh(sigma * ind * delta) / sigma;
}
int find_max(float d){
float f = (sqrtf(2)-1)/d;
return std::max(2*((int)f),2*((int)(f-0.5))+1);
}
int main(int argc, char* argv[], char*[]) {
bool euler = false;
if (argc > 1 && string(argv[1]) == "-e")
euler = true;
assert(cin.good());
// if (argc > 1 && string(argv[1]) == "-e")
// euler = true;
// assert(cin.good());
string line;
while (cin.peek() == '#') {
getline(cin, line);
cout << line << endl;
// while (cin.peek() == '#') {
// getline(cin, line);
// cout << line << endl;
// }
float d0 = 0.15167;
float d = d0;
int max_i = find_max(d0);
int umax = max_i%2==0?max_i-1:max_i;
int emax = max_i%2==0?max_i:max_i-1;
std::list<std::tuple<int,int,int>> u_indeces;
std::list<std::tuple<int,int,int>> e_indeces;
printf("Umax: %i\n",umax);
printf("Emax: %i\n",emax);
for (int i=1;i<umax+1;i+=2){
for (int j=1;j<=i+1;j+=2){
for (int k=1;k<=j+1;k+=2){
if ((i+j+k)*d/2<1){
u_indeces.push_back(std::make_tuple(i,j,k));
printf("%i %i %i\n",i,j,k);}
}
}
}
for (int i=0;i<emax+1;i+=2){
for (int j=0;j<=i+1;j+=2){
for (int k=0;k<=j+1;k+=2){
if ((i+j+k)*d/2<1){
e_indeces.push_back(std::make_tuple(i,j,k));
printf("%i %i %i\n",i,j,k);
}
}
}
}
std::exit(0);
assert(cin.good());
getline(cin, line);
assert(line == "format grid");
......
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