Chombo + EB + MF  3.2
STLReader.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 _STLREADER_H_
12 #define _STLREADER_H_
13 
14 #include <iostream>
15 #include <fstream>
16 using std::istream;
17 using std::ifstream;
18 
19 #include "MayDay.H"
20 #include "RefCountedPtr.H"
21 
22 #include "STLMesh.H"
23 
24 #include "NamespaceHeader.H"
25 
26 class STLReader
27 {
28 public:
29  /// Constructor - read from standard input
30  STLReader() {}
31 
32  /// Destructor
33  virtual ~STLReader() {}
34 
35  /// Return header information
36  virtual string* GetHeader() const = 0;
37 
38  /// Return number of elements
39  virtual void GetNtri(int& a_ntri) const = 0;
40 
41  /// Return whether number of elements from header matches file
42  virtual void GetNtriMatch(bool& a_ntriMatch) const = 0;
43 
44  /// Return pointer to the mesh
45  virtual RefCountedPtr<STLMesh> GetMesh() const = 0;
46 
47 protected:
48  virtual void ReadData(istream& a_file,
49  const int offset) = 0;
50 
51  int m_ntri; // number of triangles read in
52  bool m_ntriMatch; // true if m_ntri equals the number of triangles declared in the header
53 
54  // actual data - shared by all copies
55  RefCountedPtr<STLMesh> m_stlmesh; // pointer to the mesh
56 
57 private:
58  void operator=(const STLReader& a_inputReader)
59  {
60  MayDay::Abort("STLReader doesn't allow assignment");
61  }
62 };
63 
64 #include "NamespaceFooter.H"
65 #endif
virtual ~STLReader()
Destructor.
Definition: STLReader.H:33
void operator=(const STLReader &a_inputReader)
Definition: STLReader.H:58
virtual void GetNtriMatch(bool &a_ntriMatch) const =0
Return whether number of elements from header matches file.
bool m_ntriMatch
Definition: STLReader.H:52
STLReader()
Constructor - read from standard input.
Definition: STLReader.H:30
virtual void GetNtri(int &a_ntri) const =0
Return number of elements.
RefCountedPtr< STLMesh > m_stlmesh
Definition: STLReader.H:55
virtual string * GetHeader() const =0
Return header information.
virtual RefCountedPtr< STLMesh > GetMesh() const =0
Return pointer to the mesh.
Definition: STLReader.H:26
virtual void ReadData(istream &a_file, const int offset)=0
int m_ntri
Definition: STLReader.H:51
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).