forked from open-atmos/PyPartMC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput.cpp
58 lines (51 loc) · 2.12 KB
/
output.cpp
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
/*##################################################################################################
# This file is a part of PyPartMC licensed under the GNU General Public License v3 (LICENSE file) #
# Copyright (C) 2022 University of Illinois Urbana-Champaign #
# Authors: https://github.com/open-atmos/PyPartMC/graphs/contributors #
##################################################################################################*/
#include "output.hpp"
void output_state(
const std::string &prefix,
const AeroData &aero_data,
const AeroState &aero_state,
const GasData &gas_data,
const GasState &gas_state,
const EnvState &env_state
){
int index;
double time;
double del_t;
int i_repeat;
bool record_removals;
bool record_optical;
const int prefix_size = prefix.size();
index = 1;
time = 1.0;
del_t = 60.0;
i_repeat = 1;
record_removals = false;
record_optical = false;
f_output_state(prefix.c_str(), &prefix_size, aero_data.ptr.f_arg(),
aero_state.ptr.f_arg(), gas_state.gas_data->ptr.f_arg(),
gas_state.ptr.f_arg(), env_state.ptr.f_arg(), &index, &time, &del_t,
&i_repeat, &record_removals, &record_optical);
}
std::tuple<std::shared_ptr<AeroData>, AeroState*, std::shared_ptr<GasData>,
GasState*, EnvState*> input_state(
const std::string &name
){
int index;
double time;
double del_t;
int i_repeat;
const int name_size = name.size();
AeroState *aero_state = new AeroState(std::shared_ptr<AeroData>(new AeroData()));
GasState *gas_state = new GasState(std::shared_ptr<GasData>(new GasData()));
EnvState *env_state = new EnvState();
f_input_state(name.c_str(), &name_size, &index, &time, &del_t, &i_repeat,
aero_state->aero_data->ptr.f_arg_non_const(), aero_state->ptr.f_arg_non_const(),
gas_state->gas_data->ptr.f_arg_non_const(), gas_state->ptr.f_arg_non_const(),
env_state->ptr.f_arg_non_const());
return std::make_tuple(aero_state->aero_data, aero_state, gas_state->gas_data,
gas_state, env_state);
}