| [312c0d] | 1 | /* | 
|---|
|  | 2 | * Project: MoleCuilder | 
|---|
|  | 3 | * Description: creates and alters molecular systems | 
|---|
|  | 4 | * Copyright (C)  2012 University of Bonn. All rights reserved. | 
|---|
|  | 5 | * Please see the COPYING file or "Copyright notice" in builder.cpp for details. | 
|---|
|  | 6 | * | 
|---|
|  | 7 | * | 
|---|
|  | 8 | *   This file is part of MoleCuilder. | 
|---|
|  | 9 | * | 
|---|
|  | 10 | *    MoleCuilder is free software: you can redistribute it and/or modify | 
|---|
|  | 11 | *    it under the terms of the GNU General Public License as published by | 
|---|
|  | 12 | *    the Free Software Foundation, either version 2 of the License, or | 
|---|
|  | 13 | *    (at your option) any later version. | 
|---|
|  | 14 | * | 
|---|
|  | 15 | *    MoleCuilder is distributed in the hope that it will be useful, | 
|---|
|  | 16 | *    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
|  | 17 | *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
|  | 18 | *    GNU General Public License for more details. | 
|---|
|  | 19 | * | 
|---|
|  | 20 | *    You should have received a copy of the GNU General Public License | 
|---|
|  | 21 | *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
|  | 22 | */ | 
|---|
|  | 23 |  | 
|---|
|  | 24 | /* | 
|---|
|  | 25 | * FragmentMock.cpp | 
|---|
|  | 26 | * | 
|---|
|  | 27 | *  Created on: Dec 20, 2012 | 
|---|
|  | 28 | *      Author: heber | 
|---|
|  | 29 | */ | 
|---|
|  | 30 |  | 
|---|
|  | 31 |  | 
|---|
|  | 32 | // include config.h | 
|---|
|  | 33 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 34 | #include <config.h> | 
|---|
|  | 35 | #endif | 
|---|
|  | 36 |  | 
|---|
|  | 37 | // include headers that implement a archive in simple text format | 
|---|
|  | 38 | // otherwise BOOST_CLASS_EXPORT_IMPLEMENT has no effect | 
|---|
|  | 39 | #include <boost/archive/text_oarchive.hpp> | 
|---|
|  | 40 | #include <boost/archive/text_iarchive.hpp> | 
|---|
|  | 41 |  | 
|---|
|  | 42 | #include "CodePatterns/MemDebug.hpp" | 
|---|
|  | 43 |  | 
|---|
|  | 44 | #include "Fragmentation/SetValues/Fragment.hpp" | 
|---|
|  | 45 |  | 
|---|
|  | 46 | #include <iostream> | 
|---|
|  | 47 | #include <vector> | 
|---|
|  | 48 |  | 
|---|
|  | 49 | /** Default constructor of class Fragment. | 
|---|
|  | 50 | * | 
|---|
|  | 51 | */ | 
|---|
|  | 52 | Fragment::Fragment() {} | 
|---|
|  | 53 |  | 
|---|
|  | 54 | /** Constructor of class Fragment. | 
|---|
|  | 55 | * | 
|---|
|  | 56 | * @param _positions given positions | 
|---|
|  | 57 | * @param _charges given charges | 
|---|
|  | 58 | */ | 
|---|
|  | 59 | Fragment::Fragment(const positions_t &_positions, const charges_t &_charges) | 
|---|
|  | 60 | {} | 
|---|
|  | 61 |  | 
|---|
|  | 62 | /** Adding another fragment onto this one. | 
|---|
|  | 63 | * | 
|---|
|  | 64 | * \note The operation is area-conserving, i.e. the new area is the sum of | 
|---|
|  | 65 | * both areas. | 
|---|
|  | 66 | * | 
|---|
|  | 67 | * @param other other fragment | 
|---|
|  | 68 | * @return ref to this instance | 
|---|
|  | 69 | */ | 
|---|
|  | 70 | Fragment& Fragment::operator+=(const Fragment &other) | 
|---|
|  | 71 | { return *this; } | 
|---|
|  | 72 |  | 
|---|
|  | 73 | /** Assignment operator. | 
|---|
|  | 74 | * | 
|---|
|  | 75 | * @param other other fragment to make ourselves equal to | 
|---|
|  | 76 | * @return ref to this instance | 
|---|
|  | 77 | */ | 
|---|
|  | 78 | Fragment& Fragment::operator=(const Fragment &other) | 
|---|
|  | 79 | { return *this; } | 
|---|
|  | 80 |  | 
|---|
|  | 81 | /** Subtracting another fragment from this one. | 
|---|
|  | 82 | * | 
|---|
|  | 83 | * @param other other fragment | 
|---|
|  | 84 | * @return ref to this instance | 
|---|
|  | 85 | */ | 
|---|
|  | 86 | Fragment& Fragment::operator-=(const Fragment &other) | 
|---|
|  | 87 | { return *this; } | 
|---|
|  | 88 |  | 
|---|
|  | 89 | /** Getter for all stored positions. | 
|---|
|  | 90 | * | 
|---|
|  | 91 | * @return vector of positions | 
|---|
|  | 92 | */ | 
|---|
|  | 93 | Fragment::positions_t Fragment::getPositions() const | 
|---|
|  | 94 | { return positions_t(); } | 
|---|
|  | 95 |  | 
|---|
|  | 96 | /** Getter for all stored charges. | 
|---|
|  | 97 | * | 
|---|
|  | 98 | * @return vector of charges | 
|---|
|  | 99 | */ | 
|---|
|  | 100 | Fragment::charges_t Fragment::getCharges() const | 
|---|
|  | 101 | { return charges_t(); } | 
|---|
|  | 102 |  | 
|---|
|  | 103 | /** Equality operator. | 
|---|
|  | 104 | * | 
|---|
|  | 105 | * @param other other instance to check against | 
|---|
|  | 106 | * @return true - both are equal, false - some nucleus_t differ | 
|---|
|  | 107 | */ | 
|---|
|  | 108 | bool Fragment::operator==(const Fragment& other) const | 
|---|
|  | 109 | { return true; } | 
|---|
|  | 110 |  | 
|---|
|  | 111 | /** Creates type nucleus_t from given \a position and \a charge. | 
|---|
|  | 112 | * | 
|---|
|  | 113 | * @param position position of nucleus to create | 
|---|
|  | 114 | * @param charge charge of nucleus to create | 
|---|
|  | 115 | * @return nucleus with given \a position and \a charge | 
|---|
|  | 116 | */ | 
|---|
|  | 117 | //  static nucleus_t Fragment::createNucleus(const position_t &position, const double charge); | 
|---|
|  | 118 |  | 
|---|
|  | 119 | /** Helper function to check whether two positions are equal. | 
|---|
|  | 120 | * | 
|---|
|  | 121 | * @param a first position | 
|---|
|  | 122 | * @param b second position | 
|---|
|  | 123 | * @return a equals b within numerical precision | 
|---|
|  | 124 | */ | 
|---|
|  | 125 | //  static bool Fragment::isPositionEqual(const position_t &a, const position_t &b); | 
|---|
|  | 126 |  | 
|---|
|  | 127 | // we need to explicitly instantiate the serialization functions | 
|---|
|  | 128 | BOOST_CLASS_EXPORT_IMPLEMENT(Fragment) | 
|---|
|  | 129 |  | 
|---|
|  | 130 | /** Equality operator for two nuclei. | 
|---|
|  | 131 | * | 
|---|
|  | 132 | * @param a first nuclei | 
|---|
|  | 133 | * @param b second nuclei | 
|---|
|  | 134 | * @return true - both have same position and charge, false - either charge or position is different | 
|---|
|  | 135 | */ | 
|---|
|  | 136 | bool operator==(const Fragment::nucleus_t &a, const Fragment::nucleus_t &b) | 
|---|
|  | 137 | { return true; } | 
|---|
|  | 138 |  | 
|---|
|  | 139 | std::ostream & operator<<(std::ostream &ost, const Fragment::nucleus_t &n) | 
|---|
|  | 140 | { return ost; } | 
|---|
|  | 141 |  | 
|---|
|  | 142 | std::ostream & operator<<(std::ostream &ost, const Fragment &f) | 
|---|
|  | 143 | { return ost; } | 
|---|