/* * AtomsCalculation_impl.hpp * * Created on: Feb 19, 2010 * Author: crueger */ #ifndef ATOMSCALCULATION_IMPL_HPP_ #define ATOMSCALCULATION_IMPL_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "Actions/AtomsCalculation.hpp" #include "Actions/Calculation_impl.hpp" using namespace MoleCuilder; template AtomsCalculation::AtomsCalculation(boost::function _op,const ActionTrait &_trait,AtomDescriptor _descr) : Calculation >(0,_trait), descr(_descr), op(_op) {} template AtomsCalculation::~AtomsCalculation(){ } template std::vector* AtomsCalculation::doCalc(){ World* world = World::getPointer(); int steps = world->numAtoms(); std::vector *res = new std::vector(); res->reserve(steps); Process::setMaxSteps(steps); Process::start(); for(World::internal_AtomIterator iter=world->getAtomIter_internal(descr); iter!=world->atomEnd_internal(); ++iter){ Process::setCurrStep(iter.getCount()); res->push_back(op(*iter)); } Process::stop(); return res; } template Action* AtomsCalculation::clone(enum Action::QueryOptions flag) const { if (flag == Action::Interactive) return new AtomsCalculation(op, Action::Traits, descr); else return new AtomsCalculation(*this); } template Dialog *AtomsCalculation::fillDialog(Dialog *dialog){ ASSERT(dialog,"No Dialog given when filling action dialog"); return dialog; } #endif /* ATOMSCALCULATION_IMPL_HPP_ */