| 1 | /* | 
|---|
| 2 | * Project: MoleCuilder | 
|---|
| 3 | * Description: creates and alters molecular systems | 
|---|
| 4 | * Copyright (C)  2014 Frederik Heber. All rights reserved. | 
|---|
| 5 | * | 
|---|
| 6 | * | 
|---|
| 7 | *   This file is part of MoleCuilder. | 
|---|
| 8 | * | 
|---|
| 9 | *    MoleCuilder is free software: you can redistribute it and/or modify | 
|---|
| 10 | *    it under the terms of the GNU General Public License as published by | 
|---|
| 11 | *    the Free Software Foundation, either version 2 of the License, or | 
|---|
| 12 | *    (at your option) any later version. | 
|---|
| 13 | * | 
|---|
| 14 | *    MoleCuilder is distributed in the hope that it will be useful, | 
|---|
| 15 | *    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 16 | *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 17 | *    GNU General Public License for more details. | 
|---|
| 18 | * | 
|---|
| 19 | *    You should have received a copy of the GNU General Public License | 
|---|
| 20 | *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 21 | */ | 
|---|
| 22 |  | 
|---|
| 23 | /* | 
|---|
| 24 | * SphericalPointDistribution_getConnections.cpp | 
|---|
| 25 | * | 
|---|
| 26 | *  Created on: Jul 12, 2014 | 
|---|
| 27 | *      Author: heber | 
|---|
| 28 | */ | 
|---|
| 29 |  | 
|---|
| 30 | // include config.h | 
|---|
| 31 | #ifdef HAVE_CONFIG_H | 
|---|
| 32 | #include <config.h> | 
|---|
| 33 | #endif | 
|---|
| 34 |  | 
|---|
| 35 | //#include "CodePatterns/MemDebug.hpp" | 
|---|
| 36 |  | 
|---|
| 37 | #include "SphericalPointDistribution.hpp" | 
|---|
| 38 |  | 
|---|
| 39 | #include "CodePatterns/Assert.hpp" | 
|---|
| 40 |  | 
|---|
| 41 | #include <boost/assign.hpp> | 
|---|
| 42 |  | 
|---|
| 43 | using namespace std; | 
|---|
| 44 | using namespace boost::assign; | 
|---|
| 45 |  | 
|---|
| 46 | typedef SphericalPointDistribution::IndexSet_t IndexSet_t; | 
|---|
| 47 |  | 
|---|
| 48 | template <> | 
|---|
| 49 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<0>() | 
|---|
| 50 | { | 
|---|
| 51 | adjacency_t adjacency; | 
|---|
| 52 | ASSERT( adjacency.size() == 0, | 
|---|
| 53 | "SphericalPointDistribution::getConnections<0>() - adjacency has wrong size."); | 
|---|
| 54 | return adjacency; | 
|---|
| 55 | } | 
|---|
| 56 |  | 
|---|
| 57 | template <> | 
|---|
| 58 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<1>() | 
|---|
| 59 | { | 
|---|
| 60 | adjacency_t adjacency; | 
|---|
| 61 | ASSERT( adjacency.size() == 0, | 
|---|
| 62 | "SphericalPointDistribution::getConnections<1>() - adjacency has wrong size."); | 
|---|
| 63 | return adjacency; | 
|---|
| 64 | } | 
|---|
| 65 |  | 
|---|
| 66 | template <> | 
|---|
| 67 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<2>() | 
|---|
| 68 | { | 
|---|
| 69 | adjacency_t adjacency; | 
|---|
| 70 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1) ); | 
|---|
| 71 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0) ); | 
|---|
| 72 | ASSERT( adjacency.size() == 2, | 
|---|
| 73 | "SphericalPointDistribution::getConnections<2>() - adjacency has wrong size."); | 
|---|
| 74 | return adjacency; | 
|---|
| 75 | } | 
|---|
| 76 |  | 
|---|
| 77 | template <> | 
|---|
| 78 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<3>() | 
|---|
| 79 | { | 
|---|
| 80 | adjacency_t adjacency; | 
|---|
| 81 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2) ); | 
|---|
| 82 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(2) ); | 
|---|
| 83 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1) ); | 
|---|
| 84 | ASSERT( adjacency.size() == 3, | 
|---|
| 85 | "SphericalPointDistribution::getConnections<3>() - adjacency has wrong size."); | 
|---|
| 86 | return adjacency; | 
|---|
| 87 | } | 
|---|
| 88 |  | 
|---|
| 89 | template <> | 
|---|
| 90 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<4>() | 
|---|
| 91 | { | 
|---|
| 92 | adjacency_t adjacency; | 
|---|
| 93 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2)(3) ); | 
|---|
| 94 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(2)(3) ); | 
|---|
| 95 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3) ); | 
|---|
| 96 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2) ); | 
|---|
| 97 | ASSERT( adjacency.size() == 4, | 
|---|
| 98 | "SphericalPointDistribution::getConnections<4>() - adjacency has wrong size."); | 
|---|
| 99 | return adjacency; | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 | template <> | 
|---|
| 103 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<5>() | 
|---|
| 104 | { | 
|---|
| 105 | adjacency_t adjacency; | 
|---|
| 106 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4) ); | 
|---|
| 107 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4) ); | 
|---|
| 108 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(4) ); | 
|---|
| 109 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(4) ); | 
|---|
| 110 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(3) ); | 
|---|
| 111 | ASSERT( adjacency.size() == 5, | 
|---|
| 112 | "SphericalPointDistribution::getConnections<5>() - adjacency has wrong size."); | 
|---|
| 113 | return adjacency; | 
|---|
| 114 | } | 
|---|
| 115 |  | 
|---|
| 116 | template <> | 
|---|
| 117 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<6>() | 
|---|
| 118 | { | 
|---|
| 119 | adjacency_t adjacency; | 
|---|
| 120 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5) ); | 
|---|
| 121 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4)(5) ); | 
|---|
| 122 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(4)(5) ); | 
|---|
| 123 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(4)(5) ); | 
|---|
| 124 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(3) ); | 
|---|
| 125 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(2)(3) ); | 
|---|
| 126 | ASSERT( adjacency.size() == 6, | 
|---|
| 127 | "SphericalPointDistribution::getConnections<6>() - adjacency has wrong size."); | 
|---|
| 128 | return adjacency; | 
|---|
| 129 | } | 
|---|
| 130 |  | 
|---|
| 131 | template <> | 
|---|
| 132 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<7>() | 
|---|
| 133 | { | 
|---|
| 134 | adjacency_t adjacency; | 
|---|
| 135 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6) ); | 
|---|
| 136 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4)(5)(6) ); | 
|---|
| 137 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(6) ); | 
|---|
| 138 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(4) ); | 
|---|
| 139 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(3)(5) ); | 
|---|
| 140 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(4)(6) ); | 
|---|
| 141 | adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(1)(2)(5) ); | 
|---|
| 142 | ASSERT( adjacency.size() == 7, | 
|---|
| 143 | "SphericalPointDistribution::getConnections<7>() - adjacency has wrong size."); | 
|---|
| 144 | return adjacency; | 
|---|
| 145 | } | 
|---|
| 146 |  | 
|---|
| 147 | template <> | 
|---|
| 148 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<8>() | 
|---|
| 149 | { | 
|---|
| 150 | adjacency_t adjacency; | 
|---|
| 151 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6)(7) ); | 
|---|
| 152 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(2)(3)(4)(5) ); | 
|---|
| 153 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(4)(6)(7) ); | 
|---|
| 154 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(5)(7) ); | 
|---|
| 155 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(5)(6) ); | 
|---|
| 156 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(3)(4) ); | 
|---|
| 157 | adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(2)(4) ); | 
|---|
| 158 | adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(0)(2)(3) ); | 
|---|
| 159 | ASSERT( adjacency.size() == 8, | 
|---|
| 160 | "SphericalPointDistribution::getConnections<8>() - adjacency has wrong size."); | 
|---|
| 161 | return adjacency; | 
|---|
| 162 | } | 
|---|
| 163 |  | 
|---|
| 164 | template <> | 
|---|
| 165 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<9>() | 
|---|
| 166 | { | 
|---|
| 167 | adjacency_t adjacency; | 
|---|
| 168 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2)(3)(4) ); | 
|---|
| 169 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(3)(4)(5)(6) ); | 
|---|
| 170 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(3)(4)(7)(8) ); | 
|---|
| 171 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(1)(2)(5)(8) ); | 
|---|
| 172 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(1)(2)(6)(7) ); | 
|---|
| 173 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(1)(3)(6)(7)(8) ); | 
|---|
| 174 | adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(1)(4)(5)(7) ); | 
|---|
| 175 | adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(2)(4)(5)(6)(8) ); | 
|---|
| 176 | adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(2)(3)(5)(7) ); | 
|---|
| 177 | ASSERT( adjacency.size() == 9, | 
|---|
| 178 | "SphericalPointDistribution::getConnections<9>() - adjacency has wrong size."); | 
|---|
| 179 | return adjacency; | 
|---|
| 180 | } | 
|---|
| 181 |  | 
|---|
| 182 | template <> | 
|---|
| 183 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<10>() | 
|---|
| 184 | { | 
|---|
| 185 | adjacency_t adjacency; | 
|---|
| 186 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5) ); | 
|---|
| 187 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(6)(7)(8)(9) ); | 
|---|
| 188 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(4)(5)(6)(7) ); | 
|---|
| 189 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(4)(5)(8)(9) ); | 
|---|
| 190 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(2)(3)(6)(9) ); | 
|---|
| 191 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(2)(3)(7)(8) ); | 
|---|
| 192 | adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(1)(2)(4)(7)(9) ); | 
|---|
| 193 | adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(1)(2)(5)(6)(8) ); | 
|---|
| 194 | adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(1)(3)(5)(7)(9) ); | 
|---|
| 195 | adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(1)(3)(4)(6)(8) ); | 
|---|
| 196 | ASSERT( adjacency.size() == 10, | 
|---|
| 197 | "SphericalPointDistribution::getConnections<10>() - adjacency has wrong size."); | 
|---|
| 198 | return adjacency; | 
|---|
| 199 | } | 
|---|
| 200 |  | 
|---|
| 201 | template <> | 
|---|
| 202 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<11>() | 
|---|
| 203 | { | 
|---|
| 204 | adjacency_t adjacency; | 
|---|
| 205 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(1)(2)(3)(4)(5) ); | 
|---|
| 206 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(0)(2)(5)(6)(10) ); | 
|---|
| 207 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(1)(3)(6)(7) ); | 
|---|
| 208 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(2)(4)(7)(8) ); | 
|---|
| 209 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(3)(5)(8)(9) ); | 
|---|
| 210 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(1)(4)(9)(10) ); | 
|---|
| 211 | adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(1)(2)(7)(8)(9)(10) ); | 
|---|
| 212 | adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(2)(3)(6)(8) ); | 
|---|
| 213 | adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(3)(4)(6)(7)(9) ); | 
|---|
| 214 | adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(4)(5)(6)(8)(10) ); | 
|---|
| 215 | adjacency += make_pair<unsigned int, IndexSet_t >( 10, list_of<unsigned int>(1)(5)(6)(9) ); | 
|---|
| 216 | ASSERT( adjacency.size() == 11, | 
|---|
| 217 | "SphericalPointDistribution::getConnections<11>() - adjacency has wrong size."); | 
|---|
| 218 | return adjacency; | 
|---|
| 219 | } | 
|---|
| 220 |  | 
|---|
| 221 | template <> | 
|---|
| 222 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<12>() | 
|---|
| 223 | { | 
|---|
| 224 | adjacency_t adjacency; | 
|---|
| 225 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6) ); | 
|---|
| 226 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(7)(8)(9)(10)(11) ); | 
|---|
| 227 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(3)(6)(9)(10) ); | 
|---|
| 228 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(2)(4)(10)(11) ); | 
|---|
| 229 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(3)(5)(7)(11) ); | 
|---|
| 230 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(4)(6)(7)(8) ); | 
|---|
| 231 | adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(2)(5)(8)(9) ); | 
|---|
| 232 | adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(1)(4)(5)(8)(11) ); | 
|---|
| 233 | adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(1)(5)(6)(7)(9) ); | 
|---|
| 234 | adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(1)(2)(6)(8)(10) ); | 
|---|
| 235 | adjacency += make_pair<unsigned int, IndexSet_t >( 10, list_of<unsigned int>(1)(2)(3)(9)(11) ); | 
|---|
| 236 | adjacency += make_pair<unsigned int, IndexSet_t >( 11, list_of<unsigned int>(1)(3)(4)(7)(10) ); | 
|---|
| 237 | ASSERT( adjacency.size() == 12, | 
|---|
| 238 | "SphericalPointDistribution::getConnections<12>() - adjacency has wrong size."); | 
|---|
| 239 | return adjacency; | 
|---|
| 240 | } | 
|---|
| 241 |  | 
|---|
| 242 | template <> | 
|---|
| 243 | SphericalPointDistribution::adjacency_t SphericalPointDistribution::getConnections<14>() | 
|---|
| 244 | { | 
|---|
| 245 | adjacency_t adjacency; | 
|---|
| 246 | adjacency += make_pair<unsigned int, IndexSet_t >( 0, list_of<unsigned int>(2)(3)(4)(5)(6)(7) ); | 
|---|
| 247 | adjacency += make_pair<unsigned int, IndexSet_t >( 1, list_of<unsigned int>(8)(9)(10)(11)(12)(13) ); | 
|---|
| 248 | adjacency += make_pair<unsigned int, IndexSet_t >( 2, list_of<unsigned int>(0)(3)(7)(8)(13) ); | 
|---|
| 249 | adjacency += make_pair<unsigned int, IndexSet_t >( 3, list_of<unsigned int>(0)(2)(4)(8)(9) ); | 
|---|
| 250 | adjacency += make_pair<unsigned int, IndexSet_t >( 4, list_of<unsigned int>(0)(3)(5)(9)(10) ); | 
|---|
| 251 | adjacency += make_pair<unsigned int, IndexSet_t >( 5, list_of<unsigned int>(0)(4)(6)(10)(11) ); | 
|---|
| 252 | adjacency += make_pair<unsigned int, IndexSet_t >( 6, list_of<unsigned int>(0)(5)(7)(11)(12) ); | 
|---|
| 253 | adjacency += make_pair<unsigned int, IndexSet_t >( 7, list_of<unsigned int>(0)(2)(6)(12)(13) ); | 
|---|
| 254 | adjacency += make_pair<unsigned int, IndexSet_t >( 8, list_of<unsigned int>(1)(2)(3)(9)(13) ); | 
|---|
| 255 | adjacency += make_pair<unsigned int, IndexSet_t >( 9, list_of<unsigned int>(1)(3)(4)(8)(10) ); | 
|---|
| 256 | adjacency += make_pair<unsigned int, IndexSet_t >( 10, list_of<unsigned int>(1)(4)(5)(9)(11) ); | 
|---|
| 257 | adjacency += make_pair<unsigned int, IndexSet_t >( 11, list_of<unsigned int>(1)(5)(6)(10)(12) ); | 
|---|
| 258 | adjacency += make_pair<unsigned int, IndexSet_t >( 12, list_of<unsigned int>(1)(6)(7)(11)(13) ); | 
|---|
| 259 | adjacency += make_pair<unsigned int, IndexSet_t >( 13, list_of<unsigned int>(1)(2)(7)(8)(12) ); | 
|---|
| 260 | ASSERT( adjacency.size() == 14, | 
|---|
| 261 | "SphericalPointDistribution::getConnections<14>() - adjacency has wrong size."); | 
|---|
| 262 | return adjacency; | 
|---|
| 263 | } | 
|---|