-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReplDirSetup.h
56 lines (41 loc) · 1.51 KB
/
ReplDirSetup.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: ReplDirSetup.h
* Author: greg
*
* Created on November 10, 2018, 7:25 PM
*/
#include <dirent.h>
#include <mpi.h>
#include "repl_ex.h"
#ifndef REPLDIRSETUP_H
#define REPLDIRSETUP_H
class ReplDirSetup{
public:
ReplDirSetup(int temperature, ReplicaExchangeParameters replExParams){
ReplDirSetup::setupReplicaDirectories(temperature, replExParams);
}
void setupReplicaDirectories(int temperature, ReplicaExchangeParameters replExParams){
replica_temp << "temp_" << temperature;
std::string replica_directory = replica_temp.str();
mkdirWrapper(replExParams.multisimTitle, replica_directory);
}
void mkdirWrapper(std::string multisim_directory_name, string replica_directory_name){
replica_stream << multisim_directory_name << "/"
<< replica_directory_name;
std::string replica_directory_path = replica_stream.str();
printf("Creating directory : %s\n", multisim_directory_name.c_str());
mkdir(multisim_directory_name.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
mkdir(replica_directory_path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
path_to_replica_directory = replica_directory_path;
}
private:
std::stringstream replica_temp;
std::stringstream replica_stream;
std::string path_to_replica_directory;
};
#endif /* REPLDIRSETUP_H */