summaryrefslogtreecommitdiff
blob: 40b4b252fa48f4174a8e091d464e6dd6cee7cad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
From: Anna Dehof <anne@bioinf.uni-sb.de>
Date: Fri, 8 Jun 2012 19:28:12 +0200
Subject: Fix compilation of FTPBondOrderStrategy (Fixes #451)

This patch is due to Daniel Stoeckel.
---
 source/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.C |   33 +++++++++++---------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/source/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.C b/source/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.C
index 6572d96..98adf98 100644
--- a/source/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.C
+++ b/source/STRUCTURE/BONDORDERS/FPTBondOrderStrategy.C
@@ -322,7 +322,7 @@ namespace BALL
 			}
 		}
 
-		return *best;
+		return DPConstRow_(boost::reference_wrapper<DPConfig_ const>(best->first), best->second);
 	}
 
 	FPTBondOrderStrategy::Penalty FPTBondOrderStrategy::DPTable_::operator[](FPTBondOrderStrategy::DPConfig_ const& config) const
@@ -601,6 +601,9 @@ namespace BALL
 
 		return bonds;
 	}
+	
+#define	convertToCRow(tmp)\
+		std::make_pair(boost::reference_wrapper<const DPConfig_>((tmp).first), (tmp).second)
 
 	void FPTBondOrderStrategy::FPTBondOrderAssignment_::computeIntroduceBag(TreeDecompositionBag& bag, DPTable_& child,
 	                                                                        AdditionalBagProperties_& property)
@@ -621,7 +624,7 @@ namespace BALL
 		// copy with n new bondvalue-columns with different values
 		for (DPTable_::const_iterator iter = child.begin(); iter != child.end(); ++iter)
 		{
-			DPConstRow_ child_entry = *iter;
+			DPConstRow_ child_entry = convertToCRow(*iter);
 			DPConfig_ conf(num_valences, num_bonds);
 
 			Size vindex = 0;
@@ -786,7 +789,7 @@ namespace BALL
 
 		for (DPTable_::const_iterator entry_iterator = child.begin(); entry_iterator != child.end(); ++entry_iterator)
 		{
-			Penalty entry_penalty(forgetInnerVertexIn(bag, *entry_iterator, new_entry, child_property.bonds, forgotten_index));
+			Penalty entry_penalty(forgetInnerVertexIn(bag, convertToCRow(*entry_iterator), new_entry, child_property.bonds, forgotten_index));
 			if (entry_penalty < upper_bound_)
 			{
 				property.table->insert(new_entry, entry_penalty);
@@ -803,7 +806,7 @@ namespace BALL
 		Penalty min_penalty = FPTBondOrderStrategy::infinite_penalty;
 		for (DPTable_::const_iterator iter = child.begin(); iter != child.end(); ++iter)
 		{
-			min_penalty = std::min(min_penalty, forgetInnerVertexIn(bag, *iter, empty, empty_list, 0));
+			min_penalty = std::min(min_penalty, forgetInnerVertexIn(bag, convertToCRow(*iter), empty, empty_list, 0));
 
 			if (Maths::isEqual(0, min_penalty))
 			{
@@ -830,14 +833,14 @@ namespace BALL
 		// insert each entry of the left child into a DPJoinMap
 		for (DPTable_::const_iterator left_iter = left_child.begin(); left_iter != left_child.end(); ++left_iter)
 		{
-			DPConstRow_ left_entry = *left_iter;
+			DPConstRow_ left_entry = convertToCRow(*left_iter);
 			map.insert(std::pair<DPConfig_ const*, Penalty> (left_entry.first.get_pointer(), left_entry.second));
 		}
 
 		// find for each entry of the right child's table appropiate entries in the DPJoinMap (which have the same bondvalues)
 		for (DPTable_::const_iterator r_iter = right_child.begin(); r_iter != right_child.end(); ++r_iter)
 		{
-			DPConstRow_ right_entry = *r_iter;
+			DPConstRow_ right_entry = convertToCRow(*r_iter);
 			DPConfig_ const* right_conf = right_entry.first.get_pointer();
 
 			std::pair<DPJoinMap_::const_iterator, DPJoinMap_::const_iterator> matching_range(map.equal_range(right_conf));
@@ -1602,7 +1605,7 @@ namespace BALL
 		// insert possible antecessors in vectors
 		for (DPTable_::const_iterator iter = left_table.begin(); iter != left_table.end(); ++iter)
 		{
-			DPConstRow_ antecessor = *iter;
+			DPConstRow_ antecessor = convertToCRow(*iter);
 			if (comp.compare(&successor, antecessor.first.get_pointer()) == 0)
 			{
 				left_entries.push_back(iter);
@@ -1611,7 +1614,7 @@ namespace BALL
 
 		for (DPTable_::const_iterator iter = right_table.begin(); iter != right_table.end(); ++iter)
 		{
-			DPConstRow_ antecessor = *iter;
+			DPConstRow_ antecessor = convertToCRow(*iter);
 			if (comp.compare(&successor, antecessor.first.get_pointer()) == 0)
 			{
 				right_entries.push_back(iter);
@@ -1623,10 +1626,10 @@ namespace BALL
 
 		for (std::vector<DPTable_::const_iterator>::const_iterator left = left_entries.begin(); left != left_entries.end(); ++left)
 		{
-			DPConstRow_ left_entry = **left;
+			DPConstRow_ left_entry = convertToCRow(**left);
 			for (std::vector<DPTable_::const_iterator>::const_iterator right = right_entries.begin(); right != right_entries.end(); ++right)
 			{
-				DPConstRow_ right_entry = **right;
+				DPConstRow_ right_entry = convertToCRow(**right);
 
 				// check sum of valences
 				bool correct_valences = true;
@@ -1657,8 +1660,8 @@ namespace BALL
 
 		Penalty best_penalty = best.first->second + best.second->second;
 
-		DPConstRow_ left  = *best.first;
-		DPConstRow_ right = *best.second;
+		DPConstRow_ left  = convertToCRow(*best.first);
+		DPConstRow_ right = convertToCRow(*best.second);
 
 		extendState(state, left.first, 0);
 		++state.index;
@@ -1668,8 +1671,8 @@ namespace BALL
 		{
 			DPPairIt_ entry = *iter;
 
-			DPConstRow_ left  = *entry.first;
-			DPConstRow_ right = *entry.second;
+			DPConstRow_ left  = convertToCRow(*entry.first);
+			DPConstRow_ right = convertToCRow(*entry.second);
 
 			Penalty add_penalty = (left.second + right.second) - best_penalty;
 			if (isSolutionNeeded(state.assignment.penalty + add_penalty))
@@ -1720,7 +1723,7 @@ namespace BALL
 		// check for each row entry: is it a possible anteccessor?
 		for (DPTable_::iterator iter = table.begin(); iter != table.end(); ++iter)
 		{
-			Penalty pen  = bond_assignment_->forgetInnerVertexIn(bag, *iter, test_entry, child_bonds, forgotten_index);
+			Penalty pen  = bond_assignment_->forgetInnerVertexIn(bag, convertToCRow(*iter), test_entry, child_bonds, forgotten_index);
 
 			if (pen < FPTBondOrderStrategy::infinite_penalty && test_entry == successor)
 			{