votca
2024.2-dev
Loading...
Searching...
No Matches
tools
include
votca
tools
edge.h
Go to the documentation of this file.
1
/*
2
* Copyright 2009-2020 The VOTCA Development Team
3
* (http://www.votca.org)
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License")
6
*
7
* You may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*
18
*/
19
#ifndef VOTCA_TOOLS_EDGE_H
20
#define VOTCA_TOOLS_EDGE_H
21
22
// Standard includes
23
#include <iostream>
24
#include <limits>
25
#include <utility>
26
#include <vector>
27
28
// Local VOTCA includes
29
#include "
types.h
"
30
31
namespace
votca
{
32
namespace
tools {
33
42
class
Edge
{
43
protected
:
44
std::vector<Index>
vertices_
;
45
46
public
:
47
Edge
() =
default
;
48
virtual
~Edge
() =
default
;
51
Edge
(
Index
ID1,
Index
ID2);
53
Index
getOtherEndPoint
(
Index
ver)
const
;
55
Index
getEndPoint1
()
const
{
return
vertices_
.front(); }
57
Index
getEndPoint2
()
const
{
return
vertices_
.back(); }
58
65
bool
loop
()
const
{
return
vertices_
.front() ==
vertices_
.back(); }
66
68
bool
contains
(
Index
ID)
const
;
70
virtual
bool
operator==
(
const
Edge
& ed)
const
;
72
virtual
bool
operator!=
(
const
Edge
& ed)
const
;
73
82
virtual
bool
operator<
(
const
Edge
& ed)
const
;
83
virtual
bool
operator>
(
const
Edge
& ed)
const
;
84
virtual
bool
operator<=
(
const
Edge
& ed)
const
;
85
virtual
bool
operator>=
(
const
Edge
& ed)
const
;
86
88
friend
std::ostream&
operator<<
(std::ostream& os,
const
Edge
& ed);
89
};
90
91
// Value used as a dummy object
92
const
Edge
DUMMY_EDGE
(std::numeric_limits<Index>::max(),
93
std::numeric_limits<Index>::max());
94
}
// namespace tools
95
}
// namespace votca
96
98
namespace
std
{
99
template
<>
100
class
hash<
votca
::tools::Edge> {
101
public
:
102
size_t
operator()
(
const
votca::tools::Edge
& ed)
const
{
103
return
hash<votca::Index>()(ed.
getEndPoint1
()) ^
104
hash<votca::Index>()(ed.
getEndPoint2
());
105
}
106
};
107
}
// namespace std
108
#endif
// VOTCA_TOOLS_EDGE_H
std::hash< votca::tools::Edge >::operator()
size_t operator()(const votca::tools::Edge &ed) const
Definition
edge.h:102
votca::tools::Edge
Connects to vertices.
Definition
edge.h:42
votca::tools::Edge::operator<=
virtual bool operator<=(const Edge &ed) const
Definition
edge.cc:76
votca::tools::Edge::~Edge
virtual ~Edge()=default
votca::tools::Edge::vertices_
std::vector< Index > vertices_
Definition
edge.h:44
votca::tools::Edge::operator==
virtual bool operator==(const Edge &ed) const
Checks if Edges are equivalent.
Definition
edge.cc:49
votca::tools::Edge::operator!=
virtual bool operator!=(const Edge &ed) const
Checks if Edges are not equivalent.
Definition
edge.cc:61
votca::tools::Edge::operator>=
virtual bool operator>=(const Edge &ed) const
Definition
edge.cc:82
votca::tools::Edge::operator>
virtual bool operator>(const Edge &ed) const
Definition
edge.cc:80
votca::tools::Edge::getEndPoint1
Index getEndPoint1() const
grab the smaller integer
Definition
edge.h:55
votca::tools::Edge::getEndPoint2
Index getEndPoint2() const
grab the larger integer
Definition
edge.h:57
votca::tools::Edge::getOtherEndPoint
Index getOtherEndPoint(Index ver) const
Given one of the integers in the edge the other will be output.
Definition
edge.cc:37
votca::tools::Edge::contains
bool contains(Index ID) const
Determine if the edge contains the Index ID.
Definition
edge.cc:45
votca::tools::Edge::operator<
virtual bool operator<(const Edge &ed) const
Definition
edge.cc:63
votca::tools::Edge::loop
bool loop() const
Checks to see if an edge loops back on itself.
Definition
edge.h:65
votca::tools::Edge::Edge
Edge()=default
votca::tools::Edge::operator<<
friend std::ostream & operator<<(std::ostream &os, const Edge &ed)
Print the contents of the edge.
Definition
edge.cc:84
std
STL namespace.
votca::tools::DUMMY_EDGE
const Edge DUMMY_EDGE(std::numeric_limits< Index >::max(), std::numeric_limits< Index >::max())
votca
base class for all analysis tools
Definition
basebead.h:33
votca::Index
Eigen::Index Index
Definition
types.h:26
types.h
Generated by
1.12.0