style(includes): automatic reformatting

This commit is contained in:
James P. Howard, II
2023-01-22 20:45:46 -05:00
parent e56c257707
commit 431a4ac8cf
16 changed files with 257 additions and 86 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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<Coord> &p) const = 0;
virtual double distance(std::shared_ptr<Coord>& p) const = 0;
};

View File

@@ -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<Coord> &p) const override;
double distance(std::shared_ptr<Coord>& 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<std::set<AgentID>>
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<std::unordered_set<GridCoord1D>>
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<std::unordered_set<GridCoord1D>>
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<kami::GridCoord1D> {
size_t operator()(const kami::GridCoord1D &key) const {
size_t operator()(const kami::GridCoord1D& key) const {
return (hash<int>()(key.x()));
}
};

View File

@@ -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<Coord> &p) const override;
double distance(std::shared_ptr<Coord>& 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<GridCoord2D> &p, GridDistanceType distance_type = GridDistanceType::Euclidean) const;
distance(
std::shared_ptr<GridCoord2D>& 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<GridCoord2D> &p) const;
inline double distance_chebyshev(std::shared_ptr<GridCoord2D>& 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<GridCoord2D> &p) const;
inline double distance_euclidean(std::shared_ptr<GridCoord2D>& 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<GridCoord2D> &p) const;
inline double distance_manhattan(std::shared_ptr<GridCoord2D>& 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<std::set<AgentID>>
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<std::unordered_set<GridCoord2D>>
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<std::unordered_set<GridCoord2D>>
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<GridCoord2D> 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<GridCoord2D> 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<kami::GridCoord2D> {
size_t operator()(const kami::GridCoord2D &key) const {
size_t operator()(const kami::GridCoord2D& key) const {
return ((hash<int>()(key.x()) ^ (hash<int>()(key.y()) << 1)) >> 1);
}
};

View File

@@ -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

View File

@@ -43,7 +43,8 @@ namespace kami {
*
* @see `ReporterModel`
*/
class LIBKAMI_EXPORT Model : public std::enable_shared_from_this<Model> {
class LIBKAMI_EXPORT Model
: public std::enable_shared_from_this<Model> {
public:
/**

View File

@@ -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

View File

@@ -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

View File

@@ -58,7 +58,7 @@ namespace kami {
*
* @returns the ID of the agent added
*/
AgentID add_agent(const std::shared_ptr<Agent> &agent) noexcept;
AgentID add_agent(const std::shared_ptr<Agent>& agent) noexcept;
/**
* @brief Remove an Agent from the Population.

View File

@@ -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<RandomScheduler> {
class LIBKAMI_EXPORT RandomScheduler
: public SequentialScheduler,
std::enable_shared_from_this<RandomScheduler> {
public:
/**
* @brief Constructor.

View File

@@ -199,7 +199,7 @@ namespace kami {
*
* @returns a copy of the current report
*/
std::unique_ptr<nlohmann::json> collect(const std::shared_ptr<ReporterModel> &model);
std::unique_ptr<nlohmann::json> collect(const std::shared_ptr<ReporterModel>& 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<nlohmann::json>
collect(const std::shared_ptr<ReporterModel> &model, const std::shared_ptr<Population> &pop);
collect(
const std::shared_ptr<ReporterModel>& model,
const std::shared_ptr<Population>& 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<nlohmann::json>
collect(const std::shared_ptr<ReporterModel> &model, const std::unique_ptr<std::vector<AgentID>> &agent_list);
collect(
const std::shared_ptr<ReporterModel>& model,
const std::unique_ptr<std::vector<AgentID>>& agent_list
);
/**
* @brief Collect the report
@@ -239,7 +245,7 @@ namespace kami {
*
* @returns a copy of the current report
*/
std::unique_ptr<nlohmann::json> report(const std::shared_ptr<ReporterModel> &model);
std::unique_ptr<nlohmann::json> report(const std::shared_ptr<ReporterModel>& model);
protected:
/**

View File

@@ -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.

View File

@@ -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

View File

@@ -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;
};

View File

@@ -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<std::vector<AgentID>>
step(std::shared_ptr<Model> model, std::unique_ptr<std::vector<AgentID>> agent_list) override;
step(
std::shared_ptr<Model> model,
std::unique_ptr<std::vector<AgentID>> agent_list
) override;
std::unique_ptr<std::vector<AgentID>>
step(std::shared_ptr<ReporterModel> model, std::unique_ptr<std::vector<AgentID>> agent_list) override;
step(
std::shared_ptr<ReporterModel> model,
std::unique_ptr<std::vector<AgentID>> agent_list
) override;
private:
/**
@@ -98,7 +105,10 @@ namespace kami {
* @returns returns vector of agents successfully advanced
*/
std::unique_ptr<std::vector<AgentID>>
advance(std::shared_ptr<Model> model, std::unique_ptr<std::vector<AgentID>> agent_list);
advance(
std::shared_ptr<Model> model,
std::unique_ptr<std::vector<AgentID>> agent_list
);
};
} // namespace kami