Skip to content

Commit 328b4be

Browse files
committed
resolved lint bug
1 parent 8d7d7d9 commit 328b4be

2 files changed

Lines changed: 8 additions & 17 deletions

File tree

  • examples/cpp

examples/cpp/beesandflowers/src/main.cu

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ using flamegpu::ALIVE;
2222
using flamegpu::EnvironmentDescription;
2323

2424
CUDASimulation *global_sim = nullptr;
25-
const char *global_out_dir = "output/";
2625

2726
FLAMEGPU_AGENT_FUNCTION(calculate_priority, MessageNone, MessageNone) {
2827
float current_nectar = FLAMEGPU->getVariable<float>("current_cell_score");
@@ -136,7 +135,7 @@ FLAMEGPU_STEP_FUNCTION(stepLogger) {
136135

137136
// Export data per step using global pointer
138137
if (global_sim) {
139-
global_sim->exportData(global_out_dir + "step_" + std::to_string(step) + ".xml");
138+
global_sim->exportData("output/step_" + std::to_string(step) + ".xml");
140139
}
141140
}
142141

@@ -203,11 +202,7 @@ void define_model(ModelDescription &model) {
203202
}
204203

205204
int main(int argc, const char ** argv) {
206-
// Determine output directory based on execution context
207-
if (std::filesystem::exists("examples/cpp/beesandflowers")) {
208-
global_out_dir = "examples/cpp/beesandflowers/output/";
209-
}
210-
std::filesystem::create_directories(global_out_dir);
205+
std::filesystem::create_directories("output/");
211206

212207
ModelDescription model("OneAgentMovingModel");
213208

@@ -232,13 +227,13 @@ int main(int argc, const char ** argv) {
232227
simulation.initialise(argc, argv);
233228

234229
// Export initial state
235-
simulation.exportData(global_out_dir + "initial_state.xml");
230+
simulation.exportData("output/initial_state.xml");
236231

237232
// Run the simulation normally
238233
simulation.simulate();
239234

240235
// Export the summary log
241-
simulation.exportLog(global_out_dir + "simulation_log.json", true, true, false, false);
236+
simulation.exportLog("output/simulation_log.json", true, true, false, false);
242237

243238
return EXIT_SUCCESS;
244239
}

examples/cpp/sugarscape_submodel_api/src/main.cu

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#define SUGAR_MAX_CAPACITY 7.0f
2323

2424
flamegpu::CUDASimulation *global_sim = nullptr;
25-
const char *global_out_dir = "output/";
2625

2726
/**
2827
* Agent Functions
@@ -82,18 +81,15 @@ FLAMEGPU_STEP_FUNCTION(step_logger) {
8281
printf("Step %u: bugs=%u\n", step, bug_count);
8382

8483
if (global_sim) {
85-
global_sim->exportData(std::string(global_out_dir) + "step_" + std::to_string(step) + ".xml");
84+
global_sim->exportData("output/step_" + std::to_string(step) + ".xml");
8685
}
8786
}
8887

8988
/**
9089
* Main
9190
*/
9291
int main(int argc, const char ** argv) {
93-
if (std::filesystem::exists("examples/cpp/sugarscape_submodel_api")) {
94-
global_out_dir = "examples/cpp/sugarscape_submodel_api/output/";
95-
}
96-
std::filesystem::create_directories(global_out_dir);
92+
std::filesystem::create_directories("output/");
9793

9894
flamegpu::ModelDescription model("Sugarscape");
9995

@@ -244,11 +240,11 @@ int main(int argc, const char ** argv) {
244240
cudaSimulation.setPopulationData(cell_pop);
245241
}
246242

247-
cudaSimulation.exportData(std::string(global_out_dir) + "initial_state.xml");
243+
cudaSimulation.exportData("output/initial_state.xml");
248244

249245
cudaSimulation.simulate();
250246

251-
cudaSimulation.exportLog(std::string(global_out_dir) + "simulation_log.json", true, true, false, false);
247+
cudaSimulation.exportLog("output/simulation_log.json", true, true, false, false);
252248

253249
return 0;
254250
}

0 commit comments

Comments
 (0)