[bcf653] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[d02e07] | 8 | /*
|
---|
| 9 | * PointCorrelationAction.cpp
|
---|
| 10 | *
|
---|
| 11 | * Created on: May 9, 2010
|
---|
| 12 | * Author: heber
|
---|
| 13 | */
|
---|
| 14 |
|
---|
[bf3817] | 15 | // include config.h
|
---|
| 16 | #ifdef HAVE_CONFIG_H
|
---|
| 17 | #include <config.h>
|
---|
| 18 | #endif
|
---|
| 19 |
|
---|
[ad011c] | 20 | #include "CodePatterns/MemDebug.hpp"
|
---|
[d02e07] | 21 |
|
---|
[9b5a2c] | 22 | #include "Analysis/analysis_correlation.hpp"
|
---|
[d127c8] | 23 | #include "Tesselation/boundary.hpp"
|
---|
[d02e07] | 24 | #include "linkedcell.hpp"
|
---|
[ad011c] | 25 | #include "CodePatterns/Verbose.hpp"
|
---|
| 26 | #include "CodePatterns/Log.hpp"
|
---|
[d02e07] | 27 | #include "element.hpp"
|
---|
| 28 | #include "molecule.hpp"
|
---|
| 29 | #include "periodentafel.hpp"
|
---|
[57f243] | 30 | #include "LinearAlgebra/Vector.hpp"
|
---|
[d02e07] | 31 | #include "World.hpp"
|
---|
| 32 |
|
---|
[146cff2] | 33 | #include <cmath>
|
---|
[d02e07] | 34 | #include <iostream>
|
---|
| 35 | #include <string>
|
---|
| 36 |
|
---|
[9ee38b] | 37 | #include "Actions/AnalysisAction/PointCorrelationAction.hpp"
|
---|
| 38 |
|
---|
[ce7fdc] | 39 | using namespace MoleCuilder;
|
---|
[9ee38b] | 40 |
|
---|
| 41 | // and construct the stuff
|
---|
| 42 | #include "PointCorrelationAction.def"
|
---|
| 43 | #include "Action_impl_pre.hpp"
|
---|
[d02e07] | 44 |
|
---|
[9ee38b] | 45 | /** =========== define the function ====================== */
|
---|
[d02e07] | 46 | Action::state_ptr AnalysisPointCorrelationAction::performCall() {
|
---|
| 47 | int ranges[3] = {1, 1, 1};
|
---|
| 48 | ofstream output;
|
---|
| 49 | ofstream binoutput;
|
---|
| 50 | string type;
|
---|
| 51 | BinPairMap *binmap = NULL;
|
---|
| 52 |
|
---|
| 53 | // obtain information
|
---|
[9ee38b] | 54 | getParametersfromValueStorage();
|
---|
[d02e07] | 55 |
|
---|
| 56 | // execute action
|
---|
[e4afb4] | 57 | output.open(params.outputname.string().c_str());
|
---|
| 58 | binoutput.open(params.binoutputname.string().c_str());
|
---|
[9ee38b] | 59 | cout << "Point to correlate to is " << params.Point << endl;
|
---|
[d02e07] | 60 | CorrelationToPointMap *correlationmap = NULL;
|
---|
[9ee38b] | 61 | for(std::vector<const element *>::iterator iter = params.elements.begin(); iter != params.elements.end(); ++iter)
|
---|
[2fe971] | 62 | cout << "element is " << (*iter)->getSymbol() << endl;
|
---|
[e65de8] | 63 | std::vector<molecule*> molecules = World::getInstance().getSelectedMolecules();
|
---|
[9ee38b] | 64 | if (params.periodic)
|
---|
| 65 | correlationmap = PeriodicCorrelationToPoint(molecules, params.elements, ¶ms.Point, ranges);
|
---|
[d02e07] | 66 | else
|
---|
[9ee38b] | 67 | correlationmap = CorrelationToPoint(molecules, params.elements, ¶ms.Point);
|
---|
[92e5cb] | 68 | OutputCorrelationMap<CorrelationToPointMap>(&output, correlationmap, OutputCorrelationToPoint_Header, OutputCorrelationToPoint_Value);
|
---|
[9ee38b] | 69 | binmap = BinData( correlationmap, params.BinWidth, params.BinStart, params.BinEnd );
|
---|
[92e5cb] | 70 | OutputCorrelationMap<BinPairMap> ( &binoutput, binmap, OutputCorrelation_Header, OutputCorrelation_Value );
|
---|
[d02e07] | 71 | delete(binmap);
|
---|
| 72 | delete(correlationmap);
|
---|
| 73 | output.close();
|
---|
| 74 | binoutput.close();
|
---|
| 75 | return Action::success;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | Action::state_ptr AnalysisPointCorrelationAction::performUndo(Action::state_ptr _state) {
|
---|
| 79 | return Action::success;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | Action::state_ptr AnalysisPointCorrelationAction::performRedo(Action::state_ptr _state){
|
---|
| 83 | return Action::success;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | bool AnalysisPointCorrelationAction::canUndo() {
|
---|
| 87 | return true;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | bool AnalysisPointCorrelationAction::shouldUndo() {
|
---|
| 91 | return true;
|
---|
| 92 | }
|
---|
[9ee38b] | 93 | /** =========== end of function ====================== */
|
---|