Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
Nektar::MultiRegions::MultiLevelBisectedGraph Class Reference

#include <SubStructuredGraph.h>

Public Member Functions

 MultiLevelBisectedGraph (const Array< OneD, const int > sepTree)
 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

Protected Attributes

SubGraphSharedPtr m_BndDofs
MultiLevelBisectedGraphSharedPtr m_leftDaughterGraph
MultiLevelBisectedGraphSharedPtr m_rightDaughterGraph

Detailed Description

Definition at line 153 of file SubStructuredGraph.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph ( const Array< OneD, const int >  sepTree)

Definition at line 88 of file SubStructuredGraph.cpp.

References ErrorUtil::efatal, m_BndDofs, m_leftDaughterGraph, m_rightDaughterGraph, and NEKERROR.

:
{
static int offset = -5;
offset += 5;
int recurLevel = sepTree[offset+0];
int nLeftIntDofs = sepTree[offset+2];
int nRightIntDofs = sepTree[offset+3];
int nBndDofs = sepTree[offset+4];
bool daughtersConstructed[2] = {false,false};
if ((offset + 5) < sepTree.num_elements())
{
while (sepTree[offset+5] > recurLevel)
{
switch (sepTree[offset+6])
{
case 1:
{
m_leftDaughterGraph = MemoryManager<
MultiLevelBisectedGraph>::AllocateSharedPtr(
sepTree);
daughtersConstructed[0] = true;
break;
}
case 2:
{
m_rightDaughterGraph = MemoryManager<
MultiLevelBisectedGraph>::AllocateSharedPtr(
sepTree);
daughtersConstructed[1] = true;
break;
}
default:
{
NEKERROR(ErrorUtil::efatal,"Invalid branch id");
}
}
if ((offset + 5) >= sepTree.num_elements())
{
break;
}
}
}
m_BndDofs = MemoryManager<SubGraph>::AllocateSharedPtr(nBndDofs);
if (!daughtersConstructed[0] && nLeftIntDofs)
{
m_leftDaughterGraph = MemoryManager<
MultiLevelBisectedGraph>::AllocateSharedPtr(nLeftIntDofs);
}
if (!daughtersConstructed[1] && nRightIntDofs)
{
m_rightDaughterGraph = MemoryManager<
MultiLevelBisectedGraph>::AllocateSharedPtr(nRightIntDofs);
}
if (recurLevel == 1)
{
offset = -5;
}
}
Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph ( MultiLevelBisectedGraphSharedPtr  oldLevel,
const int  nPartition 
)

Definition at line 158 of file SubStructuredGraph.cpp.

References m_BndDofs, and m_leftDaughterGraph.

{
m_leftDaughterGraph = oldLevel;
m_BndDofs = MemoryManager<SubGraph>::AllocateSharedPtr(nPartition);
}
Nektar::MultiRegions::MultiLevelBisectedGraph::MultiLevelBisectedGraph ( const int  nBndDofs)

Definition at line 166 of file SubStructuredGraph.cpp.

:
m_BndDofs(MemoryManager<SubGraph>::AllocateSharedPtr(nBndDofs)),
{
}
Nektar::MultiRegions::MultiLevelBisectedGraph::~MultiLevelBisectedGraph ( void  )

Definition at line 173 of file SubStructuredGraph.cpp.

{
}

Member Function Documentation

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

Definition at line 249 of file SubStructuredGraph.cpp.

References m_BndDofs, m_leftDaughterGraph, and m_rightDaughterGraph.

{
int cnt = 0;
{
m_leftDaughterGraph->CollectLeaves(leaves);
cnt++;
}
{
m_rightDaughterGraph->CollectLeaves(leaves);
cnt++;
}
if (cnt == 0)
{
leaves.push_back(leave);
}
}
int Nektar::MultiRegions::MultiLevelBisectedGraph::CutEmptyLeaves ( )

Definition at line 290 of file SubStructuredGraph.cpp.

References m_leftDaughterGraph, and m_rightDaughterGraph.

{
int returnval;
static int level = 0;
static int nLeaves = 0;
level++;
if (level == 1 &&
{
level = 0;
nLeaves = 0;
return 0;
}
{
if (m_leftDaughterGraph->GetNdaughterGraphs() == 0 &&
m_leftDaughterGraph->GetBndDofsGraph()->GetNverts() == 0)
{
nLeaves++;
}
else
{
m_leftDaughterGraph->CutEmptyLeaves();
}
}
{
if (m_rightDaughterGraph->GetNdaughterGraphs() == 0 &&
m_rightDaughterGraph->GetBndDofsGraph()->GetNverts() == 0)
{
nLeaves++;
}
else
{
m_rightDaughterGraph->CutEmptyLeaves();
}
}
returnval = nLeaves;
level--;
if(level == 0)
{
nLeaves = 0;
}
return returnval;
}
int Nektar::MultiRegions::MultiLevelBisectedGraph::CutLeaves ( )

Definition at line 344 of file SubStructuredGraph.cpp.

References m_leftDaughterGraph, and m_rightDaughterGraph.

{
int returnval;
static int level = 0;
static int nLeaves = 0;
level++;
if( (level == 1) &&
(!m_leftDaughterGraph.get()) &&
{
level = 0;
nLeaves = 0;
return 0;
}
{
if(m_leftDaughterGraph->GetNdaughterGraphs() == 0)
{
nLeaves++;
}
else
{
m_leftDaughterGraph->CutLeaves();
}
}
{
if(m_rightDaughterGraph->GetNdaughterGraphs() == 0)
{
nLeaves++;
}
else
{
m_rightDaughterGraph->CutLeaves();
}
}
returnval = nLeaves;
level--;
if(level == 0)
{
nLeaves = 0;
}
return returnval;
}
void Nektar::MultiRegions::MultiLevelBisectedGraph::DumpNBndDofs ( void  ) const

Definition at line 231 of file SubStructuredGraph.cpp.

References m_BndDofs, m_leftDaughterGraph, and m_rightDaughterGraph.

{
static int level = 0;
level++;
cout << "LEVEL " << level << " " << m_BndDofs->GetNverts() << endl;
{
m_leftDaughterGraph->DumpNBndDofs();
}
{
m_rightDaughterGraph->DumpNBndDofs();
}
level--;
}
const SubGraphSharedPtr Nektar::MultiRegions::MultiLevelBisectedGraph::GetBndDofsGraph ( ) const
inline

Definition at line 174 of file SubStructuredGraph.h.

References m_BndDofs.

{
return m_BndDofs;
}
int Nektar::MultiRegions::MultiLevelBisectedGraph::GetNdaughterGraphs ( ) const
inline

Definition at line 273 of file SubStructuredGraph.cpp.

References m_leftDaughterGraph, and m_rightDaughterGraph.

{
int cnt = 0;
{
cnt++;
}
{
cnt++;
}
return cnt;
}
int Nektar::MultiRegions::MultiLevelBisectedGraph::GetTotDofs ( ) const

Definition at line 177 of file SubStructuredGraph.cpp.

References m_BndDofs, m_leftDaughterGraph, and m_rightDaughterGraph.

{
static int nBndDofs = 0;
static int level = 0;
level++;
int returnval;
{
m_leftDaughterGraph->GetTotDofs();
}
{
m_rightDaughterGraph->GetTotDofs();
}
nBndDofs += m_BndDofs->GetNverts();
returnval = nBndDofs;
level--;
if(level == 0)
{
nBndDofs = 0;
}
return returnval;
}
void Nektar::MultiRegions::MultiLevelBisectedGraph::SetGlobalNumberingOffset ( )

Definition at line 206 of file SubStructuredGraph.cpp.

References m_BndDofs, m_leftDaughterGraph, and m_rightDaughterGraph.

{
static int level = 0;
static int offset = 0;
level++;
{
m_leftDaughterGraph->SetGlobalNumberingOffset();
}
{
m_rightDaughterGraph->SetGlobalNumberingOffset();
}
m_BndDofs->SetIdOffset(offset);
offset += m_BndDofs->GetNverts();
level--;
if(level == 0)
{
offset = 0;
}
}

Member Data Documentation

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

Definition at line 180 of file SubStructuredGraph.h.

Referenced by CollectLeaves(), DumpNBndDofs(), GetBndDofsGraph(), GetTotDofs(), MultiLevelBisectedGraph(), and SetGlobalNumberingOffset().

MultiLevelBisectedGraphSharedPtr Nektar::MultiRegions::MultiLevelBisectedGraph::m_leftDaughterGraph
protected

Definition at line 181 of file SubStructuredGraph.h.

Referenced by CollectLeaves(), CutEmptyLeaves(), CutLeaves(), DumpNBndDofs(), GetNdaughterGraphs(), GetTotDofs(), MultiLevelBisectedGraph(), and SetGlobalNumberingOffset().

MultiLevelBisectedGraphSharedPtr Nektar::MultiRegions::MultiLevelBisectedGraph::m_rightDaughterGraph
protected

Definition at line 182 of file SubStructuredGraph.h.

Referenced by CollectLeaves(), CutEmptyLeaves(), CutLeaves(), DumpNBndDofs(), GetNdaughterGraphs(), GetTotDofs(), MultiLevelBisectedGraph(), and SetGlobalNumberingOffset().