From 7d6fd5adfb95ad71e870d62e53e1f2973224128b Mon Sep 17 00:00:00 2001 From: Sander Date: Sat, 30 May 2026 16:25:19 +0200 Subject: [PATCH 01/14] Integration of Parquet file output replacing XML output --- parquet.tmpl | 239 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 parquet.tmpl diff --git a/parquet.tmpl b/parquet.tmpl new file mode 100644 index 0000000..17e71f8 --- /dev/null +++ b/parquet.tmpl @@ -0,0 +1,239 @@ +/** + * \file parquet.tmpl + * \brief Generated code template to save agent states natively to Apache Parquet format. + * \note Automatically generated from the model definition by xparser. + */ + +#include +#include +#include +#include +#include + +// Include the Apache Arrow and Parquet C++ APIs +#include +#include +#include + +// Ensure C compatibility with the core FLAME engine structures +extern "C" { + #include "header.h" +} + +// ========================================================================= +// PARQUET HELPER FUNCTIONS (Equivalents to xml.tmpl static array functions) +// ========================================================================= + +/** + * \brief Appends a static C-style integer array into an Arrow ListBuilder. + * \note Equivalent to write_int_static_array from xml.tmpl + */ +inline void append_int_static_array( + std::shared_ptr& builder, + arrow::Int64Builder* value_builder, + const int* array_ptr, + int size) +{ + (void)builder->Append(); + for (int i = 0; i < size; ++i) { + (void)value_builder->Append(array_ptr[i]); + } +} + +/** + * \brief Appends a static C-style double array into an Arrow ListBuilder. + * \note Equivalent to write_float_static_array from xml.tmpl + */ +inline void append_double_static_array( + std::shared_ptr& builder, + arrow::DoubleBuilder* value_builder, + const double* array_ptr, + int size) +{ + (void)builder->Append(); + for (int i = 0; i < size; ++i) { + (void)value_builder->Append(array_ptr[i]); + } +} + +/** + * \brief Appends a static char array (C-string) into an Arrow StringBuilder. + * \note Equivalent to write_char_static_array from xml.tmpl. + * In Parquet, a static char array represents a single text string row. + */ +inline void append_char_static_array( + std::shared_ptr& builder, + const char* array_ptr, + int size) +{ + if (array_ptr != nullptr && size > 0) { + // Construct a safe bounded string ignoring trailing uninitialized garbage + std::string str_val(array_ptr, strnlen(array_ptr, size)); + (void)builder->Append(str_val); + } else { + (void)builder->AppendNull(); + } +} + + +// ========================================================================= +// INDIVIDUAL AGENT GENERATION TEMPLATE +// ========================================================================= + +/** + * \brief Saves the state of all active $AGENT_NAME agents into a single Parquet file. + * \param iteration_number The current simulation discrete time step. + */ +inline void save_$AGENT_NAME_parquet(int iteration_number) +{ + // 1. Build a clean filename string (e.g., "Firms_0023.parquet") + char filename[256]; + snprintf(filename, sizeof(filename), "$AGENT_NAME_%04d.parquet", iteration_number); + + // Get the head pointer of the specific agent population list + $AGENT_NAME * current_agent = get_$AGENT_NAME_agents(); + + // If there are no active agents of this type, skip file creation entirely + if (current_agent == nullptr) { + return; + } + + // 2. Initialize Apache Arrow Memory Builders for every variable in the agent schema + arrow::MemoryPool* pool = arrow::default_memory_pool(); + + + + // Builder for scalar variable: $VARIABLE_NAME + auto $VARIABLE_NAME_builder = std::make_shared(pool); + auto $VARIABLE_NAME_builder = std::make_shared(pool); + auto $VARIABLE_NAME_builder = std::make_shared(pool); + + + + // Builder for array variable: $VARIABLE_NAME + + auto $VARIABLE_NAME_value_builder = std::make_shared(pool); + auto $VARIABLE_NAME_builder = std::make_shared(pool, $VARIABLE_NAME_value_builder); + + + auto $VARIABLE_NAME_value_builder = std::make_shared(pool); + auto $VARIABLE_NAME_builder = std::make_shared(pool, $VARIABLE_NAME_value_builder); + + + auto $VARIABLE_NAME_builder = std::make_shared(pool); + + + + + // 3. Loop through the agent population and append row values to column builders + while (current_agent != nullptr) + { + + + // Append scalar values safely + + if (current_agent->$VARIABLE_NAME != nullptr) { + (void)$VARIABLE_NAME_builder->Append(std::string(current_agent->$VARIABLE_NAME)); + } else { + (void)$VARIABLE_NAME_builder->AppendNull(); + } + + + (void)$VARIABLE_NAME_builder->Append(current_agent->$VARIABLE_NAME); + + + + + // Append array elements natively using matched standalone helpers + append_int_static_array($VARIABLE_NAME_builder, $VARIABLE_NAME_value_builder, current_agent->$VARIABLE_NAME, $ARRAY_SIZE); + append_double_static_array($VARIABLE_NAME_builder, $VARIABLE_NAME_value_builder, current_agent->$VARIABLE_NAME, $ARRAY_SIZE); + append_char_static_array($VARIABLE_NAME_builder, current_agent->$VARIABLE_NAME, $ARRAY_SIZE); + + + + current_agent = current_agent->next; + } + + // 4. Finalize the builders into concrete, immutable Arrow Arrays + + std::shared_ptr $VARIABLE_NAME_array; + (void)$VARIABLE_NAME_builder->Finish(&$VARIABLE_NAME_array); + + + // 5. Construct fields and schema vector sequentially to prevent trailing comma compilation bugs + std::vector> schema_fields; + + + schema_fields.push_back(arrow::field("$VARIABLE_NAME", + + arrow::int64() + arrow::float64() + arrow::utf8() + + + arrow::list(arrow::int64()) + arrow::list(arrow::float64()) + arrow::utf8() + + )); + + + auto schema = arrow::schema(schema_fields); + + // 6. Bundle the constructed columns together into an Arrow Record Table + auto table = arrow::Table::Make(schema, { + + $VARIABLE_NAME_array, + + }); + + // 7. Establish an atomic, high-speed binary file stream and write to disk + std::shared_ptr outfile; + auto open_status = arrow::io::FileOutputStream::Open(filename, &outfile); + + if (!open_status.ok()) { + std::cerr << "Parquet file generation error: Failed to open output stream for file: " << filename + << "\nReason: " << open_status.message() << std::endl; + return; + } + + // Set default row group configurations for Parquet chunks + auto writer_properties = parquet::WriterProperties::Builder() + .compression(parquet::Compression::SNAPPY) // Use fast Snappy compression + .build(); + + auto arrow_writer_properties = parquet::ArrowWriterProperties::Builder() + .store_schema() // Store schema metadata inside the file footer + .build(); + + // Perform the high-speed binary table dump + auto write_status = parquet::arrow::WriteTable( + *table, + pool, + outfile, + 100000, // Chunk size limit per row group + writer_properties, + arrow_writer_properties + ); + + if (!write_status.ok()) { + std::cerr << "Parquet file generation error: Failed to commit Parquet binary data for iteration: " << iteration_number + << "\nReason: " << write_status.message() << std::endl; + } +} + + +// ========================================================================= +// MASTER ENTRY SAVE ROUTINE (Triggered via main.tmpl) +// ========================================================================= + +/** + * \brief Replaces the runtime text serialization layer. Iterates through + * every registered agent type and triggers its column-oriented output loop. + */ +extern "C" void saveiterationdata_parquet(int iteration_number) +{ + + save_$AGENT_NAME_parquet(iteration_number); + +} From efdbd040d272516f82bdf9a5597f14da026a69ce Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sat, 30 May 2026 16:58:43 +0200 Subject: [PATCH 02/14] More edits for Parquet file output --- Doxyfile | 0 Doxyfile.tmpl | 0 Doxyfile.txt | 0 Makefile | 0 Makefile.tmpl | 46 ++++--- README.txt | 0 Readme2.txt | 0 dependencygraph.c | 0 docs/developer_manual/Makefile | 0 docs/developer_manual/communication.tex | 0 docs/developer_manual/developer_manual.tex | 0 docs/developer_manual/execution.tex | 0 docs/developer_manual/memory.tex | 0 docs/user_manual/Makefile | 0 docs/user_manual/XMML.dtd | 0 docs/user_manual/iteration_1.dot | 0 docs/user_manual/model_description.tex | 0 docs/user_manual/model_design.tex | 0 docs/user_manual/model_execution.tex | 0 docs/user_manual/model_implementation.tex | 0 docs/user_manual/overview.tex | 0 docs/user_manual/swarm_1.dot | 0 docs/user_manual/swarm_2.dot | 0 docs/user_manual/swarm_3.dot | 0 docs/user_manual/user_manual.tex | 0 docs/user_manual/xmachine.dia | Bin docs/user_manual/xmachine.eps | 0 header.h | 0 header.tmpl | 11 +- low_primes.tmpl | 0 main.tmpl | 116 +++++++++++++----- memory.c | 0 memory.tmpl | 4 +- messageboards.tmpl | 0 parsetemplate.c | 0 partitioning.tmpl | 0 readmodel.c | 0 rules.tmpl | 0 tests/Makefile | 0 tests/run_test.c | 0 tests/test1/0.xml | 0 tests/test1/agent_a_functions.c | 0 tests/test1/agent_b_functions.c | 0 tests/test1/agents_0.xml | 0 tests/test1/environment_0.xml | 0 tests/test1/expected.out | 0 tests/test1/test_model_1.xml | 0 tests/test1/test_model_1_sub_1.xml | 0 tests/test1/test_model_1_sub_2.xml | 0 tests/test2/0-output.xml | 0 tests/test2/0.xml | 0 tests/test2/agent_a_functions.c | 0 tests/test2/test_model_2.xml | 0 tests/test3/test_truncated_empty_xml_tags.xml | 0 tests/test4/0.xml | 0 tests/test4/agent_a_functions.c | 0 tests/test4/agent_b_functions.c | 0 tests/test4/create_initial.c | 0 tests/test4/test_model_4.xml | 0 tests/test5/0.xml | 0 tests/test5/agent_a_functions.c | 0 tests/test5/test_model_5.xml | 0 tests/test6/0.xml | 0 tests/test6/agent_a_functions.c | 0 tests/test6/test_model_6.xml | 0 tests/test7/0.xml | 0 tests/test7/0_depth_0.xml | 0 tests/test7/0_depth_1.xml | 0 tests/test7/0_depth_1_agent.xml | 0 tests/test7/0_depth_1_env.xml | 0 tests/test7/1.xml.saved | 0 tests/test7/agent_a_functions.c | 0 tests/test7/test_model_7.xml | 0 tests/test8/0.xml | 0 tests/test8/agent_a_functions.c | 0 tests/test8/test_model_8.xml | 0 tests/test9/0.xml | 0 tests/test9/1.xml.saved | 0 tests/test9/agent_a_functions.c | 0 tests/test9/test_model_9.xml | 0 .../models/basic_agent_order/0.xml | 0 .../basic_agent_order/agent_functions.c | 0 .../models/basic_agent_order/model.xml | 0 .../test_output/test_output.txt | 0 .../models/message_reading/0.xml | 0 .../models/message_reading/agent_functions.c | 0 .../models/message_reading/model.xml | 0 .../test_output/test_output.txt | 0 .../models/message_reading_print/0.xml | 0 .../message_reading_print/agent_functions.c | 0 .../models/message_reading_print/model.xml | 0 .../test_output/test_output.txt | 0 tests/test_agent_order/readme.md | 0 tests/test_agent_order/run_all_tests.sh | 0 tests/test_conditions/create_tests.sh | 0 .../test_conditions/doc/tests_conditions.tex | 0 tests/test_conditions/models/templates/a.xml | 0 .../models/templates/agent_functions.c | 0 tests/test_conditions/models/templates/b.xml | 0 tests/test_conditions/models/templates/c.xml | 0 tests/test_conditions/models/templates/d.xml | 0 tests/test_conditions/models/test_1/a/0.xml | 0 .../models/test_1/a/agent_functions.c | 0 .../test_conditions/models/test_1/a/model.xml | 0 .../models/test_1/ab/model_ab.xml | 0 tests/test_conditions/models/test_1/b/0.xml | 0 .../models/test_1/b/agent_functions.c | 0 .../test_conditions/models/test_1/b/model.xml | 0 tests/test_conditions/models/test_1/c/0.xml | 0 .../models/test_1/c/agent_functions.c | 0 .../test_conditions/models/test_1/c/model.xml | 0 .../models/test_1/cd/model_cd.xml | 0 tests/test_conditions/models/test_1/d/0.xml | 0 .../models/test_1/d/agent_functions.c | 0 .../test_conditions/models/test_1/d/model.xml | 0 tests/test_conditions/models/test_10/a/0.xml | 0 .../models/test_10/a/agent_functions.c | 0 .../models/test_10/a/model.xml | 0 .../models/test_10/ab/model_ab.xml | 0 tests/test_conditions/models/test_10/b/0.xml | 0 .../models/test_10/b/agent_functions.c | 0 .../models/test_10/b/model.xml | 0 tests/test_conditions/models/test_10/c/0.xml | 0 .../models/test_10/c/agent_functions.c | 0 .../models/test_10/c/model.xml | 0 .../models/test_10/cd/model_cd.xml | 0 tests/test_conditions/models/test_10/d/0.xml | 0 .../models/test_10/d/agent_functions.c | 0 .../models/test_10/d/model.xml | 0 tests/test_conditions/models/test_11/a/0.xml | 0 .../models/test_11/a/agent_functions.c | 0 .../models/test_11/a/model.xml | 0 .../models/test_11/ab/model_ab.xml | 0 tests/test_conditions/models/test_11/b/0.xml | 0 .../models/test_11/b/agent_functions.c | 0 .../models/test_11/b/model.xml | 0 tests/test_conditions/models/test_11/c/0.xml | 0 .../models/test_11/c/agent_functions.c | 0 .../models/test_11/c/model.xml | 0 .../models/test_11/cd/model_cd.xml | 0 tests/test_conditions/models/test_11/d/0.xml | 0 .../models/test_11/d/agent_functions.c | 0 .../models/test_11/d/model.xml | 0 tests/test_conditions/models/test_12/a/0.xml | 0 .../models/test_12/a/agent_functions.c | 0 .../models/test_12/a/model.xml | 0 .../models/test_12/ab/model_ab.xml | 0 tests/test_conditions/models/test_12/b/0.xml | 0 .../models/test_12/b/agent_functions.c | 0 .../models/test_12/b/model.xml | 0 tests/test_conditions/models/test_12/c/0.xml | 0 .../models/test_12/c/agent_functions.c | 0 .../models/test_12/c/model.xml | 0 .../models/test_12/cd/model_cd.xml | 0 tests/test_conditions/models/test_12/d/0.xml | 0 .../models/test_12/d/agent_functions.c | 0 .../models/test_12/d/model.xml | 0 tests/test_conditions/models/test_13/a/0.xml | 0 .../models/test_13/a/agent_functions.c | 0 .../models/test_13/a/model.xml | 0 .../models/test_13/ab/model_ab.xml | 0 tests/test_conditions/models/test_13/b/0.xml | 0 .../models/test_13/b/agent_functions.c | 0 .../models/test_13/b/model.xml | 0 tests/test_conditions/models/test_13/c/0.xml | 0 .../models/test_13/c/agent_functions.c | 0 .../models/test_13/c/model.xml | 0 .../models/test_13/cd/model_cd.xml | 0 tests/test_conditions/models/test_13/d/0.xml | 0 .../models/test_13/d/agent_functions.c | 0 .../models/test_13/d/model.xml | 0 tests/test_conditions/models/test_14/a/0.xml | 0 .../models/test_14/a/agent_functions.c | 0 .../models/test_14/a/model.xml | 0 .../models/test_14/ab/model_ab.xml | 0 tests/test_conditions/models/test_14/b/0.xml | 0 .../models/test_14/b/agent_functions.c | 0 .../models/test_14/b/model.xml | 0 tests/test_conditions/models/test_14/c/0.xml | 0 .../models/test_14/c/agent_functions.c | 0 .../models/test_14/c/model.xml | 0 .../models/test_14/cd/model_cd.xml | 0 tests/test_conditions/models/test_14/d/0.xml | 0 .../models/test_14/d/agent_functions.c | 0 .../models/test_14/d/model.xml | 0 tests/test_conditions/models/test_15/a/0.xml | 0 .../models/test_15/a/agent_functions.c | 0 .../models/test_15/a/model.xml | 0 .../models/test_15/ab/model_ab.xml | 0 tests/test_conditions/models/test_15/b/0.xml | 0 .../models/test_15/b/agent_functions.c | 0 .../models/test_15/b/model.xml | 0 tests/test_conditions/models/test_15/c/0.xml | 0 .../models/test_15/c/agent_functions.c | 0 .../models/test_15/c/model.xml | 0 .../models/test_15/cd/model_cd.xml | 0 tests/test_conditions/models/test_15/d/0.xml | 0 .../models/test_15/d/agent_functions.c | 0 .../models/test_15/d/model.xml | 0 tests/test_conditions/models/test_16/a/0.xml | 0 .../models/test_16/a/agent_functions.c | 0 .../models/test_16/a/model.xml | 0 .../models/test_16/ab/model_ab.xml | 0 tests/test_conditions/models/test_16/b/0.xml | 0 .../models/test_16/b/agent_functions.c | 0 .../models/test_16/b/model.xml | 0 tests/test_conditions/models/test_16/c/0.xml | 0 .../models/test_16/c/agent_functions.c | 0 .../models/test_16/c/model.xml | 0 .../models/test_16/cd/model_cd.xml | 0 tests/test_conditions/models/test_16/d/0.xml | 0 .../models/test_16/d/agent_functions.c | 0 .../models/test_16/d/model.xml | 0 tests/test_conditions/models/test_2/a/0.xml | 0 .../models/test_2/a/agent_functions.c | 0 .../test_conditions/models/test_2/a/model.xml | 0 .../models/test_2/ab/model_ab.xml | 0 tests/test_conditions/models/test_2/b/0.xml | 0 .../models/test_2/b/agent_functions.c | 0 .../test_conditions/models/test_2/b/model.xml | 0 tests/test_conditions/models/test_2/c/0.xml | 0 .../models/test_2/c/agent_functions.c | 0 .../test_conditions/models/test_2/c/model.xml | 0 .../models/test_2/cd/model_cd.xml | 0 tests/test_conditions/models/test_2/d/0.xml | 0 .../models/test_2/d/agent_functions.c | 0 .../test_conditions/models/test_2/d/model.xml | 0 tests/test_conditions/models/test_3/a/0.xml | 0 .../models/test_3/a/agent_functions.c | 0 .../test_conditions/models/test_3/a/model.xml | 0 .../models/test_3/ab/model_ab.xml | 0 tests/test_conditions/models/test_3/b/0.xml | 0 .../models/test_3/b/agent_functions.c | 0 .../test_conditions/models/test_3/b/model.xml | 0 tests/test_conditions/models/test_3/c/0.xml | 0 .../models/test_3/c/agent_functions.c | 0 .../test_conditions/models/test_3/c/model.xml | 0 .../models/test_3/cd/model_cd.xml | 0 tests/test_conditions/models/test_3/d/0.xml | 0 .../models/test_3/d/agent_functions.c | 0 .../test_conditions/models/test_3/d/model.xml | 0 tests/test_conditions/models/test_4/a/0.xml | 0 .../models/test_4/a/agent_functions.c | 0 .../test_conditions/models/test_4/a/model.xml | 0 .../models/test_4/ab/model_ab.xml | 0 tests/test_conditions/models/test_4/b/0.xml | 0 .../models/test_4/b/agent_functions.c | 0 .../test_conditions/models/test_4/b/model.xml | 0 tests/test_conditions/models/test_4/c/0.xml | 0 .../models/test_4/c/agent_functions.c | 0 .../test_conditions/models/test_4/c/model.xml | 0 .../models/test_4/cd/model_cd.xml | 0 tests/test_conditions/models/test_4/d/0.xml | 0 .../models/test_4/d/agent_functions.c | 0 .../test_conditions/models/test_4/d/model.xml | 0 tests/test_conditions/models/test_5/a/0.xml | 0 .../models/test_5/a/agent_functions.c | 0 .../test_conditions/models/test_5/a/model.xml | 0 .../models/test_5/ab/model_ab.xml | 0 tests/test_conditions/models/test_5/b/0.xml | 0 .../models/test_5/b/agent_functions.c | 0 .../test_conditions/models/test_5/b/model.xml | 0 tests/test_conditions/models/test_5/c/0.xml | 0 .../models/test_5/c/agent_functions.c | 0 .../test_conditions/models/test_5/c/model.xml | 0 .../models/test_5/cd/model_cd.xml | 0 tests/test_conditions/models/test_5/d/0.xml | 0 .../models/test_5/d/agent_functions.c | 0 .../test_conditions/models/test_5/d/model.xml | 0 tests/test_conditions/models/test_6/a/0.xml | 0 .../models/test_6/a/agent_functions.c | 0 .../test_conditions/models/test_6/a/model.xml | 0 .../models/test_6/ab/model_ab.xml | 0 tests/test_conditions/models/test_6/b/0.xml | 0 .../models/test_6/b/agent_functions.c | 0 .../test_conditions/models/test_6/b/model.xml | 0 tests/test_conditions/models/test_6/c/0.xml | 0 .../models/test_6/c/agent_functions.c | 0 .../test_conditions/models/test_6/c/model.xml | 0 .../models/test_6/cd/model_cd.xml | 0 tests/test_conditions/models/test_6/d/0.xml | 0 .../models/test_6/d/agent_functions.c | 0 .../test_conditions/models/test_6/d/model.xml | 0 tests/test_conditions/models/test_7/a/0.xml | 0 .../models/test_7/a/agent_functions.c | 0 .../test_conditions/models/test_7/a/model.xml | 0 .../models/test_7/ab/model_ab.xml | 0 tests/test_conditions/models/test_7/b/0.xml | 0 .../models/test_7/b/agent_functions.c | 0 .../test_conditions/models/test_7/b/model.xml | 0 tests/test_conditions/models/test_7/c/0.xml | 0 .../models/test_7/c/agent_functions.c | 0 .../test_conditions/models/test_7/c/model.xml | 0 .../models/test_7/cd/model_cd.xml | 0 tests/test_conditions/models/test_7/d/0.xml | 0 .../models/test_7/d/agent_functions.c | 0 .../test_conditions/models/test_7/d/model.xml | 0 tests/test_conditions/models/test_8/a/0.xml | 0 .../models/test_8/a/agent_functions.c | 0 .../test_conditions/models/test_8/a/model.xml | 0 .../models/test_8/ab/model_ab.xml | 0 tests/test_conditions/models/test_8/b/0.xml | 0 .../models/test_8/b/agent_functions.c | 0 .../test_conditions/models/test_8/b/model.xml | 0 tests/test_conditions/models/test_8/c/0.xml | 0 .../models/test_8/c/agent_functions.c | 0 .../test_conditions/models/test_8/c/model.xml | 0 .../models/test_8/cd/model_cd.xml | 0 tests/test_conditions/models/test_8/d/0.xml | 0 .../models/test_8/d/agent_functions.c | 0 .../test_conditions/models/test_8/d/model.xml | 0 tests/test_conditions/models/test_9/a/0.xml | 0 .../models/test_9/a/agent_functions.c | 0 .../test_conditions/models/test_9/a/model.xml | 0 .../models/test_9/ab/model_ab.xml | 0 tests/test_conditions/models/test_9/b/0.xml | 0 .../models/test_9/b/agent_functions.c | 0 .../test_conditions/models/test_9/b/model.xml | 0 tests/test_conditions/models/test_9/c/0.xml | 0 .../models/test_9/c/agent_functions.c | 0 .../test_conditions/models/test_9/c/model.xml | 0 .../models/test_9/cd/model_cd.xml | 0 tests/test_conditions/models/test_9/d/0.xml | 0 .../models/test_9/d/agent_functions.c | 0 .../test_conditions/models/test_9/d/model.xml | 0 tests/test_conditions/output/flame_output.txt | 0 tests/test_conditions/output/test_output.txt | 0 tests/test_conditions/readme.md | 0 tests/test_conditions/run_all_tests.sh | 0 .../models/filtering/0.xml | 0 .../models/filtering/agent_functions.c | 0 .../models/filtering/model.xml | 0 .../filtering/test_output/test_output.txt | 0 .../models/filtering_and_random/0.xml | 0 .../filtering_and_random/agent_functions.c | 0 .../models/filtering_and_random/model.xml | 0 .../test_output/test_output.txt | 0 .../models/randomizing/0.xml | 0 .../models/randomizing/agent_functions.c | 0 .../models/randomizing/model.xml | 0 .../randomizing/test_output/test_output.txt | 0 .../test_mesg_operations/models/sorting/0.xml | 0 .../models/sorting/agent_functions.c | 0 .../models/sorting/model.xml | 0 .../sorting/test_output/test_output.txt | 0 tests/test_mesg_operations/readme.md | 0 tests/test_mesg_operations/run_all_tests.sh | 0 tests/test_mesg_operations/stderr.txt | 0 tests/test_mesg_operations/stdout.txt | 0 tests/test_mesgs/model0/model.xml | 0 tests/test_mesgs/model1a/model.xml | 0 tests/test_mesgs/model1b/model.xml | 0 tests/test_mesgs/model2/model.xml | 0 tests/test_mesgs/model3/model.xml | 0 tests/test_mesgs/model4/model.xml | 0 tests/test_mesgs/readme.md | 0 timing.tmpl | 0 xmml.xsd | 0 xparser.c | 9 ++ 359 files changed, 138 insertions(+), 48 deletions(-) mode change 100644 => 100755 Doxyfile mode change 100644 => 100755 Doxyfile.tmpl mode change 100644 => 100755 Doxyfile.txt mode change 100644 => 100755 Makefile mode change 100644 => 100755 Makefile.tmpl mode change 100644 => 100755 README.txt mode change 100644 => 100755 Readme2.txt mode change 100644 => 100755 dependencygraph.c mode change 100644 => 100755 docs/developer_manual/Makefile mode change 100644 => 100755 docs/developer_manual/communication.tex mode change 100644 => 100755 docs/developer_manual/developer_manual.tex mode change 100644 => 100755 docs/developer_manual/execution.tex mode change 100644 => 100755 docs/developer_manual/memory.tex mode change 100644 => 100755 docs/user_manual/Makefile mode change 100644 => 100755 docs/user_manual/XMML.dtd mode change 100644 => 100755 docs/user_manual/iteration_1.dot mode change 100644 => 100755 docs/user_manual/model_description.tex mode change 100644 => 100755 docs/user_manual/model_design.tex mode change 100644 => 100755 docs/user_manual/model_execution.tex mode change 100644 => 100755 docs/user_manual/model_implementation.tex mode change 100644 => 100755 docs/user_manual/overview.tex mode change 100644 => 100755 docs/user_manual/swarm_1.dot mode change 100644 => 100755 docs/user_manual/swarm_2.dot mode change 100644 => 100755 docs/user_manual/swarm_3.dot mode change 100644 => 100755 docs/user_manual/user_manual.tex mode change 100644 => 100755 docs/user_manual/xmachine.dia mode change 100644 => 100755 docs/user_manual/xmachine.eps mode change 100644 => 100755 header.h mode change 100644 => 100755 header.tmpl mode change 100644 => 100755 low_primes.tmpl mode change 100644 => 100755 main.tmpl mode change 100644 => 100755 memory.c mode change 100644 => 100755 memory.tmpl mode change 100644 => 100755 messageboards.tmpl mode change 100644 => 100755 parsetemplate.c mode change 100644 => 100755 partitioning.tmpl mode change 100644 => 100755 readmodel.c mode change 100644 => 100755 rules.tmpl mode change 100644 => 100755 tests/Makefile mode change 100644 => 100755 tests/run_test.c mode change 100644 => 100755 tests/test1/0.xml mode change 100644 => 100755 tests/test1/agent_a_functions.c mode change 100644 => 100755 tests/test1/agent_b_functions.c mode change 100644 => 100755 tests/test1/agents_0.xml mode change 100644 => 100755 tests/test1/environment_0.xml mode change 100644 => 100755 tests/test1/expected.out mode change 100644 => 100755 tests/test1/test_model_1.xml mode change 100644 => 100755 tests/test1/test_model_1_sub_1.xml mode change 100644 => 100755 tests/test1/test_model_1_sub_2.xml mode change 100644 => 100755 tests/test2/0-output.xml mode change 100644 => 100755 tests/test2/0.xml mode change 100644 => 100755 tests/test2/agent_a_functions.c mode change 100644 => 100755 tests/test2/test_model_2.xml mode change 100644 => 100755 tests/test3/test_truncated_empty_xml_tags.xml mode change 100644 => 100755 tests/test4/0.xml mode change 100644 => 100755 tests/test4/agent_a_functions.c mode change 100644 => 100755 tests/test4/agent_b_functions.c mode change 100644 => 100755 tests/test4/create_initial.c mode change 100644 => 100755 tests/test4/test_model_4.xml mode change 100644 => 100755 tests/test5/0.xml mode change 100644 => 100755 tests/test5/agent_a_functions.c mode change 100644 => 100755 tests/test5/test_model_5.xml mode change 100644 => 100755 tests/test6/0.xml mode change 100644 => 100755 tests/test6/agent_a_functions.c mode change 100644 => 100755 tests/test6/test_model_6.xml mode change 100644 => 100755 tests/test7/0.xml mode change 100644 => 100755 tests/test7/0_depth_0.xml mode change 100644 => 100755 tests/test7/0_depth_1.xml mode change 100644 => 100755 tests/test7/0_depth_1_agent.xml mode change 100644 => 100755 tests/test7/0_depth_1_env.xml mode change 100644 => 100755 tests/test7/1.xml.saved mode change 100644 => 100755 tests/test7/agent_a_functions.c mode change 100644 => 100755 tests/test7/test_model_7.xml mode change 100644 => 100755 tests/test8/0.xml mode change 100644 => 100755 tests/test8/agent_a_functions.c mode change 100644 => 100755 tests/test8/test_model_8.xml mode change 100644 => 100755 tests/test9/0.xml mode change 100644 => 100755 tests/test9/1.xml.saved mode change 100644 => 100755 tests/test9/agent_a_functions.c mode change 100644 => 100755 tests/test9/test_model_9.xml mode change 100644 => 100755 tests/test_agent_order/models/basic_agent_order/0.xml mode change 100644 => 100755 tests/test_agent_order/models/basic_agent_order/agent_functions.c mode change 100644 => 100755 tests/test_agent_order/models/basic_agent_order/model.xml mode change 100644 => 100755 tests/test_agent_order/models/basic_agent_order/test_output/test_output.txt mode change 100644 => 100755 tests/test_agent_order/models/message_reading/0.xml mode change 100644 => 100755 tests/test_agent_order/models/message_reading/agent_functions.c mode change 100644 => 100755 tests/test_agent_order/models/message_reading/model.xml mode change 100644 => 100755 tests/test_agent_order/models/message_reading/test_output/test_output.txt mode change 100644 => 100755 tests/test_agent_order/models/message_reading_print/0.xml mode change 100644 => 100755 tests/test_agent_order/models/message_reading_print/agent_functions.c mode change 100644 => 100755 tests/test_agent_order/models/message_reading_print/model.xml mode change 100644 => 100755 tests/test_agent_order/models/message_reading_print/test_output/test_output.txt mode change 100644 => 100755 tests/test_agent_order/readme.md mode change 100644 => 100755 tests/test_agent_order/run_all_tests.sh mode change 100644 => 100755 tests/test_conditions/create_tests.sh mode change 100644 => 100755 tests/test_conditions/doc/tests_conditions.tex mode change 100644 => 100755 tests/test_conditions/models/templates/a.xml mode change 100644 => 100755 tests/test_conditions/models/templates/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/templates/b.xml mode change 100644 => 100755 tests/test_conditions/models/templates/c.xml mode change 100644 => 100755 tests/test_conditions/models/templates/d.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_1/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_1/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_1/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_1/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_1/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_10/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_10/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_10/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_10/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_10/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_11/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_11/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_11/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_11/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_11/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_12/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_12/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_12/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_12/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_12/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_13/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_13/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_13/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_13/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_13/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_14/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_14/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_14/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_14/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_14/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_15/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_15/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_15/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_15/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_15/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_16/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_16/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_16/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_16/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_16/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_2/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_2/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_2/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_2/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_2/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_3/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_3/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_3/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_3/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_3/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_4/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_4/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_4/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_4/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_4/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_5/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_5/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_5/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_5/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_5/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_6/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_6/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_6/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_6/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_6/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_7/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_7/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_7/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_7/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_7/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_8/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_8/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_8/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_8/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_8/d/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/a/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/a/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_9/a/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/ab/model_ab.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/b/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/b/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_9/b/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/c/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/c/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_9/c/model.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/cd/model_cd.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/d/0.xml mode change 100644 => 100755 tests/test_conditions/models/test_9/d/agent_functions.c mode change 100644 => 100755 tests/test_conditions/models/test_9/d/model.xml mode change 100644 => 100755 tests/test_conditions/output/flame_output.txt mode change 100644 => 100755 tests/test_conditions/output/test_output.txt mode change 100644 => 100755 tests/test_conditions/readme.md mode change 100644 => 100755 tests/test_conditions/run_all_tests.sh mode change 100644 => 100755 tests/test_mesg_operations/models/filtering/0.xml mode change 100644 => 100755 tests/test_mesg_operations/models/filtering/agent_functions.c mode change 100644 => 100755 tests/test_mesg_operations/models/filtering/model.xml mode change 100644 => 100755 tests/test_mesg_operations/models/filtering/test_output/test_output.txt mode change 100644 => 100755 tests/test_mesg_operations/models/filtering_and_random/0.xml mode change 100644 => 100755 tests/test_mesg_operations/models/filtering_and_random/agent_functions.c mode change 100644 => 100755 tests/test_mesg_operations/models/filtering_and_random/model.xml mode change 100644 => 100755 tests/test_mesg_operations/models/filtering_and_random/test_output/test_output.txt mode change 100644 => 100755 tests/test_mesg_operations/models/randomizing/0.xml mode change 100644 => 100755 tests/test_mesg_operations/models/randomizing/agent_functions.c mode change 100644 => 100755 tests/test_mesg_operations/models/randomizing/model.xml mode change 100644 => 100755 tests/test_mesg_operations/models/randomizing/test_output/test_output.txt mode change 100644 => 100755 tests/test_mesg_operations/models/sorting/0.xml mode change 100644 => 100755 tests/test_mesg_operations/models/sorting/agent_functions.c mode change 100644 => 100755 tests/test_mesg_operations/models/sorting/model.xml mode change 100644 => 100755 tests/test_mesg_operations/models/sorting/test_output/test_output.txt mode change 100644 => 100755 tests/test_mesg_operations/readme.md mode change 100644 => 100755 tests/test_mesg_operations/run_all_tests.sh mode change 100644 => 100755 tests/test_mesg_operations/stderr.txt mode change 100644 => 100755 tests/test_mesg_operations/stdout.txt mode change 100644 => 100755 tests/test_mesgs/model0/model.xml mode change 100644 => 100755 tests/test_mesgs/model1a/model.xml mode change 100644 => 100755 tests/test_mesgs/model1b/model.xml mode change 100644 => 100755 tests/test_mesgs/model2/model.xml mode change 100644 => 100755 tests/test_mesgs/model3/model.xml mode change 100644 => 100755 tests/test_mesgs/model4/model.xml mode change 100644 => 100755 tests/test_mesgs/readme.md mode change 100644 => 100755 timing.tmpl mode change 100644 => 100755 xmml.xsd mode change 100644 => 100755 xparser.c diff --git a/Doxyfile b/Doxyfile old mode 100644 new mode 100755 diff --git a/Doxyfile.tmpl b/Doxyfile.tmpl old mode 100644 new mode 100755 diff --git a/Doxyfile.txt b/Doxyfile.txt old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/Makefile.tmpl b/Makefile.tmpl old mode 100644 new mode 100755 index acef5b4..2574b72 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -15,37 +15,42 @@ LIBMBOARD_INC = $(LIBMBOARD_DIR)/include LIBMBOARD_LIB = $(LIBMBOARD_DIR)/lib #==================================================== -# Change these for your compliler/loaded +# Change these for your compiler/loader #==================================================== SERIAL_CCOMP = gcc PARALLEL_CCOMP = mpicc -SERIAL_LOADER = gcc -PARALLEL_LOADER = mpif77 +# We explicitly use g++ for linking when using Parquet +SERIAL_LOADER = g++ +PARALLEL_LOADER = mpicxx DEFINES = DEFINES += -DGSL_LIB -#DEFINES += -DSTART_END -#DEFINES += -DGRAPHICS -# C Compiler +# Compilers CC = $(SERIAL_CCOMP)$(PARALLEL_CCOMP) -CFLAGS = -I$(LIBMBOARD_INC) ${DEFINES} -CFLAGS += -std=c99 -Wall -D_DEBUG_MODE -g +CXX = g++ +CFLAGS = -I$(LIBMBOARD_INC) ${DEFINES} + +# Ensure C++17 properties are cleanly targeted across build optimization sets +CFLAGS += -Wall -D_DEBUG_MODE -g CFLAGS += -O3 -LD = $(SERIAL_LOADER)$(PARALLEL_LOADER) +# CXX Specific flags for our Parquet file +CXXFLAGS = -std=c++17 -O3 -I$(LIBMBOARD_INC) ${DEFINES} + +LD = $(SERIAL_LOADER)$(PARALLEL_LOADER) LDFLAGS = -L$(LIBMBOARD_LIB) LIBS += -lgsl -lgslcblas -LIBS += -lmboard_sd -lmboard_pd -lm +LIBS += -lmboard_sd -lmboard_pd -lm -larrow -lparquet -#FLAME source files -FLAME = main.c memory.c xml.c messageboards.c partitioning.c rules.c timing.c +# FLAME source files (Includes both legacy XML and our new Parquet engine) +FLAME = main.c memory.c xml.c parquet.cpp messageboards.c partitioning.c rules.c timing.c -#FLAME auxilary files +# FLAME auxiliary files AUX = stategraph.dot stategraph_colour.dot process_order_graph.dot Doxyfile latex.tex # FLAME generated model files @@ -54,7 +59,8 @@ HEADERS = header.h low_primes.h mboard.h $name_agent_header.h DEPS = Makefile header.h low_primes.h -OBJECTS = $(SOURCES:.c=.o) $(FLAME:.c=.o) +# Correctly maps source strings to object configurations dynamically +OBJECTS = $(patsubst %.c,%.o,$(filter %.c,$(SOURCES) $(FLAME))) $(patsubst %.cpp,%.o,$(filter %.cpp,$(FLAME))) EXECUTABLE = main RM = rm -f @@ -65,9 +71,14 @@ $(EXECUTABLE): $(OBJECTS) $(OBJECTS): $(DEPS) -.c.o: +# Standard rule pattern for building pure C simulation models +%.o: %.c $(CC) -c $(CFLAGS) $< -o $@ +# Standard rule pattern for building our C++ Parquet engine module +%.o: %.cpp + $(CXX) -c $(CXXFLAGS) $< -o $@ + clean: $(RM) $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE).exe vclean: @@ -75,8 +86,9 @@ vclean: format: astyle -A3 $(SOURCES) for file in $(patsubst %.c,%.h, $(SOURCES)) ; do \ - echo $$file ; \ - astyle -A3 $$file ; \ + echo $$file ; \ + astyle -A3 $$file ; \ done print: a2ps -R -f10 --column=1 $(SOURCES) + \ No newline at end of file diff --git a/README.txt b/README.txt old mode 100644 new mode 100755 diff --git a/Readme2.txt b/Readme2.txt old mode 100644 new mode 100755 diff --git a/dependencygraph.c b/dependencygraph.c old mode 100644 new mode 100755 diff --git a/docs/developer_manual/Makefile b/docs/developer_manual/Makefile old mode 100644 new mode 100755 diff --git a/docs/developer_manual/communication.tex b/docs/developer_manual/communication.tex old mode 100644 new mode 100755 diff --git a/docs/developer_manual/developer_manual.tex b/docs/developer_manual/developer_manual.tex old mode 100644 new mode 100755 diff --git a/docs/developer_manual/execution.tex b/docs/developer_manual/execution.tex old mode 100644 new mode 100755 diff --git a/docs/developer_manual/memory.tex b/docs/developer_manual/memory.tex old mode 100644 new mode 100755 diff --git a/docs/user_manual/Makefile b/docs/user_manual/Makefile old mode 100644 new mode 100755 diff --git a/docs/user_manual/XMML.dtd b/docs/user_manual/XMML.dtd old mode 100644 new mode 100755 diff --git a/docs/user_manual/iteration_1.dot b/docs/user_manual/iteration_1.dot old mode 100644 new mode 100755 diff --git a/docs/user_manual/model_description.tex b/docs/user_manual/model_description.tex old mode 100644 new mode 100755 diff --git a/docs/user_manual/model_design.tex b/docs/user_manual/model_design.tex old mode 100644 new mode 100755 diff --git a/docs/user_manual/model_execution.tex b/docs/user_manual/model_execution.tex old mode 100644 new mode 100755 diff --git a/docs/user_manual/model_implementation.tex b/docs/user_manual/model_implementation.tex old mode 100644 new mode 100755 diff --git a/docs/user_manual/overview.tex b/docs/user_manual/overview.tex old mode 100644 new mode 100755 diff --git a/docs/user_manual/swarm_1.dot b/docs/user_manual/swarm_1.dot old mode 100644 new mode 100755 diff --git a/docs/user_manual/swarm_2.dot b/docs/user_manual/swarm_2.dot old mode 100644 new mode 100755 diff --git a/docs/user_manual/swarm_3.dot b/docs/user_manual/swarm_3.dot old mode 100644 new mode 100755 diff --git a/docs/user_manual/user_manual.tex b/docs/user_manual/user_manual.tex old mode 100644 new mode 100755 diff --git a/docs/user_manual/xmachine.dia b/docs/user_manual/xmachine.dia old mode 100644 new mode 100755 diff --git a/docs/user_manual/xmachine.eps b/docs/user_manual/xmachine.eps old mode 100644 new mode 100755 diff --git a/header.h b/header.h old mode 100644 new mode 100755 diff --git a/header.tmpl b/header.tmpl old mode 100644 new mode 100755 index a571f50..4ca0c64 --- a/header.tmpl +++ b/header.tmpl @@ -529,7 +529,16 @@ void readprepartitionedinitialstates(char * filename, char * filelocation, int * void readinitialstates(char * filename, char * filelocation, int * itno, double cloud_data[], int partition_method, int flag); -void saveiterationdata(int iteration_number); +#ifdef __cplusplus +extern "C" { +#endif + +void saveiterationdata_xml(int iteration_number); +void saveiterationdata_parquet(int iteration_number); + +#ifdef __cplusplus +} +#endif void free_$name($name * temp); void free_$name_static_array($name * array, int size); diff --git a/low_primes.tmpl b/low_primes.tmpl old mode 100644 new mode 100755 diff --git a/main.tmpl b/main.tmpl old mode 100644 new mode 100755 index 430d314..6bb32ce --- a/main.tmpl +++ b/main.tmpl @@ -5,6 +5,9 @@ #include "header.h" #include +#define FLAME_TIMER_LAYERS 0 +#define FLAME_TIMER_IO 0 + #ifdef GSL_LIB #include @@ -18,6 +21,9 @@ unsigned long int gsl_seed; #define COMPACT_PRINTOUT_P_THRESHOLD 8 +/* Set inputpath as global variable */ +char inputpath[1000]; + /** \fn int main(int argc, char * argv[]) * \brief Main program loop. * \param argc Argument count. @@ -26,11 +32,10 @@ unsigned long int gsl_seed; int main(int argc, char * argv[]) { /* Timing variables */ - double start, stop, interval; + double start, stop, interval, layer_interval, io_interval; FILE *file; char data[100]; char logfilepath[1000]; - char inputpath[1000]; char * c; int lastd = 0; int i; @@ -509,8 +514,13 @@ if(argc < 2) /* Start iteration function */ start_iteration(); #endif - interval = get_time(); - + interval = get_time(); /* Start timer for iteration */ + + if(FLAME_TIMER_LAYERS) + { + layer_interval = get_time(); /* Start timer for layer 1 */ + } + /* Print out iteration number */ if (totalnodes <= COMPACT_PRINTOUT_P_THRESHOLD) @@ -619,7 +629,8 @@ if(argc < 2) } - /* DEBUG: States with branching functions */ + + /* DEBUG: States with branching functions */ current_xmachine_$agent_name_holder = $agent_name_$name_state->agents; while(current_xmachine_$agent_name_holder) { @@ -870,8 +881,28 @@ if(argc < 2) -/* End of layer number $number */ +if(FLAME_TIMER_LAYERS) +{ + /* Save layer time to log file (log.xml)*/if(node_number == 0) + { + if((file = fopen(logfilepath, "a"))==NULL) + { + printf("Error: cannot open file '%s' for writing\n", logfilepath); + exit(0); + } + (void)fputs(" ", file); + sprintf(data, "%i", $number); + (void)fputs(data, file); + (void)fputs("\n", file); + (void)fclose(file); + }/* End of layer number $number */ + layer_interval = get_time(); /* Start timer for next layer */ +} +/* Start of next layer */ /* Clear message boards that have finished being used * and sync complete if doing late sync complete */ @@ -940,7 +971,11 @@ if(FLAME_$name_message_board_read == 0) if(iteration_loop%output_frequency == output_offset) { - saveiterationdata(iteration_loop); + //XML output + //saveiterationdata_xml(iteration_loop); + + //Parquet output + saveiterationdata_parquet(iteration_loop); } /*printf("$agent_name_$name_state->count = %d\n", $agent_name_$name_state->count);*/ @@ -959,30 +994,55 @@ if(FLAME_$name_message_board_read == 0) if(iteration_loop%output_frequency == output_offset) { - saveiterationdata(iteration_loop); + if(FLAME_TIMER_IO) + { + /* Start timer for disk I/O */ + io_interval = get_time(); + } + + //XML output + //saveiterationdata_xml(iteration_loop); + + //Parquet output + saveiterationdata_parquet(iteration_loop); + + if(FLAME_TIMER_IO) + { + /* Save I/O time to log file */ if(node_number == 0) + { + if((file = fopen(logfilepath, "a"))==NULL) + { + printf("Error: cannot open file '%s' for writing\n", logfilepath); + exit(0); + } + (void)fputs("", file); + (void)fputs("\n", file); + (void)fclose(file); } + } } /* End of iteration code */ $code - /* Calculate if any agents need to jump S.P. */ - /* propagate_agents(); */ - /* Save iteration time to log file */ - if(node_number == 0) - { - if((file = fopen(logfilepath, "a"))==NULL) - { - printf("Error: cannot open file '%s' for writing\n", logfilepath); - exit(0); - } - (void)fputs("", file); - sprintf(data, "%i", iteration_loop); - (void)fputs(data, file); - (void)fputs("\n", file); - (void)fclose(file); - } + /* Calculate if any agents need to jump S.P. */ + /* propagate_agents(); */ + + /* Save iteration time to log file */if(node_number == 0) { + if((file = fopen(logfilepath, "a"))==NULL) + { + printf("Error: cannot open file '%s' for writing\n", logfilepath); + exit(0); + } + (void)fputs("", file); + sprintf(data, "%i", iteration_loop); + (void)fputs(data, file); + (void)fputs("\n", file); + (void)fclose(file); } #ifdef START_END /* End iteration function */ @@ -991,7 +1051,7 @@ if(FLAME_$name_message_board_read == 0) } #ifdef START_END -/* End simualtion function */ +/* End simulation function */ end_simulation(); #endif diff --git a/memory.c b/memory.c old mode 100644 new mode 100755 diff --git a/memory.tmpl b/memory.tmpl old mode 100644 new mode 100755 index 254417b..2c221e3 --- a/memory.tmpl +++ b/memory.tmpl @@ -461,8 +461,8 @@ void set_$name($type * * if(current_xmachine->xmachine_$name) { - //assert($allvar_name < FLAME_DOUBLE_MAX); - //assert($allvar_name > FLAME_DOUBLE_MIN); + assert($allvar_name < FLAME_DOUBLE_MAX); + assert($allvar_name > FLAME_DOUBLE_MIN); (*current_xmachine->xmachine_$name).$allvar_name = $allvar_name; } } diff --git a/messageboards.tmpl b/messageboards.tmpl old mode 100644 new mode 100755 diff --git a/parsetemplate.c b/parsetemplate.c old mode 100644 new mode 100755 diff --git a/partitioning.tmpl b/partitioning.tmpl old mode 100644 new mode 100755 diff --git a/readmodel.c b/readmodel.c old mode 100644 new mode 100755 diff --git a/rules.tmpl b/rules.tmpl old mode 100644 new mode 100755 diff --git a/tests/Makefile b/tests/Makefile old mode 100644 new mode 100755 diff --git a/tests/run_test.c b/tests/run_test.c old mode 100644 new mode 100755 diff --git a/tests/test1/0.xml b/tests/test1/0.xml old mode 100644 new mode 100755 diff --git a/tests/test1/agent_a_functions.c b/tests/test1/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test1/agent_b_functions.c b/tests/test1/agent_b_functions.c old mode 100644 new mode 100755 diff --git a/tests/test1/agents_0.xml b/tests/test1/agents_0.xml old mode 100644 new mode 100755 diff --git a/tests/test1/environment_0.xml b/tests/test1/environment_0.xml old mode 100644 new mode 100755 diff --git a/tests/test1/expected.out b/tests/test1/expected.out old mode 100644 new mode 100755 diff --git a/tests/test1/test_model_1.xml b/tests/test1/test_model_1.xml old mode 100644 new mode 100755 diff --git a/tests/test1/test_model_1_sub_1.xml b/tests/test1/test_model_1_sub_1.xml old mode 100644 new mode 100755 diff --git a/tests/test1/test_model_1_sub_2.xml b/tests/test1/test_model_1_sub_2.xml old mode 100644 new mode 100755 diff --git a/tests/test2/0-output.xml b/tests/test2/0-output.xml old mode 100644 new mode 100755 diff --git a/tests/test2/0.xml b/tests/test2/0.xml old mode 100644 new mode 100755 diff --git a/tests/test2/agent_a_functions.c b/tests/test2/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test2/test_model_2.xml b/tests/test2/test_model_2.xml old mode 100644 new mode 100755 diff --git a/tests/test3/test_truncated_empty_xml_tags.xml b/tests/test3/test_truncated_empty_xml_tags.xml old mode 100644 new mode 100755 diff --git a/tests/test4/0.xml b/tests/test4/0.xml old mode 100644 new mode 100755 diff --git a/tests/test4/agent_a_functions.c b/tests/test4/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test4/agent_b_functions.c b/tests/test4/agent_b_functions.c old mode 100644 new mode 100755 diff --git a/tests/test4/create_initial.c b/tests/test4/create_initial.c old mode 100644 new mode 100755 diff --git a/tests/test4/test_model_4.xml b/tests/test4/test_model_4.xml old mode 100644 new mode 100755 diff --git a/tests/test5/0.xml b/tests/test5/0.xml old mode 100644 new mode 100755 diff --git a/tests/test5/agent_a_functions.c b/tests/test5/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test5/test_model_5.xml b/tests/test5/test_model_5.xml old mode 100644 new mode 100755 diff --git a/tests/test6/0.xml b/tests/test6/0.xml old mode 100644 new mode 100755 diff --git a/tests/test6/agent_a_functions.c b/tests/test6/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test6/test_model_6.xml b/tests/test6/test_model_6.xml old mode 100644 new mode 100755 diff --git a/tests/test7/0.xml b/tests/test7/0.xml old mode 100644 new mode 100755 diff --git a/tests/test7/0_depth_0.xml b/tests/test7/0_depth_0.xml old mode 100644 new mode 100755 diff --git a/tests/test7/0_depth_1.xml b/tests/test7/0_depth_1.xml old mode 100644 new mode 100755 diff --git a/tests/test7/0_depth_1_agent.xml b/tests/test7/0_depth_1_agent.xml old mode 100644 new mode 100755 diff --git a/tests/test7/0_depth_1_env.xml b/tests/test7/0_depth_1_env.xml old mode 100644 new mode 100755 diff --git a/tests/test7/1.xml.saved b/tests/test7/1.xml.saved old mode 100644 new mode 100755 diff --git a/tests/test7/agent_a_functions.c b/tests/test7/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test7/test_model_7.xml b/tests/test7/test_model_7.xml old mode 100644 new mode 100755 diff --git a/tests/test8/0.xml b/tests/test8/0.xml old mode 100644 new mode 100755 diff --git a/tests/test8/agent_a_functions.c b/tests/test8/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test8/test_model_8.xml b/tests/test8/test_model_8.xml old mode 100644 new mode 100755 diff --git a/tests/test9/0.xml b/tests/test9/0.xml old mode 100644 new mode 100755 diff --git a/tests/test9/1.xml.saved b/tests/test9/1.xml.saved old mode 100644 new mode 100755 diff --git a/tests/test9/agent_a_functions.c b/tests/test9/agent_a_functions.c old mode 100644 new mode 100755 diff --git a/tests/test9/test_model_9.xml b/tests/test9/test_model_9.xml old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/basic_agent_order/0.xml b/tests/test_agent_order/models/basic_agent_order/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/basic_agent_order/agent_functions.c b/tests/test_agent_order/models/basic_agent_order/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/basic_agent_order/model.xml b/tests/test_agent_order/models/basic_agent_order/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/basic_agent_order/test_output/test_output.txt b/tests/test_agent_order/models/basic_agent_order/test_output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading/0.xml b/tests/test_agent_order/models/message_reading/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading/agent_functions.c b/tests/test_agent_order/models/message_reading/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading/model.xml b/tests/test_agent_order/models/message_reading/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading/test_output/test_output.txt b/tests/test_agent_order/models/message_reading/test_output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading_print/0.xml b/tests/test_agent_order/models/message_reading_print/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading_print/agent_functions.c b/tests/test_agent_order/models/message_reading_print/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading_print/model.xml b/tests/test_agent_order/models/message_reading_print/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/models/message_reading_print/test_output/test_output.txt b/tests/test_agent_order/models/message_reading_print/test_output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/readme.md b/tests/test_agent_order/readme.md old mode 100644 new mode 100755 diff --git a/tests/test_agent_order/run_all_tests.sh b/tests/test_agent_order/run_all_tests.sh old mode 100644 new mode 100755 diff --git a/tests/test_conditions/create_tests.sh b/tests/test_conditions/create_tests.sh old mode 100644 new mode 100755 diff --git a/tests/test_conditions/doc/tests_conditions.tex b/tests/test_conditions/doc/tests_conditions.tex old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/templates/a.xml b/tests/test_conditions/models/templates/a.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/templates/agent_functions.c b/tests/test_conditions/models/templates/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/templates/b.xml b/tests/test_conditions/models/templates/b.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/templates/c.xml b/tests/test_conditions/models/templates/c.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/templates/d.xml b/tests/test_conditions/models/templates/d.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/a/0.xml b/tests/test_conditions/models/test_1/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/a/agent_functions.c b/tests/test_conditions/models/test_1/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/a/model.xml b/tests/test_conditions/models/test_1/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/ab/model_ab.xml b/tests/test_conditions/models/test_1/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/b/0.xml b/tests/test_conditions/models/test_1/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/b/agent_functions.c b/tests/test_conditions/models/test_1/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/b/model.xml b/tests/test_conditions/models/test_1/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/c/0.xml b/tests/test_conditions/models/test_1/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/c/agent_functions.c b/tests/test_conditions/models/test_1/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/c/model.xml b/tests/test_conditions/models/test_1/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/cd/model_cd.xml b/tests/test_conditions/models/test_1/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/d/0.xml b/tests/test_conditions/models/test_1/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/d/agent_functions.c b/tests/test_conditions/models/test_1/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_1/d/model.xml b/tests/test_conditions/models/test_1/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/a/0.xml b/tests/test_conditions/models/test_10/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/a/agent_functions.c b/tests/test_conditions/models/test_10/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/a/model.xml b/tests/test_conditions/models/test_10/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/ab/model_ab.xml b/tests/test_conditions/models/test_10/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/b/0.xml b/tests/test_conditions/models/test_10/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/b/agent_functions.c b/tests/test_conditions/models/test_10/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/b/model.xml b/tests/test_conditions/models/test_10/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/c/0.xml b/tests/test_conditions/models/test_10/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/c/agent_functions.c b/tests/test_conditions/models/test_10/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/c/model.xml b/tests/test_conditions/models/test_10/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/cd/model_cd.xml b/tests/test_conditions/models/test_10/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/d/0.xml b/tests/test_conditions/models/test_10/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/d/agent_functions.c b/tests/test_conditions/models/test_10/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_10/d/model.xml b/tests/test_conditions/models/test_10/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/a/0.xml b/tests/test_conditions/models/test_11/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/a/agent_functions.c b/tests/test_conditions/models/test_11/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/a/model.xml b/tests/test_conditions/models/test_11/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/ab/model_ab.xml b/tests/test_conditions/models/test_11/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/b/0.xml b/tests/test_conditions/models/test_11/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/b/agent_functions.c b/tests/test_conditions/models/test_11/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/b/model.xml b/tests/test_conditions/models/test_11/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/c/0.xml b/tests/test_conditions/models/test_11/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/c/agent_functions.c b/tests/test_conditions/models/test_11/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/c/model.xml b/tests/test_conditions/models/test_11/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/cd/model_cd.xml b/tests/test_conditions/models/test_11/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/d/0.xml b/tests/test_conditions/models/test_11/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/d/agent_functions.c b/tests/test_conditions/models/test_11/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_11/d/model.xml b/tests/test_conditions/models/test_11/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/a/0.xml b/tests/test_conditions/models/test_12/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/a/agent_functions.c b/tests/test_conditions/models/test_12/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/a/model.xml b/tests/test_conditions/models/test_12/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/ab/model_ab.xml b/tests/test_conditions/models/test_12/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/b/0.xml b/tests/test_conditions/models/test_12/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/b/agent_functions.c b/tests/test_conditions/models/test_12/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/b/model.xml b/tests/test_conditions/models/test_12/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/c/0.xml b/tests/test_conditions/models/test_12/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/c/agent_functions.c b/tests/test_conditions/models/test_12/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/c/model.xml b/tests/test_conditions/models/test_12/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/cd/model_cd.xml b/tests/test_conditions/models/test_12/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/d/0.xml b/tests/test_conditions/models/test_12/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/d/agent_functions.c b/tests/test_conditions/models/test_12/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_12/d/model.xml b/tests/test_conditions/models/test_12/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/a/0.xml b/tests/test_conditions/models/test_13/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/a/agent_functions.c b/tests/test_conditions/models/test_13/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/a/model.xml b/tests/test_conditions/models/test_13/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/ab/model_ab.xml b/tests/test_conditions/models/test_13/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/b/0.xml b/tests/test_conditions/models/test_13/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/b/agent_functions.c b/tests/test_conditions/models/test_13/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/b/model.xml b/tests/test_conditions/models/test_13/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/c/0.xml b/tests/test_conditions/models/test_13/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/c/agent_functions.c b/tests/test_conditions/models/test_13/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/c/model.xml b/tests/test_conditions/models/test_13/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/cd/model_cd.xml b/tests/test_conditions/models/test_13/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/d/0.xml b/tests/test_conditions/models/test_13/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/d/agent_functions.c b/tests/test_conditions/models/test_13/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_13/d/model.xml b/tests/test_conditions/models/test_13/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/a/0.xml b/tests/test_conditions/models/test_14/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/a/agent_functions.c b/tests/test_conditions/models/test_14/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/a/model.xml b/tests/test_conditions/models/test_14/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/ab/model_ab.xml b/tests/test_conditions/models/test_14/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/b/0.xml b/tests/test_conditions/models/test_14/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/b/agent_functions.c b/tests/test_conditions/models/test_14/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/b/model.xml b/tests/test_conditions/models/test_14/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/c/0.xml b/tests/test_conditions/models/test_14/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/c/agent_functions.c b/tests/test_conditions/models/test_14/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/c/model.xml b/tests/test_conditions/models/test_14/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/cd/model_cd.xml b/tests/test_conditions/models/test_14/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/d/0.xml b/tests/test_conditions/models/test_14/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/d/agent_functions.c b/tests/test_conditions/models/test_14/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_14/d/model.xml b/tests/test_conditions/models/test_14/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/a/0.xml b/tests/test_conditions/models/test_15/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/a/agent_functions.c b/tests/test_conditions/models/test_15/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/a/model.xml b/tests/test_conditions/models/test_15/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/ab/model_ab.xml b/tests/test_conditions/models/test_15/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/b/0.xml b/tests/test_conditions/models/test_15/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/b/agent_functions.c b/tests/test_conditions/models/test_15/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/b/model.xml b/tests/test_conditions/models/test_15/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/c/0.xml b/tests/test_conditions/models/test_15/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/c/agent_functions.c b/tests/test_conditions/models/test_15/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/c/model.xml b/tests/test_conditions/models/test_15/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/cd/model_cd.xml b/tests/test_conditions/models/test_15/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/d/0.xml b/tests/test_conditions/models/test_15/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/d/agent_functions.c b/tests/test_conditions/models/test_15/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_15/d/model.xml b/tests/test_conditions/models/test_15/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/a/0.xml b/tests/test_conditions/models/test_16/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/a/agent_functions.c b/tests/test_conditions/models/test_16/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/a/model.xml b/tests/test_conditions/models/test_16/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/ab/model_ab.xml b/tests/test_conditions/models/test_16/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/b/0.xml b/tests/test_conditions/models/test_16/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/b/agent_functions.c b/tests/test_conditions/models/test_16/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/b/model.xml b/tests/test_conditions/models/test_16/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/c/0.xml b/tests/test_conditions/models/test_16/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/c/agent_functions.c b/tests/test_conditions/models/test_16/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/c/model.xml b/tests/test_conditions/models/test_16/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/cd/model_cd.xml b/tests/test_conditions/models/test_16/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/d/0.xml b/tests/test_conditions/models/test_16/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/d/agent_functions.c b/tests/test_conditions/models/test_16/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_16/d/model.xml b/tests/test_conditions/models/test_16/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/a/0.xml b/tests/test_conditions/models/test_2/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/a/agent_functions.c b/tests/test_conditions/models/test_2/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/a/model.xml b/tests/test_conditions/models/test_2/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/ab/model_ab.xml b/tests/test_conditions/models/test_2/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/b/0.xml b/tests/test_conditions/models/test_2/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/b/agent_functions.c b/tests/test_conditions/models/test_2/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/b/model.xml b/tests/test_conditions/models/test_2/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/c/0.xml b/tests/test_conditions/models/test_2/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/c/agent_functions.c b/tests/test_conditions/models/test_2/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/c/model.xml b/tests/test_conditions/models/test_2/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/cd/model_cd.xml b/tests/test_conditions/models/test_2/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/d/0.xml b/tests/test_conditions/models/test_2/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/d/agent_functions.c b/tests/test_conditions/models/test_2/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_2/d/model.xml b/tests/test_conditions/models/test_2/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/a/0.xml b/tests/test_conditions/models/test_3/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/a/agent_functions.c b/tests/test_conditions/models/test_3/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/a/model.xml b/tests/test_conditions/models/test_3/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/ab/model_ab.xml b/tests/test_conditions/models/test_3/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/b/0.xml b/tests/test_conditions/models/test_3/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/b/agent_functions.c b/tests/test_conditions/models/test_3/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/b/model.xml b/tests/test_conditions/models/test_3/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/c/0.xml b/tests/test_conditions/models/test_3/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/c/agent_functions.c b/tests/test_conditions/models/test_3/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/c/model.xml b/tests/test_conditions/models/test_3/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/cd/model_cd.xml b/tests/test_conditions/models/test_3/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/d/0.xml b/tests/test_conditions/models/test_3/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/d/agent_functions.c b/tests/test_conditions/models/test_3/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_3/d/model.xml b/tests/test_conditions/models/test_3/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/a/0.xml b/tests/test_conditions/models/test_4/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/a/agent_functions.c b/tests/test_conditions/models/test_4/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/a/model.xml b/tests/test_conditions/models/test_4/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/ab/model_ab.xml b/tests/test_conditions/models/test_4/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/b/0.xml b/tests/test_conditions/models/test_4/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/b/agent_functions.c b/tests/test_conditions/models/test_4/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/b/model.xml b/tests/test_conditions/models/test_4/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/c/0.xml b/tests/test_conditions/models/test_4/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/c/agent_functions.c b/tests/test_conditions/models/test_4/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/c/model.xml b/tests/test_conditions/models/test_4/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/cd/model_cd.xml b/tests/test_conditions/models/test_4/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/d/0.xml b/tests/test_conditions/models/test_4/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/d/agent_functions.c b/tests/test_conditions/models/test_4/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_4/d/model.xml b/tests/test_conditions/models/test_4/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/a/0.xml b/tests/test_conditions/models/test_5/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/a/agent_functions.c b/tests/test_conditions/models/test_5/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/a/model.xml b/tests/test_conditions/models/test_5/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/ab/model_ab.xml b/tests/test_conditions/models/test_5/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/b/0.xml b/tests/test_conditions/models/test_5/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/b/agent_functions.c b/tests/test_conditions/models/test_5/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/b/model.xml b/tests/test_conditions/models/test_5/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/c/0.xml b/tests/test_conditions/models/test_5/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/c/agent_functions.c b/tests/test_conditions/models/test_5/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/c/model.xml b/tests/test_conditions/models/test_5/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/cd/model_cd.xml b/tests/test_conditions/models/test_5/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/d/0.xml b/tests/test_conditions/models/test_5/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/d/agent_functions.c b/tests/test_conditions/models/test_5/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_5/d/model.xml b/tests/test_conditions/models/test_5/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/a/0.xml b/tests/test_conditions/models/test_6/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/a/agent_functions.c b/tests/test_conditions/models/test_6/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/a/model.xml b/tests/test_conditions/models/test_6/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/ab/model_ab.xml b/tests/test_conditions/models/test_6/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/b/0.xml b/tests/test_conditions/models/test_6/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/b/agent_functions.c b/tests/test_conditions/models/test_6/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/b/model.xml b/tests/test_conditions/models/test_6/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/c/0.xml b/tests/test_conditions/models/test_6/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/c/agent_functions.c b/tests/test_conditions/models/test_6/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/c/model.xml b/tests/test_conditions/models/test_6/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/cd/model_cd.xml b/tests/test_conditions/models/test_6/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/d/0.xml b/tests/test_conditions/models/test_6/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/d/agent_functions.c b/tests/test_conditions/models/test_6/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_6/d/model.xml b/tests/test_conditions/models/test_6/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/a/0.xml b/tests/test_conditions/models/test_7/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/a/agent_functions.c b/tests/test_conditions/models/test_7/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/a/model.xml b/tests/test_conditions/models/test_7/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/ab/model_ab.xml b/tests/test_conditions/models/test_7/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/b/0.xml b/tests/test_conditions/models/test_7/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/b/agent_functions.c b/tests/test_conditions/models/test_7/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/b/model.xml b/tests/test_conditions/models/test_7/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/c/0.xml b/tests/test_conditions/models/test_7/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/c/agent_functions.c b/tests/test_conditions/models/test_7/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/c/model.xml b/tests/test_conditions/models/test_7/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/cd/model_cd.xml b/tests/test_conditions/models/test_7/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/d/0.xml b/tests/test_conditions/models/test_7/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/d/agent_functions.c b/tests/test_conditions/models/test_7/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_7/d/model.xml b/tests/test_conditions/models/test_7/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/a/0.xml b/tests/test_conditions/models/test_8/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/a/agent_functions.c b/tests/test_conditions/models/test_8/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/a/model.xml b/tests/test_conditions/models/test_8/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/ab/model_ab.xml b/tests/test_conditions/models/test_8/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/b/0.xml b/tests/test_conditions/models/test_8/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/b/agent_functions.c b/tests/test_conditions/models/test_8/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/b/model.xml b/tests/test_conditions/models/test_8/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/c/0.xml b/tests/test_conditions/models/test_8/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/c/agent_functions.c b/tests/test_conditions/models/test_8/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/c/model.xml b/tests/test_conditions/models/test_8/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/cd/model_cd.xml b/tests/test_conditions/models/test_8/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/d/0.xml b/tests/test_conditions/models/test_8/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/d/agent_functions.c b/tests/test_conditions/models/test_8/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_8/d/model.xml b/tests/test_conditions/models/test_8/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/a/0.xml b/tests/test_conditions/models/test_9/a/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/a/agent_functions.c b/tests/test_conditions/models/test_9/a/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/a/model.xml b/tests/test_conditions/models/test_9/a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/ab/model_ab.xml b/tests/test_conditions/models/test_9/ab/model_ab.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/b/0.xml b/tests/test_conditions/models/test_9/b/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/b/agent_functions.c b/tests/test_conditions/models/test_9/b/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/b/model.xml b/tests/test_conditions/models/test_9/b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/c/0.xml b/tests/test_conditions/models/test_9/c/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/c/agent_functions.c b/tests/test_conditions/models/test_9/c/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/c/model.xml b/tests/test_conditions/models/test_9/c/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/cd/model_cd.xml b/tests/test_conditions/models/test_9/cd/model_cd.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/d/0.xml b/tests/test_conditions/models/test_9/d/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/d/agent_functions.c b/tests/test_conditions/models/test_9/d/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_conditions/models/test_9/d/model.xml b/tests/test_conditions/models/test_9/d/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_conditions/output/flame_output.txt b/tests/test_conditions/output/flame_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_conditions/output/test_output.txt b/tests/test_conditions/output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_conditions/readme.md b/tests/test_conditions/readme.md old mode 100644 new mode 100755 diff --git a/tests/test_conditions/run_all_tests.sh b/tests/test_conditions/run_all_tests.sh old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering/0.xml b/tests/test_mesg_operations/models/filtering/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering/agent_functions.c b/tests/test_mesg_operations/models/filtering/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering/model.xml b/tests/test_mesg_operations/models/filtering/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering/test_output/test_output.txt b/tests/test_mesg_operations/models/filtering/test_output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering_and_random/0.xml b/tests/test_mesg_operations/models/filtering_and_random/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering_and_random/agent_functions.c b/tests/test_mesg_operations/models/filtering_and_random/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering_and_random/model.xml b/tests/test_mesg_operations/models/filtering_and_random/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/filtering_and_random/test_output/test_output.txt b/tests/test_mesg_operations/models/filtering_and_random/test_output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/randomizing/0.xml b/tests/test_mesg_operations/models/randomizing/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/randomizing/agent_functions.c b/tests/test_mesg_operations/models/randomizing/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/randomizing/model.xml b/tests/test_mesg_operations/models/randomizing/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/randomizing/test_output/test_output.txt b/tests/test_mesg_operations/models/randomizing/test_output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/sorting/0.xml b/tests/test_mesg_operations/models/sorting/0.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/sorting/agent_functions.c b/tests/test_mesg_operations/models/sorting/agent_functions.c old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/sorting/model.xml b/tests/test_mesg_operations/models/sorting/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/models/sorting/test_output/test_output.txt b/tests/test_mesg_operations/models/sorting/test_output/test_output.txt old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/readme.md b/tests/test_mesg_operations/readme.md old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/run_all_tests.sh b/tests/test_mesg_operations/run_all_tests.sh old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/stderr.txt b/tests/test_mesg_operations/stderr.txt old mode 100644 new mode 100755 diff --git a/tests/test_mesg_operations/stdout.txt b/tests/test_mesg_operations/stdout.txt old mode 100644 new mode 100755 diff --git a/tests/test_mesgs/model0/model.xml b/tests/test_mesgs/model0/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesgs/model1a/model.xml b/tests/test_mesgs/model1a/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesgs/model1b/model.xml b/tests/test_mesgs/model1b/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesgs/model2/model.xml b/tests/test_mesgs/model2/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesgs/model3/model.xml b/tests/test_mesgs/model3/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesgs/model4/model.xml b/tests/test_mesgs/model4/model.xml old mode 100644 new mode 100755 diff --git a/tests/test_mesgs/readme.md b/tests/test_mesgs/readme.md old mode 100644 new mode 100755 diff --git a/timing.tmpl b/timing.tmpl old mode 100644 new mode 100755 diff --git a/xmml.xsd b/xmml.xsd old mode 100644 new mode 100755 diff --git a/xparser.c b/xparser.c old mode 100644 new mode 100755 index b2edd7b..32a5d99 --- a/xparser.c +++ b/xparser.c @@ -273,10 +273,19 @@ int main(int argc, char * argv[]) strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "Makefile.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + + /* strcpy(filename, directory); strcat(filename, "xml.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "xml.tmpl"); + */ + + strcpy(filename, directory); + strcat(filename, "parquet.c"); + strcpy(tmpl_name, tmpl_directory); + strcat(tmpl_name, "parquet.tmpl"); + parseTemplate(filename, tmpl_name, modeldata); strcpy(filename, directory); strcat(filename, "main.c"); From 8b8a65ec4d656f69483734a1763f76684b29334f Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sat, 30 May 2026 17:05:28 +0200 Subject: [PATCH 03/14] Minor edits xparser.c for Parquet file output --- xparser.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/xparser.c b/xparser.c index 32a5d99..f33c7f3 100755 --- a/xparser.c +++ b/xparser.c @@ -273,19 +273,15 @@ int main(int argc, char * argv[]) strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "Makefile.tmpl"); parseTemplate(filename, tmpl_name, modeldata); - - /* strcpy(filename, directory); strcat(filename, "xml.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "xml.tmpl"); - */ - + parseTemplate(filename, tmpl_name, modeldata); strcpy(filename, directory); - strcat(filename, "parquet.c"); + strcat(filename, "parquet.cpp"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "parquet.tmpl"); - parseTemplate(filename, tmpl_name, modeldata); strcpy(filename, directory); strcat(filename, "main.c"); From 4907fb445411b18035d72c2e3a4fec4e4e06d32c Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sat, 30 May 2026 20:46:22 +0200 Subject: [PATCH 04/14] Fixes for Parquet file output integration. This now xparses a model and produces parquet.cpp file. --- Makefile.tmpl | 154 +++++++++++--------------- Makefile.tmpl.custom | 96 ---------------- parquet.tmpl | 255 +++++-------------------------------------- parquet_engine.cpp | 86 +++++++++++++++ parquet_engine.h | 16 +++ xparser.c | 12 +- 6 files changed, 198 insertions(+), 421 deletions(-) mode change 100755 => 100644 Makefile.tmpl delete mode 100644 Makefile.tmpl.custom create mode 100644 parquet_engine.cpp create mode 100644 parquet_engine.h diff --git a/Makefile.tmpl b/Makefile.tmpl old mode 100755 new mode 100644 index 2574b72..181c6f4 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -1,94 +1,66 @@ -# Makefile template file for FLAME -# -# FLAME is the FLAME source files -# SOURCE is the user source files -# -# The assumption is that the user only provides C files -# and a model files .xml -# -#=================================================== -# Change this variable for the location of the -# Message Board Library installation -#=================================================== -LIBMBOARD_DIR = /usr/local -LIBMBOARD_INC = $(LIBMBOARD_DIR)/include -LIBMBOARD_LIB = $(LIBMBOARD_DIR)/lib +# -------------------------------------------------------------------------- +# FLAME AUTOMATED GENERATION MAKEFILE TEMPLATE WITH PARQUET SERIALIZATION +# -------------------------------------------------------------------------- -#==================================================== -# Change these for your compiler/loader -#==================================================== -SERIAL_CCOMP = gcc -PARALLEL_CCOMP = mpicc - -# We explicitly use g++ for linking when using Parquet -SERIAL_LOADER = g++ -PARALLEL_LOADER = mpicxx - -DEFINES = -DEFINES += -DGSL_LIB - -# Compilers -CC = $(SERIAL_CCOMP)$(PARALLEL_CCOMP) +# 1. Compiler and Tool Chain Configurations +CC = gcc CXX = g++ -CFLAGS = -I$(LIBMBOARD_INC) ${DEFINES} - -# Ensure C++17 properties are cleanly targeted across build optimization sets -CFLAGS += -Wall -D_DEBUG_MODE -g -CFLAGS += -O3 - -# CXX Specific flags for our Parquet file -CXXFLAGS = -std=c++17 -O3 -I$(LIBMBOARD_INC) ${DEFINES} - -LD = $(SERIAL_LOADER)$(PARALLEL_LOADER) - -LDFLAGS = -L$(LIBMBOARD_LIB) - -LIBS += -lgsl -lgslcblas - -LIBS += -lmboard_sd -lmboard_pd -lm -larrow -lparquet - -# FLAME source files (Includes both legacy XML and our new Parquet engine) -FLAME = main.c memory.c xml.c parquet.cpp messageboards.c partitioning.c rules.c timing.c - -# FLAME auxiliary files -AUX = stategraph.dot stategraph_colour.dot process_order_graph.dot Doxyfile latex.tex - -# FLAME generated model files -SOURCES = $filepath -HEADERS = header.h low_primes.h mboard.h $name_agent_header.h - -DEPS = Makefile header.h low_primes.h - -# Correctly maps source strings to object configurations dynamically -OBJECTS = $(patsubst %.c,%.o,$(filter %.c,$(SOURCES) $(FLAME))) $(patsubst %.cpp,%.o,$(filter %.cpp,$(FLAME))) -EXECUTABLE = main -RM = rm -f - -all: $(SOURCES) $(FLAME) $(EXECUTABLE) - -$(EXECUTABLE): $(OBJECTS) - $(LD) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) - -$(OBJECTS): $(DEPS) - -# Standard rule pattern for building pure C simulation models -%.o: %.c - $(CC) -c $(CFLAGS) $< -o $@ - -# Standard rule pattern for building our C++ Parquet engine module -%.o: %.cpp - $(CXX) -c $(CXXFLAGS) $< -o $@ - +CFLAGS = -Wall -O3 -std=c11 +CXXFLAGS = -Wall -O3 -std=c++17 + +# 2. Dependency Libraries and Linker Targets +# Includes the runtime requirements for Apache Arrow, Parquet, and the C++ standard library +LIBS = -lm -larrow -lparquet -lstdc++ + +# 3. Object Manifest Target Registry +# Includes both the standard FLAME C outputs and the external C++ engine +OBJS = main.o \ + memory.o \ + low_io.o \ + xml.o \ + io.o \ + rules.o \ + parquet.o \ + parquet_engine.o \ + agent_.o + +# 4. Primary Build Executable Pipeline Rule +main: $(OBJS) + $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o main + +# 5. Native Compilation Rules for Standard Core Source Files +main.o: main.c header.h + $(CC) $(CFLAGS) -c main.c -o main.o + +memory.o: memory.c header.h + $(CC) $(CFLAGS) -c memory.c -o memory.o + +low_io.o: low_io.c header.h + $(CC) $(CFLAGS) -c low_io.c -o low_io.o + +xml.o: xml.c header.h + $(CC) $(CFLAGS) -c xml.c -o xml.o + +io.o: io.c header.h + $(CC) $(CFLAGS) -c io.c -o io.o + +rules.o: rules.c header.h + $(CC) $(CFLAGS) -c rules.c -o rules.o + +parquet.o: parquet.cpp header.h parquet_engine.h + $(CXX) $(CXXFLAGS) -c parquet.cpp -o parquet.o + +# 6. Standalone Native C++ Apache Arrow Engine Compilation Target +# This completely bypasses xparser to prevent unclosed template tag conflicts +parquet_engine.o: parquet_engine.cpp parquet_engine.h + $(CXX) $(CXXFLAGS) -c parquet_engine.cpp -o parquet_engine.o + +# 7. Unrolled Template Rules Matrix for FLAME Agents + +agent_.o: agent_.c header.h + $(CC) $(CFLAGS) -c agent_.c -o agent_.o + + +# 8. Clean Environment Utility Registry clean: - $(RM) $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE).exe -vclean: - $(RM) main $(EXECUTABLE) $(EXECUTABLE).exe $(OBJECTS) $(FLAME) $(HEADERS) $(AUX) Makefile -format: - astyle -A3 $(SOURCES) - for file in $(patsubst %.c,%.h, $(SOURCES)) ; do \ - echo $$file ; \ - astyle -A3 $$file ; \ - done -print: - a2ps -R -f10 --column=1 $(SOURCES) - \ No newline at end of file + rm -f *.o main parquet_output/*.parquet \ No newline at end of file diff --git a/Makefile.tmpl.custom b/Makefile.tmpl.custom deleted file mode 100644 index fe097da..0000000 --- a/Makefile.tmpl.custom +++ /dev/null @@ -1,96 +0,0 @@ -# Makefile template file for FLAME -# -# FLAME is the FLAME source files -# SOURCE is the user source files -# -# The assumption is that the user only provides C files -# and a model files .xml -# -#=================================================== -# Change this variable for the location of the -# Message Board Library installation -#=================================================== -LIBMBOARD_DIR = /upb/departments/pc2/users/e/etace004/build/libmboard -LIBMBOARD_INC = $(LIBMBOARD_DIR)/include -LIBMBOARD_LIB = $(LIBMBOARD_DIR)/lib - - -#=================================================== -# Change this variable for the location of the -# GNU Scientific Library (GSL) installation -#=================================================== -GSL_DIR = /cm/shared/apps/pc2/GSL/2.4 -GSL_LIB = $(GSL_DIR)/lib -GSL_INC = $(GSL_DIR)/include - - -#==================================================== -# Change these for your compiler/loader -#==================================================== -SERIAL_CCOMP = gcc -PARALLEL_CCOMP = mpicc - -SERIAL_LOADER = gcc -PARALLEL_LOADER = mpif77 - -DEFINES = - -DEFINES += -DGSL_LIB - - -# C Compiler -CC = $(SERIAL_CCOMP)$(PARALLEL_CCOMP) -CFLAGS = -I$(LIBMBOARD_INC) ${DEFINES} -CFLAGS += -I$(GSL_INC) - -CFLAGS += -std=c99 -Wall -D_DEBUG_MODE -g -CFLAGS += -O3 - -LD = $(SERIAL_LOADER)$(PARALLEL_LOADER) - -LDFLAGS = -L$(LIBMBOARD_LIB) - -LDFLAGS += -L$(GSL_LIB) - -LIBS += -lgsl -lgslcblas - -LIBS += -lmboard_sd -lmboard_pd -lm - -#FLAME source files -FLAME = main.c memory.c xml.c messageboards.c partitioning.c rules.c timing.c - -#FLAME auxilary files -AUX = stategraph.dot stategraph_colour.dot process_order_graph.dot Doxyfile latex.tex - -# FLAME generated model files -SOURCES = $filepath -HEADERS = header.h low_primes.h mboard.h $name_agent_header.h - -DEPS = Makefile header.h low_primes.h - -OBJECTS = $(SOURCES:.c=.o) $(FLAME:.c=.o) -EXECUTABLE = main -RM = rm -f - -all: $(SOURCES) $(FLAME) $(EXECUTABLE) - -$(EXECUTABLE): $(OBJECTS) - $(LD) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) - -$(OBJECTS): $(DEPS) - -.c.o: - $(CC) -c $(CFLAGS) $< -o $@ - -clean: - $(RM) $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE).exe -vclean: - $(RM) main $(EXECUTABLE) $(EXECUTABLE).exe $(OBJECTS) $(FLAME) $(HEADERS) $(AUX) Makefile -format: - astyle -A3 $(SOURCES) - for file in $(patsubst %.c,%.h, $(SOURCES)) ; do \ - echo $$file ; \ - astyle -A3 $$file ; \ - done -print: - a2ps -R -f10 --column=1 $(SOURCES) diff --git a/parquet.tmpl b/parquet.tmpl index 17e71f8..165b2bc 100644 --- a/parquet.tmpl +++ b/parquet.tmpl @@ -1,239 +1,36 @@ -/** - * \file parquet.tmpl - * \brief Generated code template to save agent states natively to Apache Parquet format. - * \note Automatically generated from the model definition by xparser. - */ +#include "header.h" +#include "parquet_engine.h" -#include -#include -#include -#include -#include - -// Include the Apache Arrow and Parquet C++ APIs -#include -#include -#include - -// Ensure C compatibility with the core FLAME engine structures +#ifdef __cplusplus extern "C" { - #include "header.h" -} - -// ========================================================================= -// PARQUET HELPER FUNCTIONS (Equivalents to xml.tmpl static array functions) -// ========================================================================= - -/** - * \brief Appends a static C-style integer array into an Arrow ListBuilder. - * \note Equivalent to write_int_static_array from xml.tmpl - */ -inline void append_int_static_array( - std::shared_ptr& builder, - arrow::Int64Builder* value_builder, - const int* array_ptr, - int size) -{ - (void)builder->Append(); - for (int i = 0; i < size; ++i) { - (void)value_builder->Append(array_ptr[i]); - } -} - -/** - * \brief Appends a static C-style double array into an Arrow ListBuilder. - * \note Equivalent to write_float_static_array from xml.tmpl - */ -inline void append_double_static_array( - std::shared_ptr& builder, - arrow::DoubleBuilder* value_builder, - const double* array_ptr, - int size) -{ - (void)builder->Append(); - for (int i = 0; i < size; ++i) { - (void)value_builder->Append(array_ptr[i]); - } -} - -/** - * \brief Appends a static char array (C-string) into an Arrow StringBuilder. - * \note Equivalent to write_char_static_array from xml.tmpl. - * In Parquet, a static char array represents a single text string row. - */ -inline void append_char_static_array( - std::shared_ptr& builder, - const char* array_ptr, - int size) -{ - if (array_ptr != nullptr && size > 0) { - // Construct a safe bounded string ignoring trailing uninitialized garbage - std::string str_val(array_ptr, strnlen(array_ptr, size)); - (void)builder->Append(str_val); - } else { - (void)builder->AppendNull(); - } -} - - -// ========================================================================= -// INDIVIDUAL AGENT GENERATION TEMPLATE -// ========================================================================= - -/** - * \brief Saves the state of all active $AGENT_NAME agents into a single Parquet file. - * \param iteration_number The current simulation discrete time step. - */ -inline void save_$AGENT_NAME_parquet(int iteration_number) -{ - // 1. Build a clean filename string (e.g., "Firms_0023.parquet") - char filename[256]; - snprintf(filename, sizeof(filename), "$AGENT_NAME_%04d.parquet", iteration_number); +#endif - // Get the head pointer of the specific agent population list - $AGENT_NAME * current_agent = get_$AGENT_NAME_agents(); - - // If there are no active agents of this type, skip file creation entirely - if (current_agent == nullptr) { - return; - } - - // 2. Initialize Apache Arrow Memory Builders for every variable in the agent schema - arrow::MemoryPool* pool = arrow::default_memory_pool(); - - - - // Builder for scalar variable: $VARIABLE_NAME - auto $VARIABLE_NAME_builder = std::make_shared(pool); - auto $VARIABLE_NAME_builder = std::make_shared(pool); - auto $VARIABLE_NAME_builder = std::make_shared(pool); - - - - // Builder for array variable: $VARIABLE_NAME - - auto $VARIABLE_NAME_value_builder = std::make_shared(pool); - auto $VARIABLE_NAME_builder = std::make_shared(pool, $VARIABLE_NAME_value_builder); - - - auto $VARIABLE_NAME_value_builder = std::make_shared(pool); - auto $VARIABLE_NAME_builder = std::make_shared(pool, $VARIABLE_NAME_value_builder); - - - auto $VARIABLE_NAME_builder = std::make_shared(pool); - - - + +void write_parquet_data_(int iteration_no) { + // Clear any existing stale tracking allocations + parquet_clear_buffer(""); - // 3. Loop through the agent population and append row values to column builders - while (current_agent != nullptr) - { - - - // Append scalar values safely - - if (current_agent->$VARIABLE_NAME != nullptr) { - (void)$VARIABLE_NAME_builder->Append(std::string(current_agent->$VARIABLE_NAME)); - } else { - (void)$VARIABLE_NAME_builder->AppendNull(); - } - - - (void)$VARIABLE_NAME_builder->Append(current_agent->$VARIABLE_NAME); - - + // Loop directly through the agent link chain + current_xmachine_ = * current_node_->xmachine_; + while(current_xmachine_ != NULL) { - - // Append array elements natively using matched standalone helpers - append_int_static_array($VARIABLE_NAME_builder, $VARIABLE_NAME_value_builder, current_agent->$VARIABLE_NAME, $ARRAY_SIZE); - append_double_static_array($VARIABLE_NAME_builder, $VARIABLE_NAME_value_builder, current_agent->$VARIABLE_NAME, $ARRAY_SIZE); - append_char_static_array($VARIABLE_NAME_builder, current_agent->$VARIABLE_NAME, $ARRAY_SIZE); - - - - current_agent = current_agent->next; - } - - // 4. Finalize the builders into concrete, immutable Arrow Arrays - - std::shared_ptr $VARIABLE_NAME_array; - (void)$VARIABLE_NAME_builder->Finish(&$VARIABLE_NAME_array); - - - // 5. Construct fields and schema vector sequentially to prevent trailing comma compilation bugs - std::vector> schema_fields; - - - schema_fields.push_back(arrow::field("$VARIABLE_NAME", - - arrow::int64() - arrow::float64() - arrow::utf8() - - - arrow::list(arrow::int64()) - arrow::list(arrow::float64()) - arrow::utf8() - - )); - - - auto schema = arrow::schema(schema_fields); - - // 6. Bundle the constructed columns together into an Arrow Record Table - auto table = arrow::Table::Make(schema, { - - $VARIABLE_NAME_array, - - }); - - // 7. Establish an atomic, high-speed binary file stream and write to disk - std::shared_ptr outfile; - auto open_status = arrow::io::FileOutputStream::Open(filename, &outfile); - - if (!open_status.ok()) { - std::cerr << "Parquet file generation error: Failed to open output stream for file: " << filename - << "\nReason: " << open_status.message() << std::endl; - return; + // Forward row variable states down to the external C++ buffering arrays + // Note: Change 'id' or 'value' to match actual memory names in your model.xml + parquet_buffer_row( + "", + iteration_no, + (long)current_xmachine_->id, + (double)current_xmachine_->value + ); + + current_xmachine_ = current_xmachine_->next; } - // Set default row group configurations for Parquet chunks - auto writer_properties = parquet::WriterProperties::Builder() - .compression(parquet::Compression::SNAPPY) // Use fast Snappy compression - .build(); - - auto arrow_writer_properties = parquet::ArrowWriterProperties::Builder() - .store_schema() // Store schema metadata inside the file footer - .build(); - - // Perform the high-speed binary table dump - auto write_status = parquet::arrow::WriteTable( - *table, - pool, - outfile, - 100000, // Chunk size limit per row group - writer_properties, - arrow_writer_properties - ); - - if (!write_status.ok()) { - std::cerr << "Parquet file generation error: Failed to commit Parquet binary data for iteration: " << iteration_number - << "\nReason: " << write_status.message() << std::endl; - } + // Seal and commit files safely to disk memory + parquet_write_file("", iteration_no); } + - -// ========================================================================= -// MASTER ENTRY SAVE ROUTINE (Triggered via main.tmpl) -// ========================================================================= - -/** - * \brief Replaces the runtime text serialization layer. Iterates through - * every registered agent type and triggers its column-oriented output loop. - */ -extern "C" void saveiterationdata_parquet(int iteration_number) -{ - - save_$AGENT_NAME_parquet(iteration_number); - +#ifdef __cplusplus } +#endif \ No newline at end of file diff --git a/parquet_engine.cpp b/parquet_engine.cpp new file mode 100644 index 0000000..8d57e4b --- /dev/null +++ b/parquet_engine.cpp @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include + +/* Arrow & Parquet Core Engine Headers */ +#include +#include +#include +#include + +// A generic row-buffer to store data dynamically before writing to Parquet +struct AgentDataBuffer { + std::vector iterations; + std::vector ids; + std::vector numeric_values; +}; + +// Global map to hold row buffers per agent type name +static std::map global_buffers; + +#ifdef __cplusplus +extern "C" { +#endif + +// Clear buffers at the start of an iteration step if necessary +void parquet_clear_buffer(const char* agent_name) { + std::string name(agent_name); + global_buffers[name].iterations.clear(); + global_buffers[name].ids.clear(); + global_buffers[name].numeric_values.clear(); +} + +// C-compatible function to receive data pushed from FLAME agents +void parquet_buffer_row(const char* agent_name, int iteration_no, int64_t id, double value) { + std::string name(agent_name); + global_buffers[name].iterations.push_back(iteration_no); + global_buffers[name].ids.push_back(id); + global_buffers[name].numeric_values.push_back(value); +} + +// Finalize and write accumulated rows out to a Parquet file +void parquet_write_file(const char* agent_name, int iteration_no) { + std::string name(agent_name); + auto& buf = global_buffers[name]; + + if (buf.iterations.empty()) return; + + // 1. Build Arrow Arrays from buffered vectors + arrow::Int64Builder iter_builder; + arrow::Int64Builder id_builder; + arrow::DoubleBuilder val_builder; + + (void)iter_builder.AppendValues(buf.iterations); + (void)id_builder.AppendValues(buf.ids); + (void)val_builder.AppendValues(buf.numeric_values); + + std::shared_ptr iter_array; (void)iter_builder.Finish(&iter_array); + std::shared_ptr id_array; (void)id_builder.Finish(&id_array); + std::shared_ptr val_array; (void)val_builder.Finish(&val_array); + + // 2. Map arrays to schema fields + auto schema = arrow::schema({ + arrow::field("_ITERATION_NO", arrow::int64()), + arrow::field("id", arrow::int64()), + arrow::field("value", arrow::float64()) + }); + + // 3. Construct Table + std::shared_ptr table = arrow::Table::Make(schema, {iter_array, id_array, val_array}); + + // 4. Stream to file system destination + std::string path = "parquet_output/data_" + name + "_iter_" + std::to_string(iteration_no) + ".parquet"; + std::shared_ptr outfile; + PARQUET_ASSIGN_OR_THROW(outfile, arrow::io::FileOutputStream::Open(path)); + + PARQUET_THROW_NOT_OK(parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), outfile, 3000)); + + // Clear buffer after writing + parquet_clear_buffer(agent_name); +} + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/parquet_engine.h b/parquet_engine.h new file mode 100644 index 0000000..1469742 --- /dev/null +++ b/parquet_engine.h @@ -0,0 +1,16 @@ +#ifndef PARQUET_ENGINE_H +#define PARQUET_ENGINE_H + +#ifdef __cplusplus +extern "C" { +#endif + +void parquet_clear_buffer(const char* agent_name); +void parquet_buffer_row(const char* agent_name, int iteration_no, long id, double value); +void parquet_write_file(const char* agent_name, int iteration_no); + +#ifdef __cplusplus +} +#endif + +#endif // PARQUET_ENGINE_H \ No newline at end of file diff --git a/xparser.c b/xparser.c index f33c7f3..9981c0d 100755 --- a/xparser.c +++ b/xparser.c @@ -279,11 +279,6 @@ int main(int argc, char * argv[]) strcat(tmpl_name, "xml.tmpl"); parseTemplate(filename, tmpl_name, modeldata); strcpy(filename, directory); - strcat(filename, "parquet.cpp"); - strcpy(tmpl_name, tmpl_directory); - strcat(tmpl_name, "parquet.tmpl"); - parseTemplate(filename, tmpl_name, modeldata); - strcpy(filename, directory); strcat(filename, "main.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "main.tmpl"); @@ -329,6 +324,13 @@ int main(int argc, char * argv[]) strcat(tmpl_name, "rules.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + /* Parquet */ + strcpy(filename, directory); + strcat(filename, "parquet.cpp"); + strcpy(tmpl_name, tmpl_directory); + strcat(tmpl_name, "parquet.tmpl"); + parseTemplate(filename, tmpl_name, modeldata); + printf("\n"); parseAgentHeaderTemplate(directory, modeldata); /*parseUnittest(directory, modeldata);*/ From 44f4ea11970f36c772ed04083be337445c8c19b6 Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 15:36:09 +0200 Subject: [PATCH 05/14] Fixes for Parquet file output compilation errors. --- main.tmpl | 13 ++++++++++- memory.tmpl | 15 ++++++++++-- parquet.tmpl | 33 ++++++++------------------ parquet_engine.cpp | 58 ++++++++++++++++++---------------------------- parquet_engine.h | 11 ++++++--- xparser.c | 24 +++++++++++++------ 6 files changed, 83 insertions(+), 71 deletions(-) diff --git a/main.tmpl b/main.tmpl index 6bb32ce..caaf7fa 100755 --- a/main.tmpl +++ b/main.tmpl @@ -415,12 +415,23 @@ if(argc < 2) if(node_number == 0) { /* Write log file */ - sprintf(logfilepath, "%slog.xml", outputpath); + // Check if outputpath leaves enough room for "log.xml" (7 bytes) + null terminator (1 byte) + if (strlen(outputpath) + 8 > sizeof(logfilepath)) { + fprintf(stderr, "Error: outputpath is too long for the log file path buffer.\n"); + // Handle the error gracefully (e.g., return, exit, or fall back) + exit(0); + } + // GCC now knows this snprintf will never truncate, still we use pragma's to shut up the compiler + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-truncation" + snprintf(logfilepath, sizeof(logfilepath), "%slog.xml", outputpath); /* use snprintf to protect against overflow */ + #pragma GCC diagnostic pop if((file = fopen(logfilepath, "w"))==NULL) { printf("Error: cannot open file '%s' for writing\n", logfilepath); exit(0); } + (void)fputs("\n", file); (void)fputs("", file); (void)fputs("serial", file); diff --git a/memory.tmpl b/memory.tmpl index 2c221e3..0e407c1 100755 --- a/memory.tmpl +++ b/memory.tmpl @@ -618,7 +618,7 @@ void clean_up(int code) { int rc; FILE *file; - char data[100]; + char data[1000]; free(current_xmachine); /* Free x-machine memory */ @@ -709,7 +709,18 @@ void clean_up(int code) { /* Write log file */ - sprintf(data, "%slog.xml", outputpath); + // Check if outputpath leaves enough room for "log.xml" (7 bytes) + null terminator (1 byte) + if (strlen(outputpath) + 8 > sizeof(data)) { + fprintf(stderr, "Error: outputpath is too long for the log file path buffer.\n"); + // Handle the error gracefully (e.g., return, exit, or fall back) + exit(0); + } + // GCC now knows this snprintf will never truncate, still we use pragma's to shut up the compiler + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-truncation" + snprintf(data, sizeof(data), "%slog.xml", outputpath); /* use snprintf to protect against overflow */ + #pragma GCC diagnostic pop + file = fopen(data, "a"); fputs("\n", file); fputs("", file); diff --git a/parquet.tmpl b/parquet.tmpl index 165b2bc..1992e47 100644 --- a/parquet.tmpl +++ b/parquet.tmpl @@ -1,36 +1,23 @@ #include "header.h" #include "parquet_engine.h" -#ifdef __cplusplus -extern "C" { -#endif - -void write_parquet_data_(int iteration_no) { - // Clear any existing stale tracking allocations - parquet_clear_buffer(""); +void write_parquet_data_$name(int iteration_no) { + parquet_clear_buffer("$name"); - // Loop directly through the agent link chain - current_xmachine_ = * current_node_->xmachine_; - while(current_xmachine_ != NULL) { + current_xmachine_$name = (*current_node_$name).xmachine_$name; + while(current_xmachine_$name != NULL) { - // Forward row variable states down to the external C++ buffering arrays - // Note: Change 'id' or 'value' to match actual memory names in your model.xml parquet_buffer_row( - "", + "$name", iteration_no, - (long)current_xmachine_->id, - (double)current_xmachine_->value + (long)(*current_xmachine_$name).id, + (double)(*current_xmachine_$name).value ); - current_xmachine_ = current_xmachine_->next; + current_xmachine_$name = (*current_xmachine_$name).next; } - // Seal and commit files safely to disk memory - parquet_write_file("", iteration_no); -} - - -#ifdef __cplusplus + parquet_write_file("$name", iteration_no); } -#endif \ No newline at end of file + diff --git a/parquet_engine.cpp b/parquet_engine.cpp index 8d57e4b..a7a70b9 100644 --- a/parquet_engine.cpp +++ b/parquet_engine.cpp @@ -4,50 +4,42 @@ #include #include -/* Arrow & Parquet Core Engine Headers */ +#include "header.h" // This pulls in our auto-generated execute_all_parquet_agents +#include "parquet_engine.h" + #include #include #include #include -// A generic row-buffer to store data dynamically before writing to Parquet struct AgentDataBuffer { std::vector iterations; std::vector ids; std::vector numeric_values; }; -// Global map to hold row buffers per agent type name static std::map global_buffers; -#ifdef __cplusplus extern "C" { -#endif -// Clear buffers at the start of an iteration step if necessary void parquet_clear_buffer(const char* agent_name) { - std::string name(agent_name); - global_buffers[name].iterations.clear(); - global_buffers[name].ids.clear(); - global_buffers[name].numeric_values.clear(); + global_buffers[std::string(agent_name)].iterations.clear(); + global_buffers[std::string(agent_name)].ids.clear(); + global_buffers[std::string(agent_name)].numeric_values.clear(); } -// C-compatible function to receive data pushed from FLAME agents -void parquet_buffer_row(const char* agent_name, int iteration_no, int64_t id, double value) { - std::string name(agent_name); - global_buffers[name].iterations.push_back(iteration_no); - global_buffers[name].ids.push_back(id); - global_buffers[name].numeric_values.push_back(value); +void parquet_buffer_row(const char* agent_name, int iteration, long id, double value) { + auto& buf = global_buffers[std::string(agent_name)]; + buf.iterations.push_back(iteration); + buf.ids.push_back(id); + buf.numeric_values.push_back(value); } -// Finalize and write accumulated rows out to a Parquet file -void parquet_write_file(const char* agent_name, int iteration_no) { +void parquet_write_file(const char* agent_name, int iteration) { std::string name(agent_name); auto& buf = global_buffers[name]; - if (buf.iterations.empty()) return; - // 1. Build Arrow Arrays from buffered vectors arrow::Int64Builder iter_builder; arrow::Int64Builder id_builder; arrow::DoubleBuilder val_builder; @@ -56,31 +48,27 @@ void parquet_write_file(const char* agent_name, int iteration_no) { (void)id_builder.AppendValues(buf.ids); (void)val_builder.AppendValues(buf.numeric_values); - std::shared_ptr iter_array; (void)iter_builder.Finish(&iter_array); - std::shared_ptr id_array; (void)id_builder.Finish(&id_array); - std::shared_ptr val_array; (void)val_builder.Finish(&val_array); + std::shared_ptr iter_arr; (void)iter_builder.Finish(&iter_arr); + std::shared_ptr id_arr; (void)id_builder.Finish(&id_arr); + std::shared_ptr val_arr; (void)val_builder.Finish(&val_arr); - // 2. Map arrays to schema fields auto schema = arrow::schema({ arrow::field("_ITERATION_NO", arrow::int64()), arrow::field("id", arrow::int64()), arrow::field("value", arrow::float64()) }); - // 3. Construct Table - std::shared_ptr table = arrow::Table::Make(schema, {iter_array, id_array, val_array}); - - // 4. Stream to file system destination - std::string path = "parquet_output/data_" + name + "_iter_" + std::to_string(iteration_no) + ".parquet"; + std::shared_ptr table = arrow::Table::Make(schema, {iter_arr, id_arr, val_arr}); + std::string path = "parquet_output/data_" + name + "_iter_" + std::to_string(iteration) + ".parquet"; std::shared_ptr outfile; PARQUET_ASSIGN_OR_THROW(outfile, arrow::io::FileOutputStream::Open(path)); - PARQUET_THROW_NOT_OK(parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), outfile, 3000)); - - // Clear buffer after writing - parquet_clear_buffer(agent_name); } -#ifdef __cplusplus +// Entry point called by the simulation +void run_parquet_sequence(int iteration_no) { + // Calls the C++ inline helper function unrolled inside header.h! + execute_all_parquet_agents(iteration_no); } -#endif \ No newline at end of file + +} //Extern "C" diff --git a/parquet_engine.h b/parquet_engine.h index 1469742..7be2c23 100644 --- a/parquet_engine.h +++ b/parquet_engine.h @@ -5,12 +5,17 @@ extern "C" { #endif +// Allocates or resets the vectors holding row data for a specific agent type void parquet_clear_buffer(const char* agent_name); -void parquet_buffer_row(const char* agent_name, int iteration_no, long id, double value); -void parquet_write_file(const char* agent_name, int iteration_no); + +// Appends an individual agent's state values into the memory rows +void parquet_buffer_row(const char* agent_name, int iteration, long id, double value); + +// Packages the accumulated rows into an Arrow table and commits them to a Parquet file +void parquet_write_file(const char* agent_name, int iteration); #ifdef __cplusplus } #endif -#endif // PARQUET_ENGINE_H \ No newline at end of file +#endif // PARQUET_ENGINE_H diff --git a/xparser.c b/xparser.c index 9981c0d..2f72b6a 100755 --- a/xparser.c +++ b/xparser.c @@ -273,64 +273,74 @@ int main(int argc, char * argv[]) strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "Makefile.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "xml.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "xml.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "main.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "main.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "header.h"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "header.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "memory.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "memory.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + + /* Parquet related */ +/* strcpy(filename, directory); + strcat(filename, "parquet.cpp"); + strcpy(tmpl_name, tmpl_directory); + strcat(tmpl_name, "parquet.tmpl"); + parseTemplate(filename, tmpl_name, modeldata); +*/ strcpy(filename, directory); strcat(filename, "low_primes.h"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "low_primes.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "messageboards.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "messageboards.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "partitioning.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "partitioning.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "timing.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "timing.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "Doxyfile"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "Doxyfile.tmpl"); parseTemplate(filename, tmpl_name, modeldata); + strcpy(filename, directory); strcat(filename, "rules.c"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "rules.tmpl"); parseTemplate(filename, tmpl_name, modeldata); - /* Parquet */ - strcpy(filename, directory); - strcat(filename, "parquet.cpp"); - strcpy(tmpl_name, tmpl_directory); - strcat(tmpl_name, "parquet.tmpl"); - parseTemplate(filename, tmpl_name, modeldata); - printf("\n"); parseAgentHeaderTemplate(directory, modeldata); /*parseUnittest(directory, modeldata);*/ From f9c0528297b20f61eda4d46258083b00ed438e85 Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 15:42:12 +0200 Subject: [PATCH 06/14] Fixes in Makefile template file. Adds parsing of Parquet templates to xparser.c --- Makefile.tmpl | 4 ++-- xparser.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.tmpl b/Makefile.tmpl index 181c6f4..0a05419 100644 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -22,7 +22,7 @@ OBJS = main.o \ rules.o \ parquet.o \ parquet_engine.o \ - agent_.o + agent_.o # 4. Primary Build Executable Pipeline Rule main: $(OBJS) @@ -59,7 +59,7 @@ parquet_engine.o: parquet_engine.cpp parquet_engine.h agent_.o: agent_.c header.h $(CC) $(CFLAGS) -c agent_.c -o agent_.o - + # 8. Clean Environment Utility Registry clean: diff --git a/xparser.c b/xparser.c index 2f72b6a..89cdaef 100755 --- a/xparser.c +++ b/xparser.c @@ -299,12 +299,12 @@ int main(int argc, char * argv[]) parseTemplate(filename, tmpl_name, modeldata); /* Parquet related */ -/* strcpy(filename, directory); + strcpy(filename, directory); strcat(filename, "parquet.cpp"); strcpy(tmpl_name, tmpl_directory); strcat(tmpl_name, "parquet.tmpl"); parseTemplate(filename, tmpl_name, modeldata); -*/ + strcpy(filename, directory); strcat(filename, "low_primes.h"); strcpy(tmpl_name, tmpl_directory); From 4c169cd0a741072bc17588764b51c5e1cd4c69ba Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 15:44:29 +0200 Subject: [PATCH 07/14] Fixes missing libmboard installation location in Makefile template file. --- Makefile.tmpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.tmpl b/Makefile.tmpl index 0a05419..b494839 100644 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -2,6 +2,11 @@ # FLAME AUTOMATED GENERATION MAKEFILE TEMPLATE WITH PARQUET SERIALIZATION # -------------------------------------------------------------------------- +# Change this variable for the location of the Message Board Library installation +LIBMBOARD_DIR = /home/sander/build/libmboard +LIBMBOARD_INC = $(LIBMBOARD_DIR)/include +LIBMBOARD_LIB = $(LIBMBOARD_DIR)/lib + # 1. Compiler and Tool Chain Configurations CC = gcc CXX = g++ From 97a249a3602b2fcac564e88098445506b7e1ced3 Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 15:52:49 +0200 Subject: [PATCH 08/14] Fixes to Makefile template file. --- Makefile.tmpl | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Makefile.tmpl b/Makefile.tmpl index b494839..4c26c02 100644 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -10,7 +10,8 @@ LIBMBOARD_LIB = $(LIBMBOARD_DIR)/lib # 1. Compiler and Tool Chain Configurations CC = gcc CXX = g++ -CFLAGS = -Wall -O3 -std=c11 +CFLAGS = -I$(LIBMBOARD_INC) ${DEFINES} -fcommon +CFLAGS += -Wall -O3 -std=c11 CXXFLAGS = -Wall -O3 -std=c++17 # 2. Dependency Libraries and Linker Targets @@ -21,13 +22,11 @@ LIBS = -lm -larrow -lparquet -lstdc++ # Includes both the standard FLAME C outputs and the external C++ engine OBJS = main.o \ memory.o \ - low_io.o \ xml.o \ - io.o \ rules.o \ parquet.o \ parquet_engine.o \ - agent_.o + agent_$name.o # 4. Primary Build Executable Pipeline Rule main: $(OBJS) @@ -40,15 +39,9 @@ main.o: main.c header.h memory.o: memory.c header.h $(CC) $(CFLAGS) -c memory.c -o memory.o -low_io.o: low_io.c header.h - $(CC) $(CFLAGS) -c low_io.c -o low_io.o - xml.o: xml.c header.h $(CC) $(CFLAGS) -c xml.c -o xml.o -io.o: io.c header.h - $(CC) $(CFLAGS) -c io.c -o io.o - rules.o: rules.c header.h $(CC) $(CFLAGS) -c rules.c -o rules.o @@ -62,10 +55,11 @@ parquet_engine.o: parquet_engine.cpp parquet_engine.h # 7. Unrolled Template Rules Matrix for FLAME Agents -agent_.o: agent_.c header.h - $(CC) $(CFLAGS) -c agent_.c -o agent_.o +agent_$name.o: agent_$name.c header.h + $(CC) $(CFLAGS) -c agent_$name.c -o agent_$name.o # 8. Clean Environment Utility Registry clean: - rm -f *.o main parquet_output/*.parquet \ No newline at end of file + rm -f *.o main + \ No newline at end of file From dd0cc999ff017e6e7c91e615bfedb4bf70a6cc7d Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 16:30:20 +0200 Subject: [PATCH 09/14] Fixes to Makefile template file. --- Makefile.tmpl | 146 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 57 deletions(-) diff --git a/Makefile.tmpl b/Makefile.tmpl index 4c26c02..895c4c3 100644 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -1,65 +1,97 @@ -# -------------------------------------------------------------------------- +# ========================================================================== # FLAME AUTOMATED GENERATION MAKEFILE TEMPLATE WITH PARQUET SERIALIZATION -# -------------------------------------------------------------------------- +# ========================================================================== -# Change this variable for the location of the Message Board Library installation +# Message Board Library paths LIBMBOARD_DIR = /home/sander/build/libmboard LIBMBOARD_INC = $(LIBMBOARD_DIR)/include LIBMBOARD_LIB = $(LIBMBOARD_DIR)/lib -# 1. Compiler and Tool Chain Configurations -CC = gcc -CXX = g++ -CFLAGS = -I$(LIBMBOARD_INC) ${DEFINES} -fcommon -CFLAGS += -Wall -O3 -std=c11 -CXXFLAGS = -Wall -O3 -std=c++17 - -# 2. Dependency Libraries and Linker Targets -# Includes the runtime requirements for Apache Arrow, Parquet, and the C++ standard library -LIBS = -lm -larrow -lparquet -lstdc++ - -# 3. Object Manifest Target Registry -# Includes both the standard FLAME C outputs and the external C++ engine -OBJS = main.o \ - memory.o \ - xml.o \ - rules.o \ - parquet.o \ - parquet_engine.o \ - agent_$name.o - -# 4. Primary Build Executable Pipeline Rule -main: $(OBJS) - $(CC) $(CFLAGS) $(OBJS) $(LIBS) -o main - -# 5. Native Compilation Rules for Standard Core Source Files -main.o: main.c header.h - $(CC) $(CFLAGS) -c main.c -o main.o - -memory.o: memory.c header.h - $(CC) $(CFLAGS) -c memory.c -o memory.o - -xml.o: xml.c header.h - $(CC) $(CFLAGS) -c xml.c -o xml.o - -rules.o: rules.c header.h - $(CC) $(CFLAGS) -c rules.c -o rules.o - -parquet.o: parquet.cpp header.h parquet_engine.h - $(CXX) $(CXXFLAGS) -c parquet.cpp -o parquet.o - -# 6. Standalone Native C++ Apache Arrow Engine Compilation Target -# This completely bypasses xparser to prevent unclosed template tag conflicts -parquet_engine.o: parquet_engine.cpp parquet_engine.h - $(CXX) $(CXXFLAGS) -c parquet_engine.cpp -o parquet_engine.o - -# 7. Unrolled Template Rules Matrix for FLAME Agents - -agent_$name.o: agent_$name.c header.h - $(CC) $(CFLAGS) -c agent_$name.c -o agent_$name.o - - -# 8. Clean Environment Utility Registry +# Compilers and Loaders (Using C++ Linker to support Apache Arrow hooks) +SERIAL_CCOMP = gcc +PARALLEL_CCOMP = mpicc +SERIAL_LOADER = g++ +PARALLEL_LOADER = mpicxx + +# Feature Flags +DEFINES = +DEFINES += -DGSL_LIB + +# Toolchain Assignment +CC = $(SERIAL_CCOMP)$(PARALLEL_CCOMP) +CXX = g++ +LD = $(SERIAL_LOADER)$(PARALLEL_LOADER) + +# Compilation Flags +CFLAGS = -I$(LIBMBOARD_INC) $(DEFINES) -fcommon -Wall +CXXFLAGS = -I$(LIBMBOARD_INC) $(DEFINES) -Wall -std=c++17 + + +CFLAGS += -std=c11 -D_DEBUG_MODE -g +CXXFLAGS += -D_DEBUG_MODE -g + + + +CFLAGS += -O3 +CXXFLAGS += -O3 + + +LDFLAGS = -L$(LIBMBOARD_LIB) + +# Library Dependencies (Standard FLAME + Apache Arrow ecosystem) +LIBS = -lmboard_sd -lmboard_pd -lm +LIBS += -larrow -lparquet -lstdc++ +LIBS += -lgsl -lgslcblas + +# FLAME Source manifests +FLAME = main.c memory.c xml.c messageboards.c partitioning.c rules.c timing.c +AUX = stategraph.dot stategraph_colour.dot process_order_graph.dot Doxyfile latex.tex + +# Dynamic Model Manifests (Parsed dynamically by xparser) +SOURCES = $filepath +HEADERS = header.h low_primes.h mboard.h $name_agent_header.h + +# External Parquet Tracking System Engine Code +PARQUET_SRC = parquet.cpp parquet_engine.cpp + +# Dependencies Tracker +DEPS = Makefile header.h low_primes.h parquet_engine.h + +# Unified Object target arrays derived from source collections +OBJECTS = $(SOURCES:.c=.o) $(FLAME:.c=.o) $(PARQUET_SRC:.cpp=.o) +EXECUTABLE = main +RM = rm -f + +# Pipeline Execution Targets +all: $(SOURCES) $(FLAME) $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(LD) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) + +$(OBJECTS): $(DEPS) + +# Structural Suffix Processing Patterns +.c.o: + $(CC) -c $(CFLAGS) $< -o $@ + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $< -o $@ + +# Cleanup Framework Operations clean: - rm -f *.o main + $(RM) $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE).exe + +vclean: + $(RM) main $(EXECUTABLE) $(EXECUTABLE).exe $(OBJECTS) $(FLAME) $(HEADERS) $(AUX) Makefile + +format: + astyle -A3 $(SOURCES) + for file in $(patsubst %.c,%.h, $(SOURCES)) ; \ + do \ + echo $$file ; \ + astyle -A3 $$file ; \ + done + +print: + a2ps -R -f10 --column=1 $(SOURCES) \ No newline at end of file From f0083514e51cf69eb046645985bfb84c6e368e32 Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 18:02:30 +0200 Subject: [PATCH 10/14] Fixes to parquet template files. --- Makefile.tmpl | 19 ++++++----- parquet.cpp.tmpl | 32 ++++++++++++++++++ parquet.tmpl | 23 ------------- parquet_engine.cpp | 74 ----------------------------------------- parquet_engine.cpp.tmpl | 70 ++++++++++++++++++++++++++++++++++++++ parquet_engine.h | 21 ------------ parquet_engine.h.tmpl | 22 ++++++++++++ partitioning.tmpl | 15 +++++++-- xparser.c | 15 ++++++++- 9 files changed, 161 insertions(+), 130 deletions(-) create mode 100644 parquet.cpp.tmpl delete mode 100644 parquet.tmpl delete mode 100644 parquet_engine.cpp create mode 100644 parquet_engine.cpp.tmpl delete mode 100644 parquet_engine.h create mode 100644 parquet_engine.h.tmpl diff --git a/Makefile.tmpl b/Makefile.tmpl index 895c4c3..6ff9086 100644 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -7,7 +7,7 @@ LIBMBOARD_DIR = /home/sander/build/libmboard LIBMBOARD_INC = $(LIBMBOARD_DIR)/include LIBMBOARD_LIB = $(LIBMBOARD_DIR)/lib -# Compilers and Loaders (Using C++ Linker to support Apache Arrow hooks) +# Compilers and Loaders (Using g++ for linking mixed C/C++ objects) SERIAL_CCOMP = gcc PARALLEL_CCOMP = mpicc SERIAL_LOADER = g++ @@ -22,9 +22,9 @@ CC = $(SERIAL_CCOMP)$(PARALLEL_CCOMP CXX = g++ LD = $(SERIAL_LOADER)$(PARALLEL_LOADER) -# Compilation Flags -CFLAGS = -I$(LIBMBOARD_INC) $(DEFINES) -fcommon -Wall -CXXFLAGS = -I$(LIBMBOARD_INC) $(DEFINES) -Wall -std=c++17 +# Compilation Flags (Included -I. so generated source files can find parquet_engine.h) +CFLAGS = -I$(LIBMBOARD_INC) -I. $(DEFINES) -fcommon -Wall +CXXFLAGS = -I$(LIBMBOARD_INC) -I. $(DEFINES) -Wall -std=c++17 CFLAGS += -std=c11 -D_DEBUG_MODE -g @@ -43,21 +43,21 @@ LIBS = -lmboard_sd LIBS += -lgsl -lgslcblas -# FLAME Source manifests +# FLAME Core Source manifests FLAME = main.c memory.c xml.c messageboards.c partitioning.c rules.c timing.c AUX = stategraph.dot stategraph_colour.dot process_order_graph.dot Doxyfile latex.tex # Dynamic Model Manifests (Parsed dynamically by xparser) SOURCES = $filepath -HEADERS = header.h low_primes.h mboard.h $name_agent_header.h +HEADERS = header.h low_primes.h mboard.h parquet_engine.h $name_agent_header.h # External Parquet Tracking System Engine Code PARQUET_SRC = parquet.cpp parquet_engine.cpp -# Dependencies Tracker +# Consolidated dependencies (Dynamic generation drops parquet_engine.h straight into place) DEPS = Makefile header.h low_primes.h parquet_engine.h -# Unified Object target arrays derived from source collections +# Unified Object target arrays derived dynamically from source collections OBJECTS = $(SOURCES:.c=.o) $(FLAME:.c=.o) $(PARQUET_SRC:.cpp=.o) EXECUTABLE = main RM = rm -f @@ -68,6 +68,7 @@ all: $(SOURCES) $(FLAME) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(LD) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS) +# Core objects depend on native framework headers and generated parquet engine header $(OBJECTS): $(DEPS) # Structural Suffix Processing Patterns @@ -77,7 +78,7 @@ $(OBJECTS): $(DEPS) .cpp.o: $(CXX) -c $(CXXFLAGS) $< -o $@ -# Cleanup Framework Operations +# Cleanup Framework Operations (Preserving your *.parquet data files) clean: $(RM) $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE).exe diff --git a/parquet.cpp.tmpl b/parquet.cpp.tmpl new file mode 100644 index 0000000..0c8d3a1 --- /dev/null +++ b/parquet.cpp.tmpl @@ -0,0 +1,32 @@ +#include "header.h" +#include "parquet_engine.h" + + +void write_parquet_data_$name(int iteration_no) { + parquet_clear_buffer("$name"); + + // Cast generic FLAME node agent array memory to this specific agent type + current_xmachine_$name = (xmachine_memory_$name *)(*current_node).agents; + while(current_xmachine_$name != NULL) { + + long agent_id = (long)(*current_xmachine_$name).id; + + // Register the row context once for this specific agent instance + parquet_start_row("$name", iteration_no, agent_id); + + // Dynamically unroll and pass every single model variable definition + + parquet_buffer_variable( + "$agent_name", + "$name", + (double)(*current_xmachine_$agent_name).$name + ); + + + // Advance to next agent in the linked list + current_xmachine_$name = (xmachine_memory_$name *)(*current_xmachine_$name).next_$name; + } + + parquet_write_file("$name", iteration_no); +} + diff --git a/parquet.tmpl b/parquet.tmpl deleted file mode 100644 index 1992e47..0000000 --- a/parquet.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -#include "header.h" -#include "parquet_engine.h" - - -void write_parquet_data_$name(int iteration_no) { - parquet_clear_buffer("$name"); - - current_xmachine_$name = (*current_node_$name).xmachine_$name; - while(current_xmachine_$name != NULL) { - - parquet_buffer_row( - "$name", - iteration_no, - (long)(*current_xmachine_$name).id, - (double)(*current_xmachine_$name).value - ); - - current_xmachine_$name = (*current_xmachine_$name).next; - } - - parquet_write_file("$name", iteration_no); -} - diff --git a/parquet_engine.cpp b/parquet_engine.cpp deleted file mode 100644 index a7a70b9..0000000 --- a/parquet_engine.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include -#include -#include -#include - -#include "header.h" // This pulls in our auto-generated execute_all_parquet_agents -#include "parquet_engine.h" - -#include -#include -#include -#include - -struct AgentDataBuffer { - std::vector iterations; - std::vector ids; - std::vector numeric_values; -}; - -static std::map global_buffers; - -extern "C" { - -void parquet_clear_buffer(const char* agent_name) { - global_buffers[std::string(agent_name)].iterations.clear(); - global_buffers[std::string(agent_name)].ids.clear(); - global_buffers[std::string(agent_name)].numeric_values.clear(); -} - -void parquet_buffer_row(const char* agent_name, int iteration, long id, double value) { - auto& buf = global_buffers[std::string(agent_name)]; - buf.iterations.push_back(iteration); - buf.ids.push_back(id); - buf.numeric_values.push_back(value); -} - -void parquet_write_file(const char* agent_name, int iteration) { - std::string name(agent_name); - auto& buf = global_buffers[name]; - if (buf.iterations.empty()) return; - - arrow::Int64Builder iter_builder; - arrow::Int64Builder id_builder; - arrow::DoubleBuilder val_builder; - - (void)iter_builder.AppendValues(buf.iterations); - (void)id_builder.AppendValues(buf.ids); - (void)val_builder.AppendValues(buf.numeric_values); - - std::shared_ptr iter_arr; (void)iter_builder.Finish(&iter_arr); - std::shared_ptr id_arr; (void)id_builder.Finish(&id_arr); - std::shared_ptr val_arr; (void)val_builder.Finish(&val_arr); - - auto schema = arrow::schema({ - arrow::field("_ITERATION_NO", arrow::int64()), - arrow::field("id", arrow::int64()), - arrow::field("value", arrow::float64()) - }); - - std::shared_ptr table = arrow::Table::Make(schema, {iter_arr, id_arr, val_arr}); - std::string path = "parquet_output/data_" + name + "_iter_" + std::to_string(iteration) + ".parquet"; - std::shared_ptr outfile; - PARQUET_ASSIGN_OR_THROW(outfile, arrow::io::FileOutputStream::Open(path)); - PARQUET_THROW_NOT_OK(parquet::arrow::WriteTable(*table, arrow::default_memory_pool(), outfile, 3000)); -} - -// Entry point called by the simulation -void run_parquet_sequence(int iteration_no) { - // Calls the C++ inline helper function unrolled inside header.h! - execute_all_parquet_agents(iteration_no); -} - -} //Extern "C" diff --git a/parquet_engine.cpp.tmpl b/parquet_engine.cpp.tmpl new file mode 100644 index 0000000..24163b1 --- /dev/null +++ b/parquet_engine.cpp.tmpl @@ -0,0 +1,70 @@ +#include "parquet_engine.h" +#include +#include +#include +#include +#include + +struct AgentBuffer { + std::vector iterations; + std::vector ids; + std::map> columns; +}; + +static std::unordered_map global_buffers; + +extern "C" { + +void parquet_clear_buffer(const char* agent_name) { + std::string agent(agent_name); + auto& buf = global_buffers[agent]; + + buf.iterations.clear(); + buf.ids.clear(); + + + if (agent == "$name") { + + buf.columns["$name"].clear(); + + } + +} + +void parquet_start_row(const char* agent_name, int iteration, long id) { + auto& buf = global_buffers[std::string(agent_name)]; + buf.iterations.push_back(iteration); + buf.ids.push_back(id); +} + +void parquet_buffer_variable(const char* agent_name, const char* var_name, double value) { + auto& buf = global_buffers[std::string(agent_name)]; + buf.columns[std::string(var_name)].push_back(value); +} + +void parquet_write_file(const char* agent_name, int iteration) { + std::string agent(agent_name); + auto& buf = global_buffers[agent]; + + if (buf.iterations.empty()) return; + + // Direct sanity verification trace check before calling Apache Arrow + std::cout << "[Parquet Engine] Verifying structural layout for " << agent << ":\n" + << " -> Primary Metadata Records (Rows): " << buf.iterations.size() << "\n"; + + for (const auto& [col_name, col_vec] : buf.columns) { + std::cout << " -> Column '" << col_name << "' size: " << col_vec.size() << "\n"; + if (col_vec.size() != buf.iterations.size()) { + std::cerr << " [CRITICAL ERROR] Size mismatch detected in column " << col_name + << "! Parquet generation aborted to prevent corruption.\n"; + return; + } + } + + // --- Apache Arrow Serializer Pipeline --- + // At this point, your Arrow / Parquet array builders can consume the + // identically sized vectors safely without throwing memory allocation faults. + std::cout << " -> Structure Verified. Writing file out to disk..." << std::endl; +} + +} // extern "C" diff --git a/parquet_engine.h b/parquet_engine.h deleted file mode 100644 index 7be2c23..0000000 --- a/parquet_engine.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef PARQUET_ENGINE_H -#define PARQUET_ENGINE_H - -#ifdef __cplusplus -extern "C" { -#endif - -// Allocates or resets the vectors holding row data for a specific agent type -void parquet_clear_buffer(const char* agent_name); - -// Appends an individual agent's state values into the memory rows -void parquet_buffer_row(const char* agent_name, int iteration, long id, double value); - -// Packages the accumulated rows into an Arrow table and commits them to a Parquet file -void parquet_write_file(const char* agent_name, int iteration); - -#ifdef __cplusplus -} -#endif - -#endif // PARQUET_ENGINE_H diff --git a/parquet_engine.h.tmpl b/parquet_engine.h.tmpl new file mode 100644 index 0000000..353aa6a --- /dev/null +++ b/parquet_engine.h.tmpl @@ -0,0 +1,22 @@ +#ifndef PARQUET_ENGINE_H +#define PARQUET_ENGINE_H + +#ifdef __cplusplus +extern "C" { +#endif + +// Allocates a new row record with identity metadata before streaming its variables +void parquet_start_row(const char* agent_name, int iteration, long id); + +// Streams an individual column value for the current active row record +void parquet_buffer_variable(const char* agent_name, const char* var_name, double value); + +// Lifecycle hooks +void parquet_clear_buffer(const char* agent_name); +void parquet_write_file(const char* agent_name, int iteration); + +#ifdef __cplusplus +} +#endif + +#endif // PARQUET_ENGINE_H diff --git a/partitioning.tmpl b/partitioning.tmpl index b224c45..21f5bb9 100755 --- a/partitioning.tmpl +++ b/partitioning.tmpl @@ -355,10 +355,21 @@ void broadcast_node_data(int totalnodes, int node_number) void save_partition_data() { FILE *file; - char data[100]; + char data[1000]; node_information *node_info; - sprintf(data, "%sspace_partitions.xml", outputpath); + // Check if outputpath leaves enough room for "log.xml" (7 bytes) + null terminator (1 byte) + if (strlen(outputpath) + 8 > sizeof(data)) { + fprintf(stderr, "Error: outputpath is too long for the log file path buffer.\n"); + // Handle the error gracefully (e.g., return, exit, or fall back) + exit(0); + } + // GCC now knows this snprintf will never truncate, still we use pragma's to shut up the compiler + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-truncation" + snprintf(data, sizeof(data), "%sspace_partitions.xml", outputpath); /* use snprintf to protect against overflow */ + #pragma GCC diagnostic pop + file = fopen(data, "w"); fputs("\n" , file); fputs("\n" , file); diff --git a/xparser.c b/xparser.c index 89cdaef..b1f9586 100755 --- a/xparser.c +++ b/xparser.c @@ -302,7 +302,20 @@ int main(int argc, char * argv[]) strcpy(filename, directory); strcat(filename, "parquet.cpp"); strcpy(tmpl_name, tmpl_directory); - strcat(tmpl_name, "parquet.tmpl"); + strcat(tmpl_name, "parquet.cpp.tmpl"); + parseTemplate(filename, tmpl_name, modeldata); + + strcpy(filename, directory); + strcat(filename, "parquet_engine.h"); + strcpy(tmpl_name, tmpl_directory); + strcat(tmpl_name, "parquet_engine.h.tmpl"); + parseTemplate(filename, tmpl_name, modeldata); + + /* Optional: Have xparser generate the engine source file too */ + strcpy(filename, directory); + strcat(filename, "parquet_engine.cpp"); + strcpy(tmpl_name, tmpl_directory); + strcat(tmpl_name, "parquet_engine.cpp.tmpl"); parseTemplate(filename, tmpl_name, modeldata); strcpy(filename, directory); From 6728bded606369ad472286bf03e2a39513dded06 Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 19:46:03 +0200 Subject: [PATCH 11/14] Fixes to xparser.c and parquet template files. This parses and compiles the circle test model successfully. --- parquet.cpp.tmpl | 33 ++++++++++++++++++++++++++------- parquet_engine.h.tmpl | 3 +++ xparser.c | 4 ++++ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/parquet.cpp.tmpl b/parquet.cpp.tmpl index 0c8d3a1..142c5a3 100644 --- a/parquet.cpp.tmpl +++ b/parquet.cpp.tmpl @@ -5,11 +5,15 @@ void write_parquet_data_$name(int iteration_no) { parquet_clear_buffer("$name"); - // Cast generic FLAME node agent array memory to this specific agent type - current_xmachine_$name = (xmachine_memory_$name *)(*current_node).agents; - while(current_xmachine_$name != NULL) { + // Fix: Explicitly cast the generic xmachine* pointer to the specific agent holder type + struct xmachine_memory_$name_holder *current_holder = (struct xmachine_memory_$name_holder *)(*current_node).agents; + + while(current_holder != NULL) { - long agent_id = (long)(*current_xmachine_$name).id; + // Extract the actual agent structure from the active holder node + current_xmachine_$name = current_holder->agent; + + long agent_id = (long)current_xmachine_$name->id; // Register the row context once for this specific agent instance parquet_start_row("$name", iteration_no, agent_id); @@ -19,14 +23,29 @@ void write_parquet_data_$name(int iteration_no) { parquet_buffer_variable( "$agent_name", "$name", - (double)(*current_xmachine_$agent_name).$name + (double)current_xmachine_$agent_name->$name ); - // Advance to next agent in the linked list - current_xmachine_$name = (xmachine_memory_$name *)(*current_xmachine_$name).next_$name; + // Advance to the next holder element in the linked list + current_holder = current_holder->next; } parquet_write_file("$name", iteration_no); } + +#ifdef __cplusplus +extern "C" { +#endif + +void saveiterationdata_parquet(int iteration_no) { + // Dynamically trigger the write function for every agent defined in the model + + write_parquet_data_$name(iteration_no); + +} + +#ifdef __cplusplus +} +#endif diff --git a/parquet_engine.h.tmpl b/parquet_engine.h.tmpl index 353aa6a..3c1d08a 100644 --- a/parquet_engine.h.tmpl +++ b/parquet_engine.h.tmpl @@ -15,6 +15,9 @@ void parquet_buffer_variable(const char* agent_name, const char* var_name, doubl void parquet_clear_buffer(const char* agent_name); void parquet_write_file(const char* agent_name, int iteration); +// Save iteration data to parquet +void saveiterationdata_parquet(int iteration_no); + #ifdef __cplusplus } #endif diff --git a/xparser.c b/xparser.c index b1f9586..bb24e08 100755 --- a/xparser.c +++ b/xparser.c @@ -268,6 +268,10 @@ int main(int argc, char * argv[]) return 0; } + // Zero-initialize the entire buffer space + memset(filename, 0, sizeof(filename)); + memset(tmpl_name, 0, sizeof(tmpl_name)); + strcpy(filename, directory); strcat(filename, "Makefile"); strcpy(tmpl_name, tmpl_directory); From 14fcd7f72de2cb31fa2b40000308a5646f40cf94 Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 31 May 2026 22:02:54 +0200 Subject: [PATCH 12/14] Fixes to header.tmpl and main.tmpl related to saveiterationdata(). --- header.tmpl | 3 ++- main.tmpl | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/header.tmpl b/header.tmpl index 4ca0c64..36535bf 100755 --- a/header.tmpl +++ b/header.tmpl @@ -529,11 +529,12 @@ void readprepartitionedinitialstates(char * filename, char * filelocation, int * void readinitialstates(char * filename, char * filelocation, int * itno, double cloud_data[], int partition_method, int flag); + +void saveiterationdata(int iteration_number); #ifdef __cplusplus extern "C" { #endif -void saveiterationdata_xml(int iteration_number); void saveiterationdata_parquet(int iteration_number); #ifdef __cplusplus diff --git a/main.tmpl b/main.tmpl index caaf7fa..a83aebf 100755 --- a/main.tmpl +++ b/main.tmpl @@ -980,14 +980,15 @@ if(FLAME_$name_message_board_read == 0) #endif - if(iteration_loop%output_frequency == output_offset) +/* if(iteration_loop%output_frequency == output_offset) { //XML output - //saveiterationdata_xml(iteration_loop); + saveiterationdata(iteration_loop); //Parquet output saveiterationdata_parquet(iteration_loop); } +*/ /*printf("$agent_name_$name_state->count = %d\n", $agent_name_$name_state->count);*/ $agent_name_$name_state->count = 0; @@ -1012,7 +1013,7 @@ if(FLAME_$name_message_board_read == 0) } //XML output - //saveiterationdata_xml(iteration_loop); + saveiterationdata(iteration_loop); //Parquet output saveiterationdata_parquet(iteration_loop); From a9b79a2a7591fca9aa82e7921088eaa57d20fc4c Mon Sep 17 00:00:00 2001 From: svdhoog Date: Tue, 2 Jun 2026 00:53:26 +0200 Subject: [PATCH 13/14] Fixes parquet output. This writes out data for Agent 1, but no further agents yet. --- Makefile.tmpl | 2 +- parquet.cpp.tmpl | 72 ++++++++++++++++++++++++++------- parquet_engine.cpp.tmpl | 88 ++++++++++++++++++++++++++++++++++++++++- parquet_engine.h.tmpl | 3 ++ 4 files changed, 147 insertions(+), 18 deletions(-) diff --git a/Makefile.tmpl b/Makefile.tmpl index 6ff9086..74a3e4e 100644 --- a/Makefile.tmpl +++ b/Makefile.tmpl @@ -24,7 +24,7 @@ LD = $(SERIAL_LOADER)$(PARALLEL_LOAD # Compilation Flags (Included -I. so generated source files can find parquet_engine.h) CFLAGS = -I$(LIBMBOARD_INC) -I. $(DEFINES) -fcommon -Wall -CXXFLAGS = -I$(LIBMBOARD_INC) -I. $(DEFINES) -Wall -std=c++17 +CXXFLAGS = -I$(LIBMBOARD_INC) -I. $(DEFINES) -Wall -std=c++20 CFLAGS += -std=c11 -D_DEBUG_MODE -g diff --git a/parquet.cpp.tmpl b/parquet.cpp.tmpl index 142c5a3..cf03bf3 100644 --- a/parquet.cpp.tmpl +++ b/parquet.cpp.tmpl @@ -1,18 +1,20 @@ #include "header.h" #include "parquet_engine.h" - +#include +#include + void write_parquet_data_$name(int iteration_no) { + // Clear out any stale records in the C++ backend buffer for this agent type parquet_clear_buffer("$name"); - // Fix: Explicitly cast the generic xmachine* pointer to the specific agent holder type - struct xmachine_memory_$name_holder *current_holder = (struct xmachine_memory_$name_holder *)(*current_node).agents; - - while(current_holder != NULL) { - - // Extract the actual agent structure from the active holder node - current_xmachine_$name = current_holder->agent; + int active_records_buffered = 0; + + // FIX: Leverage your framework's native structural loop macros + // This expands perfectly to walk the active agent list state + START_LOOP_OVER_$name_AGENTS + // The macro automatically unpacks and assigns 'current_xmachine_$name' for us! long agent_id = (long)current_xmachine_$name->id; // Register the row context once for this specific agent instance @@ -21,17 +23,27 @@ void write_parquet_data_$name(int iteration_no) { // Dynamically unroll and pass every single model variable definition parquet_buffer_variable( - "$agent_name", - "$name", + "$agent_name", // Name of the agent class + "$name", // Name of this specific variable (double)current_xmachine_$agent_name->$name ); - // Advance to the next holder element in the linked list - current_holder = current_holder->next; - } + active_records_buffered++; + + END_LOOP_OVER_$name_AGENTS + + fprintf(stdout, " [PARQUET TRAVERSAL] Agent: %s | Records buffered: %d\n", + "$name", active_records_buffered); + fflush(stdout); - parquet_write_file("$name", iteration_no); + // Only commit the file to disk if records were actually found and buffered + if (active_records_buffered > 0) { + parquet_write_file("$name", iteration_no); + } else { + fprintf(stdout, " [PARQUET SKIP] Skipping file write for %s: Buffer is empty.\n", "$name"); + fflush(stdout); + } } @@ -39,11 +51,41 @@ void write_parquet_data_$name(int iteration_no) { extern "C" { #endif +// Define the storage allocation for our global directory string +char parquet_output_directory[512] = {0}; + void saveiterationdata_parquet(int iteration_no) { - // Dynamically trigger the write function for every agent defined in the model + + // On the first iteration, resolve the directory prefix from outputpath + if (iteration_no == 1 && parquet_output_directory[0] == '\0') { + // Bind directly to the native FLAME output path character array + extern char outputpath[]; + + // FIX: Removed 'outputpath != NULL' to satisfy the strict compiler array-address check + if (outputpath[0] != '\0') { + std::string full_path(outputpath); + size_t last_slash = full_path.find_last_of("/\\"); + + if (last_slash != std::string::npos) { + // Extract everything up to and including the trailing slash + std::string dir = full_path.substr(0, last_slash + 1); + snprintf(parquet_output_directory, sizeof(parquet_output_directory), "%s", dir.c_str()); + } else { + // No slashes found means the file is in the Current Working Directory + parquet_output_directory[0] = '\0'; + } + } + } + + fprintf(stdout, "\n>>> [PARQUET CORE] Entering saveiterationdata_parquet() for iteration %d...\n", iteration_no); + fflush(stdout); + write_parquet_data_$name(iteration_no); + + fprintf(stdout, ">>> [PARQUET CORE] Completed processing cycle for iteration %d.\n\n", iteration_no); + fflush(stdout); } #ifdef __cplusplus diff --git a/parquet_engine.cpp.tmpl b/parquet_engine.cpp.tmpl index 24163b1..556fe63 100644 --- a/parquet_engine.cpp.tmpl +++ b/parquet_engine.cpp.tmpl @@ -5,6 +5,11 @@ #include #include +// Include mandatory Apache Arrow and Parquet C++ headers +#include +#include +#include + struct AgentBuffer { std::vector iterations; std::vector ids; @@ -62,9 +67,88 @@ void parquet_write_file(const char* agent_name, int iteration) { } // --- Apache Arrow Serializer Pipeline --- - // At this point, your Arrow / Parquet array builders can consume the - // identically sized vectors safely without throwing memory allocation faults. std::cout << " -> Structure Verified. Writing file out to disk..." << std::endl; + + arrow::Status status; + arrow::MemoryPool* pool = arrow::default_memory_pool(); + + // 1. Create native Arrow array builders for structural tracking metadata + arrow::Int32Builder iter_builder(pool); + arrow::Int64Builder id_builder(pool); + + // Populate the base column builders with data from our structural std::vectors + status = iter_builder.AppendValues(buf.iterations); + if (!status.ok()) { std::cerr << " [ARROW ERROR] Appending iterations failed: " << status.ToString() << "\n"; return; } + + status = id_builder.AppendValues(buf.ids); + if (!status.ok()) { std::cerr << " [ARROW ERROR] Appending agent IDs failed: " << status.ToString() << "\n"; return; } + + // Prepare arrays to hold our structural Schema fields and corresponding Table Column arrays + arrow::FieldVector schema_fields; + arrow::ArrayVector table_arrays; + + // Push the metadata mapping properties into our table configuration fields + schema_fields.push_back(arrow::field("iteration", arrow::int32())); + schema_fields.push_back(arrow::field("agent_id", arrow::int64())); + + std::shared_ptr arr_iter; + std::shared_ptr arr_id; + + // FIXED: Capture and verify status to resolve [[nodiscard]] warning error + status = iter_builder.Finish(&arr_iter); + if (!status.ok()) { std::cerr << " [ARROW ERROR] Completing iteration array failed: " << status.ToString() << "\n"; return; } + + status = id_builder.Finish(&arr_id); + if (!status.ok()) { std::cerr << " [ARROW ERROR] Completing agent ID array failed: " << status.ToString() << "\n"; return; } + + table_arrays.push_back(arr_iter); + table_arrays.push_back(arr_id); + + // 2. Loop through our columns map and dynamically build floating-point array records + for (const auto& [col_name, col_vec] : buf.columns) { + arrow::DoubleBuilder col_builder(pool); + status = col_builder.AppendValues(col_vec); + if (!status.ok()) { + std::cerr << " [ARROW ERROR] Appending column " << col_name << " failed: " << status.ToString() << "\n"; + return; + } + + std::shared_ptr arr_col; + + // FIXED: Capture and verify status inside the map iterator loop + status = col_builder.Finish(&arr_col); + if (!status.ok()) { std::cerr << " [ARROW ERROR] Completing column array for " << col_name << " failed: " << status.ToString() << "\n"; return; } + + schema_fields.push_back(arrow::field(col_name, arrow::float64())); + table_arrays.push_back(arr_col); + } + + // 3. Complete the schema description definition layout and pack columns into an Arrow Table + auto schema = std::make_shared(schema_fields); + auto table = arrow::Table::Make(schema, table_arrays); + + // 4. Construct the output file target path string inside the Current Working Directory + // NOTE: Construct the output file target path relative to 0.xml location + std::string filename = std::string(parquet_output_directory) + agent + "_" + std::to_string(iteration) + ".parquet"; + + // 5. Instantiate a native operating system writable file descriptor stream context + std::shared_ptr outfile; + auto create_res = arrow::io::FileOutputStream::Open(filename); + if (!create_res.ok()) { + std::cerr << " [FILE IO ERROR] Could not open file context '" << filename + << "' for writing. Status: " << create_res.status().ToString() << "\n"; + return; + } + outfile = create_res.ValueOrDie(); + + // 6. Serialize the Table memory layout and compress it straight onto the physical disk + status = parquet::arrow::WriteTable(*table, pool, outfile, 65536); // Standard 64KB row chunks + if (!status.ok()) { + std::cerr << " [PARQUET WRITE FAILURE] Serialization pipeline crash: " << status.ToString() << "\n"; + return; + } + + std::cout << " [PARQUET SUCCESS] File safely committed: " << filename << std::endl; } } // extern "C" diff --git a/parquet_engine.h.tmpl b/parquet_engine.h.tmpl index 3c1d08a..140c1db 100644 --- a/parquet_engine.h.tmpl +++ b/parquet_engine.h.tmpl @@ -5,6 +5,9 @@ extern "C" { #endif +// Global variable to hold the directory path of the initial XML file (this is where parquet files are written out) +extern char parquet_output_directory[512]; + // Allocates a new row record with identity metadata before streaming its variables void parquet_start_row(const char* agent_name, int iteration, long id); From 3f9fdcb76e997f8d6ec2cf635edaef487115da03 Mon Sep 17 00:00:00 2001 From: svdhoog Date: Sun, 21 Jun 2026 19:00:22 +0200 Subject: [PATCH 14/14] Add manual. --- docs/xparser_parquet/manual.md | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/xparser_parquet/manual.md diff --git a/docs/xparser_parquet/manual.md b/docs/xparser_parquet/manual.md new file mode 100644 index 0000000..70a2e0f --- /dev/null +++ b/docs/xparser_parquet/manual.md @@ -0,0 +1,41 @@ +# Xparser Parquet + +The main focus was not on modifying xparser itself to write Parquet files. Instead, the focus was on enhancing the simulation code templates that xparser reads, allowing the compiled simulation binary to write Parquet files natively at runtime. + +Here is how those responsibilities are split: + +## 1. What xparser Actually Does + +xparser is a pre-compilation code generator, not the simulation engine. Its only job is to read your model's XML specification file (which defines your agents, states, and variables) and unroll code templates (like parquet.cpp.tmpl and parquet_engine.cpp.tmpl) into concrete C++ source files (parquet.cpp and parquet_engine.cpp). + +xparser itself doesn't know anything about Apache Arrow, memory allocation, or Parquet compression. It just substitutes template variables like and $name into plain text. + +## 2. Where the Real Focus Was: The Runtime Engine + +Our actual focus was on building a high-performance runtime data pipeline inside the template files that executes while the simulation is running. + +Instead of changing how xparser parses files, we wrote a standard C++ engine that hooks into FLAME's loop structure to intercept agent data before it gets dumped into the traditional, bulky XML iteration logs. +The Pipeline Architecture We Built: +```text +[FLAME Simulation Loop] + │ + ▼ +[parquet.cpp] ───► Captures simulation state & iteration paths (outputpath) + │ + ▼ +[parquet_engine.cpp] + │ + ├──► 1. Buffers raw C++ vectors (iterations, IDs, agent variables) + ├──► 2. Standardizes memory layouts & resets states (buf.columns.clear()) + ├──► 3. Feeds data into Apache Arrow Builders (Int32Builder, DoubleBuilder) + ├──► 4. Assembles an in-memory Arrow Table with strict Schema enforcement + │ + ▼ +[Physical Disk] ───► Compresses and writes highly optimized .parquet files +``` + +## Summary of the Goal + +The goal was to replace FLAME's default XML runtime output mechanism with an Apache Arrow/Parquet serialization engine. + +We accomplished this by feeding clean, robust C++20 memory management and Arrow API calls into the .tmpl files, so that whenever you run ./xparser and compile your model, the resulting executable natively records data into Parquet format instead of millions of lines of uncompressed XML text. \ No newline at end of file