From 201e6358dba6a2ad01af378bc2c26ba1769e7d8b Mon Sep 17 00:00:00 2001 From: sniklas142 <niklas.schnierstein@googlemail.com> Date: Wed, 21 Aug 2019 08:30:05 +0200 Subject: [PATCH] saves spectrum to output hdf5 file --- cpp/full_code/ornstein_uhlenbeck_test.cpp | 30 +++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/cpp/full_code/ornstein_uhlenbeck_test.cpp b/cpp/full_code/ornstein_uhlenbeck_test.cpp index af2f48a2..eed860b8 100644 --- a/cpp/full_code/ornstein_uhlenbeck_test.cpp +++ b/cpp/full_code/ornstein_uhlenbeck_test.cpp @@ -41,19 +41,20 @@ int ornstein_uhlenbeck_test<rnumber>::read_parameters() { TIMEZONE("ornstein_uhlenbeck_test::read_parameters"); this->test::read_parameters(); - hid_t parameter_file = H5Fopen( - (this->simname + std::string(".h5")).c_str(), - H5F_ACC_RDONLY, - H5P_DEFAULT); + // hid_t parameter_file = H5Fopen( + // (this->simname + std::string(".h5")).c_str(), + // H5F_ACC_RDONLY, + // H5P_DEFAULT); // this->ou_kmin = hdf5_tools::read_value<double>(parameter_file, "/parameters/ou_kmin"); // this->ou_kmax = hdf5_tools::read_value<double>(parameter_file, "/parameters/ou_kmax"); // this->ou_energy_amplitude = hdf5_tools::read_value<double>(parameter_file, "/parameters/ou_energy_amplitude"); + // H5Fclose(parameter_file); //TODO - this->ou_kmin = 0; - this->ou_kmax = 10; + this->ou_kmin = 3; + this->ou_kmax = 14; this->ou_energy_amplitude = 1; - H5Fclose(parameter_file); + return EXIT_SUCCESS; } @@ -62,10 +63,23 @@ int ornstein_uhlenbeck_test<rnumber>::do_work(void) { TIMEZONE("ornstein_uhlenbeck_test::do_work"); std::string filename = this->simname + std::string("_fields.h5"); - for (int step = 0; step < 1000; step++) + for (int step = 0; step < 10000; step++) { this->ou->step(1e-3); } + hid_t gg; + + if (this->myrank == 0) { + gg = H5Fopen("test_ou_output.h5", H5F_ACC_RDWR, H5P_DEFAULT); + std::cerr << "peep" << std::endl; //DELETE + } + + // if (this->myrank == 0) gt = H5Fopen((this->simname + std::string(".h5")).c_str(), H5F_ACC_RDWR, H5P_DEFAULT); + // this->ou->kk->store(gt); + this->ou->kk->template cospectrum<rnumber,THREE>( + this->ou->ou_field->get_cdata(), + this->ou->ou_field->get_cdata(), + gg,"ou_spectra",0); return EXIT_SUCCESS; } -- GitLab