2828
2929#pragma once
3030
31+ #include < array>
32+
3133#include " CMeshReaderFVM.hpp"
3234
3335/* !
3436 * \class CSU2ASCIIMeshReaderFVM
3537 * \brief Reads a native SU2 ASCII grid into linear partitions for the finite volume solver (FVM).
36- * \author: T. Economon
38+ * \author T. Economon
3739 */
3840class CSU2ASCIIMeshReaderFVM : public CMeshReaderFVM {
3941
4042private:
43+ enum class FileSection { POINTS, ELEMENTS, MARKERS }; /* !< \brief Different sections of the file. */
44+ std::array<FileSection, 3 > SectionOrder{}; /* !< \brief Order of the sections in the file. */
4145
42- unsigned short myZone; /* !< \brief Current SU2 zone index. */
43- unsigned short nZones; /* !< \brief Total number of zones in the SU2 file. */
46+ const unsigned short myZone; /* !< \brief Current SU2 zone index. */
47+ const unsigned short nZones; /* !< \brief Total number of zones in the SU2 file. */
4448
45- string meshFilename; /* !< \brief Name of the SU2 ASCII mesh file being read. */
49+ const string meshFilename; /* !< \brief Name of the SU2 ASCII mesh file being read. */
4650 ifstream mesh_file; /* !< \brief File object for the SU2 ASCII mesh file. */
4751
4852 bool actuator_disk; /* !< \brief Boolean for whether we have an actuator disk to split. */
4953
50- unsigned long ActDiskNewPoints; /* !< \brief Total number of new grid points to add due to actuator disk splitting. */
54+ unsigned long ActDiskNewPoints = 0 ; /* !< \brief Total number of new grid points to add due to actuator disk splitting. */
5155
52- su2double Xloc; /* !< \brief X-coordinate of the CG of the actuator disk surface. */
53- su2double Yloc; /* !< \brief X-coordinate of the CG of the actuator disk surface. */
54- su2double Zloc; /* !< \brief X-coordinate of the CG of the actuator disk surface. */
56+ su2double Xloc = 0.0 ; /* !< \brief X-coordinate of the CG of the actuator disk surface. */
57+ su2double Yloc = 0.0 ; /* !< \brief X-coordinate of the CG of the actuator disk surface. */
58+ su2double Zloc = 0.0 ; /* !< \brief X-coordinate of the CG of the actuator disk surface. */
5559
5660 vector<bool > ActDisk_Bool; /* !< \brief Flag to identify the grid points on the actuator disk. */
5761
@@ -68,8 +72,11 @@ class CSU2ASCIIMeshReaderFVM: public CMeshReaderFVM {
6872
6973 /* !
7074 * \brief Reads all SU2 ASCII mesh metadata and checks for errors.
75+ * \param[in] single_pass - Try to read the contents together with the metadata if the order allows (points before elements).
76+ * \param[in,out] config - Problem configuration where some metadata is updated (e.g. AoA).
77+ * \returns True if single_pass was successful.
7178 */
72- void ReadMetadata ();
79+ bool ReadMetadata (const bool single_pass, CConfig *config );
7380
7481 /* !
7582 * \brief Splits a single surface actuator disk boundary into two separate markers (repeated points).
@@ -79,17 +86,17 @@ class CSU2ASCIIMeshReaderFVM: public CMeshReaderFVM {
7986 /* !
8087 * \brief Reads the grid points from an SU2 zone into linear partitions across all ranks.
8188 */
82- void ReadPointCoordinates ();
89+ void ReadPointCoordinates (const bool single_pass = false );
8390
8491 /* !
8592 * \brief Reads the interior volume elements from one section of an SU2 zone into linear partitions across all ranks.
8693 */
87- void ReadVolumeElementConnectivity ();
94+ void ReadVolumeElementConnectivity (const bool single_pass = false );
8895
8996 /* !
9097 * \brief Reads the surface (boundary) elements from the SU2 zone.
9198 */
92- void ReadSurfaceElementConnectivity ();
99+ void ReadSurfaceElementConnectivity (const bool single_pass = false );
93100
94101 /* !
95102 * \brief Helper function to find the current zone in an SU2 ASCII mesh object.
@@ -101,13 +108,8 @@ class CSU2ASCIIMeshReaderFVM: public CMeshReaderFVM {
101108 /* !
102109 * \brief Constructor of the CSU2ASCIIMeshReaderFVM class.
103110 */
104- CSU2ASCIIMeshReaderFVM (CConfig *val_config,
111+ CSU2ASCIIMeshReaderFVM (CConfig *val_config,
105112 unsigned short val_iZone,
106113 unsigned short val_nZone);
107114
108- /* !
109- * \brief Destructor of the CSU2ASCIIMeshReaderFVM class.
110- */
111- ~CSU2ASCIIMeshReaderFVM (void );
112-
113115};
0 commit comments