KiCad PCB EDA Suite
Loading...
Searching...
No Matches
conn_partition.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include "conn_keys.h"
23#include <span>
24
25namespace SCH_CONNECTIVITY
26{
28{
30 uint64_t version = 0;
31 std::vector<NODE_ID> edges;
32};
33
39{
41 std::vector<std::pair<NODE_ID, uint64_t>> identity;
42 uint64_t hash = 0;
43 bool operator==( const PARTITION& ) const = default;
44};
45
52{
53public:
54 std::vector<PARTITION> Build( std::span<const NODE_INPUT> aInputs, const SESSION_KEYS& aKeys );
55
56private:
57 NODE_ID Find( NODE_ID aNode );
58 void Unite( NODE_ID aLeft, NODE_ID aRight );
59
60 std::vector<NODE_ID> m_parent;
61 std::vector<uint8_t> m_rank;
62 std::vector<uint8_t> m_active;
63 std::vector<uint64_t> m_versions;
64 std::vector<NODE_ID> m_groupOfRoot;
65};
66} // namespace SCH_CONNECTIVITY
Fresh connectivity for one stratum.
NODE_ID Find(NODE_ID aNode)
void Unite(NODE_ID aLeft, NODE_ID aRight)
std::vector< NODE_ID > m_parent
std::vector< uint64_t > m_versions
std::vector< uint8_t > m_active
std::vector< uint8_t > m_rank
std::vector< PARTITION > Build(std::span< const NODE_INPUT > aInputs, const SESSION_KEYS &aKeys)
std::vector< NODE_ID > m_groupOfRoot
Session IDs are dense handles, never a canonical ordering.
Definition conn_keys.h:146
Value keys and the key session of the schematic connectivity engine.
uint32_t NODE_ID
Session handle of a NODE_KEY graph node.
Definition conn_keys.h:43
constexpr uint32_t INVALID_ID
Marks an unset handle.
Definition conn_keys.h:47
std::vector< NODE_ID > edges
Exact identity of one connected component.
std::vector< std::pair< NODE_ID, uint64_t > > identity
bool operator==(const PARTITION &) const =default