diff --git a/src/core/agent/agent_uid_generator.h b/src/core/agent/agent_uid_generator.h index 626931c22..c3d46ab1d 100644 --- a/src/core/agent/agent_uid_generator.h +++ b/src/core/agent/agent_uid_generator.h @@ -52,7 +52,8 @@ class AgentUidGenerator { } if (search_index_ < map_->size()) { auto* scheduler = Simulation::GetActive()->GetScheduler(); - return AgentUid(search_index_++, scheduler->GetSimulatedSteps()); + return AgentUid(search_index_++, static_cast( + scheduler->GetSimulatedSteps())); } // didn't find any empty slots -> disable defragmentation mode DisableDefragmentation(); @@ -74,7 +75,7 @@ class AgentUidGenerator { void DisableDefragmentation() { if (map_ != nullptr) { - counter_ = map_->size(); + counter_ = static_cast(map_->size()); } map_ = nullptr; } diff --git a/src/core/environment/uniform_grid_environment.h b/src/core/environment/uniform_grid_environment.h index a66e5cfa3..142cbe527 100644 --- a/src/core/environment/uniform_grid_environment.h +++ b/src/core/environment/uniform_grid_environment.h @@ -540,7 +540,7 @@ class UniformGridEnvironment : public Environment { std::sort(mutex_indices_.begin(), mutex_indices_.end()); } - virtual ~GridNeighborMutex() = default; + ~GridNeighborMutex() override = default; void lock() override { // NOLINT for (auto idx : mutex_indices_) { @@ -576,7 +576,7 @@ class UniformGridEnvironment : public Environment { std::atomic_flag mutex_ = ATOMIC_FLAG_INIT; }; - virtual ~GridNeighborMutexBuilder() = default; + ~GridNeighborMutexBuilder() override = default; void Update() { auto* grid = static_cast( diff --git a/src/core/resource_manager.h b/src/core/resource_manager.h index 0e34ce705..ff7a0dc71 100644 --- a/src/core/resource_manager.h +++ b/src/core/resource_manager.h @@ -91,8 +91,8 @@ class ResourceManager { uid_ah_map_.clear(); auto* agent_uid_generator = Simulation::GetActive()->GetAgentUidGenerator(); uid_ah_map_.resize(agent_uid_generator->GetHighestIndex() + 1); - for (unsigned n = 0; n < agents_.size(); ++n) { - for (unsigned i = 0; i < agents_[n].size(); ++i) { + for (AgentHandle::NumaNode_t n = 0; n < agents_.size(); ++n) { + for (AgentHandle::ElementIdx_t i = 0; i < agents_[n].size(); ++i) { auto* agent = agents_[n][i]; this->uid_ah_map_.Insert(agent->GetUid(), AgentHandle(n, i)); } @@ -217,9 +217,9 @@ class ResourceManager { virtual void ForEachAgent( const std::function& function, Functor* filter = nullptr) { - for (uint64_t n = 0; n < agents_.size(); ++n) { + for (AgentHandle::NumaNode_t n = 0; n < agents_.size(); ++n) { auto& numa_agents = agents_[n]; - for (uint64_t i = 0; i < numa_agents.size(); ++i) { + for (AgentHandle::ElementIdx_t i = 0; i < numa_agents.size(); ++i) { auto* a = numa_agents[i]; if (!filter || (filter && (*filter)(a))) { function(a, AgentHandle(n, i)); @@ -325,8 +325,9 @@ class ResourceManager { uid_ah_map_.resize(uid.GetIndex() + 1); } agents_[numa_node].push_back(agent); - uid_ah_map_.Insert(uid, - AgentHandle(numa_node, agents_[numa_node].size() - 1)); + uid_ah_map_.Insert( + uid, AgentHandle(numa_node, static_cast( + agents_[numa_node].size() - 1u))); if (type_index_) { type_index_->Add(agent); } @@ -368,7 +369,9 @@ class ResourceManager { uint64_t i = 0; for (auto* agent : new_agents) { auto uid = agent->GetUid(); - uid_ah_map_.Insert(uid, AgentHandle(numa_node, offset + i)); + uid_ah_map_.Insert( + uid, AgentHandle(numa_node, + static_cast(offset + i))); agents_[numa_node][offset + i] = agent; i++; } diff --git a/src/core/simulation_backup.cc b/src/core/simulation_backup.cc index 52f68f889..4d167993a 100644 --- a/src/core/simulation_backup.cc +++ b/src/core/simulation_backup.cc @@ -44,7 +44,12 @@ size_t SimulationBackup::GetSimulationStepsFromBackup() { IntegralTypeWrapper* wrapper = nullptr; bdm::GetPersistentObject(restore_file.c_str(), kSimulationStepName.c_str(), wrapper); - return wrapper->Get(); + if (wrapper != nullptr) { + return wrapper->Get(); + } else { + Log::Fatal("SimulationBackup", "Failed to retrieve SimulationSteps."); + return 0; + } } else { Log::Fatal("SimulationBackup", "Requested to restore data, but no restore file given."); diff --git a/src/core/util/thread_info.h b/src/core/util/thread_info.h index b16541178..c87bca663 100644 --- a/src/core/util/thread_info.h +++ b/src/core/util/thread_info.h @@ -77,7 +77,7 @@ class ThreadInfo { /// metadata. void Renew() { max_threads_ = omp_get_max_threads(); - numa_nodes_ = numa_num_configured_nodes(); + numa_nodes_ = static_cast(numa_num_configured_nodes()); thread_numa_mapping_.clear(); numa_thread_id_.clear(); @@ -97,8 +97,8 @@ class ThreadInfo { // (numa -> number of associated threads), and // (omp_thread_id -> thread id in numa) for (uint16_t n = 0; n < numa_nodes_; n++) { - uint64_t cnt = 0; - for (uint64_t t = 0; t < max_threads_; t++) { + int cnt = 0; + for (int t = 0; t < max_threads_; t++) { int numa = thread_numa_mapping_[t]; if (n == numa) { numa_thread_id_[t] = cnt; @@ -135,7 +135,7 @@ class ThreadInfo { static std::atomic thread_counter_; /// Maximum number of threads for this simulation. - uint64_t max_threads_; + int max_threads_; /// Number of NUMA nodes on this machine. uint16_t numa_nodes_; diff --git a/src/core/visualization/paraview/mapped_data_array.h b/src/core/visualization/paraview/mapped_data_array.h index 56384844a..9a6a3cb99 100644 --- a/src/core/visualization/paraview/mapped_data_array.h +++ b/src/core/visualization/paraview/mapped_data_array.h @@ -117,6 +117,8 @@ struct GetDataMemberForVis { // ----------------------------------------------------------------------------- struct MappedDataArrayInterface { + MappedDataArrayInterface() = default; + virtual ~MappedDataArrayInterface() = default; virtual void Update(const std::vector* agents, uint64_t start, uint64_t end) = 0; }; @@ -435,12 +437,12 @@ void MappedDataArray::GetTuple(vtkIdType tuple_id, } } case Param::MappedDataArrayMode::kZeroCopy: { - auto* data = get_dm_((*agents_)[start_ + tuple_id]); + auto* temporary_data = get_dm_((*agents_)[start_ + tuple_id]); for (uint64_t i = 0; i < static_cast(this->NumberOfComponents); ++i) { - tuple[i] = static_cast(data[i]); + tuple[i] = static_cast(temporary_data[i]); if (mode_ == Param::MappedDataArrayMode::kCache) { - data_[idx + i] = data[i]; + data_[idx + i] = temporary_data[i]; is_matching_[idx + i] = match_value_; } } diff --git a/src/core/visualization/root/adaptor.h b/src/core/visualization/root/adaptor.h index 9de55662b..19552e26a 100644 --- a/src/core/visualization/root/adaptor.h +++ b/src/core/visualization/root/adaptor.h @@ -79,7 +79,7 @@ class RootAdaptor { canvas_->GetListOfPrimitives()->Add(gGeoManager->GetTopVolume(), opt.c_str()); } - canvas_->SetCanvasSize(w, h); + canvas_->SetCanvasSize(static_cast(w), static_cast(h)); canvas_->Update(); canvas_->Draw(); }