MaMiCo
1.2
Toggle main menu visibility
Loading...
Searching...
No Matches
coupling
cell-mappings
VTKMoleculePlotter.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_VTKMOLECULEPLOTTER_H_
6
#define _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_VTKMOLECULEPLOTTER_H_
7
8
#include "coupling/interface/MDSolverInterface.h"
9
#include "coupling/interface/Molecule.h"
10
#include <iostream>
11
#include <sstream>
12
13
namespace
coupling
{
14
namespace
cellmappings {
15
template
<
class
LinkedCell,
unsigned
int
dim>
class
VTKMoleculePlotter
;
16
}
17
}
// namespace coupling
18
25
template
<
class
LinkedCell,
unsigned
int
dim>
class
coupling::cellmappings::VTKMoleculePlotter
{
26
public
:
34
VTKMoleculePlotter
(std::stringstream& moleculeVelocities, std::stringstream& moleculePositions, std::stringstream& moleculePotentials,
35
const
std::string& appendFloatZeros,
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
mdSolverInterface)
36
: _mdSolverInterface(mdSolverInterface), _moleculeVelocities(moleculeVelocities), _moleculePositions(moleculePositions),
37
_moleculePotentials(moleculePotentials), _appendFloatZeros(appendFloatZeros), _particleCounter(0) {}
38
40
~VTKMoleculePlotter
() {}
41
44
void
beginCellIteration
() { _particleCounter = 0; }
45
48
void
endCellIteration
() {}
49
53
void
handleCell
(LinkedCell& cell) {
54
coupling::interface::MoleculeIterator<LinkedCell, dim>
* it = _mdSolverInterface->getMoleculeIterator(cell);
55
it->
begin
();
56
while
(it->
continueIteration
()) {
57
const
coupling::interface::Molecule<dim>
& wrapper(it->
getConst
());
58
const
tarch::la::Vector<dim, double>
position = wrapper.
getPosition
();
59
const
tarch::la::Vector<dim, double>
velocity = wrapper.
getVelocity
();
60
// std::cout << "Touch molecule " << position << std::endl;
61
for
(
unsigned
int
d = 0; d < dim; d++) {
62
_moleculePositions << position[d] <<
" "
;
63
_moleculeVelocities << velocity[d] <<
" "
;
64
}
65
_moleculePositions << _appendFloatZeros << std::endl;
66
_moleculeVelocities << _appendFloatZeros << std::endl;
67
_moleculePotentials << wrapper.
getPotentialEnergy
() << std::endl;
68
69
_particleCounter++;
70
it->
next
();
71
}
72
delete
it;
73
}
74
78
const
unsigned
int
&
getParticleCounter
()
const
{
return
_particleCounter; }
79
80
private
:
81
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
_mdSolverInterface;
82
std::stringstream& _moleculeVelocities;
83
std::stringstream& _moleculePositions;
84
std::stringstream& _moleculePotentials;
85
const
std::string& _appendFloatZeros;
86
unsigned
int
_particleCounter;
87
};
88
#endif
// _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_VTKMOLECULEPLOTTER_H_
coupling::cellmappings::VTKMoleculePlotter
This class writes molecule data to streams for .vtk file.
Definition
VTKMoleculePlotter.h:25
coupling::cellmappings::VTKMoleculePlotter::VTKMoleculePlotter
VTKMoleculePlotter(std::stringstream &moleculeVelocities, std::stringstream &moleculePositions, std::stringstream &moleculePotentials, const std::string &appendFloatZeros, coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
Definition
VTKMoleculePlotter.h:34
coupling::cellmappings::VTKMoleculePlotter::getParticleCounter
const unsigned int & getParticleCounter() const
Definition
VTKMoleculePlotter.h:78
coupling::cellmappings::VTKMoleculePlotter::~VTKMoleculePlotter
~VTKMoleculePlotter()
Definition
VTKMoleculePlotter.h:40
coupling::cellmappings::VTKMoleculePlotter::handleCell
void handleCell(LinkedCell &cell)
Definition
VTKMoleculePlotter.h:53
coupling::cellmappings::VTKMoleculePlotter::beginCellIteration
void beginCellIteration()
Definition
VTKMoleculePlotter.h:44
coupling::cellmappings::VTKMoleculePlotter::endCellIteration
void endCellIteration()
Definition
VTKMoleculePlotter.h:48
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::interface::MoleculeIterator::getConst
virtual const coupling::interface::Molecule< dim > & getConst()=0
coupling::interface::Molecule
interface to access a single molecule in the MD simulation.
Definition
Molecule.h:23
coupling::interface::Molecule::getPotentialEnergy
virtual double getPotentialEnergy() const =0
coupling::interface::Molecule::getVelocity
virtual tarch::la::Vector< dim, double > getVelocity() const =0
coupling::interface::Molecule::getPosition
virtual tarch::la::Vector< dim, double > getPosition() const =0
tarch::la::Vector
Definition
Vector.h:25
coupling
everything necessary for coupling operations, is defined in here
Definition
AdditiveMomentumInsertion.h:15
Generated by
1.17.0