| 1 | /*
 | 
|---|
| 2 |  * Project: MoleCuilder
 | 
|---|
| 3 |  * Description: creates and alters molecular systems
 | 
|---|
| 4 |  * Copyright (C)  2012 University of Bonn. All rights reserved.
 | 
|---|
| 5 |  * Copyright (C)  2013 Frederik Heber. All rights reserved.
 | 
|---|
| 6 |  * Please see the COPYING file or "Copyright notice" in builder.cpp for details.
 | 
|---|
| 7 |  * 
 | 
|---|
| 8 |  *
 | 
|---|
| 9 |  *   This file is part of MoleCuilder.
 | 
|---|
| 10 |  *
 | 
|---|
| 11 |  *    MoleCuilder is free software: you can redistribute it and/or modify
 | 
|---|
| 12 |  *    it under the terms of the GNU General Public License as published by
 | 
|---|
| 13 |  *    the Free Software Foundation, either version 2 of the License, or
 | 
|---|
| 14 |  *    (at your option) any later version.
 | 
|---|
| 15 |  *
 | 
|---|
| 16 |  *    MoleCuilder is distributed in the hope that it will be useful,
 | 
|---|
| 17 |  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 18 |  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 19 |  *    GNU General Public License for more details.
 | 
|---|
| 20 |  *
 | 
|---|
| 21 |  *    You should have received a copy of the GNU General Public License
 | 
|---|
| 22 |  *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>. 
 | 
|---|
| 23 |  */
 | 
|---|
| 24 | 
 | 
|---|
| 25 | /*
 | 
|---|
| 26 |  * parseKeySetFile.cpp
 | 
|---|
| 27 |  *
 | 
|---|
| 28 |  *  Created on: Sep 28, 2012
 | 
|---|
| 29 |  *      Author: heber
 | 
|---|
| 30 |  */
 | 
|---|
| 31 | 
 | 
|---|
| 32 | 
 | 
|---|
| 33 | // include config.h
 | 
|---|
| 34 | #ifdef HAVE_CONFIG_H
 | 
|---|
| 35 | #include <config.h>
 | 
|---|
| 36 | #endif
 | 
|---|
| 37 | 
 | 
|---|
| 38 | //#include "CodePatterns/MemDebug.hpp"
 | 
|---|
| 39 | 
 | 
|---|
| 40 | #include "parseKeySetFile.hpp"
 | 
|---|
| 41 | 
 | 
|---|
| 42 | #include <sstream>
 | 
|---|
| 43 | #include <string>
 | 
|---|
| 44 | 
 | 
|---|
| 45 | #include "CodePatterns/Assert.hpp"
 | 
|---|
| 46 | 
 | 
|---|
| 47 | #include "Fragmentation/KeySetsContainer.hpp"
 | 
|---|
| 48 | #include "Helpers/defs.hpp"
 | 
|---|
| 49 | 
 | 
|---|
| 50 | 
 | 
|---|
| 51 | void parseKeySetFile(
 | 
|---|
| 52 |     KeySetsContainer &KeySet,
 | 
|---|
| 53 |     const std::string &KeySetFilename,
 | 
|---|
| 54 |     const size_t FragmentCounter,
 | 
|---|
| 55 |     const enum KeySetFileType keysettype
 | 
|---|
| 56 |     )
 | 
|---|
| 57 | {
 | 
|---|
| 58 |   std::stringstream filename;
 | 
|---|
| 59 |   switch (keysettype) {
 | 
|---|
| 60 |     case NonHydrogenKeySets:
 | 
|---|
| 61 |       filename << FRAGMENTPREFIX << KEYSETFILE;
 | 
|---|
| 62 |       break;
 | 
|---|
| 63 |     case HydrogenKeySets:
 | 
|---|
| 64 |       filename << FRAGMENTPREFIX << FORCESFILE;
 | 
|---|
| 65 |       break;
 | 
|---|
| 66 |     default:
 | 
|---|
| 67 |       ASSERT(0, "parseKeySetFile() - unknown KeySetType.");
 | 
|---|
| 68 |   }
 | 
|---|
| 69 | 
 | 
|---|
| 70 | #ifndef NDEBUG
 | 
|---|
| 71 |     bool status =
 | 
|---|
| 72 | #endif
 | 
|---|
| 73 |       KeySet.ParseKeySets(KeySetFilename, filename.str(), FragmentCounter);
 | 
|---|
| 74 |   ASSERT( status,
 | 
|---|
| 75 |       "FragmentationResults::FragmentationResults() - ParseKeySets() of "
 | 
|---|
| 76 |       +toString(KEYSETFILE)+" failed.");
 | 
|---|
| 77 | }
 | 
|---|