From: Alex Schmidt Date: Wed, 10 Oct 2012 14:12:50 +0000 (+0200) Subject: ... X-Git-Url: http://git.treefish.org/~alex/phys/latlib.git/commitdiff_plain/d3e332b13eccd2fa7e467770f6d973b4f34904cf ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f0439b..a251c13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,5 +7,7 @@ add_library(lat_neigh neigh.cpp) add_library(lat_writeout writeout.cpp) +add_library(lat_paraq paraq.cpp) + add_executable(neigh_test neigh_test.cpp) target_link_libraries(neigh_test lat_neigh) \ No newline at end of file diff --git a/paraq.cpp b/paraq.cpp new file mode 100644 index 0000000..3f7eb29 --- /dev/null +++ b/paraq.cpp @@ -0,0 +1,41 @@ +#include "paraq.h" + +paraq::paraq(int _nprocs, const int _rank) +{ + lastjob = -1; + nprocs = _nprocs; + rank = _rank; +} + +void paraq::addRange(const string& paraid, double min, double max, double step) +{ + double *range = new double[3]; + range[0] = min; + range[1] = max; + range[2] = step; + + paraMap[paraid].push_back( range ); +} + +map* paraq::nextParas() +{ + if( lastjob == -1 ) { + lastjob = 0; + + for( map< string, vector< double* > >::iterator paraIt = paraMap.begin(); paraIt != paraMap.end(); ++paraIt ) { + for( vector< map >::iterator jobIt = jobList.begin(); jobIt != jobList.end(); ++jobIt) { + for( vector::iterator rangeIt = paraIt->second.begin(); rangeIt != paraIt->second.end(); ++rangeIt ) { + + for( double paraval = *rangeIt[0]; paraval < *rangeIt[1]; paraval += *rangeIt[2] ) { + + //if( paraval == *rangeIt[0] ) + //else + + } + + } + + } + } + } +} diff --git a/paraq.h b/paraq.h new file mode 100644 index 0000000..9aaf1d0 --- /dev/null +++ b/paraq.h @@ -0,0 +1,23 @@ +#ifndef PARAQ_H +#define PARAQ_H + +#include +#include +#include + +using namespace std; + +class paraq { + public: + paraq(int nprocs, int rank); + void addRange(const string& paraid, double min, double max, double step); + map* nextParas(); + + private: + int nprocs, rank; + int lastjob; + map< string, vector< double* > > paraMap; + vector< map > jobList; +}; + +#endif