Documentation a537f1bdf2
Loading...
Searching...
No Matches
CCGNSMeshReaderBase.hpp
Go to the documentation of this file.
1/*!
2 * \file CCGNSMeshReaderBase.hpp
3 * \brief Header file for the class CCGNSMeshReaderBase.
4 * The implementations are in the <i>CCGNSMeshReaderBase.cpp</i> file.
5 * \author T. Economon
6 * \version 8.5.0 "Harrier"
7 *
8 * SU2 Project Website: https://su2code.github.io
9 *
10 * The SU2 Project is maintained by the SU2 Foundation
11 * (http://su2foundation.org)
12 *
13 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
14 *
15 * SU2 is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * SU2 is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29#pragma once
30
31#ifdef HAVE_CGNS
32#include "cgnslib.h"
33#endif
34
35#include "CMeshReaderBase.hpp"
36
37/*!
38 * \class CCGNSMeshReaderBase
39 * \brief Base class for the reading of a CGNS zone.
40 * \author: T. Economon
41 */
43 protected:
44#ifdef HAVE_CGNS
45 int cgnsFileID; /*!< \brief CGNS file identifier. */
46 const int cgnsBase = 1; /*!< \brief CGNS database index (the CGNS reader currently assumes a single database). */
47 const int cgnsZone = 1; /*!< \brief CGNS zone index (and 1 zone in that database). */
48
49 int nSections; /*!< \brief Total number of sections in the CGNS file. */
50
51 vector<bool> isInterior; /*!< \brief Vector of booleans to store whether each section in the CGNS file is an interior
52 or boundary section. */
53 vector<unsigned long>
54 nElems; /*!< \brief Vector containing the local number of elements found within each CGNS section. */
55 vector<unsigned long> elemOffset; /*!< \brief Global ID offset for each interior section (i.e., the total number of
56 global elements that came before it). */
57 vector<vector<cgsize_t> > connElems; /*!< \brief Vector containing the local element connectivity found within each
58 CGNS section. First index is the section, second contains the connectivity in
59 format [globalID VTK n1 n2 n3 n4 n5 n6 n7 n8] for each element. */
60 vector<vector<char> > sectionNames; /*!< \brief Vector for storing the names of each boundary section (marker). */
61
62 /*!
63 * \brief Open the CGNS file and checks for errors.
64 * \param[in] val_filename - string name of the CGNS file to be read.
65 */
66 void OpenCGNSFile(const string& val_filename);
67
68 /*!
69 * \brief Reads all CGNS database metadata and checks for errors.
70 */
71 void ReadCGNSDatabaseMetadata();
72
73 /*!
74 * \brief Reads all CGNS zone metadata and checks for errors.
75 */
76 void ReadCGNSZoneMetadata();
77
78 /*!
79 * \brief Reads the grid points from a CGNS zone into linear partitions across all ranks.
80 */
81 void ReadCGNSPointCoordinates();
82
83 /*!
84 * \brief Reads the metadata for each CGNS section in a zone and collect information, including the size and whether
85 * it is an interior or boundary section.
86 */
87 void ReadCGNSSectionMetadata();
88
89 /*!
90 * \brief Get the VTK type and string name for a CGNS element type.
91 * \param[in] val_elem_type - CGNS element type.
92 * \param[out] val_vtk_type - VTK type identifier index.
93 * \returns String containing the name of the element type.
94 */
95 string GetCGNSElementType(ElementType_t val_elem_type, int& val_vtk_type);
96#endif
97
98 public:
99 /*!
100 * \brief Constructor of the CCGNSMeshReaderBase class.
101 */
102 CCGNSMeshReaderBase(const CConfig* val_config, unsigned short val_iZone, unsigned short val_nZone);
103
104 /*!
105 * \brief Destructor of the CCGNSMeshReaderBase class.
106 */
107 virtual ~CCGNSMeshReaderBase(void) override;
108};
Header file for the class CMeshReaderBase. The implementations are in the CMeshReaderBase....
Base class for the reading of a CGNS zone.
Definition CCGNSMeshReaderBase.hpp:42
virtual ~CCGNSMeshReaderBase(void) override
Destructor of the CCGNSMeshReaderBase class.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Base class for the mesh zone readers.
Definition CMeshReaderBase.hpp:44