MaMiCo
1.2
Toggle main menu visibility
Loading...
Searching...
No Matches
coupling
cell-mappings
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
11
namespace
coupling
{
12
namespace
cellmappings {
13
template
<
class
LinkedCell,
unsigned
int
dim>
class
ComputeMassMapping
;
14
}
15
}
// namespace coupling
16
23
template
<
class
LinkedCell,
unsigned
int
dim>
class
coupling::cellmappings::ComputeMassMapping
{
24
public
:
28
ComputeMassMapping
(
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
mdSolverInterface)
29
: _mdSolverInterface(mdSolverInterface), _mass(0.0), _particleCounter(0) {}
30
32
~ComputeMassMapping
() {}
33
37
void
beginCellIteration
() {
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
69
private
:
70
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
_mdSolverInterface;
71
double
_mass;
72
unsigned
int
_particleCounter;
73
};
74
#endif
// _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEMASSMAPPING_H_
coupling::cellmappings::ComputeMassMapping
This class computes the mass over certain linked cells.
Definition
ComputeMassMapping.h:23
coupling::cellmappings::ComputeMassMapping::endCellIteration
void endCellIteration()
Definition
ComputeMassMapping.h:45
coupling::cellmappings::ComputeMassMapping::getNumberOfParticles
unsigned int getNumberOfParticles() const
Definition
ComputeMassMapping.h:67
coupling::cellmappings::ComputeMassMapping::getMass
double getMass() const
Definition
ComputeMassMapping.h:63
coupling::cellmappings::ComputeMassMapping::handleCell
void handleCell(LinkedCell &cell)
Definition
ComputeMassMapping.h:50
coupling::cellmappings::ComputeMassMapping::beginCellIteration
void beginCellIteration()
Definition
ComputeMassMapping.h:37
coupling::cellmappings::ComputeMassMapping::~ComputeMassMapping
~ComputeMassMapping()
Definition
ComputeMassMapping.h:32
coupling::cellmappings::ComputeMassMapping::ComputeMassMapping
ComputeMassMapping(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
Definition
ComputeMassMapping.h:28
coupling::interface::MDSolverInterface
interface to the MD simulation
Definition
MDSolverInterface.h:25
coupling::interface::MoleculeIterator
some iterator scheme for traversing the molecules within a linked cell.
Definition
MoleculeIterator.h:24
coupling::interface::MoleculeIterator::continueIteration
virtual bool continueIteration() const =0
coupling::interface::MoleculeIterator::next
virtual void next()=0
coupling::interface::MoleculeIterator::begin
virtual void begin()=0
coupling
everything necessary for coupling operations, is defined in here
Definition
AdditiveMomentumInsertion.h:15
Generated by
1.17.0