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

clean up, code compiles and test runs

parent a5b484da
No related branches found
No related tags found
1 merge request!21Bugfix/nansampling
Pipeline #
...@@ -65,7 +65,8 @@ class code_base ...@@ -65,7 +65,8 @@ class code_base
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
int print_simple_timer(void) int print_simple_timer(
const std::string operation_name)
{ {
this->time1 = clock(); this->time1 = clock();
double local_time_difference = (( double local_time_difference = ((
...@@ -80,11 +81,11 @@ class code_base ...@@ -80,11 +81,11 @@ class code_base
MPI_SUM, MPI_SUM,
MPI_COMM_WORLD); MPI_COMM_WORLD);
if (this->myrank == 0) if (this->myrank == 0)
std::cout << "iteration " << this->iteration << std::cout << operation_name <<
" took " << time_difference/this->nprocs << " took " << time_difference/this->nprocs <<
" seconds" << std::endl; " seconds" << std::endl;
if (this->myrank == 0) if (this->myrank == 0)
std::cerr << "iteration " << this->iteration << std::cerr << operation_name <<
" took " << time_difference/this->nprocs << " took " << time_difference/this->nprocs <<
" seconds" << std::endl; " seconds" << std::endl;
this->time0 = this->time1; this->time0 = this->time1;
......
...@@ -106,10 +106,12 @@ int direct_numerical_simulation::main_loop(void) ...@@ -106,10 +106,12 @@ int direct_numerical_simulation::main_loop(void)
this->check_stopping_condition(); this->check_stopping_condition();
if (this->stop_code_now) if (this->stop_code_now)
break; break;
this->print_simple_timer(); this->print_simple_timer(
"iteration " + std::to_string(this->iteration));
} }
this->do_stats(); this->do_stats();
this->print_simple_timer(); this->print_simple_timer(
"final call to do_stats ");
if (this->iteration % this->niter_out != 0) if (this->iteration % this->niter_out != 0)
this->write_checkpoint(); this->write_checkpoint();
return EXIT_SUCCESS; return EXIT_SUCCESS;
......
...@@ -34,7 +34,7 @@ herr_t hdf5_tools::grow_dataset_visitor( ...@@ -34,7 +34,7 @@ herr_t hdf5_tools::grow_dataset_visitor(
int hdf5_tools::grow_file_datasets( int hdf5_tools::grow_file_datasets(
const hid_t stat_file, const hid_t stat_file,
const std::string group_name, const std::string group_name,
const int tincrement) int tincrement)
{ {
int file_problems = 0; int file_problems = 0;
......
...@@ -44,7 +44,7 @@ namespace hdf5_tools ...@@ -44,7 +44,7 @@ namespace hdf5_tools
int grow_file_datasets( int grow_file_datasets(
const hid_t stat_file, const hid_t stat_file,
const std::string group_name, const std::string group_name,
const int tincrement); int tincrement);
} }
#endif//HDF5_TOOLS_HPP #endif//HDF5_TOOLS_HPP
......
#include <string>
#include <cmath>
#include "NSVEparticles.hpp"
#include "scope_timer.hpp"
template <typename rnumber>
int NSVEparticles<rnumber>::initialize(void)
{
return EXIT_SUCCESS;
}
template <typename rnumber>
int NSVEparticles<rnumber>::step(void)
{
return EXIT_SUCCESS;
}
template <typename rnumber>
int NSVEparticles<rnumber>::write_checkpoint(void)
{
return EXIT_SUCCESS;
}
template <typename rnumber>
int NSVEparticles<rnumber>::finalize(void)
{
this->NSVE<rnumber>::finalize();
return EXIT_SUCCESS;
}
template <typename rnumber>
int NSVEparticles<rnumber>::do_stats()
{
return EXIT_SUCCESS;
}
template <typename rnumber>
int direct_numerical_simulation::main_loop(void)
{
this->start_simple_timer();
int max_iter = (this->iteration + this->niter_todo -
(this->iteration % this->niter_todo));
for (; this->iteration < max_iter;)
{
#ifdef USE_TIMINGOUTPUT
const std::string loopLabel = ("code::main_start::loop-" +
std::to_string(this->iteration));
TIMEZONE(loopLabel.c_str());
#endif
this->do_stats();
this->step();
if (this->iteration % this->niter_out == 0)
this->write_checkpoint();
this->check_stopping_condition();
if (this->stop_code_now)
break;
this->print_simple_timer();
}
this->do_stats();
this->print_simple_timer();
if (this->iteration % this->niter_out != 0)
this->write_checkpoint();
return EXIT_SUCCESS;
}
template class NSVEparticles<float>;
template class NSVEparticles<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 PPNSVE_HPP
#define PPNSVE_HPP
#include <cstdlib>
#include "base.hpp"
#include "vorticity_equation.hpp"
#include "full_code/direct_numerical_simulation.hpp"
#include "full_code/NSVE.hpp"
template <typename rnumber>
class ppNSVE: public NSVE<rnumber>
{
public:
ppNSVE(
const MPI_Comm COMMUNICATOR,
const std::string &simulation_name):
NSVE<rnumber>(
COMMUNICATOR,
simulation_name){}
~ppNSVE(){}
int initialize(void);
int step(void);
int finalize(void);
virtual int read_parameters(void);
int write_checkpoint(void);
int do_stats(void);
int main_loop(void);
};
#endif//PPNSVE_HPP
...@@ -88,13 +88,12 @@ print('This is bfps version ' + VERSION) ...@@ -88,13 +88,12 @@ print('This is bfps version ' + VERSION)
### lists of files and MANIFEST.in ### lists of files and MANIFEST.in
src_file_list = ['full_code/ppNSVE', src_file_list = ['full_code/hdf5_tools',
'field_binary_IO',
'full_code/hdf5_tools',
'full_code/code_base', 'full_code/code_base',
'full_code/direct_numerical_simulation', 'full_code/direct_numerical_simulation',
'full_code/NSVE', 'full_code/NSVE',
'full_code/NSVEparticles', 'full_code/NSVEparticles',
'field_binary_IO',
'vorticity_equation', 'vorticity_equation',
'field', 'field',
'kspace', 'kspace',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment