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

Constructor & Destructor Documentation

◆ MultiLevelBisectedGraph() [1/2]

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

Definition at line 133 of file SubStructuredGraph.cpp.

136  {
137  m_daughterGraphs.push_back(oldLevel);
139  }
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 141 of file SubStructuredGraph.cpp.

141  :
143  {
144  }

◆ ~MultiLevelBisectedGraph()

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

Definition at line 146 of file SubStructuredGraph.cpp.

147  {
148  }

Member Function Documentation

◆ CollectLeaves()

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

Definition at line 198 of file SubStructuredGraph.cpp.

200  {
201  int cnt = 0;
202 
203  for (auto &g : m_daughterGraphs)
204  {
205  g->CollectLeaves(leaves);
206  cnt++;
207  }
208 
209  if (cnt == 0)
210  {
212  leaves.push_back(leave);
213  }
214  }
std::shared_ptr< SubGraph > SubGraphSharedPtr

References m_BndDofs, and m_daughterGraphs.

◆ CutEmptyLeaves()

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

Definition at line 216 of file SubStructuredGraph.cpp.

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

References CellMLToNektar.pycml::level, and m_daughterGraphs.

◆ CutLeaves()

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

Definition at line 257 of file SubStructuredGraph.cpp.

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

References CellMLToNektar.pycml::level, and m_daughterGraphs.

◆ DumpNBndDofs()

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

Definition at line 184 of file SubStructuredGraph.cpp.

185  {
186  static int level = 0;
187  level++;
188  cout << "LEVEL " << level << " " << m_BndDofs->GetNverts() << endl;
189 
190  for (auto &g : m_daughterGraphs)
191  {
192  g->DumpNBndDofs();
193  }
194 
195  level--;
196  }

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

◆ GetBndDofsGraph()

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

Definition at line 184 of file SubStructuredGraph.h.

185  {
186  return m_BndDofs;
187  }

References m_BndDofs.

◆ GetDaughterGraphs()

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

Definition at line 190 of file SubStructuredGraph.h.

191  {
192  return m_daughterGraphs;
193  }

References m_daughterGraphs.

◆ GetNdaughterGraphs()

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

Definition at line 179 of file SubStructuredGraph.h.

180  {
181  return m_daughterGraphs.size();
182  }

References m_daughterGraphs.

◆ GetTotDofs()

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

Definition at line 150 of file SubStructuredGraph.cpp.

151  {
152  int returnval = 0;
153 
154  for (auto &g : m_daughterGraphs)
155  {
156  returnval += g->GetTotDofs();
157  }
158 
159  returnval += m_BndDofs->GetNverts();
160  return returnval;
161  }

References m_BndDofs, and m_daughterGraphs.

◆ SetGlobalNumberingOffset()

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

Definition at line 163 of file SubStructuredGraph.cpp.

164  {
165  static int level = 0;
166  static int offset = 0;
167  level++;
168 
169  for (auto &g : m_daughterGraphs)
170  {
171  g->SetGlobalNumberingOffset();
172  }
173 
174  m_BndDofs->SetIdOffset(offset);
175  offset += m_BndDofs->GetNverts();
176 
177  level--;
178  if(level == 0)
179  {
180  offset = 0;
181  }
182  }

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