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 155 of file SubStructuredGraph.h.

Constructor & Destructor Documentation

◆ MultiLevelBisectedGraph() [1/2]

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

Definition at line 129 of file SubStructuredGraph.cpp.

131 {
132  m_daughterGraphs.push_back(oldLevel);
134 }
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 136 of file SubStructuredGraph.cpp.

138 {
139 }

◆ ~MultiLevelBisectedGraph()

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

Definition at line 141 of file SubStructuredGraph.cpp.

142 {
143 }

Member Function Documentation

◆ CollectLeaves()

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

Definition at line 193 of file SubStructuredGraph.cpp.

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

References m_BndDofs, and m_daughterGraphs.

◆ CutEmptyLeaves()

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

Definition at line 211 of file SubStructuredGraph.cpp.

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

References CellMLToNektar.pycml::level, and m_daughterGraphs.

◆ CutLeaves()

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

Definition at line 252 of file SubStructuredGraph.cpp.

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

References CellMLToNektar.pycml::level, and m_daughterGraphs.

◆ DumpNBndDofs()

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

Definition at line 179 of file SubStructuredGraph.cpp.

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

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

◆ GetBndDofsGraph()

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

Definition at line 175 of file SubStructuredGraph.h.

176  {
177  return m_BndDofs;
178  }

References m_BndDofs.

◆ GetDaughterGraphs()

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

Definition at line 180 of file SubStructuredGraph.h.

181  {
182  return m_daughterGraphs;
183  }

References m_daughterGraphs.

◆ GetNdaughterGraphs()

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

Definition at line 170 of file SubStructuredGraph.h.

171  {
172  return m_daughterGraphs.size();
173  }

References m_daughterGraphs.

◆ GetTotDofs()

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

Definition at line 145 of file SubStructuredGraph.cpp.

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

References m_BndDofs, and m_daughterGraphs.

◆ SetGlobalNumberingOffset()

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

Definition at line 158 of file SubStructuredGraph.cpp.

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

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