• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

BlueBrain / MorphIO / 6533524408

16 Oct 2023 12:24PM UTC coverage: 76.051% (-0.02%) from 76.073%
6533524408

push

github

mgeplf
fix test_root_node_split

1972 of 2593 relevant lines covered (76.05%)

903.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

37.25
/src/mut/mito_section.cpp
1
/* Copyright (c) 2013-2023, EPFL/Blue Brain Project
2
 *
3
 * SPDX-License-Identifier: Apache-2.0
4
 */
5
#include <morphio/mut/mito_section.h>
6
#include <morphio/mut/mitochondria.h>
7

8
namespace morphio {
9
namespace mut {
10
MitoSection::MitoSection(Mitochondria* mitochondria,
66✔
11
                         unsigned int section_id,
12
                         const Property::MitochondriaPointLevel& pointProperties)
66✔
13
    : id_(section_id)
14
    , mitochondria_(mitochondria)
15
    , _mitoPoints(pointProperties) {}
66✔
16

17
MitoSection::MitoSection(Mitochondria* mitochondria,
66✔
18
                         unsigned int section_id,
19
                         const morphio::MitoSection& section)
66✔
20
    : MitoSection(mitochondria,
21
                  section_id,
22
                  Property::MitochondriaPointLevel(section.properties_->_mitochondriaPointLevel,
132✔
23
                                                   section.range_)) {}
198✔
24

25
MitoSection::MitoSection(Mitochondria* mitochondria,
×
26
                         unsigned int section_id,
27
                         const MitoSection& section)
×
28
    : id_(section_id)
29
    , mitochondria_(mitochondria)
30
    , _mitoPoints(section._mitoPoints) {}
×
31

32
std::shared_ptr<MitoSection> MitoSection::appendSection(
×
33
    const Property::MitochondriaPointLevel& points) {
34
    unsigned int parentId = id();
×
35

36
    std::shared_ptr<MitoSection> ptr(
37
        new MitoSection(mitochondria_, mitochondria_->_counter, points));
×
38

39
    uint32_t childId = mitochondria_->_register(ptr);
×
40

41
    mitochondria_->parent_[childId] = parentId;
×
42
    mitochondria_->children_[parentId].push_back(ptr);
×
43
    return ptr;
×
44
}
45

46
std::shared_ptr<MitoSection> MitoSection::appendSection(
×
47
    const std::shared_ptr<MitoSection>& original_section, bool recursive) {
48
    std::shared_ptr<MitoSection> ptr(
49
        new MitoSection(mitochondria_, mitochondria_->_counter, *original_section));
×
50
    unsigned int parentId = id();
×
51
    uint32_t section_id = mitochondria_->_register(ptr);
×
52

53
    mitochondria_->parent_[section_id] = parentId;
×
54
    mitochondria_->children_[parentId].push_back(ptr);
×
55

56
    if (recursive) {
×
57
        for (const auto& child : original_section->children()) {
×
58
            ptr->appendSection(child, true);
×
59
        }
60
    }
61

62
    return ptr;
×
63
}
64

65
std::shared_ptr<MitoSection> MitoSection::appendSection(const morphio::MitoSection& section,
22✔
66
                                                        bool recursive) {
67
    std::shared_ptr<MitoSection> ptr(
68
        new MitoSection(mitochondria_, mitochondria_->_counter, section));
22✔
69
    unsigned int parentId = id();
22✔
70
    uint32_t childId = mitochondria_->_register(ptr);
22✔
71

72
    mitochondria_->parent_[childId] = parentId;
22✔
73
    mitochondria_->children_[parentId].push_back(ptr);
22✔
74

75
    if (recursive) {
22✔
76
        for (const auto& child : section.children()) {
22✔
77
            ptr->appendSection(child, true);
×
78
        }
79
    }
80

81
    return ptr;
44✔
82
}
83

84
std::shared_ptr<MitoSection> MitoSection::parent() const {
×
85
    return mitochondria_->sections_.at(mitochondria_->parent_.at(id()));
×
86
}
87

88
bool MitoSection::isRoot() const {
×
89
    return mitochondria_->parent_.count(id()) == 0;
×
90
}
91

92
bool MitoSection::hasSameShape(const MitoSection& other) const noexcept {
2✔
93
    return (other.neuriteSectionIds() == neuriteSectionIds() && other.diameters() == diameters() &&
4✔
94
            other.pathLengths() == pathLengths());
4✔
95
}
96

97
const std::vector<std::shared_ptr<MitoSection>>& MitoSection::children() const {
×
98
    const auto& children = mitochondria_->children_;
×
99
    const auto it = children.find(id());
×
100
    if (it == children.end()) {
×
101
        static std::vector<std::shared_ptr<MitoSection>> empty;
×
102
        return empty;
×
103
    }
104
    return it->second;
×
105
}
106

107
}  // namespace mut
108
}  // namespace morphio
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc