MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SuperQuadricParticleVtkWriter Class Referencefinal

#include <SuperQuadricParticleVtkWriter.h>

+ Inheritance diagram for SuperQuadricParticleVtkWriter:

Public Member Functions

 SuperQuadricParticleVtkWriter (ParticleHandler &particleHandler)
 
void writeVTK () const override
 
 ~SuperQuadricParticleVtkWriter () override=default
 
std::string getName () const override
 
- Public Member Functions inherited from ParticleVtkWriter
 ParticleVtkWriter (ParticleHandler &particleHandler)
 
virtual ~ParticleVtkWriter ()=default
 
- Public Member Functions inherited from BaseVTKWriter< ParticleHandler >
 BaseVTKWriter (ParticleHandler &handler)
 
 BaseVTKWriter (const BaseVTKWriter &other)
 
unsigned getFileCounter () const
 
void setFileCounter (unsigned fileCounter)
 

Private Member Functions

void writeVTKOrientation (std::fstream &file) const
 
void writeVTKSuperquadricGeometry (std::fstream &file) const
 

Additional Inherited Members

- Protected Member Functions inherited from ParticleVtkWriter
void writeExtraFields (std::fstream &file) const
 
void writeVTKIndSpecies (std::fstream &file) const
 
void writeVTKPositions (std::fstream &file) const
 
bool particleMustBeWritten (BaseParticle *particle) const
 
- Protected Member Functions inherited from BaseVTKWriter< ParticleHandler >
std::fstream makeVTKFileWithHeader () const
 
void writeVTKFooterAndClose (std::fstream &file) const
 
- Protected Attributes inherited from BaseVTKWriter< ParticleHandler >
ParticleHandlerhandler_
 particle handler from which the particles should be written More...
 
unsigned int fileCounter
 

Detailed Description

Definition at line 33 of file SuperQuadricParticleVtkWriter.h.

Constructor & Destructor Documentation

SuperQuadricParticleVtkWriter::SuperQuadricParticleVtkWriter ( ParticleHandler particleHandler)
inlineexplicit

Definition at line 37 of file SuperQuadricParticleVtkWriter.h.

37  : ParticleVtkWriter(particleHandler)
38  {}
ParticleVtkWriter(ParticleHandler &particleHandler)
SuperQuadricParticleVtkWriter::~SuperQuadricParticleVtkWriter ( )
overridedefault

Member Function Documentation

std::string SuperQuadricParticleVtkWriter::getName ( ) const
inlineoverridevirtual

Implements ParticleVtkWriter.

Definition at line 44 of file SuperQuadricParticleVtkWriter.h.

45  {
46  return "SuperQuadricParticleVtkWriter";
47  }
void SuperQuadricParticleVtkWriter::writeVTK ( ) const
overridevirtual

Implements BaseVTKWriter< ParticleHandler >.

Definition at line 30 of file SuperQuadricParticleVtkWriter.cc.

References BaseHandler< T >::getSize(), BaseVTKWriter< ParticleHandler >::handler_, BaseVTKWriter< ParticleHandler >::makeVTKFileWithHeader(), BaseVTKWriter< ParticleHandler >::writeVTKFooterAndClose(), ParticleVtkWriter::writeVTKIndSpecies(), writeVTKOrientation(), ParticleVtkWriter::writeVTKPositions(), and writeVTKSuperquadricGeometry().

31 {
32  std::fstream file = makeVTKFileWithHeader();
33  file << "<Piece NumberOfPoints=\"" << handler_.getSize() << "\" NumberOfCells=\"" << 0 << "\">\n";
34  writeVTKPositions(file);
35  file << "<PointData Scalars=\"speciesType\" Vectors=\"axesScales\" Tensors=\"orientationTensor\">\n";
36  writeVTKIndSpecies(file);
38  writeVTKOrientation(file);
39  file << "</PointData>\n";
41 }
void writeVTKPositions(std::fstream &file) const
void writeVTKOrientation(std::fstream &file) const
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
void writeVTKIndSpecies(std::fstream &file) const
ParticleHandler & handler_
particle handler from which the particles should be written
Definition: BaseVTKWriter.h:72
std::fstream makeVTKFileWithHeader() const
void writeVTKFooterAndClose(std::fstream &file) const
void writeVTKSuperquadricGeometry(std::fstream &file) const
void SuperQuadricParticleVtkWriter::writeVTKOrientation ( std::fstream &  file) const
private

Definition at line 43 of file SuperQuadricParticleVtkWriter.cc.

References A, BaseVTKWriter< ParticleHandler >::handler_, and constants::i.

Referenced by writeVTK().

44 {
45  file << " <DataArray type=\"Float32\" Name=\"orientationTensor\" NumberOfComponents=\"9\" format=\"ascii\">\n";
46  // Add orientationTensor
47  for (const auto& p: handler_)
48  {
50  p->getOrientation().getRotationMatrix(A);
51  file << '\t';
52  for (unsigned i = 0; i < 3; ++i)
53  {
54  for (unsigned j = 0; j < 3; ++j)
55  {
56  file << A(i, j) << " ";
57  }
58  }
59  file << '\n';
60  }
61  file << " </DataArray>\n";
62 }
ParticleHandler & handler_
particle handler from which the particles should be written
Definition: BaseVTKWriter.h:72
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
Data type for small dense matrix.
Definition: SmallMatrix.h:67
void SuperQuadricParticleVtkWriter::writeVTKSuperquadricGeometry ( std::fstream &  file) const
private

Definition at line 64 of file SuperQuadricParticleVtkWriter.cc.

References BaseVTKWriter< ParticleHandler >::handler_.

Referenced by writeVTK().

65 {
66  file << " <DataArray type=\"Float32\" Name=\"phiAndTheta\" NumberOfComponents=\"2\" format=\"ascii\">\n";
67  // Add exponents eps1 and eps2. Note, they are defined in reverse order in Paraview!
68  for (const auto& p: handler_)
69  {
70  file << '\t' << p->getExponentEps2() << " " << p->getExponentEps1() << '\n';
71  }
72  file << " </DataArray>\n";
73  file << " <DataArray type=\"Float32\" Name=\"axesScales\" NumberOfComponents=\"3\" format=\"ascii\">\n";
74  // Add axesScales
75  for (const auto& p: handler_)
76  {
77  file << '\t' << 2 * p->getAxes() << '\n';
78  }
79  file << " </DataArray>\n";
80 }
ParticleHandler & handler_
particle handler from which the particles should be written
Definition: BaseVTKWriter.h:72

The documentation for this class was generated from the following files: