Test of the binary reader. The files used is STL file with containing one triange.
This code users BinaryReader to open a binary file called SimpleTrianlge.stl and read in currently the single tringle from this file. The triangle was created using nclab.org and contains a single triangle with normal (0,0,1) and vertex (0,1,0), (1,0,0) and (1,1,0). This is currently a UnitTest as does not require selftest data; however, it does require he file SimpleTrianlge.stl to exist
24 std::ifstream STLFile;
40 logger(
FATAL,
"Failed to read the correct number of triangles");
42 double xTmp,yTmp,zTmp;
44 for (
unsigned int i=0;
i<(numTriangles);
i++)
52 Vec3D Normal(xTmp,yTmp,zTmp);
54 if (!(Normal.isEqualTo(
Vec3D(0,0,1),1
e-10)))
62 Vec3D Point1(xTmp,yTmp,zTmp);
64 if (!(Point1.isEqualTo(
Vec3D(0,1,0),1
e-10)))
71 Vec3D Point2(xTmp,yTmp,zTmp);
73 if (!(Point2.isEqualTo(
Vec3D(1,0,0),1
e-10)))
81 Vec3D Point3(xTmp,yTmp,zTmp);
83 if (!(Point3.isEqualTo(
Vec3D(1,1,0),1
e-10)))
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const std::string getMercuryDPMSourceDir()
This file is used for generating definitions that give access to CMakeVariables from within a cpp fil...
Definition: Configuration/CMakeDefinitions.cc:10
Array< double, 1, 3 > e(1./3., 0.5, 2.)
LL< Log::FATAL > FATAL
Definition of the different loglevels by its wrapper class LL. These are used as tags in template met...
Definition: Logger.cc:31
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
This gives functionality to read information from binary formats like STL etc. This class is complete...
Definition: BinaryReader.h:16
double readFloat(unsigned int size)
read the next so many bytes as a double (not in this case they were saves as a float orgainlly)
Definition: BinaryReader.cc:85
void ignoreChar(unsigned int size)
read and ignore the next number of characters
Definition: BinaryReader.cc:110
unsigned int readUnsignedInt(unsigned int size)
read the next so many bytes as a unsined int
Definition: BinaryReader.cc:98
std::string readString(unsigned int numChar)
reads the next so many Characters (bytes) as a std::string
Definition: BinaryReader.cc:57
Definition: BinaryReaderSTL1by1by1bySquareUnitTest.cpp:48
Definition: Kernel/Math/Vector.h:30
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286