MaMiCo 1.2
Loading...
Searching...
No Matches
ComputeMassMapping.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_COMPUTEMASSMAPPING_H_
6#define _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEMASSMAPPING_H_
7
8#include "coupling/interface/MDSolverInterface.h"
9#include <iostream>
10
11namespace coupling {
12namespace cellmappings {
13template <class LinkedCell, unsigned int dim> class ComputeMassMapping;
14}
15} // namespace coupling
16
23template <class LinkedCell, unsigned int dim> class coupling::cellmappings::ComputeMassMapping {
24public:
29 : _mdSolverInterface(mdSolverInterface), _mass(0.0), _particleCounter(0) {}
30
33
38 _mass = 0.0;
39 _particleCounter = 0;
40 }
41
45 void endCellIteration() { _mass = _mdSolverInterface->getMoleculeMass() * _particleCounter; }
46
50 void handleCell(LinkedCell& cell) {
51 coupling::interface::MoleculeIterator<LinkedCell, dim>* it = _mdSolverInterface->getMoleculeIterator(cell);
52 it->begin();
53 while (it->continueIteration()) {
54 _particleCounter++;
55 it->next();
56 }
57 delete it;
58 }
59
63 double getMass() const { return _mass; }
67 unsigned int getNumberOfParticles() const { return _particleCounter; }
68
69private:
71 double _mass;
72 unsigned int _particleCounter;
73};
74#endif // _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEMASSMAPPING_H_
This class computes the mass over certain linked cells.
Definition ComputeMassMapping.h:23
void endCellIteration()
Definition ComputeMassMapping.h:45
unsigned int getNumberOfParticles() const
Definition ComputeMassMapping.h:67
double getMass() const
Definition ComputeMassMapping.h:63
void handleCell(LinkedCell &cell)
Definition ComputeMassMapping.h:50
void beginCellIteration()
Definition ComputeMassMapping.h:37
~ComputeMassMapping()
Definition ComputeMassMapping.h:32
ComputeMassMapping(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
Definition ComputeMassMapping.h:28
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
everything necessary for coupling operations, is defined in here
Definition AdditiveMomentumInsertion.h:15