| [8df74d] | 1 | /*
 | 
|---|
 | 2 |  * Project: MoleCuilder
 | 
|---|
 | 3 |  * Description: creates and alters molecular systems
 | 
|---|
| [0aa122] | 4 |  * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
 | 
|---|
| [94d5ac6] | 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/>.
 | 
|---|
| [8df74d] | 21 |  */
 | 
|---|
 | 22 | 
 | 
|---|
 | 23 | /*
 | 
|---|
 | 24 |  * BoxCommandLineQuery.cpp
 | 
|---|
 | 25 |  *
 | 
|---|
 | 26 |  *  Created on: Oct 25, 2010
 | 
|---|
 | 27 |  *      Author: heber
 | 
|---|
 | 28 |  */
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | // include config.h
 | 
|---|
 | 31 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 32 | #include <config.h>
 | 
|---|
 | 33 | #endif
 | 
|---|
 | 34 | 
 | 
|---|
| [ad011c] | 35 | #include "CodePatterns/MemDebug.hpp"
 | 
|---|
| [8df74d] | 36 | 
 | 
|---|
 | 37 | #include "Actions/Values.hpp"
 | 
|---|
| [87db7a] | 38 | #include "CommandLineUI/Query/CommandLineQuery.hpp"
 | 
|---|
| [e4afb4] | 39 | #include "CommandLineUI/CommandLineParser.hpp"
 | 
|---|
| [ad011c] | 40 | #include "CodePatterns/Log.hpp"
 | 
|---|
 | 41 | #include "CodePatterns/Verbose.hpp"
 | 
|---|
| [cca9ef] | 42 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
 | 
|---|
| [8df74d] | 43 | 
 | 
|---|
| [9d5531] | 44 | CommandLineDialog::RealSpaceMatrixCommandLineQuery::RealSpaceMatrixCommandLineQuery(Parameter<RealSpaceMatrix> &_param, std::string title, std::string _description) :
 | 
|---|
| [1c55b8] | 45 |     Dialog::TQuery<RealSpaceMatrix>(_param, title, _description)
 | 
|---|
| [8df74d] | 46 | {}
 | 
|---|
 | 47 | 
 | 
|---|
| [7d9416] | 48 | CommandLineDialog::RealSpaceMatrixCommandLineQuery::~RealSpaceMatrixCommandLineQuery()
 | 
|---|
| [8df74d] | 49 | {}
 | 
|---|
 | 50 | 
 | 
|---|
| [7d9416] | 51 | bool CommandLineDialog::RealSpaceMatrixCommandLineQuery::handle() {
 | 
|---|
| [9d5531] | 52 |   RealSpaceMatrixValue _temp;
 | 
|---|
| [8df74d] | 53 |   if (CommandLineParser::getInstance().vm.count(getTitle())) {
 | 
|---|
| [dd0c8f] | 54 |     try {
 | 
|---|
 | 55 |       _temp = CommandLineParser::getInstance().vm[getTitle()].as< RealSpaceMatrixValue >();
 | 
|---|
 | 56 |     } catch(boost::bad_any_cast &e) {
 | 
|---|
 | 57 |       for (size_t i=0;i<(NDIM*(NDIM+1))/2;++i)
 | 
|---|
 | 58 |         _temp.matrix[i] = 0.;
 | 
|---|
 | 59 |       return false;
 | 
|---|
 | 60 |     }
 | 
|---|
| [852ea3] | 61 |     temp = _temp.toRealSpaceMatrix();
 | 
|---|
| [8df74d] | 62 |     return true;
 | 
|---|
 | 63 |   }
 | 
|---|
| [dd0c8f] | 64 |   return false;
 | 
|---|
| [8df74d] | 65 | }
 | 
|---|
 | 66 | 
 | 
|---|