build(GridFire): building on gcc and clang
resolved some issues preventing GridFire from building on both gcc and clang. Also resolved all warnings on both compilers.
This commit is contained in:
@@ -2,4 +2,4 @@ eigen_dep = dependency(
|
|||||||
'eigen3',
|
'eigen3',
|
||||||
version : '>=3.3',
|
version : '>=3.3',
|
||||||
fallback : ['eigen', 'eigen_dep']
|
fallback : ['eigen', 'eigen_dep']
|
||||||
)
|
).as_system()
|
||||||
12
meson.build
12
meson.build
@@ -22,8 +22,20 @@ project('GridFire', 'cpp', version: '0.0.1a', default_options: ['cpp_std=c++23']
|
|||||||
|
|
||||||
# Add default visibility for all C++ targets
|
# Add default visibility for all C++ targets
|
||||||
add_project_arguments('-fvisibility=default', language: 'cpp')
|
add_project_arguments('-fvisibility=default', language: 'cpp')
|
||||||
|
|
||||||
|
message('Found CXX compiler: ' + meson.get_compiler('cpp').get_id())
|
||||||
|
|
||||||
|
if meson.get_compiler('cpp').get_id() == 'clang'
|
||||||
# We disable these because of CppAD
|
# We disable these because of CppAD
|
||||||
|
message('disabling bitwise-instead-of-logical warnings for clang')
|
||||||
add_project_arguments('-Wno-bitwise-instead-of-logical', language: 'cpp')
|
add_project_arguments('-Wno-bitwise-instead-of-logical', language: 'cpp')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if meson.get_compiler('cpp').get_id() == 'gcc'
|
||||||
|
# We disable these because of boost notes about abi changes from C++10 -> C++17 make the build too noisey
|
||||||
|
message('disabling psabi warnings for gcc')
|
||||||
|
add_project_arguments('-Wno-psabi', language: 'cpp')
|
||||||
|
endif
|
||||||
|
|
||||||
# For Eigen
|
# For Eigen
|
||||||
add_project_arguments('-Wno-deprecated-declarations', language: 'cpp')
|
add_project_arguments('-Wno-deprecated-declarations', language: 'cpp')
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace gridfire::reaclib {
|
namespace gridfire::reaclib {
|
||||||
|
|
||||||
static bool s_initialized = false;
|
[[maybe_unused]] static bool s_initialized = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Provides global access to the fully initialized REACLIB reaction set.
|
* @brief Provides global access to the fully initialized REACLIB reaction set.
|
||||||
|
|||||||
@@ -536,7 +536,7 @@ namespace gridfire::reaction {
|
|||||||
///
|
///
|
||||||
friend std::ostream& operator<<(std::ostream& os, const TemplatedReactionSet<ReactionT>& r) {
|
friend std::ostream& operator<<(std::ostream& os, const TemplatedReactionSet<ReactionT>& r) {
|
||||||
os << "(ReactionSet: [";
|
os << "(ReactionSet: [";
|
||||||
int counter = 0;
|
size_t counter = 0;
|
||||||
for (const auto& reaction : r.m_reactions) {
|
for (const auto& reaction : r.m_reactions) {
|
||||||
os << reaction;
|
os << reaction;
|
||||||
if (counter < r.m_reactions.size() - 2) {
|
if (counter < r.m_reactions.size() - 2) {
|
||||||
|
|||||||
@@ -860,7 +860,7 @@ namespace gridfire {
|
|||||||
// Dynamic cast to REACLIBReaction to access specific properties
|
// Dynamic cast to REACLIBReaction to access specific properties
|
||||||
csvFile << reaction.id() << ";";
|
csvFile << reaction.id() << ";";
|
||||||
// Reactants
|
// Reactants
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
for (const auto& reactant : reaction.reactants()) {
|
for (const auto& reactant : reaction.reactants()) {
|
||||||
csvFile << reactant.name();
|
csvFile << reactant.name();
|
||||||
if (++count < reaction.reactants().size()) {
|
if (++count < reaction.reactants().size()) {
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ namespace gridfire {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t AdaptiveEngineView::mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const {
|
size_t AdaptiveEngineView::mapCulledToFullSpeciesIndex(size_t culledSpeciesIndex) const {
|
||||||
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= static_cast<int>(m_speciesIndexMap.size())) {
|
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= m_speciesIndexMap.size()) {
|
||||||
LOG_ERROR(m_logger, "Culled index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
|
LOG_ERROR(m_logger, "Culled index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
|
||||||
m_logger->flush_log();
|
m_logger->flush_log();
|
||||||
throw std::out_of_range("Culled index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
|
throw std::out_of_range("Culled index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
|
||||||
@@ -348,7 +348,7 @@ namespace gridfire {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t AdaptiveEngineView::mapCulledToFullReactionIndex(size_t culledReactionIndex) const {
|
size_t AdaptiveEngineView::mapCulledToFullReactionIndex(size_t culledReactionIndex) const {
|
||||||
if (culledReactionIndex < 0 || culledReactionIndex >= static_cast<int>(m_reactionIndexMap.size())) {
|
if (culledReactionIndex < 0 || culledReactionIndex >= m_reactionIndexMap.size()) {
|
||||||
LOG_ERROR(m_logger, "Culled index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
|
LOG_ERROR(m_logger, "Culled index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
|
||||||
m_logger->flush_log();
|
m_logger->flush_log();
|
||||||
throw std::out_of_range("Culled index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");
|
throw std::out_of_range("Culled index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ namespace gridfire {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t DefinedEngineView::mapViewToFullSpeciesIndex(size_t culledSpeciesIndex) const {
|
size_t DefinedEngineView::mapViewToFullSpeciesIndex(size_t culledSpeciesIndex) const {
|
||||||
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= static_cast<int>(m_speciesIndexMap.size())) {
|
if (culledSpeciesIndex < 0 || culledSpeciesIndex >= m_speciesIndexMap.size()) {
|
||||||
LOG_ERROR(m_logger, "Defined index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
|
LOG_ERROR(m_logger, "Defined index {} is out of bounds for species index map of size {}.", culledSpeciesIndex, m_speciesIndexMap.size());
|
||||||
m_logger->flush_log();
|
m_logger->flush_log();
|
||||||
throw std::out_of_range("Defined index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
|
throw std::out_of_range("Defined index " + std::to_string(culledSpeciesIndex) + " is out of bounds for species index map of size " + std::to_string(m_speciesIndexMap.size()) + ".");
|
||||||
@@ -302,7 +302,7 @@ namespace gridfire {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t DefinedEngineView::mapViewToFullReactionIndex(size_t culledReactionIndex) const {
|
size_t DefinedEngineView::mapViewToFullReactionIndex(size_t culledReactionIndex) const {
|
||||||
if (culledReactionIndex < 0 || culledReactionIndex >= static_cast<int>(m_reactionIndexMap.size())) {
|
if (culledReactionIndex < 0 || culledReactionIndex >= m_reactionIndexMap.size()) {
|
||||||
LOG_ERROR(m_logger, "Defined index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
|
LOG_ERROR(m_logger, "Defined index {} is out of bounds for reaction index map of size {}.", culledReactionIndex, m_reactionIndexMap.size());
|
||||||
m_logger->flush_log();
|
m_logger->flush_log();
|
||||||
throw std::out_of_range("Defined index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");
|
throw std::out_of_range("Defined index " + std::to_string(culledReactionIndex) + " is out of bounds for reaction index map of size " + std::to_string(m_reactionIndexMap.size()) + ".");
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
#include "gridfire/engine/views/engine_multiscale.h"
|
#include "gridfire/engine/views/engine_multiscale.h"
|
||||||
#include "gridfire/exceptions/error_engine.h"
|
#include "gridfire/exceptions/error_engine.h"
|
||||||
|
|
||||||
#include <numeric>
|
|
||||||
|
|
||||||
#include "fourdst/logging/logging.h"
|
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@@ -531,7 +529,7 @@ namespace gridfire {
|
|||||||
m_algebraic_species.size(),
|
m_algebraic_species.size(),
|
||||||
[&]() -> std::string {
|
[&]() -> std::string {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
for (const auto& species : m_algebraic_species) {
|
for (const auto& species : m_algebraic_species) {
|
||||||
ss << species.name();
|
ss << species.name();
|
||||||
if (m_algebraic_species.size() > 1 && count < m_algebraic_species.size() - 1) {
|
if (m_algebraic_species.size() > 1 && count < m_algebraic_species.size() - 1) {
|
||||||
@@ -1256,7 +1254,7 @@ namespace gridfire {
|
|||||||
} else {
|
} else {
|
||||||
msg << "nuclei ";
|
msg << "nuclei ";
|
||||||
// TODO: Refactor nice list printing into utility function somewhere
|
// TODO: Refactor nice list printing into utility function somewhere
|
||||||
int counter = 0;
|
size_t counter = 0;
|
||||||
for (const auto& seed_idx : seed_indices) {
|
for (const auto& seed_idx : seed_indices) {
|
||||||
msg << m_baseEngine.getNetworkSpecies()[seed_idx].name();
|
msg << m_baseEngine.getNetworkSpecies()[seed_idx].name();
|
||||||
if (counter < seed_indices.size() - 2) {
|
if (counter < seed_indices.size() - 2) {
|
||||||
@@ -1309,7 +1307,7 @@ namespace gridfire {
|
|||||||
|
|
||||||
size_t slowest_pool_index = 0; // Default to the first pool if no valid pool is found
|
size_t slowest_pool_index = 0; // Default to the first pool if no valid pool is found
|
||||||
double slowest_mean_timescale = std::numeric_limits<double>::min();
|
double slowest_mean_timescale = std::numeric_limits<double>::min();
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
for (const auto& pool : pools) {
|
for (const auto& pool : pools) {
|
||||||
double mean_timescale = 0.0;
|
double mean_timescale = 0.0;
|
||||||
for (const auto& species_idx : pool) {
|
for (const auto& species_idx : pool) {
|
||||||
@@ -1321,7 +1319,7 @@ namespace gridfire {
|
|||||||
LOG_CRITICAL(m_logger, "Encountered infinite mean timescale for pool {} with species: {}",
|
LOG_CRITICAL(m_logger, "Encountered infinite mean timescale for pool {} with species: {}",
|
||||||
count, [&]() -> std::string {
|
count, [&]() -> std::string {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
int iCount = 0;
|
size_t iCount = 0;
|
||||||
for (const auto& idx : pool) {
|
for (const auto& idx : pool) {
|
||||||
ss << all_species[idx].name() << ": " << all_timescales.at(all_species[idx]);
|
ss << all_species[idx].name() << ": " << all_timescales.at(all_species[idx]);
|
||||||
if (iCount < pool.size() - 1) {
|
if (iCount < pool.size() - 1) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace gridfire::partition {
|
|||||||
std::string CompositePartitionFunction::type() const {
|
std::string CompositePartitionFunction::type() const {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "CompositePartitionFunction(";
|
ss << "CompositePartitionFunction(";
|
||||||
int count = 0;
|
size_t count = 0;
|
||||||
for (const auto& partitionFunction : m_partitionFunctions) {
|
for (const auto& partitionFunction : m_partitionFunctions) {
|
||||||
ss << partitionFunction->type();
|
ss << partitionFunction->type();
|
||||||
if (count < m_partitionFunctions.size() - 1) {
|
if (count < m_partitionFunctions.size() - 1) {
|
||||||
|
|||||||
@@ -221,8 +221,8 @@ namespace gridfire::solver {
|
|||||||
size_t numSpecies = m_engine.getNetworkSpecies().size();
|
size_t numSpecies = m_engine.getNetworkSpecies().size();
|
||||||
J.resize(numSpecies+1, numSpecies+1);
|
J.resize(numSpecies+1, numSpecies+1);
|
||||||
J.clear();
|
J.clear();
|
||||||
for (int i = 0; i < numSpecies; ++i) {
|
for (size_t i = 0; i < numSpecies; ++i) {
|
||||||
for (int j = 0; j < numSpecies; ++j) {
|
for (size_t j = 0; j < numSpecies; ++j) {
|
||||||
J(i, j) = m_engine.getJacobianMatrixEntry(i, j);
|
J(i, j) = m_engine.getJacobianMatrixEntry(i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://github.com/4D-STAR/fourdst
|
url = https://github.com/4D-STAR/fourdst
|
||||||
revision = v0.5.1
|
revision = v0.5.2
|
||||||
depth = 1
|
depth = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user