Page MenuHomec4science

Simulation.h
No OneTemporary

File Metadata

Created
Wed, Jun 19, 23:55

Simulation.h

//
// Created by Joachim Koerfer on 10.05.2019.
//
#ifndef SEQUENTIAL_SIMULATION_H
#define SEQUENTIAL_SIMULATION_H
#include <memory>
#include <string>
#include "Matrix.h"
#define SQRT_2 1.414213562373095
struct State {
int niter = 0;
double T = 0;
double max_nu = 0;
double delta_t = 0;
};
typedef std::chrono::high_resolution_clock Clock;
class Simulation {
private:
std::unique_ptr<Matrix> H_;
std::unique_ptr<Matrix> Hu_;
std::unique_ptr<Matrix> Hv_;
std::unique_ptr<Matrix> Zdx_;
std::unique_ptr<Matrix> Zdy_;
//Temp storage
std::unique_ptr<Matrix> Ht_;
std::unique_ptr<Matrix> Hut_;
std::unique_ptr<Matrix> Hvt_;
int size_;
int nx_;
double delta_nx_;
double Tend_;
const double g_ = 127267.2;
//Variables relative to the state of the simulation
double T_;
double delta_t_;
double cst_;
int niter_;
//Variables relative to the measure of performance
Clock::time_point start_time_;
Clock::time_point end_time_;
double measured_time = 0;
double nflops_ = 0;
double compute_delta_t();
void impose_tolerances();
void enforce_boundary_conditions();
void copy_old_borders();
public:
Simulation(std::string path, int nx, int size, double Tend);
void compute();
bool compute_step();
double get_flops_performance() { return nflops_; }
void save(const std::string &file_name);
};
#endif //SEQUENTIAL_SIMULATION_H

Event Timeline