| [f89b45] | 1 | /* | 
|---|
|  | 2 | * Project: MoleCuilder | 
|---|
|  | 3 | * Description: creates and alters molecular systems | 
|---|
| [0aa122] | 4 | * Copyright (C)  2010-2012 University of Bonn. All rights reserved. | 
|---|
| [f89b45] | 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
|  | 8 | /* | 
|---|
|  | 9 | * CalculateBoundingBoxAction.cpp | 
|---|
|  | 10 | * | 
|---|
|  | 11 | *  Created on: Nov 02, 2011 | 
|---|
|  | 12 | *      Author: heber | 
|---|
|  | 13 | */ | 
|---|
|  | 14 |  | 
|---|
|  | 15 | // include config.h | 
|---|
|  | 16 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 17 | #include <config.h> | 
|---|
|  | 18 | #endif | 
|---|
|  | 19 |  | 
|---|
|  | 20 | #include "CodePatterns/MemDebug.hpp" | 
|---|
|  | 21 |  | 
|---|
|  | 22 | #include "CodePatterns/Log.hpp" | 
|---|
|  | 23 |  | 
|---|
|  | 24 | #include "Box.hpp" | 
|---|
|  | 25 | #include "CodePatterns/Assert.hpp" | 
|---|
|  | 26 | #include "LinearAlgebra/Plane.hpp" | 
|---|
|  | 27 | #include <vector> | 
|---|
|  | 28 | #include <utility> | 
|---|
|  | 29 | #include "World.hpp" | 
|---|
|  | 30 |  | 
|---|
|  | 31 | #include <iostream> | 
|---|
|  | 32 | #include <string> | 
|---|
|  | 33 |  | 
|---|
|  | 34 | #include "CalculateBoundingBoxAction.hpp" | 
|---|
|  | 35 |  | 
|---|
|  | 36 | using namespace MoleCuilder; | 
|---|
|  | 37 |  | 
|---|
|  | 38 | // and construct the stuff | 
|---|
|  | 39 | #include "CalculateBoundingBoxAction.def" | 
|---|
|  | 40 | #include "Reaction_impl_pre.hpp" | 
|---|
|  | 41 |  | 
|---|
|  | 42 | #include "Reaction_impl.hpp" | 
|---|
|  | 43 |  | 
|---|
|  | 44 | /** =========== define the function ====================== */ | 
|---|
|  | 45 | doubleVec * AnalysisCalculateBoundingBoxAction::doCalc() { | 
|---|
|  | 46 | typedef std::pair<Plane,Plane> PairOfPlanes; | 
|---|
|  | 47 | typedef std::vector<PairOfPlanes> PairOfPlanesVector; | 
|---|
|  | 48 | const PairOfPlanesVector planes = World::getInstance().getDomain().getBoundingPlanes(); | 
|---|
|  | 49 | doubleVec returnvalues; | 
|---|
|  | 50 | for (PairOfPlanesVector::const_iterator iter = planes.begin(); | 
|---|
|  | 51 | iter != planes.end(); ++iter) { | 
|---|
|  | 52 | returnvalues.push_back(fabs(iter->first.getOffset())); | 
|---|
|  | 53 | returnvalues.push_back(fabs(iter->second.getOffset())); | 
|---|
|  | 54 | } | 
|---|
|  | 55 | ASSERT( returnvalues.size() == (size_t)6, | 
|---|
|  | 56 | "AnalysisCalculateBoundingBoxAction::doCalc() - returnvalues should be of length 6 but is " | 
|---|
|  | 57 | +toString(returnvalues.size())+"."); | 
|---|
|  | 58 |  | 
|---|
|  | 59 | LOG(0, "RESULT: The current bounding box is " << returnvalues << "."); | 
|---|
|  | 60 |  | 
|---|
|  | 61 | return (new doubleVec(returnvalues)); | 
|---|
|  | 62 | } | 
|---|
|  | 63 | /** =========== end of function ====================== */ | 
|---|