Skip to content
Snippets Groups Projects
Commit ce1a45da authored by Cristian Lalescu's avatar Cristian Lalescu
Browse files

add resize cpp files

parent b1b5a27f
Branches
Tags
1 merge request!23WIP: Feature/use cmake
Pipeline #
#include <string>
#include <cmath>
#include "resize.hpp"
#include "scope_timer.hpp"
template <typename rnumber>
int resize<rnumber>::initialize(void)
{
this->NSVE_field_stats<rnumber>::initialize();
DEBUG_MSG("after NSVE_field_stats::initialize\n");
hid_t parameter_file = H5Fopen(
(this->simname + std::string(".h5")).c_str(),
H5F_ACC_RDONLY,
H5P_DEFAULT);
this->niter_out = hdf5_tools::read_value<int>(
parameter_file, "/parameters/niter_out");
H5Fclose(parameter_file);
parameter_file = H5Fopen(
(this->simname + std::string("_post.h5")).c_str(),
H5F_ACC_RDONLY,
H5P_DEFAULT);
DEBUG_MSG("before read_vector\n");
this->iteration_list = hdf5_tools::read_vector<int>(
parameter_file,
"/resize/parameters/iteration_list");
this->new_nx = hdf5_tools::read_value<int>(
parameter_file, "/resize/parameters/new_nx");
this->new_ny = hdf5_tools::read_value<int>(
parameter_file, "/resize/parameters/new_ny");
this->new_nz = hdf5_tools::read_value<int>(
parameter_file, "/resize/parameters/new_nz");
this->new_simname = hdf5_tools::read_string(
parameter_file, "/resize/parameters/new_simname");
H5Fclose(parameter_file);
this->new_field = new field<rnumber, FFTW, THREE>(
this->new_nx, this->new_ny, this->new_nz,
this->comm,
this->vorticity->fftw_plan_rigor);
return EXIT_SUCCESS;
}
template <typename rnumber>
int resize<rnumber>::work_on_current_iteration(void)
{
DEBUG_MSG("entered resize::work_on_current_iteration\n");
this->read_current_cvorticity();
std::string fname = (
this->new_simname +
std::string("_fields.h5"));
this->new_field = this->vorticity;
this->new_field->io(
fname,
"vorticity",
this->iteration,
false);
return EXIT_SUCCESS;
}
template <typename rnumber>
int resize<rnumber>::finalize(void)
{
delete this->new_field;
this->NSVE_field_stats<rnumber>::finalize();
return EXIT_SUCCESS;
}
template class resize<float>;
template class resize<double>;
/**********************************************************************
* *
* Copyright 2017 Max Planck Institute *
* for Dynamics and Self-Organization *
* *
* This file is part of bfps. *
* *
* bfps is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, either version 3 of the License, *
* or (at your option) any later version. *
* *
* bfps is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with bfps. If not, see <http://www.gnu.org/licenses/> *
* *
* Contact: Cristian.Lalescu@ds.mpg.de *
* *
**********************************************************************/
#ifndef RESIZE_HPP
#define RESIZE_HPP
#include <cstdlib>
#include <sys/types.h>
#include <sys/stat.h>
#include <vector>
#include "base.hpp"
#include "field.hpp"
#include "field_binary_IO.hpp"
#include "full_code/NSVE_field_stats.hpp"
template <typename rnumber>
class resize: public NSVE_field_stats<rnumber>
{
public:
std::string new_simname;
int new_nx;
int new_ny;
int new_nz;
int niter_out;
field<rnumber, FFTW, THREE> *new_field;
resize(
const MPI_Comm COMMUNICATOR,
const std::string &simulation_name):
NSVE_field_stats<rnumber>(
COMMUNICATOR,
simulation_name){}
virtual ~resize(){}
int initialize(void);
int work_on_current_iteration(void);
int finalize(void);
};
#endif//RESIZE_HPP
...@@ -94,6 +94,7 @@ src_file_list = ['full_code/joint_acc_vel_stats', ...@@ -94,6 +94,7 @@ src_file_list = ['full_code/joint_acc_vel_stats',
'full_code/field_test', 'full_code/field_test',
'hdf5_tools', 'hdf5_tools',
'full_code/get_rfields', 'full_code/get_rfields',
'full_code/resize',
'full_code/NSVE_field_stats', 'full_code/NSVE_field_stats',
'full_code/native_binary_to_hdf5', 'full_code/native_binary_to_hdf5',
'full_code/postprocess', 'full_code/postprocess',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment