From d2739af60ef0e40f4f3fa999495ee42fdf56380d Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Wed, 24 May 2017 09:05:17 +0200
Subject: [PATCH] clean up, code compiles and test runs

---
 bfps/cpp/full_code/code_base.hpp              |  7 +-
 .../full_code/direct_numerical_simulation.cpp |  6 +-
 bfps/cpp/full_code/hdf5_tools.cpp             |  2 +-
 bfps/cpp/full_code/hdf5_tools.hpp             |  2 +-
 bfps/cpp/full_code/ppNSVE.cpp                 | 70 -------------------
 bfps/cpp/full_code/ppNSVE.hpp                 | 61 ----------------
 setup.py                                      |  5 +-
 7 files changed, 12 insertions(+), 141 deletions(-)
 delete mode 100644 bfps/cpp/full_code/ppNSVE.cpp
 delete mode 100644 bfps/cpp/full_code/ppNSVE.hpp

diff --git a/bfps/cpp/full_code/code_base.hpp b/bfps/cpp/full_code/code_base.hpp
index b0c2eb6b..6fc29ff1 100644
--- a/bfps/cpp/full_code/code_base.hpp
+++ b/bfps/cpp/full_code/code_base.hpp
@@ -65,7 +65,8 @@ class code_base
             return EXIT_SUCCESS;
         }
 
-        int print_simple_timer(void)
+        int print_simple_timer(
+                const std::string operation_name)
         {
             this->time1 = clock();
             double local_time_difference = ((
@@ -80,11 +81,11 @@ class code_base
                     MPI_SUM,
                     MPI_COMM_WORLD);
             if (this->myrank == 0)
-                std::cout << "iteration " << this->iteration <<
+                std::cout << operation_name <<
                              " took " << time_difference/this->nprocs <<
                              " seconds" << std::endl;
             if (this->myrank == 0)
-                std::cerr << "iteration " << this->iteration <<
+                std::cerr << operation_name <<
                              " took " << time_difference/this->nprocs <<
                              " seconds" << std::endl;
             this->time0 = this->time1;
diff --git a/bfps/cpp/full_code/direct_numerical_simulation.cpp b/bfps/cpp/full_code/direct_numerical_simulation.cpp
index 5d56b930..7b179fc5 100644
--- a/bfps/cpp/full_code/direct_numerical_simulation.cpp
+++ b/bfps/cpp/full_code/direct_numerical_simulation.cpp
@@ -106,10 +106,12 @@ int direct_numerical_simulation::main_loop(void)
         this->check_stopping_condition();
         if (this->stop_code_now)
             break;
-        this->print_simple_timer();
+        this->print_simple_timer(
+                "iteration " + std::to_string(this->iteration));
     }
     this->do_stats();
-    this->print_simple_timer();
+    this->print_simple_timer(
+            "final call to do_stats ");
     if (this->iteration % this->niter_out != 0)
         this->write_checkpoint();
     return EXIT_SUCCESS;
diff --git a/bfps/cpp/full_code/hdf5_tools.cpp b/bfps/cpp/full_code/hdf5_tools.cpp
index 595580e7..2262db98 100644
--- a/bfps/cpp/full_code/hdf5_tools.cpp
+++ b/bfps/cpp/full_code/hdf5_tools.cpp
@@ -34,7 +34,7 @@ herr_t hdf5_tools::grow_dataset_visitor(
 int hdf5_tools::grow_file_datasets(
         const hid_t stat_file,
         const std::string group_name,
-        const int tincrement)
+        int tincrement)
 {
     int file_problems = 0;
 
diff --git a/bfps/cpp/full_code/hdf5_tools.hpp b/bfps/cpp/full_code/hdf5_tools.hpp
index 3664d2c0..aaa98b5d 100644
--- a/bfps/cpp/full_code/hdf5_tools.hpp
+++ b/bfps/cpp/full_code/hdf5_tools.hpp
@@ -44,7 +44,7 @@ namespace hdf5_tools
     int grow_file_datasets(
             const hid_t stat_file,
             const std::string group_name,
-            const int tincrement);
+            int tincrement);
 }
 
 #endif//HDF5_TOOLS_HPP
diff --git a/bfps/cpp/full_code/ppNSVE.cpp b/bfps/cpp/full_code/ppNSVE.cpp
deleted file mode 100644
index 41fda6df..00000000
--- a/bfps/cpp/full_code/ppNSVE.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#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>;
-
diff --git a/bfps/cpp/full_code/ppNSVE.hpp b/bfps/cpp/full_code/ppNSVE.hpp
deleted file mode 100644
index 22e3cd95..00000000
--- a/bfps/cpp/full_code/ppNSVE.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/**********************************************************************
-*                                                                     *
-*  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
-
diff --git a/setup.py b/setup.py
index a6dd94fc..63941c1d 100644
--- a/setup.py
+++ b/setup.py
@@ -88,13 +88,12 @@ print('This is bfps version ' + VERSION)
 
 
 ### lists of files and MANIFEST.in
-src_file_list = ['full_code/ppNSVE',
-                 'field_binary_IO',
-                 'full_code/hdf5_tools',
+src_file_list = ['full_code/hdf5_tools',
                  'full_code/code_base',
                  'full_code/direct_numerical_simulation',
                  'full_code/NSVE',
                  'full_code/NSVEparticles',
+                 'field_binary_IO',
                  'vorticity_equation',
                  'field',
                  'kspace',
-- 
GitLab