Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/check_clang_format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DIRS_TO_FORMAT='src include python'
set -euo pipefail

VENV=build/venv-clang-format
CLANG_FORMAT_VERSION=9.0.0
CLANG_FORMAT_VERSION=20.1.5

if [[ ! -d $VENV ]]; then
python3 -mvenv "$VENV"
Expand Down
1 change: 1 addition & 0 deletions ci/check_generated_docstrings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set -euo pipefail

if [[ -z $LIBCLANG_PATH ]]; then
echo "Expect a \$LIBCLANG_PATH in the environment, it should have the path to the libclang.so"
echo "see .github/workflows/docstring_check.yaml for the version currrently used"
exit -1
fi

Expand Down
3 changes: 2 additions & 1 deletion include/bbp/sonata/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ class SONATA_API SimulationConfig
std::string name;
};

struct ModificationTTX: public ModificationBase {};
struct ModificationTTX: public ModificationBase {
};

struct ModificationConfigureAllSections: public ModificationBase {
/// For “ConfigureAllSections” manipulation, a snippet of python code to perform one or more
Expand Down
33 changes: 19 additions & 14 deletions python/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,16 @@ py::class_<Storage> bindStorageClass(py::module& m, const char* clsName, const c
namespace pybind11 {
namespace detail {
template <typename T>
struct type_caster<nonstd::optional<T>>: optional_caster<nonstd::optional<T>> {};
struct type_caster<nonstd::optional<T>>: optional_caster<nonstd::optional<T>> {
};

template <>
struct type_caster<nonstd::nullopt_t>: public void_caster<nonstd::nullopt_t> {};
struct type_caster<nonstd::nullopt_t>: public void_caster<nonstd::nullopt_t> {
};

template <typename... Ts>
struct type_caster<nonstd::variant<Ts...>>: variant_caster<nonstd::variant<Ts...>> {};
struct type_caster<nonstd::variant<Ts...>>: variant_caster<nonstd::variant<Ts...>> {
};
} // namespace detail
} // namespace pybind11

Expand All @@ -345,17 +348,19 @@ void bindReportReader(py::module& m, const std::string& prefix) {
// .ids, .data and .time members are owned by the c++ object. We can't do std::move.
// To avoid copies, we must declare the owner of the data as the current Python
// object. Numpy will adjust owner reference count according to returned arrays
.def_property_readonly("ids", [](const DataFrame<KeyType>& dframe) {
std::array<ssize_t, 1> dims { ssize_t(dframe.ids.size()) };
return managedMemoryArray(dframe.ids.data(), dims, dframe);
})
.def_property_readonly("data", [](const DataFrame<KeyType>& dframe) {
std::array<ssize_t, 2> dims {0l, ssize_t(dframe.ids.size())};
if (dims[1] > 0) {
dims[0] = dframe.data.size() / dims[1];
}
return managedMemoryArray(dframe.data.data(), dims, dframe);
})
.def_property_readonly("ids",
[](const DataFrame<KeyType>& dframe) {
std::array<ssize_t, 1> dims{ssize_t(dframe.ids.size())};
return managedMemoryArray(dframe.ids.data(), dims, dframe);
})
.def_property_readonly("data",
[](const DataFrame<KeyType>& dframe) {
std::array<ssize_t, 2> dims{0l, ssize_t(dframe.ids.size())};
if (dims[1] > 0) {
dims[0] = dframe.data.size() / dims[1];
}
return managedMemoryArray(dframe.data.data(), dims, dframe);
})
.def_property_readonly("times", [](DataFrame<KeyType>& dframe) {
return managedMemoryArray(dframe.times.data(), dframe.times.size(), dframe);
});
Expand Down
2 changes: 1 addition & 1 deletion src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ namespace bbp {
namespace sonata {

SonataError::SonataError(const std::string& what)
: std::runtime_error(what) {}
: std::runtime_error(what) { }
} // namespace sonata
} // namespace bbp
29 changes: 16 additions & 13 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ template <typename Type>
void raiseIfInvalidEnum(const char* /*unused*/,
const Type& /*unused*/,
const std::string& /*unused*/,
std::false_type /* tag */) {}
std::false_type /* tag */) { }

template <typename Type>
void parseMandatory(const nlohmann::json& it,
Expand Down Expand Up @@ -923,10 +923,11 @@ class CircuitConfig::Parser
"node",
status,
[&](NodePopulationProperties& popProperties, const nlohmann::json& popData) {
popProperties.spatialSegmentIndexDir = getJSONPath(popData, "spatial_segment_index_dir");
popProperties.vasculatureFile = getOptionalJSONPath(popData, "vasculature_file");
popProperties.vasculatureMesh = getOptionalJSONPath(popData, "vasculature_mesh");
popProperties.microdomainsFile = getOptionalJSONPath(popData, "microdomains_file");
popProperties.spatialSegmentIndexDir = getJSONPath(popData,
"spatial_segment_index_dir");
popProperties.vasculatureFile = getOptionalJSONPath(popData, "vasculature_file");
popProperties.vasculatureMesh = getOptionalJSONPath(popData, "vasculature_mesh");
popProperties.microdomainsFile = getOptionalJSONPath(popData, "microdomains_file");
});
}

Expand All @@ -936,10 +937,12 @@ class CircuitConfig::Parser
"edge",
status,
[&](EdgePopulationProperties& popProperties, const nlohmann::json& popData) {
popProperties.spatialSynapseIndexDir = getJSONPath(popData, "spatial_synapse_index_dir");
popProperties.endfeetMeshesFile = getOptionalJSONPath(popData, "endfeet_meshes_file");
popProperties.spineMorphologiesDir = getOptionalJSONPath(popData,
"spine_morphologies_dir");
popProperties.spatialSynapseIndexDir = getJSONPath(popData,
"spatial_synapse_index_dir");
popProperties.endfeetMeshesFile = getOptionalJSONPath(popData,
"endfeet_meshes_file");
popProperties.spineMorphologiesDir = getOptionalJSONPath(popData,
"spine_morphologies_dir");
});
}

Expand Down Expand Up @@ -1458,13 +1461,13 @@ const nonstd::optional<std::string>& SimulationConfig::getNodeSet() const noexce
return _nodeSet;
}

const std::unordered_map<std::string, variantValueType>& SimulationConfig::getMetaData() const
noexcept {
const std::unordered_map<std::string, variantValueType>& SimulationConfig::getMetaData()
const noexcept {
return _metaData;
}

const std::unordered_map<std::string, variantValueType>& SimulationConfig::getBetaFeatures() const
noexcept {
const std::unordered_map<std::string, variantValueType>& SimulationConfig::getBetaFeatures()
const noexcept {
return _betaFeatures;
}

Expand Down
4 changes: 2 additions & 2 deletions src/edges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ namespace sonata {
EdgePopulation::EdgePopulation(const std::string& h5FilePath,
const std::string& csvFilePath,
const std::string& name)
: Population(h5FilePath, csvFilePath, name, ELEMENT, Hdf5Reader()) {}
: Population(h5FilePath, csvFilePath, name, ELEMENT, Hdf5Reader()) { }

EdgePopulation::EdgePopulation(const std::string& h5FilePath,
const std::string& csvFilePath,
const std::string& name,
const Hdf5Reader& hdf5_reader)
: Population(h5FilePath, csvFilePath, name, ELEMENT, hdf5_reader) {}
: Population(h5FilePath, csvFilePath, name, ELEMENT, hdf5_reader) { }


std::string EdgePopulation::source() const {
Expand Down
4 changes: 2 additions & 2 deletions src/hdf5_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ namespace sonata {

Hdf5Reader::Hdf5Reader()
: impl(std::make_shared<
Hdf5PluginDefault<Hdf5Reader::supported_1D_types, supported_2D_types>>()) {}
Hdf5PluginDefault<Hdf5Reader::supported_1D_types, supported_2D_types>>()) { }

Hdf5Reader::Hdf5Reader(
std::shared_ptr<Hdf5PluginInterface<supported_1D_types, supported_2D_types>> impl)
: impl(std::move(impl)) {}
: impl(std::move(impl)) { }

HighFive::File Hdf5Reader::openFile(const std::string& filename) const {
return impl->openFile(filename);
Expand Down
30 changes: 15 additions & 15 deletions src/node_sets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,15 @@ class NodeSets
}

explicit NodeSets(const fs::path& path)
: NodeSets(json::parse(std::ifstream(validate_path(path)))) {}
: NodeSets(json::parse(std::ifstream(validate_path(path)))) { }

static std::unique_ptr<NodeSets> fromFile(const std::string& path_) {
fs::path path(path_);
return std::make_unique<detail::NodeSets>(path);
}

explicit NodeSets(const std::string& content)
: NodeSets(json::parse(content)) {}
: NodeSets(json::parse(content)) { }

Selection materialize(const std::string& name, const NodePopulation& population) const;

Expand Down Expand Up @@ -168,7 +168,7 @@ class NodeSetBasicRule: public NodeSetRule
public:
NodeSetBasicRule(std::string attribute, const std::vector<T>& values)
: attribute_(std::move(attribute))
, values_(values) {}
, values_(values) { }

Selection materialize(const detail::NodeSets& /* unused */,
const NodePopulation& np) const final {
Expand Down Expand Up @@ -200,7 +200,7 @@ class NodeSetBasicPopulation: public NodeSetRule
{
public:
explicit NodeSetBasicPopulation(const std::vector<std::string>& values)
: values_(values) {}
: values_(values) { }

Selection materialize(const detail::NodeSets& /* unused */,
const NodePopulation& np) const final {
Expand Down Expand Up @@ -228,7 +228,7 @@ class NodeSetBasicNodeIds: public NodeSetRule
{
public:
explicit NodeSetBasicNodeIds(Selection::Values values)
: values_(std::move(values)) {}
: values_(std::move(values)) { }

Selection materialize(const detail::NodeSets& /* unused */,
const NodePopulation& np) const final {
Expand Down Expand Up @@ -256,7 +256,7 @@ class NodeSetBasicMultiClause: public NodeSetRule
{
public:
explicit NodeSetBasicMultiClause(std::vector<NodeSetRulePtr>&& clauses)
: clauses_(std::move(clauses)) {}
: clauses_(std::move(clauses)) { }

Selection materialize(const detail::NodeSets& ns, const NodePopulation& np) const final {
Selection ret = np.selectAll();
Expand Down Expand Up @@ -302,14 +302,14 @@ class NodeSetBasicOperatorString: public NodeSetRule
std::string value)
: op_(string2op(op))
, attribute_(std::move(attribute))
, value_(std::move(value)) {}
, value_(std::move(value)) { }

Selection materialize(const detail::NodeSets& /* unused */,
const NodePopulation& np) const final {
switch (op_) {
case Op::regex:
return np.regexMatch(attribute_, value_);
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
LIBSONATA_THROW_IF_REACHED // LCOV_EXCL_LINE
}
}
Expand All @@ -333,7 +333,7 @@ class NodeSetBasicOperatorString: public NodeSetRule
switch (op) {
case Op::regex:
return "$regex";
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
LIBSONATA_THROW_IF_REACHED // LCOV_EXCL_LINE
}
}
Expand All @@ -357,7 +357,7 @@ class NodeSetBasicOperatorNumeric: public NodeSetRule
explicit NodeSetBasicOperatorNumeric(std::string name, const std::string& op, double value)
: name_(std::move(name))
, value_(value)
, op_(string2op(op)) {}
, op_(string2op(op)) { }

Selection materialize(const detail::NodeSets& /* unused */,
const NodePopulation& np) const final {
Expand All @@ -372,7 +372,7 @@ class NodeSetBasicOperatorNumeric: public NodeSetRule
case Op::lte:
return np.filterAttribute<double>(name_,
[this](const double v) { return v <= value_; });
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
LIBSONATA_THROW_IF_REACHED // LCOV_EXCL_LINE
}
}
Expand Down Expand Up @@ -411,7 +411,7 @@ class NodeSetBasicOperatorNumeric: public NodeSetRule
return "$gte";
case Op::lte:
return "$lte";
default: // LCOV_EXCL_LINE
default: // LCOV_EXCL_LINE
LIBSONATA_THROW_IF_REACHED // LCOV_EXCL_LINE
}
}
Expand All @@ -432,7 +432,7 @@ class NodeSetCompoundRule: public NodeSetRule
public:
NodeSetCompoundRule(std::string name, CompoundTargets targets)
: name_(std::move(name))
, targets_(std::move(targets)) {}
, targets_(std::move(targets)) { }

Selection materialize(const detail::NodeSets& ns, const NodePopulation& np) const final {
Selection ret{{}};
Expand Down Expand Up @@ -727,10 +727,10 @@ Selection NodeSets::materialize(const std::string& name, const NodePopulation& p
} // namespace detail

NodeSets::NodeSets(const std::string& content)
: impl_(new detail::NodeSets(content)) {}
: impl_(new detail::NodeSets(content)) { }

NodeSets::NodeSets(std::unique_ptr<detail::NodeSets>&& impl)
: impl_(std::move(impl)) {}
: impl_(std::move(impl)) { }

NodeSets::NodeSets(NodeSets&&) noexcept = default;
NodeSets& NodeSets::operator=(NodeSets&&) noexcept = default;
Expand Down
4 changes: 2 additions & 2 deletions src/nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ Selection _filterStringAttribute(const NodePopulation& population,
NodePopulation::NodePopulation(const std::string& h5FilePath,
const std::string& csvFilePath,
const std::string& name)
: NodePopulation(h5FilePath, csvFilePath, name, Hdf5Reader()) {}
: NodePopulation(h5FilePath, csvFilePath, name, Hdf5Reader()) { }

NodePopulation::NodePopulation(const std::string& h5FilePath,
const std::string& csvFilePath,
const std::string& name,
const Hdf5Reader& hdf5_reader)
: Population(h5FilePath, csvFilePath, name, ELEMENT, hdf5_reader) {}
: Population(h5FilePath, csvFilePath, name, ELEMENT, hdf5_reader) { }

Selection NodePopulation::regexMatch(const std::string& attribute, const std::string& regex) const {
std::regex re(regex);
Expand Down
2 changes: 1 addition & 1 deletion src/population.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Population::Population(const std::string& h5FilePath,
: impl_([h5FilePath, csvFilePath, name, prefix, hdf5_reader] {
HDF5_LOCK_GUARD
return new Population::Impl(h5FilePath, csvFilePath, name, prefix, hdf5_reader);
}()) {}
}()) { }


Population::Population(Population&&) noexcept = default;
Expand Down
12 changes: 6 additions & 6 deletions src/population.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ struct Population::Impl {
template <typename Population>
struct PopulationStorage<Population>::Impl {
Impl(const std::string& _h5FilePath)
: Impl(_h5FilePath, Hdf5Reader()) {}
: Impl(_h5FilePath, Hdf5Reader()) { }

Impl(const std::string& _h5FilePath, const Hdf5Reader& hdf5_reader)
: Impl(_h5FilePath, std::string(), hdf5_reader) {}
: Impl(_h5FilePath, std::string(), hdf5_reader) { }

Impl(const std::string& _h5FilePath,
const std::string& _csvFilePath,
Expand All @@ -196,17 +196,17 @@ struct PopulationStorage<Population>::Impl {

template <typename Population>
PopulationStorage<Population>::PopulationStorage(const std::string& h5FilePath)
: PopulationStorage(h5FilePath, Hdf5Reader()) {}
: PopulationStorage(h5FilePath, Hdf5Reader()) { }

template <typename Population>
PopulationStorage<Population>::PopulationStorage(const std::string& h5FilePath,
const Hdf5Reader& hdf5_reader)
: PopulationStorage(h5FilePath, std::string(), hdf5_reader) {}
: PopulationStorage(h5FilePath, std::string(), hdf5_reader) { }

template <typename Population>
PopulationStorage<Population>::PopulationStorage(const std::string& h5FilePath,
const std::string& csvFilePath)
: PopulationStorage(h5FilePath, csvFilePath, Hdf5Reader()) {}
: PopulationStorage(h5FilePath, csvFilePath, Hdf5Reader()) { }

template <typename Population>
PopulationStorage<Population>::PopulationStorage(const std::string& h5FilePath,
Expand All @@ -215,7 +215,7 @@ PopulationStorage<Population>::PopulationStorage(const std::string& h5FilePath,
: impl_([h5FilePath, csvFilePath, hdf5_reader] {
HDF5_LOCK_GUARD
return new PopulationStorage::Impl(h5FilePath, csvFilePath, hdf5_reader);
}()) {}
}()) { }


template <typename Population>
Expand Down
2 changes: 1 addition & 1 deletion src/read_canonical_selection.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <vector>
#include <highfive/H5File.hpp>
#include <vector>

#include "read_bulk.hpp"

Expand Down
Loading
Loading