Chombo + EB + MF  3.2
STLBinaryReader.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _STLBINARYREADER_H_
12 #define _STLBINARYREADER_H_
13 
14 #include <iostream>
15 #include <string>
16 using namespace std;
17 
18 #include "MayDay.H"
19 
20 #include "STLReader.H"
21 #include "STLMesh.H"
22 //#include "STLExplorer.H" // for comparators
23 
24 #include "NamespaceHeader.H"
25 
26 /*
27  * Reads binary STL files and generates a mesh
28  * see http://www.cplusplus.com/doc/tutorial/files/
29  */
30 
32 {
33 public:
34  /// Constructor - read from standard input
36 
37  /// Constructor - read from file name
38  STLBinaryReader(const string& a_filename);
39 
40  /// Destructor
41  ~STLBinaryReader();
42 
43  /// Return header information
44  string* GetHeader() const;
45 
46  /// Return number of elements
47  void GetNtri(int& a_ntri) const;
48 
49  /// Return whether number of elements from header matches file
50  void GetNtriMatch(bool& a_ntriMatch) const;
51 
52  /// Return pointer to the mesh
53  RefCountedPtr<STLMesh> GetMesh() const;
54 
55 protected:
56  void ReadData(istream& a_file,
57  const int offset);
58 
59  string* m_header; // header info
60  int m_ntri; // number of triangles read in
61  bool m_ntriMatch; // true if m_ntri equals the number of triangles declared in the header
62 
63  // actual data - shared by all copies
64  RefCountedPtr<STLMesh> m_stlmesh; // pointer to the mesh
65 
66 private:
67  void operator=(const STLBinaryReader& a_inputReader)
68  {
69  MayDay::Abort("STLBinaryReader doesn't allow assignment");
70  }
71 };
72 
73 #include "NamespaceFooter.H"
74 #endif
void operator=(const STLBinaryReader &a_inputReader)
Definition: STLBinaryReader.H:67
RefCountedPtr< STLMesh > m_stlmesh
Definition: STLBinaryReader.H:64
string * m_header
Definition: STLBinaryReader.H:59
int m_ntri
Definition: STLBinaryReader.H:60
Definition: STLBinaryReader.H:31
bool m_ntriMatch
Definition: STLBinaryReader.H:61
Definition: STLReader.H:26
static void Abort(const char *const a_msg=m_nullString)
Print out message to cerr and exit via abort() (if serial) or MPI_Abort() (if parallel).