source: molecuilder/src/Actions/AtomsCalculation_impl.hpp@ 5dba7a

Last change on this file since 5dba7a was 5dba7a, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Made the periodentafel use STL-containers instead of custom llists

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[01d28a]1/*
2 * AtomsCalculation_impl.hpp
3 *
4 * Created on: Feb 19, 2010
5 * Author: crueger
6 */
7
8#ifndef ATOMSCALCULATION_IMPL_HPP_
9#define ATOMSCALCULATION_IMPL_HPP_
10
11#include "Actions/AtomsCalculation.hpp"
12#include "Actions/Calculation_impl.hpp"
13
14#include <iostream>
15
16using namespace std;
17
18template<typename T>
19AtomsCalculation<T>::AtomsCalculation(boost::function<T(atom*)> _op,std::string name,AtomDescriptor _descr) :
20 Calculation<std::vector<T> >(0,name,false),
[5dba7a]21 descr(_descr),
22 op(_op)
[01d28a]23{}
24
25template<typename T>
26AtomsCalculation<T>::~AtomsCalculation(){
27}
28
29template<typename T>
30std::vector<T>* AtomsCalculation<T>::doCalc(){
[4c60ef]31 World* world = World::getPointer();
[01d28a]32 int steps = world->numAtoms();
33 std::vector<T> *res = new std::vector<T>();
34 res->reserve(steps);
35 Process::setMaxSteps(steps);
36 Process::start();
37 World::AtomIterator iter;
38 for(iter=world->getAtomIter(descr);iter!=world->atomEnd();++iter){
39 Process::setCurrStep(iter.getCount());
40 res->push_back(op(*iter));
41 }
42 Process::stop();
43 return res;
44}
45
46
47#endif /* ATOMSCALCULATION_IMPL_HPP_ */
Note: See TracBrowser for help on using the repository browser.