Commit ad888730 authored by Leon Pyka's avatar Leon Pyka
Browse files

now trying to include Paolos composite files

parent 16dc89da
Loading
Loading
Loading
Loading
+6 KiB

File added.

No diff preview for this file type.

+770 −0

File added.

Preview size limit exceeded, changes collapsed.

+103 −0
Original line number Diff line number Diff line
#include <iostream>
#include <sstream>
//#include <mpi.h>
//#include <ctime>
//#include <executionblock.hpp>
#include <random.h>
#include <lattice3d.h>
//#include <fuser3d.h>

using namespace std;

template<typename T>
void get_from_command_line(int argc, char **argv, string name, T &a) {
    string value;
    for(int i=1; i<argc; ++i) {
        string argument(argv[i]);
        size_t found = argument.find(name);
        if(found!=string::npos) {
            size_t eqsgn = argument.find("=");
            value = string(argument,eqsgn+1,argument.size());
            break;
        }
    }
    stringstream vss(value);
    vss >> a;
}

int main(int argc, char **argv)
{
    // MPI_Init(NULL,NULL);
    // // Get the number of processes
    // int comm_size = 1;
    // MPI_Comm_size(MPI_COMM_WORLD, &comm_size);
    // // Get the rank of the process
    // int comm_rank = 1;
    // MPI_Comm_rank(MPI_COMM_WORLD, &comm_rank);
    // //time_t tzero = time(nullptr);
    // //cout << "tzero " << tzero << endl;

    uint64_t seed = 1;
    uint32_t steps = 2;
    char type = 'h';
    uint32_t nremove = 0;
    double weik = 4.0;
    uint32_t precr = 0;
    uint32_t niter = 1;
    uint32_t networks = 1;
    bool optional = true; //output data for individual realizations
    bool storeiv = true;
    get_from_command_line<>(argc,argv,"seed",seed);
    get_from_command_line<>(argc,argv,"steps",steps);
    get_from_command_line<>(argc,argv,"type",type);
    get_from_command_line<>(argc,argv,"nremove",nremove);
    get_from_command_line<double>(argc,argv,"weik",weik);
    get_from_command_line<>(argc,argv,"niter",niter);
    get_from_command_line<>(argc,argv,"networks",networks);
    get_from_command_line<>(argc,argv,"optional",optional);
    get_from_command_line<>(argc,argv,"storeiv",storeiv);
    get_from_command_line<>(argc,argv,"precr",precr);
    // seed = seed*1000ULL + comm_rank;

    cout << "seed = " << seed << endl;

    if(true) {
        Random ra(seed);
        int realizations = networks;
        //if(realizations>1) optional = false;
        for(int r=0; r<realizations; ++r) {
            Lattice lt(ra,steps,type,nremove,weik,precr);
            Lattice lb(ra,steps,'r',nremove,weik,0);
            Lattice l(ra,lb,lt);
            



            if(optional) {
                stringstream e_stream;
                e_stream << "edgelist_0_seed" << seed << "_" << r;
                l.export_edgelist_nobus(e_stream.str().c_str());
            }
            
            // Fuser f(l);
            // f.execute(niter);
            // if(storeiv) {
            //     stringstream namestream;
            //     namestream << "iv_seed" << seed << "_" << r;
            //     f.export_qstatic_iv_only_doubleprecision(namestream.str().c_str());
            // }
            // //stringstream p_stream;
            // //p_stream << "potentials_seed" << seed << "_" << r;
            // //f.export_potentials_nodewise(p_stream.str().c_str());
            // stringstream bs_stream;
            // bs_stream << "brokenlist_sorted_seed" << seed << "_" << r;
            // l.export_brokenlist_sorted_nobus(bs_stream.str().c_str());
        }
    }
    // //time_t tfinal = time(nullptr);
    // //time_t tdelta = tfinal-tzero;
    // //cout << "tfinal " << tfinal << "\n" <<
    // //    "tdelta " << tdelta << " s\n" <<
    // //    "nhours " << tdelta/3600 << endl;
    // MPI_Finalize();
}
+20 −0
Original line number Diff line number Diff line
#ifndef __RANDOM_H__
#define __RANDOM_H__
struct Random {
    uint64_t u,v,w;
    Random(uint64_t j) : v(4101842887655102017LL), w(1) {
        u = j ^ v; int64();
        v = u; int64();
        w = v; int64();
    }
    inline uint64_t int64() {
        u = u * 2862933555777941757LL + 7046029254386353087LL;
        v ^= v >> 17; v ^= v << 31; v ^= v >> 8;
        w = 4294957665U*(w & 0xffffffff) + (w >> 32);
        uint64_t x = u ^ (u << 21); x ^= x >> 35; x ^= x << 4;
        return (x + v) ^ w;
    }
    inline double doub() { return 5.42101086242752217E-20 * int64(); }
    inline uint32_t int32() { return (uint32_t)int64(); }
};
#endif
+250 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading