-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCPDN_control_code.h
73 lines (70 loc) · 2.74 KB
/
CPDN_control_code.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// Control code header file for the OpenIFS application in the climateprediction.net project
//
// Written by Andy Bowery (Oxford eResearch Centre, Oxford University) November 2022
// Contributions from Glenn Carver (ex-ECMWF), 2022->
//
#include <string>
#include <chrono>
#include <thread>
#include <fstream>
#include <sstream>
#include <iostream>
#include <filesystem> // required by file_is_empty
#include <exception>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <dirent.h>
#include <regex.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include "boinc/boinc_api.h"
#include "boinc/boinc_zip.h"
#include "boinc/diagnostics.h"
#include "boinc/util.h"
#include "rapidxml.hpp"
#include <algorithm>
int initialise_boinc(std::string&, std::string&, std::string&, int&);
int move_and_unzip_app_file(std::string, std::string, std::string, std::string);
const char* strip_path(const char* path);
int check_child_status(long, int);
int check_boinc_status(long, int);
long launch_process_oifs(const std::string, const char*, const char*, const std::string);
long launch_process_wrf(const std::string, const char*);
std::string get_tag(const std::string &str);
void process_trickle(double, const std::string, const std::string, const std::string, int, int);
bool file_exists(const std::string &str);
bool file_is_empty(std::string &str);
double cpu_time(long);
double model_frac_done(double, double, int);
std::string get_second_part(const std::string, const std::string);
int move_result_file(std::string, std::string, std::string, std::string);
bool check_stoi(std::string& cin);
bool oifs_parse_stat(std::string&, std::string&, int);
bool oifs_get_stat(std::ifstream&, std::string&);
bool oifs_valid_step(std::string&,int);
int print_last_lines(std::string filename, int nlines);
void read_progress_file(std::string, int&, int&, std::string&, int&, int&);
void update_progress_file(std::string, int, int, std::string, int, int);
bool read_rcf_file(std::ifstream&, std::string&, std::string&);
bool read_delimited_line(std::string&, std::string, std::string, int, std::string&);
void call_boinc_begin_critical_section();
void call_boinc_end_critical_section();
int call_boinc_unzip(std::string, std::string path);
int call_boinc_zip(std::string, const ZipFileList*);
int call_boinc_copy(std::string, std::string);
int call_boinc_resolve_filename_s(std::string, std::string&);
void call_boinc_upload_file(std::string);
int call_boinc_upload_status(std::string);
void call_boinc_report_app_status(double, int, double);
void call_boinc_fraction_done(double);
void call_boinc_finish(int);
using namespace std;
using namespace std::chrono;
using namespace std::this_thread;
using namespace rapidxml;