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
protocols
multistate_design
MultiStateEntity.cc
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 MultiStateEntity.hh
11
/// @brief
12
/// @author Colin A. Smith
13
14
// Unit headers
15
#include <
protocols/multistate_design/MultiStateEntity.hh
>
16
17
#include <
protocols/genetic_algorithm/Entity.hh
>
18
#include <
protocols/multistate_design/SingleStateEntityData.hh
>
19
20
#include <
core/types.hh
>
21
#include <basic/MetricValue.hh>
22
23
// Utility Headers
24
#include <utility/pointer/ReferenceCount.hh>
25
26
// ObjexxFCL Headers
27
#include <ObjexxFCL/format.hh>
28
29
// C++ Headers
30
#include <map>
31
32
#include <utility/vector1.hh>
33
34
35
36
namespace
protocols {
37
namespace
multistate_design {
38
39
MultiStateEntity::MultiStateEntity
() : protocols::genetic_algorithm::Entity() {}
40
41
MultiStateEntity::MultiStateEntity
(
MultiStateEntity
const
& entity ) :
42
protocols::genetic_algorithm::Entity(entity),
43
single_state_entity_data_(entity.single_state_entity_data())
44
{}
45
46
MultiStateEntity::~MultiStateEntity
() {}
47
48
MultiStateEntity::EntityOP
49
MultiStateEntity::clone
()
const
{
return
new
MultiStateEntity
(*
this
); }
50
51
void
MultiStateEntity::show
( std::ostream & os )
const
52
{
53
using namespace
ObjexxFCL::fmt;
54
55
os <<
"MultiStateEntity with traits:"
;
56
genetic_algorithm::EntityElements
const
& seq( this->
traits
() );
57
for
( genetic_algorithm::EntityElements::const_iterator
58
it( seq.begin() ),
end
( seq.end() );
59
it !=
end
; ++it ) {
60
os <<
" "
<< (*it)->to_string();
61
}
62
os <<
" and fitness "
<< F(6,3,this->
fitness
());
63
for
(
core::Size
i = 1; i <=
single_state_entity_data_
.size(); ++i) {
64
os <<
'\n'
<<
" SingleState "
<< i <<
" with fitness: "
<<
single_state_entity_data_
[i].fitness();
65
}
66
}
67
68
69
void
70
MultiStateEntity::write_checkpoint
(
71
std::ostream & os
72
)
const
73
{
74
protocols::genetic_algorithm::Entity::write_checkpoint
(os);
75
76
os <<
" states "
<<
single_state_entity_data_
.size();
77
for
(
core::Size
i = 1; i <=
single_state_entity_data_
.size(); ++i) {
78
os <<
"\n "
;
79
single_state_entity_data_
[i].write_checkpoint(os);
80
}
81
}
82
83
bool
84
MultiStateEntity::read_checkpoint
(
85
std::istream & is
86
)
87
{
88
if
(!
protocols::genetic_algorithm::Entity::read_checkpoint
(is))
return
false
;
89
90
std::string
word;
91
if
(!(is >> word))
return
false
;
92
if
(word !=
"states"
)
return
false
;
93
94
core::Size
num_states;
95
if
(!(is >> num_states))
return
false
;
96
single_state_entity_data_
.resize(num_states);
97
98
for
(
core::Size
i = 1; i <=
single_state_entity_data_
.size(); ++i) {
99
if
(!
single_state_entity_data_
[i].
read_checkpoint
(is))
return
false
;
100
}
101
102
return
true
;
103
}
104
105
utility::vector1< SingleStateEntityData >
const
&
106
MultiStateEntity::single_state_entity_data
()
const
{
return
single_state_entity_data_
; }
107
108
utility::vector1< SingleStateEntityData >
&
109
MultiStateEntity::single_state_entity_data
() {
return
single_state_entity_data_
; }
110
111
112
}
// namespace multistate_design
113
}
// namespace protocols
114
Generated on Sat Jun 1 2013 12:00:43 for Rosetta 3.5 by
1.8.4