Documentation a537f1bdf2
Loading...
Searching...
No Matches
CSurfaceFEMDataSorter.hpp
Go to the documentation of this file.
1/*!
2 * \file CSurfaceFEMDataSorter.hpp
3 * \brief Headers fo the surface FEM 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 "CFEMDataSorter.hpp"
31
33
34 const CFEMDataSorter* volumeSorter; //!< Pointer to the volume sorter instance
35 vector<unsigned long> globalSurfaceDOFIDs; //!< Structure to map the local sorted point ID to the global point ID
36 vector<unsigned long> nSurfaceDOFsRanks; //!< Number of points on each rank
37
38public:
39
40 /*!
41 * \brief Construct a file writer using field names and the data sorter.
42 * \param[in] config - Pointer to the current config structure
43 * \param[in] geometry - Pointer to the current geometry
44 * \param[in] valVolumeSorter - The datasorter containing the volume data
45 */
46 CSurfaceFEMDataSorter(CConfig *config, CGeometry *geometry, const CFEMDataSorter* valVolumeSorter);
47
48 /*!
49 * \brief Sort the output data for each grid node into a linear partitioning across all processors.
50 * \param[in] config - Definition of the particular problem.
51 * \param[in] geometry - Geometrical definition of the problem.
52 */
53 void SortOutputData() override;
54
55 /*!
56 * \brief Sort the connectivities on the surface into data structures used for output file writing.
57 * All markers in MARKER_PLOTTING will be sorted.
58 * \param[in] config - Definition of the particular problem.
59 * \param[in] geometry - Geometrical definition of the problem.
60 * \param[in] val_sort - boolean controlling whether surface <TRUE> or volume connectivity <FALSE> should be sorted.
61 */
62 void SortConnectivity(CConfig *config, CGeometry *geometry, bool val_sort) override;
63
64 /*!
65 * \brief Sort the connectivities (volume and surface) into data structures used for output file writing.
66 * Only markers in the markerList argument will be sorted.
67 * \param[in] config - Definition of the particular problem.
68 * \param[in] geometry - Geometrical definition of the problem.
69 * \param[in] markerList - List of markers to sort.
70 */
71 void SortConnectivity(CConfig *config, CGeometry *geometry, const vector<string> &markerList) override;
72
73 /*!
74 * \brief Get the global index of a point.
75 * \input iPoint - the point ID.
76 * \return Global index of a specific point.
77 */
78 unsigned long GetGlobalIndex(unsigned long iPoint) const override {
79 return globalSurfaceDOFIDs[iPoint];
80 }
81
82 /*!
83 * \brief Get the beginning global renumbered node ID of the linear partition owned by a specific processor.
84 * \param[in] rank - the processor rank.
85 * \return The beginning global renumbered node ID.
86 */
87 unsigned long GetNodeBegin(unsigned short rank) const override {
88 unsigned long offsetSurfaceDOFs = 0;
89 for(int i=0; i<rank; ++i) offsetSurfaceDOFs += nSurfaceDOFsRanks[i];
90 return offsetSurfaceDOFs;
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 unsigned long offsetSurfaceDOFs = nSurfaceDOFsRanks[0];
100 for (unsigned short iRank = 1; iRank < size; iRank++){
101 if (offsetSurfaceDOFs > iPoint){
102 return iRank - 1;
103 }
104 offsetSurfaceDOFs += nSurfaceDOFsRanks[iRank];
105 }
106 return size-1;
107 }
108
109 /*!
110 * \brief Get the cumulated number of points
111 * \param[in] rank - the processor rank.
112 * \return The cumulated number of points up to certain processor rank.
113 */
114 unsigned long GetnPointCumulative(unsigned short rank) const override {
115 return GetNodeBegin(rank);
116 }
117
118private:
119
120 /*!
121 * \brief Sort the connectivity for a single surface element type into a linear partitioning across all processors.
122 * \param[in] config - Definition of the particular problem.
123 * \param[in] geometry - Geometrical definition of the problem.
124 * \param[in] Elem_Type - VTK index of the element type being merged.
125 * \param[in] markerList - List of markers to sort
126 */
127 void SortSurfaceConnectivity(CConfig *config, CGeometry *geometry, unsigned short Elem_Type,
128 const vector<string> &markerList);
129
130};
Headers fo the FEM data sorter class.
Headers fo the data sorter class.
Main class for defining the problem; basically this class reads the configuration file,...
Definition CConfig.hpp:64
Definition CFEMDataSorter.hpp:32
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
Definition CSurfaceFEMDataSorter.hpp:32
void SortOutputData() override
Sort the output data for each grid node into a linear partitioning across all processors.
Definition CSurfaceFEMDataSorter.cpp:69
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 CSurfaceFEMDataSorter.hpp:87
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 CSurfaceFEMDataSorter.cpp:322
unsigned short FindProcessor(unsigned long iPoint) const override
Get the Processor ID a Point belongs to.
Definition CSurfaceFEMDataSorter.hpp:98
unsigned long GetGlobalIndex(unsigned long iPoint) const override
Get the global index of a point. \input iPoint - the point ID.
Definition CSurfaceFEMDataSorter.hpp:78
unsigned long GetnPointCumulative(unsigned short rank) const override
Get the cumulated number of points.
Definition CSurfaceFEMDataSorter.hpp:114