MaMiCo 1.2
Loading...
Searching...
No Matches
MoleculeExtractor.h
1// Copyright (C) 2015 Technische Universitaet Muenchen
2// This file is part of the Mamico project. For conditions of distribution
3// and use, please see the copyright notice in Mamico's main folder, or at
4// www5.in.tum.de/mamico
5#ifndef _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_MOLECULEEXTRACTOR_H_
6#define _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_MOLECULEEXTRACTOR_H_
7#include "coupling/interface/MDSolverInterface.h"
8#include "coupling/interface/MoleculeIterator.h"
9#include <iostream>
10
11namespace coupling {
12namespace cellmappings {
13template <class LinkedCell, unsigned int dim> class MoleculeExtractor;
14}
15} // namespace coupling
16
28template <class LinkedCell, unsigned int dim> class coupling::cellmappings::MoleculeExtractor {
29public:
33 MoleculeExtractor(coupling::interface::MDSolverInterface<LinkedCell, dim>* const mdSolverInterface) : _mdSolverInterface(mdSolverInterface) {
34 _molecules.clear();
35 }
36
39
43 void beginCellIteration() { _molecules.clear(); }
44
48
52 void handleCell(LinkedCell& cell) {
53 coupling::interface::MoleculeIterator<LinkedCell, dim>* it = _mdSolverInterface->getMoleculeIterator(cell);
54 it->begin();
55 while (it->continueIteration()) {
56 _molecules.push_back(it->getConst().getPosition());
57 it->next();
58 }
59 delete it;
60 }
61
65 const std::vector<tarch::la::Vector<dim, double>>& getExtractedMolecules() const { return _molecules; }
66
67private:
69 std::vector<tarch::la::Vector<dim, double>> _molecules;
70};
71
72#endif // _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_MOLECULEEXTRACTOR_H_
This class extracts molecule information from a given coupling cell and stores all molecule positions...
Definition MoleculeExtractor.h:28
void endCellIteration()
Definition MoleculeExtractor.h:47
MoleculeExtractor(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
Definition MoleculeExtractor.h:33
void beginCellIteration()
Definition MoleculeExtractor.h:43
void handleCell(LinkedCell &cell)
Definition MoleculeExtractor.h:52
~MoleculeExtractor()
Definition MoleculeExtractor.h:38
const std::vector< tarch::la::Vector< dim, double > > & getExtractedMolecules() const
Definition MoleculeExtractor.h:65
interface to the MD simulation
Definition MDSolverInterface.h:25
some iterator scheme for traversing the molecules within a linked cell.
Definition MoleculeIterator.h:24
virtual bool continueIteration() const =0
virtual const coupling::interface::Molecule< dim > & getConst()=0
everything necessary for coupling operations, is defined in here
Definition AdditiveMomentumInsertion.h:15