Commit 7763be11 authored by VAN TOLL Wouter's avatar VAN TOLL Wouter
Browse files

Merge master into GUI

parents f5beef8a ab558227
......@@ -20,7 +20,7 @@
cmake_minimum_required( VERSION 2.8 )
project( UMANS )
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_CXX_STANDARD 17)
#set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
......@@ -51,7 +51,7 @@ endif (UMANS_USE_MULTITHREADING)
# === Linux compatibility compiler option
if (NOT MSVC)
add_definitions(-fPIC)
add_definitions(-O3 -lstdc++fs -fPIC -shared)
endif()
# === Engine project: a static library that performs the simulation
......
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
......
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
......@@ -236,7 +236,7 @@ Vector2D TtcaDca::GetGradient(const Vector2D& velocity, Agent* agent, const Worl
GradS += GradThS_movement.second;
// clamp the change in angle
//GradTh = clamp(GradTh, -1.f, 1.f);
//GradTh = clampVector(GradTh, -1.f, 1.f);
Vector2D Gradient;
......
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettré
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
......@@ -62,7 +62,7 @@ public:
/// This affects whether or not the program will try to print progress information to the console.</param>
/// <returns>A pointer to new CrowdSimulator object, or nullptr if the loading failed for any reason.</returns>
static CrowdSimulator* FromConfigFile(const std::string& filename, bool isConsoleApplication);
/// <summary>Destroys this CrowdSimulator object.</summary>
~CrowdSimulator();
......
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettré
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
......@@ -61,10 +61,10 @@ Vector2D Policy::ComputeNewVelocity(Agent* agent, WorldBase * world)
}
// clamp to a maximum acceleration
acceleration = clamp(acceleration, agent->getMaximumAcceleration());
acceleration = clampVector(acceleration, agent->getMaximumAcceleration());
// use this to compute a new velocity, clamped to a maximum speed
return clamp(currentVelocity + acceleration * dt, agent->getMaximumSpeed());
return clampVector(currentVelocity + acceleration * dt, agent->getMaximumSpeed());
}
Vector2D Policy::getAccelerationFromGradient(Agent* agent, WorldBase * world)
......
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
......@@ -238,7 +238,7 @@ inline bool isPointRightOfLine(const Vector2D& p, const Vector2D& la, const Vect
#pragma endregion
inline Vector2D clamp(const Vector2D& v, float maxLength)
inline Vector2D clampVector(const Vector2D& v, float maxLength)
{
float mag = v.magnitude();
if (mag <= maxLength)
......
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettré
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
......@@ -26,9 +26,12 @@
#include <core/crowdSimulator.h>
#include <algorithm>
#include <omp.h>
#include <cstring>
#include <string>
#include <clocale>
extern "C" {
extern "C"
{
CrowdSimulator* cs;
AgentData* agentData;
size_t agentDataSize;
......@@ -43,12 +46,17 @@ extern "C" {
API_FUNCTION bool StartSimulation(const char* configFileName, int numberOfThreads)
{
std::setlocale(LC_NUMERIC, "en_US.UTF-8");
omp_set_num_threads(numberOfThreads);
// initialize a new crowd simulation; we'll fill it with the contents of the given config file
cs = CrowdSimulator::FromConfigFile(configFileName, false);
if (cs == nullptr)
{
return false;
}
cs->GetWorld()->SetNumberOfThreads(numberOfThreads);
......@@ -196,4 +204,4 @@ extern "C" {
return true;
}
}
\ No newline at end of file
}
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettré
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
......@@ -23,12 +23,11 @@
#ifdef WIN32
#define API_FUNCTION __declspec(dllexport)
#else
#define API_FUNCTION __attribute__((visibility("default")))
#define API_FUNCTION
#endif
#endif
extern "C"
{
extern "C"{
/// <summary>A struct that describes the status of a single agent in the simulation.
/// This struct is used for communication between the UMANS library and external applications.</summary>
struct AgentData
......@@ -52,7 +51,7 @@ extern "C"
/// <summary>Sets up a simulation based on a configuration file.
/// After this function call, the simulation will be ready for its first time step.</summary>
/// <returns>true if the operation was successful; false otherwise, e.g. if the configuration file is invalid.</returns>
API_FUNCTION bool StartSimulation(const char* configFileName, int nrThreads);
API_FUNCTION bool StartSimulation(const char* configFileName, int nrThreads);
/// <summary>Gets the step size of the simulation, in seconds.</summary>
/// <param ref="result_dt">[out] Will store the step size of the simulation.</param>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment