46 logger(
DEBUG,
"WallHandler::WallHandler() finished");
61 logger(
DEBUG,
"WallHandler::WallHandler(const WallHandler &WH) finished");
78 logger(
DEBUG,
"WallHandler::operator = (const WallHandler& rhs) finished");
84 logger(
DEBUG,
"WallHandler::~WallHandler() finished");
96 logger(
WARN,
"WARNING: The wall with ID % that is added in WallHandler::addObject "
97 "does not have a species yet. Please make sure that you have "
98 "set the species somewhere in the driver code.", W->
getId());
114 logger.log(
Log::DEBUG,
"WallHandler::readObject(is): reading type %.", type);
117 if (type ==
"CylindricalWall")
124 else if (type ==
"AxisymmetricIntersectionOfWalls")
131 else if (type ==
"IntersectionOfWalls")
138 else if (type ==
"InfiniteWall")
145 else if (type ==
"InfiniteWallWithHole")
152 else if (type ==
"Screw")
159 else if (type ==
"Coil")
167 else if (type ==
"numFiniteWalls")
171 else if (type ==
"TriolietScrew"||type ==
"TriolietBaseScrew"||type==
"RestrictedWall") {
172 logger(
WARN,
"Wall type: % cannot be restarted and is ignored", type);
177 else if (!
getDPMBase()->readUserDefinedWall(type,is))
179 logger(
ERROR,
"Wall type: % not understood in restart file", type);
193 std::stringstream line(std::stringstream::in | std::stringstream::out);
198 unsigned int numWalls;
207 line >> dummy >> normal >> dummy >> position;
208 wall.
set(normal, position*normal);
215 for (
unsigned int i = 0; i < numWalls; ++i)
217 line >> dummy >> normal >> dummy >> position;
229 return "WallHandler";
244 static unsigned int capacityPoints = 0;
245 static unsigned int capacityTriangleStrips = 0;
248 vtk.
points.reserve(capacityTriangleStrips);
251 for (
const auto& w: *
this)
271 static unsigned fileCounter = 0;
277 file.open(fileName.c_str(), std::ios::out);
281 logger(
WARN,
"Error in writeToFile: file % could not be opened", fileName);
283 file <<
"<?xml version=\"1.0\"?>\n\n";
284 file <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
285 file <<
"<UnstructuredGrid>\n";
286 file <<
"<Piece NumberOfPoints=\"" << vtk.
points.size() <<
"\" NumberOfCells=\"" << vtk.
triangleStrips.size() <<
"\">\n";
287 file <<
"<Points>\n";
288 file <<
" <DataArray type=\"Float32\" Name=\"Position\" NumberOfComponents=\"3\" format=\"ascii\">\n";
291 file <<
'\t' << p <<
'\n';
293 file <<
" </DataArray>\n";
294 file <<
"</Points>\n";
296 file <<
" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
300 for (
const double& i : c)
306 file <<
" </DataArray>\n";
307 file <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
312 file <<
'\t' << count <<
'\n';
314 file <<
" </DataArray>\n";
315 file <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
318 if (c.front()==c.back())
328 file <<
" </DataArray>\n";
329 file <<
"</Cells>\n";
330 file <<
"</Piece>\n";
331 file <<
"</UnstructuredGrid>\n";
332 file <<
"</VTKFile>\n";
344 logger(
INFO,
"% writing vtk file for bounding box: %",
347 file.open(fileName.c_str(), std::ios::out);
351 logger(
WARN,
"Error in writeToFile: file could not be opened");
353 file <<
"<?xml version=\"1.0\"?>\n\n";
354 file <<
"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n";
355 file <<
"<UnstructuredGrid>\n";
356 file <<
"<Piece NumberOfPoints=\"8\" NumberOfCells=\"1\">\n";
357 file <<
"<Points>\n";
358 file <<
" <DataArray type=\"Float32\" Name=\"Position\" NumberOfComponents=\"3\" format=\"ascii\">\n";
360 for (
unsigned i = 0; i < 2; i++)
362 for (
unsigned j = 0; j < 2; j++)
364 for (
unsigned k = 0; k < 2; k++)
367 file <<
'\t' << p <<
'\n';
372 file <<
" </DataArray>\n";
373 file <<
"</Points>\n";
376 " <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n";
377 file <<
"\t0 1 3 2 0 4 5 1 5 7 3 7 6 2 6 4\n";
378 file <<
" </DataArray>\n";
379 file <<
" <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n";
382 file <<
" </DataArray>\n";
383 file <<
" <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n";
385 file <<
" </DataArray>\n";
386 file <<
"</Cells>\n";
387 file <<
"</Piece>\n";
388 file <<
"</UnstructuredGrid>\n";
389 file <<
"</VTKFile>\n";
Container to store all ParticleSpecies.
unsigned int getId() const
Returns the unique identifier of any particular object.
A IntersectionOfWalls is convex polygon defined as an intersection of InfiniteWall's.
This function defines an Archimedes' screw in the z-direction from a (constant) starting point...
Logger< MERCURY_LOGLEVEL > logger("MercuryKernel")
void setDPMBase(DPMBase *DPMBase)
Sets the problem that is solved using this handler.
void readOldObject(std::istream &is)
Reads a BaseWall into the WallHandler from old-style restart data.
const ParticleSpecies * getSpecies() const
Returns a pointer to the species of this BaseInteractable.
Vec3D getMin() const
Return the "bottom left" corner of the domain, a vector with xMin_, yMin_ and zMin_.
virtual void setHandler(WallHandler *handler)
A function which sets the WallHandler for this BaseWall.
void addObject(Vec3D normal, Vec3D point)
Adds a wall to the set of infinite walls, given an outward normal vector s.t. normal*x=normal*point.
void setSpecies(const ParticleSpecies *species)
sets species of subwalls as well
void readObject(std::istream &is)
Reads BaseWall into the WallHandler from restart data.
void writeVTKFile(const VTKContainer vtk) const
Writes the data collected in writeVTK into vtk files, one per timestep.
void getLineFromStringStream(std::istream &in, std::stringstream &out)
Reads a line from one stringstream into another, and prepares the latter for reading in...
std::vector< std::vector< double > > triangleStrips
T * getObject(const unsigned int id)
Gets a pointer to the Object at the specified index in the BaseHandler.
void writeVTKBoundingBox() const
Writes a bounding box around the domain into a vtk file.
WallHandler()
Default constructor, it creates an empty WallHandler.
std::enable_if<!std::is_pointer< U >::value, U * >::type copyAndAddObject(const U &object)
Creates a copy of a Object and adds it to the BaseHandler.
unsigned int getNumberOfObjects() const
Gets the number of Object in this BaseHandler.
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. elastic, linear visco-elastic... et cetera...
Vec3D getMax() const
Return the "upper right" corner of the domain, a vector with xMin_, yMin_ and zMin_.
A AxisymmetricIntersectionOfWalls is an axisymmetric wall, defined by rotating a twodimensional Inter...
Container to store all BaseWall.
std::string to_string(const T &n)
std::vector< Vec3D > points
void set(Vec3D normal, Vec3D point)
Defines a standard wall, given an outward normal vector s.t. normal*x=normal*point for all x of the w...
virtual void addObject(T *object)
Adds a new Object to the BaseHandler.
This is a class defining walls.
void addObject(BaseWall *W)
Adds a BaseWall to the WallHandler.
WallHandler operator=(const WallHandler &rhs)
Assignment operator that copies the pointer to the DPMBase and all BaseWall in the given WallHandler...
~WallHandler()
Destructor, it destructs the WallHandler and all BaseWall it contains.
void copyContentsFromOtherHandler(const BaseHandler< BaseWall > &BH)
Function that copies the contents (vector of pointers, maxObject_, nextId_, DPMBase_) from one handle...
Implementation of a 3D vector (by Vitaliy).
DPMBase * getDPMBase()
Gets the problem that is solved using this handler.
This class defines a coil in the z-direction from a (constant) starting point, a (constant) length L...
const std::string & getName() const
Returns the name of the file. Does not allow to change it though.
void writeVTK() const
Writes all walls into a vtk format, consisting of points (edges) and cells (faces).
void clear()
Empties the whole BaseHandler by removing all Objects and setting all other variables to 0...
void setSpecies(const ParticleSpecies *species)
Define the species of this wall.
std::string getName() const
Returns the name of the handler, namely the string "WallHandler".