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

Constructs 1D-specific mappings for the C0 scalar continuous Galerkin formulation. More...

#include <AssemblyMapCG1D.h>

Inheritance diagram for Nektar::MultiRegions::AssemblyMapCG1D:
Inheritance graph
[legend]
Collaboration diagram for Nektar::MultiRegions::AssemblyMapCG1D:
Collaboration graph
[legend]

Public Member Functions

 AssemblyMapCG1D (const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
 Default constructor.
 AssemblyMapCG1D (const LibUtilities::SessionReaderSharedPtr &pSession, const int numLocalCoeffs, const ExpList &locExp, const Array< OneD, const ExpListSharedPtr > &bndCondExp, const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &bndConditions, const PeriodicMap &periodicVerts, const std::string variable="DefaultVar")
 Constructor for the 1D expansion mappings with boundary conditions.
 AssemblyMapCG1D (const LibUtilities::SessionReaderSharedPtr &pSession, const int numLocalCoeffs, const ExpList &locExp)
 General constructor for expansions of all dimensions without boundary conditions.
virtual ~AssemblyMapCG1D ()
 Destructor.
- Public Member Functions inherited from Nektar::MultiRegions::AssemblyMapCG
 AssemblyMapCG (const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
 Default constructor.
 AssemblyMapCG (const LibUtilities::SessionReaderSharedPtr &pSession, const int numLocalCoeffs, const ExpList &locExp)
 General constructor for expansions of all dimensions without boundary conditions.
virtual ~AssemblyMapCG ()
 Destructor.
map< int, vector< ExtraDirDof > > & GetExtraDirDofs ()
- Public Member Functions inherited from Nektar::MultiRegions::AssemblyMap
 AssemblyMap ()
 Default constructor.
 AssemblyMap (const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
 Constructor with a communicator.
 AssemblyMap (AssemblyMap *oldLevelMap, const BottomUpSubStructuredGraphSharedPtr &multiLevelGraph)
 Constructor for next level in multi-level static condensation.
virtual ~AssemblyMap ()
 Destructor.
LibUtilities::CommSharedPtr GetComm ()
 Retrieves the communicator.
size_t GetHash () const
 Retrieves the hash of this map.
int GetLocalToGlobalMap (const int i) const
int GetGlobalToUniversalMap (const int i) const
int GetGlobalToUniversalMapUnique (const int i) const
const Array< OneD, const int > & GetLocalToGlobalMap ()
const Array< OneD, const int > & GetGlobalToUniversalMap ()
const Array< OneD, const int > & GetGlobalToUniversalMapUnique ()
NekDouble GetLocalToGlobalSign (const int i) const
const Array< OneD, NekDouble > & GetLocalToGlobalSign () const
void LocalToGlobal (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
void LocalToGlobal (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global) const
void GlobalToLocal (const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
void GlobalToLocal (const NekVector< NekDouble > &global, NekVector< NekDouble > &loc) const
void Assemble (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
void Assemble (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global) const
void UniversalAssemble (Array< OneD, NekDouble > &pGlobal) const
void UniversalAssemble (NekVector< NekDouble > &pGlobal) const
void UniversalAssemble (Array< OneD, NekDouble > &pGlobal, int offset) const
int GetLocalToGlobalBndMap (const int i) const
 Retrieve the global index of a given local boundary mode.
const Array< OneD, const int > & GetLocalToGlobalBndMap ()
 Retrieve the global indices of the local boundary modes.
const Array< OneD, const int > & GetGlobalToUniversalBndMap ()
const Array< OneD, const int > & GetGlobalToUniversalBndMapUnique ()
bool GetSignChange ()
 Returns true if using a modal expansion requiring a change of sign of some modes.
NekDouble GetLocalToGlobalBndSign (const int i) const
 Retrieve the sign change of a given local boundary mode.
Array< OneD, const NekDoubleGetLocalToGlobalBndSign () const
 Retrieve the sign change for all local boundary modes.
int GetBndCondCoeffsToGlobalCoeffsMap (const int i)
 Retrieves the global index corresponding to a boundary expansion mode.
const Array< OneD, const int > & GetBndCondCoeffsToGlobalCoeffsMap ()
 Retrieves the global indices corresponding to the boundary expansion modes.
NekDouble GetBndCondCoeffsToGlobalCoeffsSign (const int i)
 Returns the modal sign associated with a given boundary expansion mode.
int GetBndCondTraceToGlobalTraceMap (const int i)
 Returns the global index of the boundary trace giving the index on the boundary expansion.
const Array< OneD, const int > & GetBndCondTraceToGlobalTraceMap ()
int GetNumGlobalDirBndCoeffs () const
 Returns the number of global Dirichlet boundary coefficients.
int GetNumLocalDirBndCoeffs () const
 Returns the number of local Dirichlet boundary coefficients.
int GetNumGlobalBndCoeffs () const
 Returns the total number of global boundary coefficients.
int GetNumLocalBndCoeffs () const
 Returns the total number of local boundary coefficients.
int GetNumLocalCoeffs () const
 Returns the total number of local coefficients.
int GetNumGlobalCoeffs () const
 Returns the total number of global coefficients.
bool GetSingularSystem () const
 Retrieves if the system is singular (true) or not (false)
void GlobalToLocalBnd (const NekVector< NekDouble > &global, NekVector< NekDouble > &loc, int offset) const
void GlobalToLocalBnd (const NekVector< NekDouble > &global, NekVector< NekDouble > &loc) const
void GlobalToLocalBnd (const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc, int offset) const
void GlobalToLocalBnd (const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
void LocalBndToGlobal (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, int offset) const
void LocalBndToGlobal (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global) const
void LocalBndToGlobal (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, int offset) const
void LocalBndToGlobal (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
void AssembleBnd (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, int offset) const
void AssembleBnd (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global) const
void AssembleBnd (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, int offset) const
void AssembleBnd (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
void UniversalAssembleBnd (Array< OneD, NekDouble > &pGlobal) const
void UniversalAssembleBnd (NekVector< NekDouble > &pGlobal) const
void UniversalAssembleBnd (Array< OneD, NekDouble > &pGlobal, int offset) const
int GetFullSystemBandWidth () const
int GetNumNonDirVertexModes () const
int GetNumNonDirEdgeModes () const
int GetNumNonDirFaceModes () const
int GetNumDirEdges () const
int GetNumDirFaces () const
int GetNumNonDirEdges () const
int GetNumNonDirFaces () const
void PrintStats (std::ostream &out, std::string variable) const
const Array< OneD, const int > & GetExtraDirEdges ()
boost::shared_ptr< AssemblyMapLinearSpaceMap (const ExpList &locexp, GlobalSysSolnType solnType)
int GetBndSystemBandWidth () const
 Returns the bandwidth of the boundary system.
int GetStaticCondLevel () const
 Returns the level of static condensation for this map.
int GetNumPatches () const
 Returns the number of patches in this static condensation level.
const Array< OneD, const
unsigned int > & 
GetNumLocalBndCoeffsPerPatch ()
 Returns the number of local boundary coefficients in each patch.
const Array< OneD, const
unsigned int > & 
GetNumLocalIntCoeffsPerPatch ()
 Returns the number of local interior coefficients in each patch.
const AssemblyMapSharedPtr GetNextLevelLocalToGlobalMap () const
 Returns the local to global mapping for the next level in the multi-level static condensation.
void SetNextLevelLocalToGlobalMap (AssemblyMapSharedPtr pNextLevelLocalToGlobalMap)
const PatchMapSharedPtrGetPatchMapFromPrevLevel (void) const
 Returns the patch map from the previous level of the multi-level static condensation.
bool AtLastLevel () const
 Returns true if this is the last level in the multi-level static condensation.
GlobalSysSolnType GetGlobalSysSolnType () const
 Returns the method of solving global systems.
PreconditionerType GetPreconType () const
NekDouble GetIterativeTolerance () const
int GetSuccessiveRHS () const
int GetLowestStaticCondLevel () const

Private Member Functions

void SetUp1DExpansionC0ContMap (const int numLocalCoeffs, const ExpList &locExp, const Array< OneD, const MultiRegions::ExpListSharedPtr > &bndCondExp=NullExpListSharedPtrArray, const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &bndConditions=SpatialDomains::NullBoundaryConditionShPtrArray, const PeriodicMap &periodicVerts=NullPeriodicMap)
 Construct mappings for a one-dimensional scalar expansion.

Additional Inherited Members

- Protected Member Functions inherited from Nektar::MultiRegions::AssemblyMapCG
void SetUpUniversalC0ContMap (const ExpList &locExp, const PeriodicMap &perVerts=NullPeriodicMap, const PeriodicMap &perEdges=NullPeriodicMap, const PeriodicMap &perFaces=NullPeriodicMap)
void CalculateFullSystemBandWidth ()
 Calculate the bandwith of the full matrix system.
virtual int v_GetLocalToGlobalMap (const int i) const
virtual int v_GetGlobalToUniversalMap (const int i) const
virtual int v_GetGlobalToUniversalMapUnique (const int i) const
virtual const Array< OneD,
const int > & 
v_GetLocalToGlobalMap ()
virtual const Array< OneD,
const int > & 
v_GetGlobalToUniversalMap ()
virtual const Array< OneD,
const int > & 
v_GetGlobalToUniversalMapUnique ()
virtual NekDouble v_GetLocalToGlobalSign (const int i) const
virtual const Array< OneD,
NekDouble > & 
v_GetLocalToGlobalSign () const
virtual void v_LocalToGlobal (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
virtual void v_LocalToGlobal (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global) const
virtual void v_GlobalToLocal (const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
virtual void v_GlobalToLocal (const NekVector< NekDouble > &global, NekVector< NekDouble > &loc) const
virtual void v_Assemble (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
virtual void v_Assemble (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global) const
virtual void v_UniversalAssemble (Array< OneD, NekDouble > &pGlobal) const
virtual void v_UniversalAssemble (NekVector< NekDouble > &pGlobal) const
virtual void v_UniversalAssemble (Array< OneD, NekDouble > &pGlobal, int offset) const
virtual int v_GetFullSystemBandWidth () const
virtual int v_GetNumNonDirVertexModes () const
virtual int v_GetNumNonDirEdgeModes () const
virtual int v_GetNumNonDirFaceModes () const
virtual int v_GetNumDirEdges () const
virtual int v_GetNumDirFaces () const
virtual int v_GetNumNonDirEdges () const
virtual int v_GetNumNonDirFaces () const
virtual const Array< OneD,
const int > & 
v_GetExtraDirEdges ()
virtual AssemblyMapSharedPtr v_LinearSpaceMap (const ExpList &locexp, GlobalSysSolnType solnType)
 Construct an AssemblyMapCG object which corresponds to the linear space of the current object.
- Protected Attributes inherited from Nektar::MultiRegions::AssemblyMapCG
Array< OneD, int > m_localToGlobalMap
 Integer map of local coeffs to global space.
Array< OneD, NekDoublem_localToGlobalSign
 Integer sign of local coeffs to global space.
int m_fullSystemBandWidth
 Bandwith of the full matrix system (no static condensation).
Array< OneD, int > m_globalToUniversalMap
 Integer map of process coeffs to universal space.
Array< OneD, int > m_globalToUniversalMapUnique
 Integer map of unique process coeffs to universal space (signed)
int m_numNonDirVertexModes
 Number of non Dirichlet vertex modes.
int m_numNonDirEdgeModes
 Number of non Dirichlet edge modes.
int m_numNonDirFaceModes
 Number of non Dirichlet face modes.
int m_numDirEdges
 Number of Dirichlet edges.
int m_numDirFaces
 Number of Dirichlet faces.
int m_numNonDirEdges
 Number of Dirichlet edges.
int m_numNonDirFaces
 Number of Dirichlet faces.
Array< OneD, int > m_extraDirEdges
 Extra dirichlet edges in parallel.
int m_maxStaticCondLevel
 Maximum static condensation level.
map< int, vector< ExtraDirDof > > m_extraDirDofs
 Map indicating degrees of freedom which are Dirichlet but whose value is stored on another processor.

Detailed Description

Constructs 1D-specific mappings for the C0 scalar continuous Galerkin formulation.

Mappings are created for three possible global solution types:

These mappings are used by GlobalLinSys to generate the global system.

Definition at line 53 of file AssemblyMapCG1D.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::AssemblyMapCG1D::AssemblyMapCG1D ( const LibUtilities::SessionReaderSharedPtr pSession,
const std::string  variable = "DefaultVar" 
)

Default constructor.

Definition at line 65 of file AssemblyMapCG1D.cpp.

:
AssemblyMapCG(pSession,variable)
{
}
Nektar::MultiRegions::AssemblyMapCG1D::AssemblyMapCG1D ( const LibUtilities::SessionReaderSharedPtr pSession,
const int  numLocalCoeffs,
const ExpList locExp,
const Array< OneD, const ExpListSharedPtr > &  bndCondExp,
const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &  bndConditions,
const PeriodicMap periodicVerts,
const std::string  variable = "DefaultVar" 
)

Constructor for the 1D expansion mappings with boundary conditions.

Definition at line 76 of file AssemblyMapCG1D.cpp.

References Nektar::MultiRegions::AssemblyMap::CalculateBndSystemBandWidth(), Nektar::MultiRegions::AssemblyMapCG::CalculateFullSystemBandWidth(), and SetUp1DExpansionC0ContMap().

:
AssemblyMapCG(pSession,variable)
{
SetUp1DExpansionC0ContMap(numLocalCoeffs,
locExp,
bndCondExp,
bndConditions,
periodicVerts);
}
Nektar::MultiRegions::AssemblyMapCG1D::AssemblyMapCG1D ( const LibUtilities::SessionReaderSharedPtr pSession,
const int  numLocalCoeffs,
const ExpList locExp 
)

General constructor for expansions of all dimensions without boundary conditions.

Definition at line 102 of file AssemblyMapCG1D.cpp.

References Nektar::MultiRegions::AssemblyMap::CalculateBndSystemBandWidth(), Nektar::MultiRegions::AssemblyMapCG::CalculateFullSystemBandWidth(), and SetUp1DExpansionC0ContMap().

Nektar::MultiRegions::AssemblyMapCG1D::~AssemblyMapCG1D ( )
virtual

Destructor.

Definition at line 117 of file AssemblyMapCG1D.cpp.

{
}

Member Function Documentation

void Nektar::MultiRegions::AssemblyMapCG1D::SetUp1DExpansionC0ContMap ( const int  numLocalCoeffs,
const ExpList locExp,
const Array< OneD, const MultiRegions::ExpListSharedPtr > &  bndCondExp = NullExpListSharedPtrArray,
const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &  bndConditions = SpatialDomains::NullBoundaryConditionShPtrArray,
const PeriodicMap periodicVerts = NullPeriodicMap 
)
private

Construct mappings for a one-dimensional scalar expansion.

Construction of the local->global map is achieved in several stages. A mesh vertex renumbering is constructed as follows

The boundary condition mapping is generated from the same vertex renumbering.

Definition at line 139 of file AssemblyMapCG1D.cpp.

References ASSERTL0, Nektar::SpatialDomains::eDirichlet, Nektar::MultiRegions::ExpList::GetCoeff_Offset(), Nektar::MultiRegions::ExpList::GetExp(), Nektar::MultiRegions::ExpList::GetOffset_Elmt_Id(), Nektar::MultiRegions::AssemblyMap::m_bndCondCoeffsToGlobalCoeffsMap, Nektar::MultiRegions::AssemblyMap::m_comm, Nektar::MultiRegions::AssemblyMap::m_hash, Nektar::MultiRegions::AssemblyMap::m_localToGlobalBndMap, Nektar::MultiRegions::AssemblyMapCG::m_localToGlobalMap, Nektar::MultiRegions::AssemblyMap::m_numGlobalBndCoeffs, Nektar::MultiRegions::AssemblyMap::m_numGlobalCoeffs, Nektar::MultiRegions::AssemblyMap::m_numGlobalDirBndCoeffs, Nektar::MultiRegions::AssemblyMap::m_numLocalBndCoeffs, Nektar::MultiRegions::AssemblyMap::m_numLocalBndCoeffsPerPatch, Nektar::MultiRegions::AssemblyMap::m_numLocalCoeffs, Nektar::MultiRegions::AssemblyMap::m_numLocalDirBndCoeffs, Nektar::MultiRegions::AssemblyMap::m_numLocalIntCoeffsPerPatch, Nektar::MultiRegions::AssemblyMap::m_numPatches, Nektar::MultiRegions::AssemblyMap::m_signChange, Nektar::MultiRegions::AssemblyMap::m_staticCondLevel, Nektar::LibUtilities::ReduceSum, and Nektar::MultiRegions::AssemblyMapCG::SetUpUniversalC0ContMap().

Referenced by AssemblyMapCG1D().

{
int i,j;
int cnt = 0;
int meshVertId;
int meshVertId2;
int graphVertId = 0;
int globalId;
const LocalRegions::ExpansionVector &locExpVector = *(locExp.GetExp());
int nbnd = bndCondExp.num_elements();
m_signChange = false;
m_numPatches = locExpVector.size();
m_numLocalCoeffs = numLocalCoeffs;
m_numLocalBndCoeffs = 2*locExpVector.size();
m_localToGlobalMap = Array<OneD, int>(m_numLocalCoeffs,-1);
m_bndCondCoeffsToGlobalCoeffsMap = Array<OneD, int>(nbnd);
m_numLocalBndCoeffsPerPatch = Array<OneD, unsigned int>(m_numPatches);
m_numLocalIntCoeffsPerPatch = Array<OneD, unsigned int>(m_numPatches);
for(i = 0; i < m_numPatches; ++i)
{
m_numLocalBndCoeffsPerPatch[i] = (unsigned int) locExpVector[locExp.GetOffset_Elmt_Id(i)]->NumBndryCoeffs();
m_numLocalIntCoeffsPerPatch[i] = (unsigned int) locExpVector[locExp.GetOffset_Elmt_Id(i)]->GetNcoeffs() - locExpVector[locExp.GetOffset_Elmt_Id(i)]->NumBndryCoeffs();
}
// The only unique identifiers of the vertices of the mesh
// are the vertex id (stored in their corresponding
// Geometry object). However, setting up a global
// numbering based on these id's will not lead to a
// suitable or optimal numbering. Mainly because: - we
// want the Dirichlet DOF's to be listed first - we want
// an optimal global numbering of the remaining DOF's
// (strategy still need to be defined but can for example
// be: minimum bandwith or minimum fill-in of the
// resulting global system matrix)
//
// That's why the vertices be rearranged. Currently, this
// is done in the following way: The vertices of the mesh
// are considered as vertices of a graph. (We then will
// use algorithms to reorder these graph-vertices -
// although not implemented yet in 1D).
//
// A container is used to store the graph vertex id's of
// the different mesh vertices. This is implemented as a
// STL map such that the graph vertex id can later be
// retrieved by the unique mesh vertex id's which serve as
// the key of the map.
map<int, int> vertReorderedGraphVertId;
PeriodicMap::const_iterator pIt;
// STEP 1: Order the Dirichlet vertices first
for(i = 0; i < nbnd; i++)
{
ASSERTL0(bndCondExp[i]->GetNumElmts() > 0,
"Boundary expansion contains no expansions.");
if(bndConditions[i]->GetBoundaryConditionType()==SpatialDomains::eDirichlet)
{
meshVertId = bndCondExp[i]->GetExp(0)->GetGeom()->GetVertex(0)->GetVid();
vertReorderedGraphVertId[meshVertId] = graphVertId++;
}
}
// STEP 2: Order the periodic vertices next. This allows to give
// corresponding DOF's the same global ID
for(pIt = periodicVerts.begin(); pIt != periodicVerts.end(); pIt++)
{
meshVertId = pIt->first;
meshVertId2 = pIt->second[0].id;
if (!pIt->second[0].isLocal)
{
if (vertReorderedGraphVertId.count(meshVertId) == 0)
{
vertReorderedGraphVertId[meshVertId] = graphVertId++;
}
}
else
{
if (vertReorderedGraphVertId.count(meshVertId) == 0 &&
vertReorderedGraphVertId.count(meshVertId2) == 0)
{
vertReorderedGraphVertId[meshVertId] = graphVertId;
vertReorderedGraphVertId[meshVertId2] = graphVertId++;
}
else if ((vertReorderedGraphVertId.count(meshVertId) == 0 &&
vertReorderedGraphVertId.count(meshVertId2) != 0) ||
(vertReorderedGraphVertId.count(meshVertId) != 0 &&
vertReorderedGraphVertId.count(meshVertId2) == 0))
{
ASSERTL0(false,
"Numbering error for periodic boundary conditions!");
}
}
}
// STEP 3: List the other vertices
// STEP 4: Set up simple map based on vertex and edge id's
for(i = 0; i < locExpVector.size(); ++i)
{
cnt = locExp.GetCoeff_Offset(i);
if((locSegExp = locExpVector[i]->as<LocalRegions::SegExp>()))
{
for(j = 0; j < locSegExp->GetNverts(); ++j)
{
meshVertId = (locSegExp->GetGeom1D())->GetVid(j);
if(vertReorderedGraphVertId.count(meshVertId) == 0)
{
vertReorderedGraphVertId[meshVertId] = graphVertId++;
}
m_localToGlobalMap[cnt+locSegExp->GetVertexMap(j)] =
vertReorderedGraphVertId[meshVertId];
}
}
else
{
ASSERTL0(false,"dynamic cast to a segment expansion failed");
}
}
// Set up the mapping for the boundary conditions
for(i = 0; i < nbnd; i++)
{
meshVertId = bndCondExp[i]->GetExp(0)->GetGeom()->GetVertex(0)->GetVid();
m_bndCondCoeffsToGlobalCoeffsMap[i] = vertReorderedGraphVertId[meshVertId];
}
// Setup interior mapping and the boundary map
globalId = graphVertId;
cnt=0;
for(i = 0; i < m_numLocalCoeffs; ++i)
{
if(m_localToGlobalMap[i] == -1)
{
m_localToGlobalMap[i] = globalId++;
}
else
{
m_localToGlobalBndMap[cnt++]=m_localToGlobalMap[i];
}
}
m_numGlobalCoeffs = globalId;
m_hash = boost::hash_range(m_localToGlobalMap.begin(), m_localToGlobalMap.end());
// Add up hash values if parallel
int hash = m_hash;
m_comm->AllReduce(hash, LibUtilities::ReduceSum);
m_hash = hash;
}