STLReaderUnitTest.cpp File Reference
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <BinaryReader.h>
#include <Logger.h>
#include <Math/Vector.h>
#include <CMakeDefinitions.h>
#include <Mercury3D.h>
#include <Species/LinearViscoelasticSpecies.h>

Functions

int main ()
 Test of the STL reader. The files read is an STL file containing 12 triangles that forms a unit cube, created in autocad. More...
 

Function Documentation

◆ main()

int main ( )

Test of the STL reader. The files read is an STL file containing 12 triangles that forms a unit cube, created in autocad.

42 {
43  std::string directory = getMercuryDPMSourceDir();
44  std::string filename = directory+"/Drivers/ImportTools/ExampleSTLFiles/Box1x1x1.stl";
45  Mercury3D dpm;
47  dpm.wallHandler.readTriangleWall(filename,species);
48  helpers::check(dpm.wallHandler.getNumberOfObjects(),12,0,"Number of walls read");
49  dpm.write(std::cout,true);
50  return 0;
51 }
const std::string getMercuryDPMSourceDir()
This file is used for generating definitions that give access to CMakeVariables from within a cpp fil...
Definition: CMakeDefinitions.cc:32
Species< LinearViscoelasticNormalSpecies > LinearViscoelasticSpecies
Definition: LinearViscoelasticSpecies.h:33
virtual unsigned int getNumberOfObjects() const
Gets the number of real Object in this BaseHandler. (i.e. no mpi or periodic particles)
Definition: BaseHandler.h:648
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.
Definition: BaseHandler.h:379
SpeciesHandler speciesHandler
A handler to that stores the species type i.e. LinearViscoelasticSpecies, etc.
Definition: DPMBase.h:1427
WallHandler wallHandler
An object of the class WallHandler. Contains pointers to all the walls created.
Definition: DPMBase.h:1447
This adds on the hierarchical grid code for 3D problems.
Definition: Mercury3D.h:37
void write(std::ostream &os, bool writeAllParticles=true) const override
Writes all data into a restart file.
Definition: MercuryBase.cc:147
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:341
void check(double real, double ideal, double error, std::string errorMessage)
Definition: TestHelpers.cc:37

References helpers::check(), BaseHandler< T >::copyAndAddObject(), getMercuryDPMSourceDir(), BaseHandler< T >::getNumberOfObjects(), WallHandler::readTriangleWall(), DPMBase::speciesHandler, DPMBase::wallHandler, and MercuryBase::write().