|
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
|
| Line | |
|---|
| 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 |
|
|---|
| 16 | using namespace std;
|
|---|
| 17 |
|
|---|
| 18 | template<typename T>
|
|---|
| 19 | AtomsCalculation<T>::AtomsCalculation(boost::function<T(atom*)> _op,std::string name,AtomDescriptor _descr) :
|
|---|
| 20 | Calculation<std::vector<T> >(0,name,false),
|
|---|
| 21 | descr(_descr),
|
|---|
| 22 | op(_op)
|
|---|
| 23 | {}
|
|---|
| 24 |
|
|---|
| 25 | template<typename T>
|
|---|
| 26 | AtomsCalculation<T>::~AtomsCalculation(){
|
|---|
| 27 | }
|
|---|
| 28 |
|
|---|
| 29 | template<typename T>
|
|---|
| 30 | std::vector<T>* AtomsCalculation<T>::doCalc(){
|
|---|
| 31 | World* world = World::getPointer();
|
|---|
| 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.