From 431a4ac8cfb499ff50fd25832b08c58af80601c1 Mon Sep 17 00:00:00 2001 From: "James P. Howard, II" Date: Sun, 22 Jan 2023 20:45:46 -0500 Subject: [PATCH] style(includes): automatic reformatting --- include/kami/agent.h | 33 ++++++++--- include/kami/domain.h | 5 +- include/kami/grid.h | 9 ++- include/kami/grid1d.h | 81 ++++++++++++++++++++------- include/kami/grid2d.h | 111 +++++++++++++++++++++++++++---------- include/kami/kami.h | 4 +- include/kami/model.h | 3 +- include/kami/multigrid1d.h | 13 ++++- include/kami/multigrid2d.h | 15 ++++- include/kami/population.h | 2 +- include/kami/random.h | 4 +- include/kami/reporter.h | 14 +++-- include/kami/sequential.h | 3 +- include/kami/sologrid1d.h | 13 ++++- include/kami/sologrid2d.h | 15 ++++- include/kami/staged.h | 18 ++++-- 16 files changed, 257 insertions(+), 86 deletions(-) diff --git a/include/kami/agent.h b/include/kami/agent.h index 2d8e48f..71d9765 100644 --- a/include/kami/agent.h +++ b/include/kami/agent.h @@ -80,7 +80,10 @@ namespace kami { * @param rhs is the right-hand side of the equality test. * @return true is they are equal and false if not. */ - friend bool operator==(const AgentID &lhs, const AgentID &rhs); + friend bool operator==( + const AgentID& lhs, + const AgentID& rhs + ); /** * @brief Test if two `AgentID` instances are not equal. @@ -89,7 +92,10 @@ namespace kami { * @param rhs is the right-hand side of the equality test. * @return true is they are not equal and false if they are. */ - friend bool operator!=(const AgentID &lhs, const AgentID &rhs); + friend bool operator!=( + const AgentID& lhs, + const AgentID& rhs + ); /** * @brief Test if one AgentID is less than another. @@ -103,7 +109,10 @@ namespace kami { * @return true if `lhs` is "less than" `rhs` as determined by the * underlying implementation of the `AgentID`. */ - friend bool operator<(const AgentID &lhs, const AgentID &rhs); + friend bool operator<( + const AgentID& lhs, + const AgentID& rhs + ); /** * @brief Output an AgentID to the specified output stream @@ -115,7 +124,10 @@ namespace kami { * @param rhs is the `AgentID` to output * @return the output stream for reuse */ - friend std::ostream &operator<<(std::ostream &lhs, const AgentID &rhs); + friend std::ostream& operator<<( + std::ostream& lhs, + const AgentID& rhs + ); }; /** @@ -165,7 +177,10 @@ namespace kami { * Subclasses of Agent may chose to extend this operator to tighten * the restrictions on the comparison. */ - friend bool operator==(const Agent &lhs, const Agent &rhs); + friend bool operator==( + const Agent& lhs, + const Agent& rhs + ); /** * @brief Compare if two `Agent`s are not the same `Agent`. @@ -181,7 +196,10 @@ namespace kami { * Subclasses of `Agent` may chose to extend this operator to tighten * the restrictions on the comparison. */ - friend bool operator!=(const Agent &lhs, const Agent &rhs); + friend bool operator!=( + const Agent& lhs, + const Agent& rhs + ); }; /** @@ -196,7 +214,8 @@ namespace kami { * * `StagedAgents` must implement both the `step()` and `advance()` functions. */ - class LIBKAMI_EXPORT StagedAgent : public Agent { + class LIBKAMI_EXPORT StagedAgent + : public Agent { public: /** * @brief Post-step advance the agent diff --git a/include/kami/domain.h b/include/kami/domain.h index 7bb4df0..418f060 100644 --- a/include/kami/domain.h +++ b/include/kami/domain.h @@ -82,7 +82,10 @@ namespace kami { * @param rhs is the `Coord` to output * @return the output stream for reuse */ - friend std::ostream &operator<<(std::ostream &lhs, const Coord &rhs); + friend std::ostream& operator<<( + std::ostream& lhs, + const Coord& rhs + ); }; } // namespace kami diff --git a/include/kami/grid.h b/include/kami/grid.h index 332d805..f8f49e1 100644 --- a/include/kami/grid.h +++ b/include/kami/grid.h @@ -103,14 +103,17 @@ namespace kami { * rectilinear grid where the cells are equal size and laid out in an ordered * fashion. */ - class LIBKAMI_EXPORT GridDomain : public Domain {}; + class LIBKAMI_EXPORT GridDomain + : public Domain { + }; /** * @brief An abstract for gridded coordinates. * * @details All gridded coordinates are expected to subclass `GridCoord`. */ - class LIBKAMI_EXPORT GridCoord : public Coord { + class LIBKAMI_EXPORT GridCoord + : public Coord { public: @@ -129,7 +132,7 @@ namespace kami { * * @returns the distance as a `double` */ - virtual double distance(std::shared_ptr &p) const = 0; + virtual double distance(std::shared_ptr& p) const = 0; }; diff --git a/include/kami/grid1d.h b/include/kami/grid1d.h index c192a02..dfcec23 100644 --- a/include/kami/grid1d.h +++ b/include/kami/grid1d.h @@ -47,7 +47,8 @@ namespace kami { /** * @brief One-dimensional coordinates */ - class LIBKAMI_EXPORT GridCoord1D : public GridCoord { + class LIBKAMI_EXPORT GridCoord1D + : public GridCoord { public: /** * @brief Constructor for one-dimensional coordinates @@ -84,32 +85,47 @@ namespace kami { * * @returns the distance as a `double` */ - double distance(std::shared_ptr &p) const override; + double distance(std::shared_ptr& p) const override; /** * @brief Test if two coordinates are equal */ - friend bool operator==(const GridCoord1D &lhs, const GridCoord1D &rhs); + friend bool operator==( + const GridCoord1D& lhs, + const GridCoord1D& rhs + ); /** * @brief Test if two coordinates are not equal */ - friend bool operator!=(const GridCoord1D &lhs, const GridCoord1D &rhs); + friend bool operator!=( + const GridCoord1D& lhs, + const GridCoord1D& rhs + ); /** * @brief Output a given coordinate to the specified stream */ - friend std::ostream &operator<<(std::ostream &lhs, const GridCoord1D &rhs); + friend std::ostream& operator<<( + std::ostream& lhs, + const GridCoord1D& rhs + ); /** * @brief Add two coordinates together */ - inline friend GridCoord1D operator+(const GridCoord1D &lhs, const GridCoord1D &rhs); + inline friend GridCoord1D operator+( + const GridCoord1D& lhs, + const GridCoord1D& rhs + ); /** * @brief Subtract one coordinate from another */ - inline friend GridCoord1D operator-(const GridCoord1D &lhs, const GridCoord1D &rhs); + inline friend GridCoord1D operator-( + const GridCoord1D& lhs, + const GridCoord1D& rhs + ); /** * @brief Multiply a coordinate by a scalar @@ -117,7 +133,10 @@ namespace kami { * @details If any component of the resulting value is not a whole number, it is * truncated following the same rules as `int`. */ - inline friend GridCoord1D operator*(const GridCoord1D &lhs, double rhs); + inline friend GridCoord1D operator*( + const GridCoord1D& lhs, + double rhs + ); /** * @brief Multiply a coordinate by a scalar @@ -125,7 +144,10 @@ namespace kami { * @details If any component of the resulting value is not a whole number, it is * truncated following the same rules as `int`. */ - inline friend GridCoord1D operator*(double lhs, const GridCoord1D &rhs); + inline friend GridCoord1D operator*( + double lhs, + const GridCoord1D& rhs + ); private: int _x_coord; @@ -139,7 +161,8 @@ namespace kami { * @see `MultiGrid1D` * @see `SoloGrid1D` */ - class LIBKAMI_EXPORT Grid1D : public GridDomain { + class LIBKAMI_EXPORT Grid1D + : public GridDomain { public: /** * @brief Constructor @@ -147,7 +170,10 @@ namespace kami { * @param[in] maximum_x the length of the grid. * @param[in] wrap_x should the grid wrap around on itself. */ - explicit Grid1D(unsigned int maximum_x, bool wrap_x = false); + explicit Grid1D( + unsigned int maximum_x, + bool wrap_x = false + ); /** * @brief Place agent on the grid at the specified location. @@ -158,7 +184,10 @@ namespace kami { * @returns false if the agent is not placed at the specified * location, otherwise, true. */ - virtual AgentID add_agent(AgentID agent_id, const GridCoord1D &coord) = 0; + virtual AgentID add_agent( + AgentID agent_id, + const GridCoord1D& coord + ) = 0; /** * @brief Remove agent from the grid. @@ -177,7 +206,10 @@ namespace kami { * * @returns the `AgentID` of the `Agent` deleted */ - AgentID delete_agent(AgentID agent_id, const GridCoord1D &coord); + AgentID delete_agent( + AgentID agent_id, + const GridCoord1D& coord + ); /** * @brief Move an agent to the specified location. @@ -185,7 +217,10 @@ namespace kami { * @param[in] agent_id the `AgentID` of the agent to move. * @param[in] coord the coordinates of the agent. */ - AgentID move_agent(AgentID agent_id, const GridCoord1D &coord); + AgentID move_agent( + AgentID agent_id, + const GridCoord1D& coord + ); /** * @brief Inquire if the specified location is empty. @@ -213,7 +248,7 @@ namespace kami { * * @return the location of the specified `Agent` */ - [[nodiscard]] GridCoord1D get_location_by_agent(const AgentID &agent_id) const; + [[nodiscard]] GridCoord1D get_location_by_agent(const AgentID& agent_id) const; /** * @brief Get the contents of the specified location. @@ -226,7 +261,7 @@ namespace kami { * should not be deleted when no longer used. */ [[nodiscard]] std::shared_ptr> - get_location_contents(const GridCoord1D &coord) const; + get_location_contents(const GridCoord1D& coord) const; /** * @brief Inquire to whether the grid wraps in the `x` dimension. @@ -246,7 +281,10 @@ namespace kami { * for all adjacent points. */ [[nodiscard]] std::shared_ptr> - get_neighborhood(AgentID agent_id, bool include_center) const; + get_neighborhood( + AgentID agent_id, + bool include_center + ) const; /** * @brief Return the neighborhood of the specified location @@ -259,7 +297,10 @@ namespace kami { * for all adjacent points. */ [[nodiscard]] std::shared_ptr> - get_neighborhood(const GridCoord1D &coord, bool include_center) const; + get_neighborhood( + const GridCoord1D& coord, + bool include_center + ) const; /** * @brief Get the size of the grid in the `x` dimension. @@ -298,7 +339,7 @@ namespace kami { * * @return the adjusted coordinate wrapped if appropriate. */ - [[nodiscard]] GridCoord1D coord_wrap(const GridCoord1D &coord) const; + [[nodiscard]] GridCoord1D coord_wrap(const GridCoord1D& coord) const; private: unsigned int _maximum_x; @@ -312,7 +353,7 @@ namespace kami { namespace std { template<> struct hash { - size_t operator()(const kami::GridCoord1D &key) const { + size_t operator()(const kami::GridCoord1D& key) const { return (hash()(key.x())); } }; diff --git a/include/kami/grid2d.h b/include/kami/grid2d.h index 0854ade..345d624 100644 --- a/include/kami/grid2d.h +++ b/include/kami/grid2d.h @@ -48,12 +48,16 @@ namespace kami { /** * @brief Two-dimensional coordinates */ - class LIBKAMI_EXPORT GridCoord2D : public GridCoord { + class LIBKAMI_EXPORT GridCoord2D + : public GridCoord { public: /** * @brief Constructor for two-dimensional coordinates */ - GridCoord2D(int x_coord, int y_coord); + GridCoord2D( + int x_coord, + int y_coord + ); /** * @brief Get the coordinate in the first dimension or `x`. @@ -87,7 +91,7 @@ namespace kami { * * @returns the distance as a `double` */ - double distance(std::shared_ptr &p) const override; + double distance(std::shared_ptr& p) const override; /** * @brief Find the distance between two points @@ -107,32 +111,50 @@ namespace kami { * @returns the distance as a `double` */ double - distance(std::shared_ptr &p, GridDistanceType distance_type = GridDistanceType::Euclidean) const; + distance( + std::shared_ptr& p, + GridDistanceType distance_type = GridDistanceType::Euclidean + ) const; /** * @brief Test if two coordinates are equal */ - friend bool operator==(const GridCoord2D &, const GridCoord2D &); + friend bool operator==( + const GridCoord2D&, + const GridCoord2D& + ); /** * @brief Test if two coordinates are not equal */ - friend bool operator!=(const GridCoord2D &, const GridCoord2D &); + friend bool operator!=( + const GridCoord2D&, + const GridCoord2D& + ); /** * @brief Output a given coordinate to the specified stream */ - friend std::ostream &operator<<(std::ostream &, const GridCoord2D &); + friend std::ostream& operator<<( + std::ostream&, + const GridCoord2D& + ); /** * @brief Add two coordinates together */ - inline friend GridCoord2D operator+(const GridCoord2D &lhs, const GridCoord2D &rhs); + inline friend GridCoord2D operator+( + const GridCoord2D& lhs, + const GridCoord2D& rhs + ); /** * @brief Subtract one coordinate from another */ - inline friend GridCoord2D operator-(const GridCoord2D &lhs, const GridCoord2D &rhs); + inline friend GridCoord2D operator-( + const GridCoord2D& lhs, + const GridCoord2D& rhs + ); /** * @brief Multiply a coordinate by a scalar @@ -140,7 +162,10 @@ namespace kami { * @details If any component of the resulting value is not a whole number, it is * truncated following the same rules as `int`. */ - inline friend GridCoord2D operator*(const GridCoord2D &lhs, const double rhs); + inline friend GridCoord2D operator*( + const GridCoord2D& lhs, + const double rhs + ); /** * @brief Multiply a coordinate by a scalar @@ -148,7 +173,10 @@ namespace kami { * @details If any component of the resulting value is not a whole number, it is * truncated following the same rules as `int`. */ - inline friend GridCoord2D operator*(const double lhs, const GridCoord2D &rhs); + inline friend GridCoord2D operator*( + const double lhs, + const GridCoord2D& rhs + ); protected: /** @@ -158,7 +186,7 @@ namespace kami { * * @returns the distance as a `double` */ - inline double distance_chebyshev(std::shared_ptr &p) const; + inline double distance_chebyshev(std::shared_ptr& p) const; /** * @brief Find the distance between two points using the Euclidean metric @@ -167,7 +195,7 @@ namespace kami { * * @returns the distance as a `double` */ - inline double distance_euclidean(std::shared_ptr &p) const; + inline double distance_euclidean(std::shared_ptr& p) const; /** * @brief Find the distance between two points using the Manhattan metric @@ -176,7 +204,7 @@ namespace kami { * * @returns the distance as a `double` */ - inline double distance_manhattan(std::shared_ptr &p) const; + inline double distance_manhattan(std::shared_ptr& p) const; private: int _x_coord, _y_coord; @@ -190,7 +218,8 @@ namespace kami { * @see `MultiGrid2D` * @see `SoloGrid2D` */ - class LIBKAMI_EXPORT Grid2D : public GridDomain { + class LIBKAMI_EXPORT Grid2D + : public GridDomain { public: /** * @brief Constructor @@ -202,7 +231,12 @@ namespace kami { * @param[in] wrap_y should the grid wrap around on itself in the second * dimension */ - explicit Grid2D(unsigned int maximum_x, unsigned int maximum_y, bool wrap_x = false, bool wrap_y = false); + explicit Grid2D( + unsigned int maximum_x, + unsigned int maximum_y, + bool wrap_x = false, + bool wrap_y = false + ); /** * @brief Place agent on the grid at the specified location. @@ -213,7 +247,10 @@ namespace kami { * @returns false if the agent is not placed at the specified * location, otherwise, true. */ - virtual AgentID add_agent(AgentID agent_id, const GridCoord2D &coord) = 0; + virtual AgentID add_agent( + AgentID agent_id, + const GridCoord2D& coord + ) = 0; /** * @brief Remove agent from the grid. @@ -232,7 +269,10 @@ namespace kami { * * @returns false if the agent is not removed, otherwise, true. */ - AgentID delete_agent(AgentID agent_id, const GridCoord2D &coord); + AgentID delete_agent( + AgentID agent_id, + const GridCoord2D& coord + ); /** * @brief Move an agent to the specified location. @@ -240,7 +280,10 @@ namespace kami { * @param[in] agent_id the `AgentID` of the agent to move. * @param[in] coord the coordinates of the agent. */ - AgentID move_agent(AgentID agent_id, const GridCoord2D &coord); + AgentID move_agent( + AgentID agent_id, + const GridCoord2D& coord + ); /** * @brief Inquire if the specified location is empty. @@ -268,7 +311,7 @@ namespace kami { * * @return the location of the specified `Agent` */ - GridCoord2D get_location_by_agent(const AgentID &agent_id) const; + GridCoord2D get_location_by_agent(const AgentID& agent_id) const; /** * @brief Get the contents of the specified location. @@ -281,14 +324,14 @@ namespace kami { * should not be deleted when no longer used. */ [[nodiscard]] std::shared_ptr> - get_location_contents(const GridCoord2D &coord) const; + get_location_contents(const GridCoord2D& coord) const; /** * @brief Inquire to whether the grid wraps in the `x` dimension. * * @return true if the grid wraps, and false otherwise */ - [[nodiscard]] bool get_wrap_x() const; + [[nodiscard]] bool get_wrap_x() const; /** * @brief Inquire to whether the grid wraps in the `y` dimension. @@ -311,7 +354,11 @@ namespace kami { * @see `NeighborhoodType` */ std::shared_ptr> - get_neighborhood(AgentID agent_id, bool include_center, GridNeighborhoodType neighborhood_type) const; + get_neighborhood( + AgentID agent_id, + bool include_center, + GridNeighborhoodType neighborhood_type + ) const; /** * @brief Return the neighborhood of the specified location @@ -327,7 +374,11 @@ namespace kami { * @see `NeighborhoodType` */ [[nodiscard]] std::shared_ptr> - get_neighborhood(const GridCoord2D &coord, bool include_center, GridNeighborhoodType neighborhood_type) const; + get_neighborhood( + const GridCoord2D& coord, + bool include_center, + GridNeighborhoodType neighborhood_type + ) const; /** * @brief Get the size of the grid in the `x` dimension. @@ -352,7 +403,7 @@ namespace kami { * directions are enumerated clockwise. */ const std::vector directions_vonneumann = {GridCoord2D(0, 1), GridCoord2D(1, 0), - GridCoord2D(0, -1), GridCoord2D(-1, 0)}; + GridCoord2D(0, -1), GridCoord2D(-1, 0)}; /** * @brief Moore neighborhood coordinates @@ -362,9 +413,9 @@ namespace kami { * directions are enumerated clockwise. */ const std::vector directions_moore = {GridCoord2D(0, 1), GridCoord2D(1, 1), - GridCoord2D(1, 0), GridCoord2D(1, -1), - GridCoord2D(0, -1), GridCoord2D(-1, -1), - GridCoord2D(-1, 0), GridCoord2D(-1, 1)}; + GridCoord2D(1, 0), GridCoord2D(1, -1), + GridCoord2D(0, -1), GridCoord2D(-1, -1), + GridCoord2D(-1, 0), GridCoord2D(-1, 1)}; /** * @brief A map containing the `AgentID`s of all agents assigned to this @@ -384,7 +435,7 @@ namespace kami { * * @return the adjusted coordinate wrapped if appropriate. */ - [[nodiscard]] GridCoord2D coord_wrap(const GridCoord2D &coord) const; + [[nodiscard]] GridCoord2D coord_wrap(const GridCoord2D& coord) const; private: unsigned int _maximum_x, _maximum_y; @@ -397,7 +448,7 @@ namespace kami { namespace std { template<> struct hash { - size_t operator()(const kami::GridCoord2D &key) const { + size_t operator()(const kami::GridCoord2D& key) const { return ((hash()(key.x()) ^ (hash()(key.y()) << 1)) >> 1); } }; diff --git a/include/kami/kami.h b/include/kami/kami.h index cdae384..0e0381e 100644 --- a/include/kami/kami.h +++ b/include/kami/kami.h @@ -58,7 +58,9 @@ namespace kami { * * @return a `semver::version` object containing version information */ - inline semver::version get_version() { return version; } + inline semver::version get_version() { + return version; + } /** * @brief A catalog of handy constants, mostly useful for seeding diff --git a/include/kami/model.h b/include/kami/model.h index e7a52b5..41a4f6f 100644 --- a/include/kami/model.h +++ b/include/kami/model.h @@ -43,7 +43,8 @@ namespace kami { * * @see `ReporterModel` */ - class LIBKAMI_EXPORT Model : public std::enable_shared_from_this { + class LIBKAMI_EXPORT Model + : public std::enable_shared_from_this { public: /** diff --git a/include/kami/multigrid1d.h b/include/kami/multigrid1d.h index 8a79706..e3a7326 100644 --- a/include/kami/multigrid1d.h +++ b/include/kami/multigrid1d.h @@ -45,7 +45,8 @@ namespace kami { * @see `Grid1D` * @see `SoloGrid1D` */ - class LIBKAMI_EXPORT MultiGrid1D : public Grid1D { + class LIBKAMI_EXPORT MultiGrid1D + : public Grid1D { public: /** * @brief Constructor @@ -53,7 +54,10 @@ namespace kami { * @param[in] maximum_x the length of the grid. * @param[in] wrap_x should the grid wrap around on itself. */ - MultiGrid1D(unsigned int maximum_x, bool wrap_x); + MultiGrid1D( + unsigned int maximum_x, + bool wrap_x + ); /** * @brief Place agent on the grid at the specified location. @@ -64,7 +68,10 @@ namespace kami { * @returns false if the agent is not placed at the specified * location, otherwise, true */ - AgentID add_agent(AgentID agent_id, const GridCoord1D &coord) override; + AgentID add_agent( + AgentID agent_id, + const GridCoord1D& coord + ) override; }; } // namespace kami diff --git a/include/kami/multigrid2d.h b/include/kami/multigrid2d.h index f7c341d..79634fc 100644 --- a/include/kami/multigrid2d.h +++ b/include/kami/multigrid2d.h @@ -45,7 +45,8 @@ namespace kami { * @see `Grid2D` * @see `SoloGrid2D` */ - class LIBKAMI_EXPORT MultiGrid2D : public Grid2D { + class LIBKAMI_EXPORT MultiGrid2D + : public Grid2D { public: /** * @brief Constructor @@ -57,7 +58,12 @@ namespace kami { * @param[in] wrap_y should the grid wrap around on itself in the second * dimension */ - MultiGrid2D(unsigned int maximum_x, unsigned int maximum_y, bool wrap_x, bool wrap_y); + MultiGrid2D( + unsigned int maximum_x, + unsigned int maximum_y, + bool wrap_x, + bool wrap_y + ); /** * @brief Place agent on the grid at the specified location. @@ -67,7 +73,10 @@ namespace kami { * * @returns the `AgentID` of the agent added */ - AgentID add_agent(AgentID agent_id, const GridCoord2D &coord) override; + AgentID add_agent( + AgentID agent_id, + const GridCoord2D& coord + ) override; }; } // namespace kami diff --git a/include/kami/population.h b/include/kami/population.h index d231d07..0c36169 100644 --- a/include/kami/population.h +++ b/include/kami/population.h @@ -58,7 +58,7 @@ namespace kami { * * @returns the ID of the agent added */ - AgentID add_agent(const std::shared_ptr &agent) noexcept; + AgentID add_agent(const std::shared_ptr& agent) noexcept; /** * @brief Remove an Agent from the Population. diff --git a/include/kami/random.h b/include/kami/random.h index ea9ec00..b454c3e 100644 --- a/include/kami/random.h +++ b/include/kami/random.h @@ -46,7 +46,9 @@ namespace kami { * That order should be different for each subsequent call to `step()`, * but is not guaranteed not to repeat. */ - class LIBKAMI_EXPORT RandomScheduler : public SequentialScheduler, std::enable_shared_from_this { + class LIBKAMI_EXPORT RandomScheduler + : public SequentialScheduler, + std::enable_shared_from_this { public: /** * @brief Constructor. diff --git a/include/kami/reporter.h b/include/kami/reporter.h index 45e19f2..310a47b 100644 --- a/include/kami/reporter.h +++ b/include/kami/reporter.h @@ -199,7 +199,7 @@ namespace kami { * * @returns a copy of the current report */ - std::unique_ptr collect(const std::shared_ptr &model); + std::unique_ptr collect(const std::shared_ptr& model); /** * @brief Collect the current state of the model @@ -213,7 +213,10 @@ namespace kami { * @returns a copy of the current report */ std::unique_ptr - collect(const std::shared_ptr &model, const std::shared_ptr &pop); + collect( + const std::shared_ptr& model, + const std::shared_ptr& pop + ); /** * @brief Collect the current state of the model @@ -227,7 +230,10 @@ namespace kami { * @returns a copy of the current report */ std::unique_ptr - collect(const std::shared_ptr &model, const std::unique_ptr> &agent_list); + collect( + const std::shared_ptr& model, + const std::unique_ptr>& agent_list + ); /** * @brief Collect the report @@ -239,7 +245,7 @@ namespace kami { * * @returns a copy of the current report */ - std::unique_ptr report(const std::shared_ptr &model); + std::unique_ptr report(const std::shared_ptr& model); protected: /** diff --git a/include/kami/sequential.h b/include/kami/sequential.h index 4c86f59..7c9b344 100644 --- a/include/kami/sequential.h +++ b/include/kami/sequential.h @@ -47,7 +47,8 @@ namespace kami { * That order is preserved between calls to `step()` but may be modified by * `addAgent()` or `deleteAgent()`. */ - class LIBKAMI_EXPORT SequentialScheduler : public Scheduler { + class LIBKAMI_EXPORT SequentialScheduler + : public Scheduler { public: /** * @brief Execute a single time step. diff --git a/include/kami/sologrid1d.h b/include/kami/sologrid1d.h index 866f725..2a5d7fe 100644 --- a/include/kami/sologrid1d.h +++ b/include/kami/sologrid1d.h @@ -44,7 +44,8 @@ namespace kami { * @see `Grid1D` * @see `MultiGrid1D` */ - class LIBKAMI_EXPORT SoloGrid1D : public Grid1D { + class LIBKAMI_EXPORT SoloGrid1D + : public Grid1D { public: /** * @brief Constructor @@ -52,7 +53,10 @@ namespace kami { * @param[in] maximum_x the length of the grid. * @param[in] wrap_x should the grid wrap around on itself. */ - SoloGrid1D(unsigned int maximum_x, bool wrap_x); + SoloGrid1D( + unsigned int maximum_x, + bool wrap_x + ); /** * @brief Place agent on the grid at the specified location. @@ -63,7 +67,10 @@ namespace kami { * @returns false if the agent is not placed at the specified * location, otherwise, true */ - AgentID add_agent(AgentID agent_id, const GridCoord1D &coord) override; + AgentID add_agent( + AgentID agent_id, + const GridCoord1D& coord + ) override; }; } // namespace kami diff --git a/include/kami/sologrid2d.h b/include/kami/sologrid2d.h index ef5b37d..0ed66d0 100644 --- a/include/kami/sologrid2d.h +++ b/include/kami/sologrid2d.h @@ -44,7 +44,8 @@ namespace kami { * @see `Grid2D` * @see `MultiGrid2D` */ - class LIBKAMI_EXPORT SoloGrid2D : public Grid2D { + class LIBKAMI_EXPORT SoloGrid2D + : public Grid2D { public: /** * @details Constructor @@ -54,7 +55,12 @@ namespace kami { * @param[in] wrap_x should the grid wrap around on itself in the first dimension * @param[in] wrap_y should the grid wrap around on itself in the second dimension */ - SoloGrid2D(unsigned int maximum_x, unsigned int maximum_y, bool wrap_x, bool wrap_y);; + SoloGrid2D( + unsigned int maximum_x, + unsigned int maximum_y, + bool wrap_x, + bool wrap_y + );; /** * @details Place agent on the grid at the specified location. @@ -65,7 +71,10 @@ namespace kami { * @returns false if the agent is not placed at the specified * location, otherwise, true */ - AgentID add_agent(AgentID agent_id, const GridCoord2D &coord) override; + AgentID add_agent( + AgentID agent_id, + const GridCoord2D& coord + ) override; }; diff --git a/include/kami/staged.h b/include/kami/staged.h index d169af4..a4afafb 100644 --- a/include/kami/staged.h +++ b/include/kami/staged.h @@ -46,7 +46,8 @@ namespace kami { * preserved between calls to `step()` but may be modified by `add_agent()` or * `delete_agent()`. */ - class LIBKAMI_EXPORT StagedScheduler : public SequentialScheduler { + class LIBKAMI_EXPORT StagedScheduler + : public SequentialScheduler { public: /** * @brief Execute a single time step @@ -62,10 +63,16 @@ namespace kami { * @returns returns vector of agents successfully stepped */ std::unique_ptr> - step(std::shared_ptr model, std::unique_ptr> agent_list) override; + step( + std::shared_ptr model, + std::unique_ptr> agent_list + ) override; std::unique_ptr> - step(std::shared_ptr model, std::unique_ptr> agent_list) override; + step( + std::shared_ptr model, + std::unique_ptr> agent_list + ) override; private: /** @@ -98,7 +105,10 @@ namespace kami { * @returns returns vector of agents successfully advanced */ std::unique_ptr> - advance(std::shared_ptr model, std::unique_ptr> agent_list); + advance( + std::shared_ptr model, + std::unique_ptr> agent_list + ); }; } // namespace kami