votca 2024-dev
Loading...
Searching...
No Matches
beadmotifconnector.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// Local VOTCA includes
20
21using namespace std;
22using namespace votca::tools;
23
24namespace votca {
25namespace csg {
26
27using element = reduced_edge_to_edges_map::value_type;
28
30 const Edge& bead_edge) {
31 motif_and_bead_edges_.insert(element(motif_edge, bead_edge));
32}
33
34vector<Edge> BeadMotifConnector::getBeadEdges(const Edge& motif_edge) const {
35 auto left_iterator_range = motif_and_bead_edges_.left.equal_range(motif_edge);
36 vector<Edge> bead_edges;
37 for (auto iterator = left_iterator_range.first;
38 iterator != left_iterator_range.second; ++iterator) {
39 bead_edges.push_back(iterator->second);
40 }
41 return bead_edges;
42}
43
44vector<Edge> BeadMotifConnector::getBeadEdges() const noexcept {
45 vector<Edge> bead_edges;
46 for (auto left_iterator = motif_and_bead_edges_.left.begin();
47 left_iterator != motif_and_bead_edges_.left.end(); ++left_iterator) {
48 bead_edges.push_back(left_iterator->second);
49 }
50 return bead_edges;
51}
52
54 assert(motif_and_bead_edges_.right.count(bead_edge) &&
55 "bead_edge is not contained in beadmotifconnector.");
56 return motif_and_bead_edges_.right.at(bead_edge);
57}
58
59unordered_set<Edge> BeadMotifConnector::getMotifEdges() const noexcept {
60 unordered_set<Edge> motif_edges;
61 for (auto left_iterator = motif_and_bead_edges_.left.begin();
62 left_iterator != motif_and_bead_edges_.left.end(); ++left_iterator) {
63 motif_edges.insert(left_iterator->first);
64 }
65 return motif_edges;
66}
67} // namespace csg
68} // namespace votca
tools::Edge getMotifEdge(const tools::Edge &bead_edge) const
Returns the motifs involved between two beads given by bead_edge.
std::vector< tools::Edge > getBeadEdges() const noexcept
Returns all the bead edges connecting the motifs.
void AddMotifAndBeadEdge(const tools::Edge &motif_edge, const tools::Edge &bead_edge)
std::unordered_set< tools::Edge > getMotifEdges() const noexcept
Returns all the motif edges.
reduced_edge_to_edges_map motif_and_bead_edges_
Connects to vertices.
Definition edge.h:42
STL namespace.
reduced_edge_to_edges_map::value_type element
base class for all analysis tools
Definition basebead.h:33