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
 

Constructor & Destructor Documentation

◆ SuperQuadricParticleVtkWriter()

SuperQuadricParticleVtkWriter::SuperQuadricParticleVtkWriter ( ParticleHandler particleHandler)
inlineexplicit
37  : ParticleVtkWriter(particleHandler)
38  {}
ParticleVtkWriter(ParticleHandler &particleHandler)
Definition: ParticleVtkWriter.h:38

◆ ~SuperQuadricParticleVtkWriter()

SuperQuadricParticleVtkWriter::~SuperQuadricParticleVtkWriter ( )
overridedefault

Member Function Documentation

◆ getName()

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

Implements ParticleVtkWriter.

45  {
46  return "SuperQuadricParticleVtkWriter";
47  }

◆ writeVTK()

void SuperQuadricParticleVtkWriter::writeVTK ( ) const
overridevirtual

Implements BaseVTKWriter< ParticleHandler >.

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 }
unsigned int getSize() const
Gets the size of the particleHandler (including mpi and periodic particles)
Definition: BaseHandler.h:655
void writeVTKFooterAndClose(std::fstream &file) const
Definition: BaseVTKWriter.h:123
ParticleHandler & handler_
particle handler from which the particles should be written
Definition: BaseVTKWriter.h:72
std::fstream makeVTKFileWithHeader() const
Definition: BaseVTKWriter.h:80
void writeVTKIndSpecies(std::fstream &file) const
Definition: ParticleVtkWriter.cc:49
void writeVTKPositions(std::fstream &file) const
Definition: ParticleVtkWriter.cc:29
void writeVTKSuperquadricGeometry(std::fstream &file) const
Definition: SuperQuadricParticleVtkWriter.cc:64
void writeVTKOrientation(std::fstream &file) const
Definition: SuperQuadricParticleVtkWriter.cc:43

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

Referenced by ShapesDemo::setupInitialConditions().

◆ writeVTKOrientation()

void SuperQuadricParticleVtkWriter::writeVTKOrientation ( std::fstream &  file) const
private
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 }
@ A
Definition: StatisticsVector.h:42
Data type for small dense matrix.
Definition: SmallMatrix.h:68
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51

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

Referenced by writeVTK().

◆ writeVTKSuperquadricGeometry()

void SuperQuadricParticleVtkWriter::writeVTKSuperquadricGeometry ( std::fstream &  file) const
private
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 }

References BaseVTKWriter< ParticleHandler >::handler_.

Referenced by writeVTK().


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