]> git.treefish.org Git - phys/latlib.git/commitdiff
...
authorAlex Schmidt <alex@treefish.org>
Wed, 10 Oct 2012 14:12:50 +0000 (16:12 +0200)
committerAlex Schmidt <alex@treefish.org>
Wed, 10 Oct 2012 14:12:50 +0000 (16:12 +0200)
CMakeLists.txt
paraq.cpp [new file with mode: 0644]
paraq.h [new file with mode: 0644]

index 2f0439b2ecc689c230c28b29bde6917b51ad100f..a251c138df5e180ccd44140fd4d7b633f773f7e7 100644 (file)
@@ -7,5 +7,7 @@ add_library(lat_neigh neigh.cpp)
 
 add_library(lat_writeout writeout.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
 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 (file)
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<string,double>* paraq::nextParas()
+{
+  if( lastjob == -1 ) {
+    lastjob = 0;
+    
+    for( map< string, vector< double* > >::iterator paraIt = paraMap.begin(); paraIt != paraMap.end(); ++paraIt ) {
+      for( vector< map<string,double>  >::iterator jobIt = jobList.begin(); jobIt != jobList.end(); ++jobIt) {
+       for( vector<double*>::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 (file)
index 0000000..9aaf1d0
--- /dev/null
+++ b/paraq.h
@@ -0,0 +1,23 @@
+#ifndef PARAQ_H
+#define PARAQ_H
+
+#include <string>
+#include <map>
+#include <vector>
+
+using namespace std;
+
+class paraq {
+ public: 
+  paraq(int nprocs, int rank);
+  void addRange(const string& paraid, double min, double max, double step);
+  map<string,double>* nextParas();
+
+ private:
+  int nprocs, rank;
+  int lastjob;
+  map< string, vector< double* > > paraMap;
+  vector< map<string,double>  > jobList;
+};
+
+#endif