Documentation 6b54b78464
Loading...
Searching...
No Matches
CSurfaceFVMDataSorter.hpp
Go to the documentation of this file.
1/*!
2 * \file CSurfaceFVMDataSorter.hpp
3 * \brief Headers for the surface FVM data sorter class.
4 * \author T. Albring
5 * \version 8.5.0 "Harrier"
6 *
7 * SU2 Project Website: https://su2code.github.io
8 *
9 * The SU2 Project is maintained by the SU2 Foundation
10 * (http://su2foundation.org)
11 *
12 * Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13 *
14 * SU2 is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * SU2 is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26 */
27#pragma once
28
30#include "CFVMDataSorter.hpp"
31
33
34 const CFVMDataSorter* volumeSorter; //!< Pointer to the volume sorter instance
35 map<unsigned long,unsigned long> Renumber2Global; //! Structure to map the local sorted point ID to the global point ID
36public:
37
38 /*!
39 * \brief Construct a file writer using field names and the data sorter.
40 * \param[in] config - Pointer to the current config structure
41 * \param[in] geometry - Pointer to the current geometry
42 * \param[in] valVolumeSorter - The datasorter containing the volume data
43 */
44 CSurfaceFVMDataSorter(CConfig *config, CGeometry* geometry, const CFVMDataSorter* valVolumeSorter);
45
46 /*!
47 * \brief Sort the output data for each grid node into a linear partitioning across all processors.
48 * \param[in] config - Definition of the particular problem.
49 * \param[in] geometry - Geometrical definition of the problem.
50 */
51 void SortOutputData() override;
52
53 /*!
54 * \brief Sort the connectivities on the surface into data structures used for output file writing.
55 * All markers in MARKER_PLOTTING will be sorted.
56 * \param[in] config - Definition of the particular problem.
57 * \param[in] geometry - Geometrical definition of the problem.
58 * \param[in] val_sort - boolean controlling whether surface <TRUE> or volume connectivity <FALSE> should be sorted.
59 */
60 void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) override;
61
62 /*!
63 * \brief Sort the connectivities (volume and surface) into data structures used for output file writing.
64 * Only markers in the markerList argument will be sorted.
65 * \param[in] config - Definition of the particular problem.
66 * \param[in] geometry - Geometrical definition of the problem.
67 * \param[in] markerList - List of markers to sort.
68 */
69 void SortConnectivity(CConfig *config, CGeometry *geometry, const vector<string> &markerList) override;
70
71 /*!
72 * \brief Get the global index of a point.
73 * \param[in] iPoint - the local renumbered point ID.
74 * \return Global index of a specific point.
75 */
76 unsigned long GetGlobalIndex(unsigned long iPoint) const override{
77 if (iPoint > nPoints)
78 SU2_MPI::Error(string("Local renumbered iPoint ID ") + to_string(iPoint) +
79 string(" is larger than max number of nodes ") + to_string(nPoints), CURRENT_FUNCTION);
80
81 return Renumber2Global.at(iPoint);
82 }
83
84 /*!
85 * \brief Get the beginning global renumbered node ID of the linear partition owned by a specific processor.
86 * \param[in] rank - the processor rank.
87 * \return The beginning global renumbered node ID.
88 */
89 unsigned long GetNodeBegin(unsigned short rank) const override {
90 return nPoint_Recv[rank];
91 }
92
93 /*!
94 * \brief Get the Processor ID a Point belongs to.
95 * \param[in] iPoint - global renumbered ID of the point
96 * \return The rank/processor number.
97 */
98 unsigned short FindProcessor(unsigned long iPoint) const override {
99
100 for (unsigned short iRank = 1; iRank < size; iRank++){
101 if (nPoint_Recv[iRank] > static_cast<int>(iPoint)){
102 return iRank - 1;
103 }
104 }
105 return size-1;
106 }
107
108 /*!
109 * \brief Get the cumulated number of points
110 * \input rank - the processor rank.
111 * \return The cumulated number of points up to certain processor rank.
112 */
113 unsigned long GetnPointCumulative(unsigned short rank) const override {
114 return GetNodeBegin(rank);
115 }
116
117private:
118
119 /*!
120 * \brief Sort the connectivity for a single surface element type into a linear partitioning across all processors.
121 * \param[in] config - Definition of the particular problem.
122 * \param[in] geometry - Geometrical definition of the problem.
123 * \param[in] Elem_Type - VTK index of the element type being merged.
124 * \param[in] markerList - List of markers to sort
125 */
126 void SortSurfaceConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type,
127 const vector<string> &markerList);
128
129};
Headers fo the FVM data sorter class.
Headers fo the data sorter class.
static void Error(const std::string &ErrorMsg, const std::string &FunctionName)
Definition mpi_structure.cpp:131
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Definition CFVMDataSorter.hpp:33
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Definition CParallelDataSorter.hpp:39
const int size
The MPI size, aka the number of processors.
Definition CParallelDataSorter.hpp:50
const int rank
The MPI rank.
Definition CParallelDataSorter.hpp:45
int * nPoint_Recv
Number of points this processor receives from other processors.
Definition CParallelDataSorter.hpp:99
unsigned long nPoints
Local number of points.
Definition CParallelDataSorter.hpp:88
Definition CSurfaceFVMDataSorter.hpp:32
void SortOutputData() override
Sort the output data for each grid node into a linear partitioning across all processors.
Definition CSurfaceFVMDataSorter.cpp:50
unsigned long GetNodeBegin(unsigned short rank) const override
Get the beginning global renumbered node ID of the linear partition owned by a specific processor.
Definition CSurfaceFVMDataSorter.hpp:89
unsigned short FindProcessor(unsigned long iPoint) const override
Get the Processor ID a Point belongs to.
Definition CSurfaceFVMDataSorter.hpp:98
unsigned long GetGlobalIndex(unsigned long iPoint) const override
Get the global index of a point.
Definition CSurfaceFVMDataSorter.hpp:76
void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) override
Sort the connectivities on the surface into data structures used for output file writing....
Definition CSurfaceFVMDataSorter.cpp:1070
unsigned long GetnPointCumulative(unsigned short rank) const override
Get the cumulated number of points \input rank - the processor rank.
Definition CSurfaceFVMDataSorter.hpp:113
#define CURRENT_FUNCTION
Definition mpi_structure.hpp:59