Nektar++
Public Member Functions | Protected Attributes | List of all members
Nektar::MultiRegions::MultiLevelBisectedGraph Class Reference

#include <SubStructuredGraph.h>

Public Member Functions

 MultiLevelBisectedGraph (MultiLevelBisectedGraphSharedPtr oldLevel, const int nPartition)
 
 MultiLevelBisectedGraph (const int nBndDofs)
 
 ~MultiLevelBisectedGraph (void)
 
int GetTotDofs () const
 
void SetGlobalNumberingOffset ()
 
void DumpNBndDofs (void) const
 
void CollectLeaves (std::vector< SubGraphSharedPtr > &leaves) const
 
int CutLeaves ()
 
int CutEmptyLeaves ()
 
int GetNdaughterGraphs () const
 
const SubGraphSharedPtr GetBndDofsGraph () const
 
std::vector< MultiLevelBisectedGraphSharedPtr > & GetDaughterGraphs ()
 

Protected Attributes

SubGraphSharedPtr m_BndDofs
 
std::vector< MultiLevelBisectedGraphSharedPtrm_daughterGraphs
 

Detailed Description

Definition at line 153 of file SubStructuredGraph.h.

Constructor & Destructor Documentation

◆ MultiLevelBisectedGraph() [1/2]

Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph ( MultiLevelBisectedGraphSharedPtr  oldLevel,
const int  nPartition 
)

Definition at line 127 of file SubStructuredGraph.cpp.

129{
130 m_daughterGraphs.push_back(oldLevel);
132}
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::vector< MultiLevelBisectedGraphSharedPtr > m_daughterGraphs

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), m_BndDofs, and m_daughterGraphs.

◆ MultiLevelBisectedGraph() [2/2]

Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph ( const int  nBndDofs)

Definition at line 134 of file SubStructuredGraph.cpp.

◆ ~MultiLevelBisectedGraph()

Nektar::MultiRegions::MultiLevelBisectedGraph::~MultiLevelBisectedGraph ( void  )

Definition at line 139 of file SubStructuredGraph.cpp.

140{
141}

Member Function Documentation

◆ CollectLeaves()

void Nektar::MultiRegions::MultiLevelBisectedGraph::CollectLeaves ( std::vector< SubGraphSharedPtr > &  leaves) const

Definition at line 191 of file SubStructuredGraph.cpp.

193{
194 int cnt = 0;
195
196 for (auto &g : m_daughterGraphs)
197 {
198 g->CollectLeaves(leaves);
199 cnt++;
200 }
201
202 if (cnt == 0)
203 {
205 leaves.push_back(leave);
206 }
207}
std::shared_ptr< SubGraph > SubGraphSharedPtr

References m_BndDofs, and m_daughterGraphs.

◆ CutEmptyLeaves()

int Nektar::MultiRegions::MultiLevelBisectedGraph::CutEmptyLeaves ( )

Definition at line 209 of file SubStructuredGraph.cpp.

210{
211 int returnval;
212 static int level = 0;
213 static int nLeaves = 0;
214 level++;
215
216 if (level == 1 && m_daughterGraphs.size() == 0)
217 {
218 level = 0;
219 nLeaves = 0;
220 return 0;
221 }
222
223 for (auto it = m_daughterGraphs.begin(); it != m_daughterGraphs.end();)
224 {
225 auto g = *it;
226 if (g->GetNdaughterGraphs() == 0 &&
227 g->GetBndDofsGraph()->GetNverts() == 0)
228 {
229 it = m_daughterGraphs.erase(it);
230 nLeaves++;
231 }
232 else
233 {
234 g->CutEmptyLeaves();
235 ++it;
236 }
237 }
238
239 returnval = nLeaves;
240
241 level--;
242 if (level == 0)
243 {
244 nLeaves = 0;
245 }
246
247 return returnval;
248}

References CellMLToNektar.pycml::level, and m_daughterGraphs.

◆ CutLeaves()

int Nektar::MultiRegions::MultiLevelBisectedGraph::CutLeaves ( )

Definition at line 250 of file SubStructuredGraph.cpp.

251{
252 int returnval;
253 static int level = 0;
254 static int nLeaves = 0;
255 level++;
256
257 if (level == 1 && m_daughterGraphs.size() == 0)
258 {
259 level = 0;
260 nLeaves = 0;
261 return 0;
262 }
263
264 for (auto it = m_daughterGraphs.begin(); it != m_daughterGraphs.end();)
265 {
266 auto g = *it;
267 if (g->GetNdaughterGraphs() == 0)
268 {
269 it = m_daughterGraphs.erase(it);
270 nLeaves++;
271 }
272 else
273 {
274 g->CutLeaves();
275 ++it;
276 }
277 }
278
279 returnval = nLeaves;
280
281 level--;
282 if (level == 0)
283 {
284 nLeaves = 0;
285 }
286
287 return returnval;
288}

References CellMLToNektar.pycml::level, and m_daughterGraphs.

◆ DumpNBndDofs()

void Nektar::MultiRegions::MultiLevelBisectedGraph::DumpNBndDofs ( void  ) const

Definition at line 177 of file SubStructuredGraph.cpp.

178{
179 static int level = 0;
180 level++;
181 cout << "LEVEL " << level << " " << m_BndDofs->GetNverts() << endl;
182
183 for (auto &g : m_daughterGraphs)
184 {
185 g->DumpNBndDofs();
186 }
187
188 level--;
189}

References CellMLToNektar.pycml::level, m_BndDofs, and m_daughterGraphs.

◆ GetBndDofsGraph()

const SubGraphSharedPtr Nektar::MultiRegions::MultiLevelBisectedGraph::GetBndDofsGraph ( ) const
inline

Definition at line 173 of file SubStructuredGraph.h.

174 {
175 return m_BndDofs;
176 }

References m_BndDofs.

◆ GetDaughterGraphs()

std::vector< MultiLevelBisectedGraphSharedPtr > & Nektar::MultiRegions::MultiLevelBisectedGraph::GetDaughterGraphs ( )
inline

Definition at line 178 of file SubStructuredGraph.h.

179 {
180 return m_daughterGraphs;
181 }

References m_daughterGraphs.

◆ GetNdaughterGraphs()

int Nektar::MultiRegions::MultiLevelBisectedGraph::GetNdaughterGraphs ( ) const
inline

Definition at line 168 of file SubStructuredGraph.h.

169 {
170 return m_daughterGraphs.size();
171 }

References m_daughterGraphs.

◆ GetTotDofs()

int Nektar::MultiRegions::MultiLevelBisectedGraph::GetTotDofs ( ) const

Definition at line 143 of file SubStructuredGraph.cpp.

144{
145 int returnval = 0;
146
147 for (auto &g : m_daughterGraphs)
148 {
149 returnval += g->GetTotDofs();
150 }
151
152 returnval += m_BndDofs->GetNverts();
153 return returnval;
154}

References m_BndDofs, and m_daughterGraphs.

◆ SetGlobalNumberingOffset()

void Nektar::MultiRegions::MultiLevelBisectedGraph::SetGlobalNumberingOffset ( )

Definition at line 156 of file SubStructuredGraph.cpp.

157{
158 static int level = 0;
159 static int offset = 0;
160 level++;
161
162 for (auto &g : m_daughterGraphs)
163 {
164 g->SetGlobalNumberingOffset();
165 }
166
167 m_BndDofs->SetIdOffset(offset);
168 offset += m_BndDofs->GetNverts();
169
170 level--;
171 if (level == 0)
172 {
173 offset = 0;
174 }
175}

References CellMLToNektar.pycml::level, m_BndDofs, and m_daughterGraphs.

Member Data Documentation

◆ m_BndDofs

SubGraphSharedPtr Nektar::MultiRegions::MultiLevelBisectedGraph::m_BndDofs
protected

◆ m_daughterGraphs

std::vector<MultiLevelBisectedGraphSharedPtr> Nektar::MultiRegions::MultiLevelBisectedGraph::m_daughterGraphs
protected