Documentation 6b54b78464
Loading...
Searching...
No Matches
CMeshReaderBase.hpp
Go to the documentation of this file.
1
2/*!
3 * \file CMeshReaderBase.hpp
4 * \brief Header file for the class CMeshReaderBase.
5 * The implementations are in the <i>CMeshReaderBase.cpp</i> file.
6 * \author T. Economon
7 * \version 8.5.0 "Harrier"
8 *
9 * SU2 Project Website: https://su2code.github.io
10 *
11 * The SU2 Project is maintained by the SU2 Foundation
12 * (http://su2foundation.org)
13 *
14 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
15 *
16 * SU2 is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
20 *
21 * SU2 is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public
27 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
28 */
29
30#pragma once
31
32#include <string.h>
33
34#include "../primal_grid/CPrimalGridFEM.hpp"
35#include "../../toolboxes/fem/CFaceOfElement.hpp"
36#include "../../parallelization/mpi_structure.hpp"
37#include "../../CConfig.hpp"
38
39/*!
40 * \class CMeshReaderBase
41 * \brief Base class for the mesh zone readers.
42 * \author T. Economon
43 */
45 protected:
46 const int rank; /*!< \brief MPI Rank. */
47 const int size; /*!< \brief MPI Size. */
48
49 const CConfig* config = nullptr; /*!< \brief Local pointer to the config parameter object. */
50
51 unsigned short dimension = 0; /*!< \brief Dimension of the problem (2 or 3). */
52
53 unsigned long numberOfLocalPoints =
54 0; /*!< \brief Number of local grid points within the linear partition on this rank. */
55 unsigned long numberOfGlobalPoints = 0; /*!< \brief Number of global grid points within the mesh file. */
56 vector<vector<passivedouble> >
57 localPointCoordinates; /*!< \brief Vector holding the coordinates from the mesh file for the local grid points.
58 First index is dimension, second is point index. */
59 vector<unsigned long> globalPointIDs; /*!< \brief Vector holding the global IDs of the local grid points. */
60
61 unsigned long numberOfLocalElements =
62 0; /*!< \brief Number of local elements within the linear partition on this rank. */
63 unsigned long numberOfGlobalElements = 0; /*!< \brief Number of global elements within the mesh file. */
64 vector<unsigned long> localVolumeElementConnectivity; /*!< \brief Vector containing the element connectivity from the
65 mesh file for the local elements. */
66
67 unsigned long numberOfMarkers = 0; /*!< \brief Total number of markers contained within the mesh file. */
68 vector<string> markerNames; /*!< \brief String names for all markers in the mesh file. */
69 vector<unsigned long>
70 numberOfLocalSurfaceElements; /*!< \brief Vector containing the number of local surface elements. */
71 vector<vector<unsigned long> >
72 surfaceElementConnectivity; /*!< \brief Vector containing the surface element connectivity from the mesh file on a
73 per-marker basis. For FVM, only the master node reads and stores this connectivity.
74 */
75
76 /*!
77 * \brief Function, which determines the faces of the local volume elements.
78 * \param[out] localFaces - The faces of the locally stored volume elements.
79 */
80 void DetermineFacesVolumeElements(vector<CFaceOfElement>& localFaces);
81
82 /*!
83 * \brief Get all the corner points of all the faces of the given element. It must
84 * \param[in] elemInfo - Array, which contains the info of the given element.
85 * \param[out] nFaces - Number of faces of the element.
86 * \param[out] nPointsPerFace - Number of corner points for each of the faces.
87 * \param[out] faceConn - Global IDs of the corner points of the faces.
88 */
89 void GetCornerPointsAllFaces(const unsigned long* elemInfo, unsigned short& numFaces, unsigned short nPointsPerFace[],
90 unsigned long faceConn[6][4]);
91
92 /*!
93 * \brief Creates copies of some markers.
94 * \param[in] srcDstMarkers - List of marker names [src_1, dst_1, ..., src_n, dst_n].
95 */
96 void CopyMarkers(const std::vector<std::string>& srcDstMarkers);
97
98 public:
99 /*!
100 * \brief Constructor of the CMeshReaderBase class.
101 * \param[in] val_config - config object for the current zone.
102 * \param[in] val_iZone - Current zone index.
103 * \param[in] val_nZone - Total number of zones.
104 */
105 CMeshReaderBase(const CConfig* val_config, unsigned short val_iZone, unsigned short val_nZone);
106
107 virtual ~CMeshReaderBase() = default;
108
109 /*!
110 * \brief Get the physical dimension of the problem (2 or 3).
111 * \returns Physical dimension of the problem.
112 */
113 inline unsigned short GetDimension() const { return dimension; }
114
115 /*!
116 * \brief Get the global IDs of the local points.
117 * \returns Reference to the vector containing the global points IDs.
118 */
119 inline const vector<unsigned long>& GetGlobalPointIDs() const { return globalPointIDs; }
120
121 /*!
122 * \brief Get the local point coordinates (linearly partitioned).
123 * \returns Local point coordinates (linear partitioned).
124 */
125 inline const vector<vector<passivedouble> >& GetLocalPointCoordinates() const { return localPointCoordinates; }
126
127 /*!
128 * \brief Get the surface element connectivity for the specified marker. Only the master node owns the surface
129 * connectivity. \param[in] val_iMarker - current marker index. \returns Surface element connecitivity for a marker
130 * from the master rank.
131 */
132 inline const vector<unsigned long>& GetSurfaceElementConnectivityForMarker(int val_iMarker) const {
133 return surfaceElementConnectivity[val_iMarker];
134 }
135
136 /*!
137 * \brief Get the number surface elements for all markers.
138 * \returns Reference to the vector containing the number of surface elements for all markers.
139 */
140 inline const vector<unsigned long>& GetNumberOfSurfaceElementsAllMarkers() const {
142 }
143
144 /*!
145 * \brief Get the number surface elements for the specified marker.
146 * \param[in] val_iMarker - current marker index.
147 * \returns Number of surface elements for a marker.
148 */
149 inline unsigned long GetNumberOfSurfaceElementsForMarker(int val_iMarker) const {
150 return (unsigned long)surfaceElementConnectivity[val_iMarker].size() / SU2_CONN_SIZE;
151 }
152
153 /*!
154 * \brief Get the local volume element connectivity (linearly partitioned).
155 * \returns Local volume element connectivity (linearly partitioned).
156 */
157 inline const vector<unsigned long>& GetLocalVolumeElementConnectivity() const {
159 }
160
161 /*!
162 * \brief Get the total number of markers in the mesh zone.
163 * \returns Total number of markers in the mesh zone.
164 */
165 inline unsigned long GetNumberOfMarkers() const { return numberOfMarkers; }
166
167 /*!
168 * \brief Get the vector of string names for all markers in the mesh zone.
169 * \returns Vector of string names for all markers in the mesh zone.
170 */
171 inline const vector<string>& GetMarkerNames() const { return markerNames; }
172
173 /*!
174 * \brief Get the number of local grid points within the linear partition on this rank.
175 * \returns Number of local grid points within the linear partition on this rank.
176 */
177 inline unsigned long GetNumberOfLocalPoints() const { return numberOfLocalPoints; }
178
179 /*!
180 * \brief Get the number of global grid points within the mesh file.
181 * \returns Number of global grid points within the mesh file.
182 */
183 inline unsigned long GetNumberOfGlobalPoints() const { return numberOfGlobalPoints; }
184
185 /*!
186 * \brief Get the number of local elements within the linear partition on this rank.
187 * \returns Number of local elements within the linear partition on this rank.
188 */
189 inline unsigned long GetNumberOfLocalElements() const { return numberOfLocalElements; }
190
191 /*!
192 * \brief Get the number of global elements within the mesh file.
193 * \returns Number of global elements within the mesh file.
194 */
195 inline unsigned long GetNumberOfGlobalElements() const { return numberOfGlobalElements; }
196};
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
unsigned long GetNumberOfLocalElements() const
Get the number of local elements within the linear partition on this rank.
Definition CMeshReaderBase.hpp:189
const vector< unsigned long > & GetNumberOfSurfaceElementsAllMarkers() const
Get the number surface elements for all markers.
Definition CMeshReaderBase.hpp:140
vector< vector< passivedouble > > localPointCoordinates
Vector holding the coordinates from the mesh file for the local grid points. First index is dimension...
Definition CMeshReaderBase.hpp:57
const int size
MPI Size.
Definition CMeshReaderBase.hpp:47
vector< vector< unsigned long > > surfaceElementConnectivity
Vector containing the surface element connectivity from the mesh file on a per-marker basis....
Definition CMeshReaderBase.hpp:72
const int rank
MPI Rank.
Definition CMeshReaderBase.hpp:46
const vector< unsigned long > & GetLocalVolumeElementConnectivity() const
Get the local volume element connectivity (linearly partitioned).
Definition CMeshReaderBase.hpp:157
vector< unsigned long > globalPointIDs
Vector holding the global IDs of the local grid points.
Definition CMeshReaderBase.hpp:59
unsigned long GetNumberOfGlobalPoints() const
Get the number of global grid points within the mesh file.
Definition CMeshReaderBase.hpp:183
const vector< string > & GetMarkerNames() const
Get the vector of string names for all markers in the mesh zone.
Definition CMeshReaderBase.hpp:171
const CConfig * config
Local pointer to the config parameter object.
Definition CMeshReaderBase.hpp:49
void CopyMarkers(const std::vector< std::string > &srcDstMarkers)
Creates copies of some markers.
Definition CMeshReaderBase.cpp:97
void GetCornerPointsAllFaces(const unsigned long *elemInfo, unsigned short &numFaces, unsigned short nPointsPerFace[], unsigned long faceConn[6][4])
Get all the corner points of all the faces of the given element. It must.
Definition CMeshReaderBase.cpp:74
unsigned long GetNumberOfLocalPoints() const
Get the number of local grid points within the linear partition on this rank.
Definition CMeshReaderBase.hpp:177
const vector< unsigned long > & GetSurfaceElementConnectivityForMarker(int val_iMarker) const
Get the surface element connectivity for the specified marker. Only the master node owns the surface ...
Definition CMeshReaderBase.hpp:132
vector< unsigned long > numberOfLocalSurfaceElements
Vector containing the number of local surface elements.
Definition CMeshReaderBase.hpp:70
const vector< vector< passivedouble > > & GetLocalPointCoordinates() const
Get the local point coordinates (linearly partitioned).
Definition CMeshReaderBase.hpp:125
virtual ~CMeshReaderBase()=default
void DetermineFacesVolumeElements(vector< CFaceOfElement > &localFaces)
Function, which determines the faces of the local volume elements.
Definition CMeshReaderBase.cpp:34
unsigned short GetDimension() const
Get the physical dimension of the problem (2 or 3).
Definition CMeshReaderBase.hpp:113
unsigned long numberOfMarkers
Total number of markers contained within the mesh file.
Definition CMeshReaderBase.hpp:67
unsigned long numberOfGlobalPoints
Number of global grid points within the mesh file.
Definition CMeshReaderBase.hpp:55
unsigned long numberOfLocalElements
Number of local elements within the linear partition on this rank.
Definition CMeshReaderBase.hpp:61
vector< unsigned long > localVolumeElementConnectivity
Vector containing the element connectivity from the mesh file for the local elements.
Definition CMeshReaderBase.hpp:64
unsigned long numberOfLocalPoints
Number of local grid points within the linear partition on this rank.
Definition CMeshReaderBase.hpp:53
unsigned long GetNumberOfMarkers() const
Get the total number of markers in the mesh zone.
Definition CMeshReaderBase.hpp:165
unsigned long GetNumberOfSurfaceElementsForMarker(int val_iMarker) const
Get the number surface elements for the specified marker.
Definition CMeshReaderBase.hpp:149
const vector< unsigned long > & GetGlobalPointIDs() const
Get the global IDs of the local points.
Definition CMeshReaderBase.hpp:119
unsigned long GetNumberOfGlobalElements() const
Get the number of global elements within the mesh file.
Definition CMeshReaderBase.hpp:195
unsigned short dimension
Dimension of the problem (2 or 3).
Definition CMeshReaderBase.hpp:51
unsigned long numberOfGlobalElements
Number of global elements within the mesh file.
Definition CMeshReaderBase.hpp:63
vector< string > markerNames
String names for all markers in the mesh file.
Definition CMeshReaderBase.hpp:68
const int SU2_CONN_SIZE
Size of the connectivity array that is allocated for each element that we read from a mesh file in th...
Definition option_structure.hpp:266