Loading drivers/TestMemResolv1.h +23 −24 Original line number Diff line number Diff line #ifndef TEST_MEM_RESOLV_1_H #define TEST_MEM_RESOLV_1_H #include <iostream> #include <cstdlib> #include "MemResolv.h" #include "IsClass.h" #include "MemResolv.h" #include <cstdlib> #include <iostream> typedef PsimagLite::MemResolv MemResolv; template <typename T> class TestMemResolv1 { class TestMemResolv1 { static const bool IS_CLASS = PsimagLite::IsClass<T>::value; typedef std::vector<T> VectorType; typedef PsimagLite::ResolveFinalOrNot<VectorType,IS_CLASS> ResolveFinalOrNotType; typedef PsimagLite::ResolveFinalOrNot<VectorType, IS_CLASS> ResolveFinalOrNotType; typedef TestMemResolv1<T> ThisType; public: TestMemResolv1(int size) : size_(size),data_(size) {} : size_(size) , data_(size) { } void setTo(T x) { Loading @@ -27,14 +31,9 @@ public: data_[i] = x; } const T& get(int i) const { return data_[i]; } const T& get(int i) const { return data_[i]; } SizeType memResolv(MemResolv& vmptr, SizeType = 0, PsimagLite::String msg = "") const SizeType memResolv(MemResolv& vmptr, SizeType = 0, PsimagLite::String msg = "") const { PsimagLite::String str = msg; msg += "TestMemResolv1 "; Loading @@ -46,7 +45,8 @@ public: } template <typename T2> friend std::ostream& operator<<(std::ostream& os, const TestMemResolv1<T2>& mt); friend std::ostream& operator<<(std::ostream& os, const TestMemResolv1<T2>& mt); private: Loading @@ -69,4 +69,3 @@ std::ostream& operator<<(std::ostream& os, const TestMemResolv1<T>& mt) } #endif drivers/affinityTest.cpp +16 −19 Original line number Diff line number Diff line Loading @@ -16,12 +16,13 @@ Please see full open source license included in file LICENSE. */ #include "Concurrency.h" #include <iostream> #include <cstdlib> #include <iostream> #define USE_PTHREADS_OR_NOT_NG #include "Parallelizer.h" class MyHelper { class MyHelper { typedef PsimagLite::Concurrency ConcurrencyType; typedef PsimagLite::Vector<SizeType>::Type VectorSizeType; Loading @@ -29,15 +30,14 @@ class MyHelper { public: MyHelper(SizeType ntasks, SizeType nthreads) : ntasks_(ntasks), x_(nthreads,0) {} : ntasks_(ntasks) , x_(nthreads, 0) { } SizeType tasks() const { return ntasks_; } int result() const { return x_[0]; } int result() const { return x_[0]; } void doTask(SizeType taskNumber, SizeType threadNum) { Loading @@ -56,12 +56,10 @@ private: VectorSizeType x_; }; // class MyHelper int main(int argc, char* argv[]) { typedef PsimagLite::Concurrency ConcurrencyType; if (argc != 3) { std::cout << "USAGE: " << argv[0] << " nthreads ntasks\n"; return 1; Loading @@ -86,4 +84,3 @@ int main(int argc,char *argv[]) helper.sync(); std::cout << "Sum of all tasks= " << helper.result() << "\n"; } drivers/akimaSpline.cpp +24 −24 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ Please see full open source license included in file LICENSE. */ // END LICENSE BLOCK #include <string> #include "AkimaSpline.h" #include "Vector.h" #include <cstdlib> #include <fstream> #include <iostream> #include <cstdlib> #include "Vector.h" #include "AkimaSpline.h" #include <string> typedef double FieldType; typedef typename Vector<FieldType>::Type VectorType; Loading @@ -33,18 +33,21 @@ typedef AkimaSplineType::IntervalType IntervalType; void readTwoColumnData(const String& file, VectorType& v0, VectorType& v1) { std::ifstream fin(file.c_str()); if (!fin || !fin.good() || fin.bad()) throw RuntimeError("Cannot open file\n"); if (!fin || !fin.good() || fin.bad()) throw RuntimeError("Cannot open file\n"); while (!fin.eof()) { String s; fin >> s; if (s[0]=='#') continue; if (s[0] == '#') continue; FieldType x = std::atof(s.c_str()); SizeType size = v0.size(); if (size>1 && x<v0[size-1]) break; if (size > 1 && x < v0[size - 1]) break; v0.push_back(x); fin >> s; if (s[0]=='#') continue; if (s[0] == '#') continue; v1.push_back(atof(s.c_str())); } fin.close(); Loading @@ -65,6 +68,3 @@ int main(int argc,char *argv[]) std::cout << x << " " << akimaSpline(x) << "\n"; } } drivers/base64test.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -47,4 +47,3 @@ int main() std::cout << "encoded: " << encoded << "\n"; std::cout << "decoded: " << PsimagLite::PsiBase64::Decode(encoded)() << "\n"; } drivers/binaryIoTest.cpp +19 −20 Original line number Diff line number Diff line Loading @@ -43,5 +43,4 @@ int main() fout.close(); readMe(myfile); } Loading
drivers/TestMemResolv1.h +23 −24 Original line number Diff line number Diff line #ifndef TEST_MEM_RESOLV_1_H #define TEST_MEM_RESOLV_1_H #include <iostream> #include <cstdlib> #include "MemResolv.h" #include "IsClass.h" #include "MemResolv.h" #include <cstdlib> #include <iostream> typedef PsimagLite::MemResolv MemResolv; template <typename T> class TestMemResolv1 { class TestMemResolv1 { static const bool IS_CLASS = PsimagLite::IsClass<T>::value; typedef std::vector<T> VectorType; typedef PsimagLite::ResolveFinalOrNot<VectorType,IS_CLASS> ResolveFinalOrNotType; typedef PsimagLite::ResolveFinalOrNot<VectorType, IS_CLASS> ResolveFinalOrNotType; typedef TestMemResolv1<T> ThisType; public: TestMemResolv1(int size) : size_(size),data_(size) {} : size_(size) , data_(size) { } void setTo(T x) { Loading @@ -27,14 +31,9 @@ public: data_[i] = x; } const T& get(int i) const { return data_[i]; } const T& get(int i) const { return data_[i]; } SizeType memResolv(MemResolv& vmptr, SizeType = 0, PsimagLite::String msg = "") const SizeType memResolv(MemResolv& vmptr, SizeType = 0, PsimagLite::String msg = "") const { PsimagLite::String str = msg; msg += "TestMemResolv1 "; Loading @@ -46,7 +45,8 @@ public: } template <typename T2> friend std::ostream& operator<<(std::ostream& os, const TestMemResolv1<T2>& mt); friend std::ostream& operator<<(std::ostream& os, const TestMemResolv1<T2>& mt); private: Loading @@ -69,4 +69,3 @@ std::ostream& operator<<(std::ostream& os, const TestMemResolv1<T>& mt) } #endif
drivers/affinityTest.cpp +16 −19 Original line number Diff line number Diff line Loading @@ -16,12 +16,13 @@ Please see full open source license included in file LICENSE. */ #include "Concurrency.h" #include <iostream> #include <cstdlib> #include <iostream> #define USE_PTHREADS_OR_NOT_NG #include "Parallelizer.h" class MyHelper { class MyHelper { typedef PsimagLite::Concurrency ConcurrencyType; typedef PsimagLite::Vector<SizeType>::Type VectorSizeType; Loading @@ -29,15 +30,14 @@ class MyHelper { public: MyHelper(SizeType ntasks, SizeType nthreads) : ntasks_(ntasks), x_(nthreads,0) {} : ntasks_(ntasks) , x_(nthreads, 0) { } SizeType tasks() const { return ntasks_; } int result() const { return x_[0]; } int result() const { return x_[0]; } void doTask(SizeType taskNumber, SizeType threadNum) { Loading @@ -56,12 +56,10 @@ private: VectorSizeType x_; }; // class MyHelper int main(int argc, char* argv[]) { typedef PsimagLite::Concurrency ConcurrencyType; if (argc != 3) { std::cout << "USAGE: " << argv[0] << " nthreads ntasks\n"; return 1; Loading @@ -86,4 +84,3 @@ int main(int argc,char *argv[]) helper.sync(); std::cout << "Sum of all tasks= " << helper.result() << "\n"; }
drivers/akimaSpline.cpp +24 −24 Original line number Diff line number Diff line Loading @@ -18,12 +18,12 @@ Please see full open source license included in file LICENSE. */ // END LICENSE BLOCK #include <string> #include "AkimaSpline.h" #include "Vector.h" #include <cstdlib> #include <fstream> #include <iostream> #include <cstdlib> #include "Vector.h" #include "AkimaSpline.h" #include <string> typedef double FieldType; typedef typename Vector<FieldType>::Type VectorType; Loading @@ -33,18 +33,21 @@ typedef AkimaSplineType::IntervalType IntervalType; void readTwoColumnData(const String& file, VectorType& v0, VectorType& v1) { std::ifstream fin(file.c_str()); if (!fin || !fin.good() || fin.bad()) throw RuntimeError("Cannot open file\n"); if (!fin || !fin.good() || fin.bad()) throw RuntimeError("Cannot open file\n"); while (!fin.eof()) { String s; fin >> s; if (s[0]=='#') continue; if (s[0] == '#') continue; FieldType x = std::atof(s.c_str()); SizeType size = v0.size(); if (size>1 && x<v0[size-1]) break; if (size > 1 && x < v0[size - 1]) break; v0.push_back(x); fin >> s; if (s[0]=='#') continue; if (s[0] == '#') continue; v1.push_back(atof(s.c_str())); } fin.close(); Loading @@ -65,6 +68,3 @@ int main(int argc,char *argv[]) std::cout << x << " " << akimaSpline(x) << "\n"; } }
drivers/base64test.cpp +3 −4 Original line number Diff line number Diff line Loading @@ -47,4 +47,3 @@ int main() std::cout << "encoded: " << encoded << "\n"; std::cout << "decoded: " << PsimagLite::PsiBase64::Decode(encoded)() << "\n"; }
drivers/binaryIoTest.cpp +19 −20 Original line number Diff line number Diff line Loading @@ -43,5 +43,4 @@ int main() fout.close(); readMe(myfile); }