WallHandler.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 WALLHANDLER_H
6 #define WALLHANDLER_H
7 
8 #include "BaseHandler.h"
9 #include "Walls/BaseWall.h"
10 #include "File.h"
11 
12 class BaseWall;
13 
21 class WallHandler final : public BaseHandler<BaseWall>
22 {
23 public:
27  WallHandler();
28 
32  WallHandler(const WallHandler& BH);
33 
37  WallHandler& operator=(const WallHandler& rhs);
38 
42  ~WallHandler() final;
43 
47  void addObject(BaseWall* W) final;
48 
52  static BaseWall* createObject(const std::string& type);
53 
57  BaseWall* readAndCreateObject(std::istream& is);
58 
62  void readAndAddObject(std::istream& is) final;
63 
67  std::string getName() const final;
68 
73  unsigned readTriangleWall(std::string filename, ParticleSpecies* species, Mdouble scaleFactor = 1, Vec3D centerOfRotation = {0,0,0}, Vec3D velocity = {0,0,0}, Vec3D angularVelocity = {0,0,0});
74 
79 
83  void setWriteVTK(FileType);
84 
88  void setWriteVTK(bool);
89 
93  FileType getWriteVTK() const;
94 
95  enum class DetailsVTKOptions
96  {
97  // Used as keys for an unordered_map.
98  // The actual enum values are written to the restart file and their meaning should therefore never change.
99  // So when adding new options, be sure to hardcode a unique enum value!
100  // The options can be in any order and their values are completely free to choose, as long as they're unique.
101 
105  BOUNDINGBOX = 0,
106 
110  NURBSWALL = 1,
111 
116  };
117 
119 
121 
123 
124  bool getWriteDetailsVTKAny() const;
125 
126  std::unordered_map<DetailsVTKOptions, FileType> getWriteWallDetailsVTKAll() const;
127 
129 
133  void setWriteWallSurfaceAreaVTK(bool writeWallSurfaceAreaVTK);
134 
135  bool getWriteWallSurfaceAreaVTK() const;
136 
137 private:
138 
142  BaseWall* readAndCreateOldObject(std::istream& is);
143 
145 
151  std::unordered_map<DetailsVTKOptions, FileType> writeDetailsVTK_;
152 };
153 
154 #endif
FileType
With FileType options, one is able to choose if data is to be read/written from/into no or single or ...
Definition: File.h:19
int data[]
Definition: Map_placement_new.cpp:1
Container to store the pointers to all objects that one creates in a simulation.
Definition: BaseHandler.h:30
Basic class for walls.
Definition: BaseWall.h:28
Definition: ParticleSpecies.h:16
Definition: Kernel/VTKWriter/VTKData.h:15
Definition: Kernel/Math/Vector.h:30
Container to store all BaseWall.
Definition: WallHandler.h:22
std::unordered_map< DetailsVTKOptions, FileType > getWriteWallDetailsVTKAll() const
Definition: WallHandler.cc:493
void setWriteDetailsVTK(DetailsVTKOptions, FileType)
Definition: WallHandler.cc:460
BaseWall * readAndCreateObject(std::istream &is)
Create a new wall, based on the information provided in a restart file.
Definition: WallHandler.cc:191
FileType getWriteVTK() const
Returns whether walls are written in a VTK file.
Definition: WallHandler.cc:455
WallHandler()
Default constructor, it creates an empty WallHandler.
Definition: WallHandler.cc:32
void addObject(BaseWall *W) final
Adds a BaseWall to the WallHandler.
Definition: WallHandler.cc:93
void setWriteWallSurfaceAreaVTK(bool writeWallSurfaceAreaVTK)
Enables/disables the calculation and writing of the surface area of the cells.
Definition: WallHandler.cc:498
FileType writeVTK_
Definition: WallHandler.h:144
void readAndAddObject(std::istream &is) final
Create a new wall in the WallHandler, based on the information provided in a restart file.
Definition: WallHandler.cc:277
bool getWriteWallSurfaceAreaVTK() const
Definition: WallHandler.cc:503
std::unordered_map< DetailsVTKOptions, FileType > writeDetailsVTK_
unordered_map storing the file types corresponding to each of the enum DetailsVTKOptions
Definition: WallHandler.h:151
bool getWriteDetailsVTKAny() const
Definition: WallHandler.cc:486
DetailsVTKOptions
Definition: WallHandler.h:96
@ WEARABLENURBSWALL
Writes the debris.
@ BOUNDINGBOX
Writes a bounding box around the domain.
@ NURBSWALL
Writes the NURBS control points.
void setWriteVTK(FileType)
Sets whether walls are written into a VTK file.
Definition: WallHandler.cc:445
FileType getWriteDetailsVTK(DetailsVTKOptions) const
Definition: WallHandler.cc:472
std::string getName() const final
Returns the name of the handler, namely the string "WallHandler".
Definition: WallHandler.cc:288
~WallHandler() final
Destructor, it destructs the WallHandler and all BaseWall it contains.
Definition: WallHandler.cc:81
BaseWall * readAndCreateOldObject(std::istream &is)
Create a new wall, based on the information from old-style restart data.
Definition: WallHandler.cc:237
void actionsAfterParticleGhostUpdate()
Calls the method actionsAfterParticleGhostUpdate of every wall in the handler.
Definition: WallHandler.cc:436
WallHandler & operator=(const WallHandler &rhs)
Assignment operator that copies the pointer to the DPMBase and all BaseWall in the given WallHandler.
Definition: WallHandler.cc:66
unsigned readTriangleWall(std::string filename, ParticleSpecies *species, Mdouble scaleFactor=1, Vec3D centerOfRotation={0, 0, 0}, Vec3D velocity={0, 0, 0}, Vec3D angularVelocity={0, 0, 0})
Reads triangulated walls from vtk or stl files, and converts them into a set of TriangleWalls.
Definition: WallHandler.cc:319
void writeWallDetailsVTKBoundingBox(VTKData &data) const
Definition: WallHandler.cc:293
static BaseWall * createObject(const std::string &type)
Create a new wall, with the type given as a string (required for restarting).
Definition: WallHandler.cc:107
double velocity(const double &t)
Angular velocity as function of time t.
Definition: jeffery_orbit.cc:107
string filename
Definition: MergeRestartFiles.py:39
type
Definition: compute_granudrum_aor.py:141
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
@ W
Definition: quadtree.h:63