WallVTKWriter.h
Go to the documentation of this file.
1 // This file is part of the MercuryDPM project (https://www.mercurydpm.org).
2 // Copyright (c), The MercuryDPM Developers Team. All rights reserved.
3 // License: BSD 3-Clause License; see the LICENSE file in the root directory.
4 
5 #ifndef WALL_VTKWRITER_H
6 #define WALL_VTKWRITER_H
7 
9 #include "WallHandler.h"
10 
11 class WallVTKWriter final : public BaseVTKWriter<WallHandler>
12 {
13 
14 public:
15 
19  explicit WallVTKWriter(WallHandler& wallHandler) : BaseVTKWriter(wallHandler)
20  {}
21 
25  WallVTKWriter(const WallVTKWriter&) = default;
26 
30  void getVTKData(VTKContainer& vtk) const;
31 
35  void writeVTK() const override;
36 
41  { return "WallVTKWriter"; }
42 
43  void setWriteWallSurfaceAreaVTK(bool writeWallSurfaceAreaVTK);
44  bool getWriteWallSurfaceAreaVTK() const;
45 
46  // set function for cg fields (set cgWidth to zero to turn off writing cg fields)
47  void setCGWidth(double cgWidth) {
48  cgWidth_ = std::max(0.0,cgWidth);
49  if (cgWidth==0.0) {
50  logger(INFO, "CG Width set to zero; no CG data is written to the VTU files");
51  }
52  }
53 
54 protected:
55 
56  void write(std::fstream& file, std::string name, std::function<double(BaseWall*)> f) const;
57 
61  void writeVTKPoints(std::fstream& file, VTKContainer& vtk) const;
62 
66  void writeVTKCells(std::fstream& file, VTKContainer& vtk) const;
67 
71  void writeVTKCellData(std::fstream& file, VTKContainer& vtk) const;
72 
76  void writeVTKPointData(std::fstream& file, VTKContainer& vtk) const;
77 
81  void writeCGFields(std::fstream& file, VTKContainer& vtk) const;
82 
86  void writeVTKSurfaceArea(std::fstream& file, VTKContainer& vtk) const;
87 
88  // determines whether wall surface area is written to the vtu file
89  bool writeWallSurfaceAreaVTK_ { false };
90 
91  // stores the cg width used in writeCGFields (0 means no cg data is written)
92  double cgWidth_ = 0.0;
93 };
94 
95 
96 #endif
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
@ INFO
Definition: BaseVTKWriter.h:18
Basic class for walls.
Definition: BaseWall.h:28
Container to store all BaseWall.
Definition: WallHandler.h:22
Definition: WallVTKWriter.h:12
void setWriteWallSurfaceAreaVTK(bool writeWallSurfaceAreaVTK)
Definition: WallVTKWriter.cc:204
void writeCGFields(std::fstream &file, VTKContainer &vtk) const
Definition: WallVTKWriter.cc:130
bool getWriteWallSurfaceAreaVTK() const
Definition: WallVTKWriter.cc:209
void writeVTKPointData(std::fstream &file, VTKContainer &vtk) const
Definition: WallVTKWriter.cc:124
bool writeWallSurfaceAreaVTK_
Definition: WallVTKWriter.h:89
WallVTKWriter(const WallVTKWriter &)=default
void writeVTKCells(std::fstream &file, VTKContainer &vtk) const
Definition: WallVTKWriter.cc:83
void getVTKData(VTKContainer &vtk) const
Definition: WallVTKWriter.cc:9
void writeVTKSurfaceArea(std::fstream &file, VTKContainer &vtk) const
Calculates and writes the surface areas of the cells to the vtu file.
Definition: WallVTKWriter.cc:168
void writeVTKCellData(std::fstream &file, VTKContainer &vtk) const
Definition: WallVTKWriter.cc:118
std::string getName() const
Definition: WallVTKWriter.h:40
void write(std::fstream &file, std::string name, std::function< double(BaseWall *)> f) const
Definition: WallVTKWriter.cc:63
WallVTKWriter(WallHandler &wallHandler)
Definition: WallVTKWriter.h:19
void setCGWidth(double cgWidth)
Definition: WallVTKWriter.h:47
double cgWidth_
Definition: WallVTKWriter.h:92
void writeVTKPoints(std::fstream &file, VTKContainer &vtk) const
Definition: WallVTKWriter.cc:73
void writeVTK() const override
Definition: WallVTKWriter.cc:31
static int f(const TensorMap< Tensor< int, 3 > > &tensor)
Definition: cxx11_tensor_map.cpp:237
#define max(a, b)
Definition: datatypes.h:23
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
string name
Definition: plotDoE.py:33
Definition: BaseWall.h:17