Documentation 6b54b78464
Loading...
Searching...
No Matches
CMultiGridQueue.hpp
Go to the documentation of this file.
1/*!
2 * \file CMultiGridQueue.hpp
3 * \brief Header of the multigrid queue class for the FVM solver.
4 * The subroutines and functions are in the <i>CMultiGridQueue.cpp</i> file.
5 * \author F. Palacios
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#include <vector>
32#include "../containers/CFastFindAndEraseQueue.hpp"
33#include "CGeometry.hpp"
34
35using namespace std;
36
37/*!
38 * \class CMultiGridQueue
39 * \brief Class for a multigrid queue system for the finite volume solver.
40 * \author F. Palacios
41 */
43 private:
45 vector<QueueType>
46 QueueCV; /*!< \brief Queue structure to choose the next control volume in the agglomeration process. */
47 vector<short> Priority; /*!< \brief The priority is based on the number of pre-agglomerated neighbors. */
48 vector<char> RightCV; /*!< \brief In the lowest priority there are some CV that can not be agglomerated, this is the
49 way to identify them. */
50 const unsigned long nPoint = 0; /*!< \brief Total number of points. */
51
52 /*!
53 * \brief Throw error with error message that the point is not in the priority list.
54 */
55 void ThrowPointNotInListError(unsigned long iPoint) const;
56
57 public:
58 /*!
59 * \brief Constructor of the class.
60 * \param[in] npoint - Number of control volumes.
61 */
62 CMultiGridQueue(unsigned long npoint);
63
64 /*!
65 * \brief No default construction.
66 */
67 CMultiGridQueue() = delete;
68
69 /*!
70 * \brief Add a new CV to the list.
71 * \param[in] newPoint - Index of the new point.
72 * \param[in] numberNeighbors - Number of neighbors of the new point.
73 */
74 void AddCV(unsigned long newPoint, short numberNeighbors);
75
76 /*!
77 * \brief Remove a CV from the list.
78 * \param[in] removePoint - Index of the control volume to be removed.
79 */
80 void RemoveCV(unsigned long removePoint);
81
82 /*!
83 * \brief Change a CV from a list to a different list.
84 * \param[in] movePoint - Index of the control volume to be moved.
85 * \param[in] numberNeighbors - New number of neighbors of the control volume.
86 */
87 void MoveCV(unsigned long movePoint, short numberNeighbors);
88
89 /*!
90 * \brief Increase the priority of the CV.
91 * \param[in] incrPoint - Index of the control volume.
92 */
93 void IncrPriorityCV(unsigned long incrPoint);
94
95 /*!
96 * \brief Reduce the priority of the CV.
97 * \param[in] redPoint - Index of the control volume.
98 */
99 void RedPriorityCV(unsigned long redPoint);
100
101 /*!
102 * \brief Visualize the control volume queue.
103 */
104 void VisualizeQueue(void) const;
105
106 /*!
107 * \brief Visualize the priority list.
108 */
109 void VisualizePriority(void) const;
110
111 /*!
112 * \brief Find a new seed control volume.
113 * \return Index of the new control volume.
114 */
115 inline long NextCV(void) const {
116 if (!QueueCV.empty())
117 return QueueCV.back().front();
118 else
119 return -1;
120 }
121
122 /*!
123 * \brief Check if the queue is empty.
124 * \return <code>TRUE</code> or <code>FALSE</code> depending if the queue is empty.
125 */
126 bool EmptyQueue(void) const;
127
128 /*!
129 * \brief Total number of control volume in the queue.
130 * \return Total number of control points.
131 */
132 unsigned long TotalCV(void) const;
133
134 /*!
135 * \brief Update the queue with the new control volume (remove the CV and
136 * increase the priority of the neighbors).
137 * \param[in] updatePoint - Index of the new point.
138 * \param[in] fineGrid - Fine grid geometry.
139 */
140 void Update(unsigned long updatePoint, CGeometry* fineGrid);
141};
Headers of the main subroutines for creating the geometrical structure. The subroutines and functions...
A queue-type container (push back, pop front), but with fast deletion of arbitrary items (possibly in...
Definition CFastFindAndEraseQueue.hpp:48
Parent class for defining the geometry of the problem (complete geometry, multigrid agglomerated geom...
Definition CGeometry.hpp:75
Class for a multigrid queue system for the finite volume solver.
Definition CMultiGridQueue.hpp:42
long NextCV(void) const
Find a new seed control volume.
Definition CMultiGridQueue.hpp:115
CMultiGridQueue()=delete
No default construction.
void IncrPriorityCV(unsigned long incrPoint)
Increase the priority of the CV.
Definition CMultiGridQueue.cpp:102
void VisualizePriority(void) const
Visualize the priority list.
Definition CMultiGridQueue.cpp:137
unsigned long TotalCV(void) const
Total number of control volume in the queue.
Definition CMultiGridQueue.cpp:157
void MoveCV(unsigned long movePoint, short numberNeighbors)
Change a CV from a list to a different list.
Definition CMultiGridQueue.cpp:91
void VisualizeQueue(void) const
Visualize the control volume queue.
Definition CMultiGridQueue.cpp:125
void AddCV(unsigned long newPoint, short numberNeighbors)
Add a new CV to the list.
Definition CMultiGridQueue.cpp:42
bool EmptyQueue(void) const
Check if the queue is empty.
Definition CMultiGridQueue.cpp:143
void Update(unsigned long updatePoint, CGeometry *fineGrid)
Update the queue with the new control volume (remove the CV and increase the priority of the neighbor...
Definition CMultiGridQueue.cpp:163
void RemoveCV(unsigned long removePoint)
Remove a CV from the list.
Definition CMultiGridQueue.cpp:67
void RedPriorityCV(unsigned long redPoint)
Reduce the priority of the CV.
Definition CMultiGridQueue.cpp:113