Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
core
scoring
TenANeighborGraph.hh
Go to the documentation of this file.
1
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2
// vi: set ts=2 noet:
3
//
4
// (c) Copyright Rosetta Commons Member Institutions.
5
// (c) This file is part of the Rosetta software suite and is made available under license.
6
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9
10
/// @file core/scoring/TenANeighborGraph.hh
11
/// @brief Ten Angstrom Neighbor Graph class declaration
12
/// @author Andrew Leaver-Fay (leaverfa@email.unc.edu)
13
14
#ifndef INCLUDED_core_scoring_TenANeighborGraph_hh
15
#define INCLUDED_core_scoring_TenANeighborGraph_hh
16
17
// Unit Headers
18
#include <
core/scoring/TenANeighborGraph.fwd.hh
>
19
20
// Package Headers
21
#include <
core/scoring/ContextGraph.hh
>
22
23
// Project Headers
24
#include <
core/graph/Graph.hh
>
25
26
#include <
core/pose/Pose.fwd.hh
>
27
28
#include <utility/vector1.hh>
29
30
31
namespace
core {
32
namespace
scoring {
33
34
class
TenANeighborNode
:
public
graph::Node
35
{
36
public
:
37
typedef
graph::Node
parent
;
38
39
public
:
40
virtual
~TenANeighborNode
();
41
TenANeighborNode
(
graph::Graph
*,
Size
node_id );
42
43
virtual
void
copy_from
(
Node
const
* source );
44
45
virtual
Size
count_static_memory
()
const
;
46
virtual
Size
count_dynamic_memory
()
const
;
47
48
/// @brief set the neighbor mass for a vertex
49
void
neighbor_mass
(
Real
mass );
50
51
/// @brief return the neighbor mass for a vertex
52
inline
53
Real
neighbor_mass
()
const
54
{
return
neighbor_mass_
; }
55
56
inline
57
Real
sum_of_neighbors_masses
()
const
58
{
59
if
(
since_last_sonm_update_
==
TIME_TO_UPDATE
) {
60
update_neighbor_mass_sum
();
61
}
62
return
sum_of_neighbors_masses_
;
63
}
64
65
/// @brief To be called by TenANeighborEdge only
66
/// called at the time of edge addition
67
void
add_neighbors_mass
(
Real
neighbors_mass ) {
68
sum_of_neighbors_masses_
+= neighbors_mass;
69
++
since_last_sonm_update_
;
70
}
71
72
/// @brief To be called by TenANeighborEdge only
73
/// called at the time of edge deletion
74
void
subtract_neighbors_mass
(
Real
neighbors_mass ) {
75
sum_of_neighbors_masses_
-= neighbors_mass;
76
++
since_last_sonm_update_
;
77
}
78
private
:
79
void
80
update_neighbor_mass_sum
()
const
;
81
82
private
:
83
static
Size
const
TIME_TO_UPDATE
= 1024;
84
85
Real
neighbor_mass_
;
86
mutable
Real
sum_of_neighbors_masses_
;
87
mutable
Size
since_last_sonm_update_
;
88
};
89
90
class
TenANeighborEdge
:
public
graph::Edge
91
{
92
public
:
93
typedef
graph::Edge
parent
;
94
95
public
:
96
virtual
~TenANeighborEdge
();
97
TenANeighborEdge
(
graph::Graph
* owner,
Size
first_node_ind,
Size
second_node_ind);
98
99
virtual
void
copy_from
(
graph::Edge
const
* source );
100
101
virtual
Size
count_static_memory
()
const
;
102
virtual
Size
count_dynamic_memory
()
const
;
103
104
private
:
105
inline
106
TenANeighborNode
const
*
107
get_TenANode
(
Size
node_index )
const
{
108
assert( dynamic_cast< TenANeighborNode const * > (
get_node
( node_index ) ) );
109
return
static_cast<
TenANeighborNode
const
*
>
(
get_node
( node_index ) );
110
}
111
112
inline
113
TenANeighborNode
*
114
get_TenANode
(
Size
node_index ) {
115
assert( dynamic_cast< TenANeighborNode * > (
get_node
( node_index ) ) );
116
return
static_cast<
TenANeighborNode
*
>
(
get_node
( node_index ) );
117
}
118
119
};
120
121
class
TenANeighborGraph
:
public
ContextGraph
122
{
123
public
:
124
typedef
ContextGraph
parent
;
125
126
public
:
127
128
virtual
~TenANeighborGraph
();
129
130
TenANeighborGraph
();
131
TenANeighborGraph
(
Size
num_nodes
);
132
TenANeighborGraph
(
TenANeighborGraph
const
& source );
133
TenANeighborGraph
&
operator =
(
TenANeighborGraph
const
& source );
134
135
virtual
136
Distance
137
neighbor_cutoff
()
const
;
138
139
virtual
140
void
141
conditionally_add_edge
(
142
Size
lower_node_id,
143
Size
upper_node_id,
144
DistanceSquared
dsq
145
);
146
147
virtual
148
ContextGraphOP
149
clone
()
const
;
150
151
virtual
152
void
update_from_pose
(
153
pose::Pose
const
& pose
154
);
155
156
virtual
void
delete_edge
(
graph::Edge
* edge );
157
158
159
protected
:
160
161
virtual
Size
count_static_memory
()
const
;
162
virtual
Size
count_dynamic_memory
()
const
;
163
164
virtual
graph::Node
*
create_new_node
(
Size
node_index );
165
virtual
graph::Edge
*
create_new_edge
(
Size
index1,
Size
index2);
166
virtual
graph::Edge
*
create_new_edge
(
graph::Edge
const
* example_edge );
167
168
private
:
169
static
Distance
const
tenA_
;
170
static
DistanceSquared
const
tenA_squared_
;
171
172
boost::unordered_object_pool< TenANeighborEdge >
*
tenA_edge_pool_
;
173
174
};
175
176
}
// scoring
177
}
// core
178
179
#endif
Generated on Sat Jun 1 2013 11:40:19 for Rosetta 3.5 by
1.8.4