GCC Code Coverage Report


Directory: ./
File: Mapping/include/Mapping/RoutingMethod.hpp
Date: 2022-10-15 05:10:18
Exec Total Coverage
Lines: 0 8 0.0%
Functions: 0 4 0.0%
Branches: 0 6 0.0%
Decisions: 0 0 -%

Line Branch Decision Exec Source
1 // Copyright 2019-2022 Cambridge Quantum Computing
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #pragma once
16
17 #include "Mapping/MappingFrontier.hpp"
18 #include "Utils/Json.hpp"
19
20 namespace tket {
21
22 class RoutingMethod {
23 public:
24 RoutingMethod(){};
25 virtual ~RoutingMethod() {}
26
27 /**
28 * routing_method modifies circuit held in mapping_frontier with gates for the
29 * purpose of moving circuit closer to one physically permitted by given
30 * architecture. Returns a pair with a bool returning whether any modification
31 * was made and a new initial mapping of qubits in case permutation via swap
32 * network is then required, or new ancilla qubits are added. This is
33 * completed by converting boundary subcircuit in mapping frontier to a
34 * Circuit object which is then passed to route_subcircuit_ as defined in the
35 * constructor.
36 *
37 * Overloaded parameter mapping_frontier contains boundary of routed/unrouted
38 * circuit for modifying.
39 * Overloaded parameter architecture provides physical constraints
40 *
41 * @return Whether circuit is modified and Logical to Physical mapping at
42 * boundary due to modification.
43 *
44 */
45 virtual std::pair<bool, unit_map_t> routing_method(
46 MappingFrontier_ptr& /*mapping_frontier*/,
47 const ArchitecturePtr& /*architecture*/) const {
48 return {false, {}};
49 }
50
51 virtual nlohmann::json serialize() const {
52 nlohmann::json j;
53 j["name"] = "RoutingMethod";
54 return j;
55 }
56 };
57
58 typedef std::shared_ptr<const RoutingMethod> RoutingMethodPtr;
59
60 } // namespace tket
61