diff --git a/examples/minimal/CMakeLists.txt b/examples/minimal/CMakeLists.txt new file mode 100644 index 0000000..bb09e34 --- /dev/null +++ b/examples/minimal/CMakeLists.txt @@ -0,0 +1,22 @@ +#### +# Set minimum version of CMake. +cmake_minimum_required(VERSION 3.13) + +find_package(spdlog) + +set(EXAMPLE_NAME "minimal") + +project(${EXAMPLE_NAME} LANGUAGES CXX) + +file(GLOB EXAMPLE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cc") + +create_executable( + NAME ${EXAMPLE_NAME} + SOURCES ${EXAMPLE_SOURCES} + PUBLIC_DEFINITIONS USE_DOUBLE_PRECISION=1 + PRIVATE_DEFINITIONS DEBUG_VERBOSE + PRIVATE_INCLUDE_PATHS ${CMAKE_SOURCE_DIR}/include + PUBLIC_LINKED_TARGETS fmt spdlog::spdlog kami::libkami +) + +set_target_properties(${EXAMPLE_NAME} PROPERTIES VERSION ${VERSION_STRING}) diff --git a/examples/minimal/minimal.cc b/examples/minimal/minimal.cc new file mode 100644 index 0000000..10bbc28 --- /dev/null +++ b/examples/minimal/minimal.cc @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2023 The Johns Hopkins University Applied Physics + * Laboratory LLC + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +class MinimumAgent + : public kami::Agent { +public: + kami::AgentID step(std::shared_ptr model) override { + return this->get_agent_id(); + } +}; + +class MinimumModel + : public kami::Model { +public: + MinimumModel() { + _sched = std::make_shared(); + _pop = std::make_shared(); + + for (auto i = 0; i < 10; i++) { + auto new_agent = std::make_shared(); + _pop->add_agent(new_agent); + } + } +}; + +int main() { + auto model = std::make_shared(); + + for (int i = 0; i < 10; i++) + model->step(); + + return 0; +}