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

#include <AssemblyMapDG.h>

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

Public Member Functions

 AssemblyMapDG ()
 Default constructor. More...
 
 AssemblyMapDG (const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &graph1D, const ExpListSharedPtr &trace, const ExpList &locExp, const Array< OneD, const MultiRegions::ExpListSharedPtr > &bndConstraint, const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &bndCond, const PeriodicMap &periodicTrace, const std::string variable="DefaultVar")
 Constructor for trace map for one-dimensional expansion. More...
 
virtual ~AssemblyMapDG ()
 Destructor. More...
 
int GetNumDirichletBndPhys ()
 Return the number of boundary segments on which Dirichlet boundary conditions are imposed. More...
 
Array< OneD,
LocalRegions::ExpansionSharedPtr > & 
GetElmtToTrace (const int i)
 
Array< OneD, Array< OneD,
LocalRegions::ExpansionSharedPtr > > & 
GetElmtToTrace ()
 
int GetTraceToUniversalMap (int i)
 
int GetTraceToUniversalMapUnique (int i)
 
void UniversalTraceAssemble (Array< OneD, NekDouble > &pGlobal) const
 
- Public Member Functions inherited from Nektar::MultiRegions::AssemblyMap
 AssemblyMap ()
 Default constructor. More...
 
 AssemblyMap (const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
 Constructor with a communicator. More...
 
 AssemblyMap (AssemblyMap *oldLevelMap, const BottomUpSubStructuredGraphSharedPtr &multiLevelGraph)
 Constructor for next level in multi-level static condensation. More...
 
virtual ~AssemblyMap ()
 Destructor. More...
 
LibUtilities::CommSharedPtr GetComm ()
 Retrieves the communicator. More...
 
size_t GetHash () const
 Retrieves the hash of this map. More...
 
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, bool useComm=true) const
 
void LocalToGlobal (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, bool useComm=true) 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. More...
 
const Array< OneD, const int > & GetLocalToGlobalBndMap ()
 Retrieve the global indices of the local boundary modes. More...
 
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. More...
 
NekDouble GetLocalToGlobalBndSign (const int i) const
 Retrieve the sign change of a given local boundary mode. More...
 
Array< OneD, const NekDoubleGetLocalToGlobalBndSign () const
 Retrieve the sign change for all local boundary modes. More...
 
int GetBndCondCoeffsToGlobalCoeffsMap (const int i)
 Retrieves the global index corresponding to a boundary expansion mode. More...
 
const Array< OneD, const int > & GetBndCondCoeffsToGlobalCoeffsMap ()
 Retrieves the global indices corresponding to the boundary expansion modes. More...
 
NekDouble GetBndCondCoeffsToGlobalCoeffsSign (const int i)
 Returns the modal sign associated with a given boundary expansion mode. More...
 
int GetBndCondTraceToGlobalTraceMap (const int i)
 Returns the global index of the boundary trace giving the index on the boundary expansion. More...
 
const Array< OneD, const int > & GetBndCondTraceToGlobalTraceMap ()
 
int GetNumGlobalDirBndCoeffs () const
 Returns the number of global Dirichlet boundary coefficients. More...
 
int GetNumLocalDirBndCoeffs () const
 Returns the number of local Dirichlet boundary coefficients. More...
 
int GetNumGlobalBndCoeffs () const
 Returns the total number of global boundary coefficients. More...
 
int GetNumLocalBndCoeffs () const
 Returns the total number of local boundary coefficients. More...
 
int GetNumLocalCoeffs () const
 Returns the total number of local coefficients. More...
 
int GetNumGlobalCoeffs () const
 Returns the total number of global coefficients. More...
 
bool GetSingularSystem () const
 Retrieves if the system is singular (true) or not (false) More...
 
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, bool printHeader=true) 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. More...
 
int GetStaticCondLevel () const
 Returns the level of static condensation for this map. More...
 
int GetNumPatches () const
 Returns the number of patches in this static condensation level. More...
 
const Array< OneD, const
unsigned int > & 
GetNumLocalBndCoeffsPerPatch ()
 Returns the number of local boundary coefficients in each patch. More...
 
const Array< OneD, const
unsigned int > & 
GetNumLocalIntCoeffsPerPatch ()
 Returns the number of local interior coefficients in each patch. More...
 
const AssemblyMapSharedPtr GetNextLevelLocalToGlobalMap () const
 Returns the local to global mapping for the next level in the multi-level static condensation. More...
 
void SetNextLevelLocalToGlobalMap (AssemblyMapSharedPtr pNextLevelLocalToGlobalMap)
 
const PatchMapSharedPtrGetPatchMapFromPrevLevel (void) const
 Returns the patch map from the previous level of the multi-level static condensation. More...
 
bool AtLastLevel () const
 Returns true if this is the last level in the multi-level static condensation. More...
 
GlobalSysSolnType GetGlobalSysSolnType () const
 Returns the method of solving global systems. More...
 
PreconditionerType GetPreconType () const
 
NekDouble GetIterativeTolerance () const
 
int GetMaxIterations () const
 
int GetSuccessiveRHS () const
 
int GetLowestStaticCondLevel () const
 

Protected Member Functions

void SetUpUniversalDGMap (const ExpList &locExp)
 
void SetUpUniversalTraceMap (const ExpList &locExp, const ExpListSharedPtr trace, const PeriodicMap &perMap=NullPeriodicMap)
 
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 void v_LocalToGlobal (const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm) const
 
virtual void v_LocalToGlobal (const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, bool useComm) 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 int v_GetFullSystemBandWidth () const
 
void RealignTraceElement (Array< OneD, int > &toAlign, StdRegions::Orientation orient, int nquad1, int nquad2=0)
 
- Protected Member Functions inherited from Nektar::MultiRegions::AssemblyMap
void CalculateBndSystemBandWidth ()
 Calculates the bandwidth of the boundary system. More...
 
void GlobalToLocalBndWithoutSign (const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc)
 

Protected Attributes

Gs::gs_datam_traceGsh
 
int m_numDirichletBndPhys
 Number of physical dirichlet boundary values in trace. More...
 
Array< OneD, Array< OneD,
LocalRegions::ExpansionSharedPtr > > 
m_elmtToTrace
 list of edge expansions for a given element More...
 
Array< OneD, int > m_traceToUniversalMap
 Integer map of process trace space quadrature points to universal space. More...
 
Array< OneD, int > m_traceToUniversalMapUnique
 Integer map of unique process trace space quadrature points to universal space (signed). More...
 
- Protected Attributes inherited from Nektar::MultiRegions::AssemblyMap
LibUtilities::SessionReaderSharedPtr m_session
 Session object. More...
 
LibUtilities::CommSharedPtr m_comm
 Communicator. More...
 
size_t m_hash
 Hash for map. More...
 
int m_numLocalBndCoeffs
 Number of local boundary coefficients. More...
 
int m_numGlobalBndCoeffs
 Total number of global boundary coefficients. More...
 
int m_numLocalDirBndCoeffs
 Number of Local Dirichlet Boundary Coefficients. More...
 
int m_numGlobalDirBndCoeffs
 Number of Global Dirichlet Boundary Coefficients. More...
 
bool m_systemSingular
 Flag indicating if the system is singular or not. More...
 
int m_numLocalCoeffs
 Total number of local coefficients. More...
 
int m_numGlobalCoeffs
 Total number of global coefficients. More...
 
bool m_signChange
 Flag indicating if modes require sign reversal. More...
 
Array< OneD, int > m_localToGlobalBndMap
 Integer map of local boundary coeffs to global space. More...
 
Array< OneD, NekDoublem_localToGlobalBndSign
 Integer sign of local boundary coeffs to global space. More...
 
Array< OneD, int > m_bndCondCoeffsToGlobalCoeffsMap
 Integer map of bnd cond coeffs to global coefficients. More...
 
Array< OneD, NekDoublem_bndCondCoeffsToGlobalCoeffsSign
 Integer map of bnd cond coeffs to global coefficients. More...
 
Array< OneD, int > m_bndCondTraceToGlobalTraceMap
 Integer map of bnd cond trace number to global trace number. More...
 
Array< OneD, int > m_globalToUniversalBndMap
 Integer map of process coeffs to universal space. More...
 
Array< OneD, int > m_globalToUniversalBndMapUnique
 Integer map of unique process coeffs to universal space (signed) More...
 
GlobalSysSolnType m_solnType
 The solution type of the global system. More...
 
int m_bndSystemBandWidth
 The bandwith of the global bnd system. More...
 
PreconditionerType m_preconType
 Type type of preconditioner to use in iterative solver. More...
 
int m_maxIterations
 Maximum iterations for iterative solver. More...
 
NekDouble m_iterativeTolerance
 Tolerance for iterative solver. More...
 
int m_successiveRHS
 sucessive RHS for iterative solver More...
 
Gs::gs_datam_gsh
 
Gs::gs_datam_bndGsh
 
int m_staticCondLevel
 The level of recursion in the case of multi-level static condensation. More...
 
int m_numPatches
 The number of patches (~elements) in the current level. More...
 
Array< OneD, unsigned int > m_numLocalBndCoeffsPerPatch
 The number of bnd dofs per patch. More...
 
Array< OneD, unsigned int > m_numLocalIntCoeffsPerPatch
 The number of int dofs per patch. More...
 
AssemblyMapSharedPtr m_nextLevelLocalToGlobalMap
 Map from the patches of the previous level to the patches of the current level. More...
 
int m_lowestStaticCondLevel
 Lowest static condensation level. More...
 

Detailed Description

Definition at line 53 of file AssemblyMapDG.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::AssemblyMapDG::AssemblyMapDG ( )

Default constructor.

Definition at line 61 of file AssemblyMapDG.cpp.

61  :
63  {
64  }
int m_numDirichletBndPhys
Number of physical dirichlet boundary values in trace.
Definition: AssemblyMapDG.h:97
Nektar::MultiRegions::AssemblyMapDG::AssemblyMapDG ( const LibUtilities::SessionReaderSharedPtr pSession,
const SpatialDomains::MeshGraphSharedPtr graph1D,
const ExpListSharedPtr trace,
const ExpList locExp,
const Array< OneD, const MultiRegions::ExpListSharedPtr > &  bndConstraint,
const Array< OneD, const SpatialDomains::BoundaryConditionShPtr > &  bndCond,
const PeriodicMap periodicTrace,
const std::string  variable = "DefaultVar" 
)

Constructor for trace map for one-dimensional expansion.

Definition at line 70 of file AssemblyMapDG.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ASSERTL2, Nektar::MultiRegions::AssemblyMap::CalculateBndSystemBandWidth(), Nektar::MultiRegions::CuthillMckeeReordering(), Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::MultiRegions::eDirectFullMatrix, Nektar::MultiRegions::eDirectMultiLevelStaticCond, Nektar::MultiRegions::eDirectStaticCond, Nektar::SpatialDomains::eDirichlet, Nektar::StdRegions::eForwards, Nektar::LibUtilities::eGauss_Lagrange, Nektar::LibUtilities::eGLL_Lagrange, Nektar::MultiRegions::eIterativeFull, Nektar::MultiRegions::eIterativeMultiLevelStaticCond, Nektar::MultiRegions::eIterativeStaticCond, Nektar::LibUtilities::eModified_A, Nektar::MultiRegions::ePETScFullMatrix, Nektar::MultiRegions::ePETScMultiLevelStaticCond, Nektar::MultiRegions::ePETScStaticCond, Nektar::MultiRegions::eXxtFullMatrix, Nektar::MultiRegions::eXxtMultiLevelStaticCond, Nektar::MultiRegions::eXxtStaticCond, Nektar::MultiRegions::ExpList::GetExp(), Nektar::MultiRegions::ExpList::GetOffset_Elmt_Id(), Nektar::MultiRegions::AssemblyMap::m_bndCondCoeffsToGlobalCoeffsMap, Nektar::MultiRegions::AssemblyMap::m_bndCondTraceToGlobalTraceMap, m_elmtToTrace, Nektar::MultiRegions::AssemblyMap::m_hash, Nektar::MultiRegions::AssemblyMap::m_localToGlobalBndMap, Nektar::MultiRegions::AssemblyMap::m_localToGlobalBndSign, Nektar::MultiRegions::AssemblyMap::m_lowestStaticCondLevel, Nektar::MultiRegions::AssemblyMap::m_nextLevelLocalToGlobalMap, m_numDirichletBndPhys, 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_solnType, Nektar::MultiRegions::AssemblyMap::m_staticCondLevel, Nektar::MultiRegions::MultiLevelBisectionReordering(), Nektar::MultiRegions::NoReordering(), SetUpUniversalDGMap(), and SetUpUniversalTraceMap().

78  :
79  AssemblyMap(pSession,variable)
80  {
81  int i, j, k, cnt, eid, id, id1, gid;
82  int order_e = 0;
83  int nTraceExp = trace->GetExpSize();
84  int nbnd = bndCondExp.num_elements();
85 
89 
90  const LocalRegions::ExpansionVector expList = *(locExp.GetExp());
91  int nel = expList.size();
92 
93  map<int, int> meshTraceId;
94 
95  m_signChange = true;
96 
97  // determine mapping from geometry edges to trace
98  for(i = 0; i < nTraceExp; ++i)
99  {
100  meshTraceId[trace->GetExp(i)->GetGeom()->GetGlobalID()] = i;
101  }
102 
103  // Count total number of trace elements
104  cnt = 0;
105  for(i = 0; i < nel; ++i)
106  {
107  cnt += expList[i]->GetNtrace();
108  }
109 
110  Array<OneD, LocalRegions::ExpansionSharedPtr> tracemap(cnt);
111  m_elmtToTrace = Array<
112  OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> >(nel);
113 
114  // set up trace expansions links;
115  for(cnt = i = 0; i < nel; ++i)
116  {
117  m_elmtToTrace[i] = tracemap + cnt;
118 
119  for(j = 0; j < expList[i]->GetNtrace(); ++j)
120  {
121  id = expList[i]->GetGeom()->GetTid(j);
122 
123  if(meshTraceId.count(id) > 0)
124  {
125  m_elmtToTrace[i][j] =
126  trace->GetExp(meshTraceId.find(id)->second);
127  }
128  else
129  {
130  ASSERTL0(false, "Failed to find trace map");
131  }
132  }
133 
134  cnt += expList[i]->GetNtrace();
135  }
136 
137  // Set up boundary mapping
138  cnt = 0;
139  for(i = 0; i < nbnd; ++i)
140  {
141  cnt += bndCondExp[i]->GetExpSize();
142  }
143 
144  set<int> dirTrace;
145 
148 
149  cnt = 0;
150  for(i = 0; i < bndCondExp.num_elements(); ++i)
151  {
152  for(j = 0; j < bndCondExp[i]->GetExpSize(); ++j)
153  {
154  bndExp = bndCondExp[i]->GetExp(j);
155  traceGeom = bndExp->GetGeom();
156  id = traceGeom->GetGlobalID();
157 
158  if(bndCond[i]->GetBoundaryConditionType() ==
160  {
161  m_numLocalDirBndCoeffs += bndExp->GetNcoeffs();
162  m_numDirichletBndPhys += bndExp->GetTotPoints();
163  dirTrace.insert(id);
164  }
165  }
166 
167  cnt += j;
168  }
169 
170  // Set up integer mapping array and sign change for each degree of
171  // freedom + initialise some more data members.
172  m_staticCondLevel = 0;
174  m_numPatches = nel;
175  m_numLocalBndCoeffsPerPatch = Array<OneD, unsigned int>(nel);
176  m_numLocalIntCoeffsPerPatch = Array<OneD, unsigned int>(nel);
177 
178  int nbndry = 0;
179  for(i = 0; i < nel; ++i) // count number of elements in array
180  {
181  eid = locExp.GetOffset_Elmt_Id(i);
182  nbndry += expList[eid]->NumDGBndryCoeffs();
183  m_numLocalIntCoeffsPerPatch[i] = 0;
185  (unsigned int) expList[eid]->NumDGBndryCoeffs();
186  }
187 
189  m_numLocalBndCoeffs = nbndry;
190  m_numLocalCoeffs = nbndry;
191  m_localToGlobalBndMap = Array<OneD, int> (nbndry);
192  m_localToGlobalBndSign = Array<OneD, NekDouble> (nbndry,1);
193 
194  // Set up array for potential mesh optimsation
195  Array<OneD,int> traceElmtGid(nTraceExp, -1);
196  int nDir = 0;
197  cnt = 0;
198 
199  // We are now going to construct a graph of the mesh which can be
200  // reordered depending on the type of solver we would like to use.
201  typedef boost::adjacency_list<
202  boost::setS, boost::vecS, boost::undirectedS> BoostGraph;
203 
204  BoostGraph boostGraphObj;
205  int trace_id, trace_id1;
206  int dirOffset = 0;
207 
208  // make trace trace renumbering map where first solved trace starts
209  // at 0 so we can set up graph.
210  for(i = 0; i < nTraceExp; ++i)
211  {
212  id = trace->GetExp(i)->GetGeom()->GetGlobalID();
213 
214  if (dirTrace.count(id) == 0)
215  {
216  // Initial put in element ordering (starting from zero) into
217  // traceElmtGid
218  boost::add_vertex(boostGraphObj);
219  traceElmtGid[i] = cnt++;
220  }
221  else
222  {
223  // Use existing offset for Dirichlet edges
224  traceElmtGid[i] = dirOffset;
225  dirOffset += trace->GetExp(i)->GetNcoeffs();
226  nDir++;
227  }
228  }
229 
230  // Set up boost Graph
231  for(i = 0; i < nel; ++i)
232  {
233  eid = locExp.GetOffset_Elmt_Id(i);
234 
235  for(j = 0; j < expList[eid]->GetNtrace(); ++j)
236  {
237  // Add trace to boost graph for non-Dirichlet Boundary
238  traceGeom = m_elmtToTrace[eid][j]->GetGeom();
239  id = traceGeom->GetGlobalID();
240  trace_id = meshTraceId.find(id)->second;
241 
242  if(dirTrace.count(id) == 0)
243  {
244  for(k = j+1; k < expList[eid]->GetNtrace(); ++k)
245  {
246  traceGeom = m_elmtToTrace[eid][k]->GetGeom();
247  id1 = traceGeom->GetGlobalID();
248  trace_id1 = meshTraceId.find(id1)->second;
249 
250  if(dirTrace.count(id1) == 0)
251  {
252  boost::add_edge((size_t)traceElmtGid[trace_id],
253  (size_t)traceElmtGid[trace_id1],
254  boostGraphObj);
255  }
256  }
257  }
258  }
259  }
260 
261  int nGraphVerts = nTraceExp - nDir;
262  Array<OneD, int> perm (nGraphVerts);
263  Array<OneD, int> iperm(nGraphVerts);
264  Array<OneD, int> vwgts(nGraphVerts);
266 
267  for(i = 0; i < nGraphVerts; ++i)
268  {
269  vwgts[i] = trace->GetExp(i+nDir)->GetNcoeffs();
270  }
271 
272  if(nGraphVerts)
273  {
274  switch(m_solnType)
275  {
276  case eDirectFullMatrix:
277  case eIterativeFull:
279  case eXxtFullMatrix:
280  case eXxtStaticCond:
281  case ePETScFullMatrix:
282  case ePETScStaticCond:
283  {
284  NoReordering(boostGraphObj,perm,iperm);
285  break;
286  }
287  case eDirectStaticCond:
288  {
289  CuthillMckeeReordering(boostGraphObj,perm,iperm);
290  break;
291  }
296  {
297  MultiLevelBisectionReordering(boostGraphObj,perm,iperm,
298  bottomUpGraph);
299  break;
300  }
301  default:
302  {
303  ASSERTL0(false,"Unrecognised solution type");
304  }
305  }
306  }
307 
308  // Recast the permutation so that it can be used as a map from old
309  // trace ID to new trace ID
311  for(i = 0; i < nTraceExp - nDir; ++i)
312  {
313  traceElmtGid[perm[i]+nDir] = cnt;
314  cnt += trace->GetExp(perm[i]+nDir)->GetNcoeffs();
315  }
316 
317  // Now have trace edges Gid position
318 
319  cnt = 0;
320  for(i = 0; i < nel; ++i)
321  {
322  // order list according to m_offset_elmt_id details in expList
323  eid = locExp.GetOffset_Elmt_Id(i);
324  exp = expList[eid];
325 
326  for(j = 0; j < exp->GetNtrace(); ++j)
327  {
328  traceGeom = m_elmtToTrace[eid][j]->GetGeom();
329  id = traceGeom->GetGlobalID();
330  gid = traceElmtGid[meshTraceId.find(id)->second];
331 
332  const int nDim = expList[eid]->GetNumBases();
333 
334  if (nDim == 1)
335  {
336  order_e = 1;
337  m_localToGlobalBndMap[cnt] = gid;
338  }
339  else if (nDim == 2)
340  {
341  order_e = expList[eid]->GetEdgeNcoeffs(j);
342 
343  if(expList[eid]->GetEorient(j) == StdRegions::eForwards)
344  {
345  for(k = 0; k < order_e; ++k)
346  {
347  m_localToGlobalBndMap[k+cnt] = gid + k;
348  }
349  }
350  else
351  {
352  switch(m_elmtToTrace[eid][j]->GetBasisType(0))
353  {
355  {
356  // reverse vertex order
357  m_localToGlobalBndMap[cnt] = gid + 1;
358  m_localToGlobalBndMap[cnt+1] = gid;
359  for (k = 2; k < order_e; ++k)
360  {
361  m_localToGlobalBndMap[k+cnt] = gid + k;
362  }
363 
364  // negate odd modes
365  for(k = 3; k < order_e; k+=2)
366  {
367  m_localToGlobalBndSign[cnt+k] = -1.0;
368  }
369  break;
370  }
372  {
373  // reverse order
374  for(k = 0; k < order_e; ++k)
375  {
376  m_localToGlobalBndMap[cnt+order_e-k-1] = gid + k;
377  }
378  break;
379  }
381  {
382  // reverse order
383  for(k = 0; k < order_e; ++k)
384  {
385  m_localToGlobalBndMap[cnt+order_e-k-1] = gid + k;
386  }
387  break;
388  }
389  default:
390  {
391  ASSERTL0(false,"Boundary type not permitted");
392  }
393  }
394  }
395  }
396  else if (nDim == 3)
397  {
398  order_e = expList[eid]->GetFaceNcoeffs(j);
399 
400  std::map<int, int> orientMap;
401 
402  Array<OneD, unsigned int> elmMap1 (order_e);
403  Array<OneD, int> elmSign1(order_e);
404  Array<OneD, unsigned int> elmMap2 (order_e);
405  Array<OneD, int> elmSign2(order_e);
406 
407  StdRegions::Orientation fo = expList[eid]->GetForient(j);
408 
409  // Construct mapping which will permute global IDs
410  // according to face orientations.
411  expList[eid]->GetFaceToElementMap(j,fo,elmMap1,elmSign1);
412  expList[eid]->GetFaceToElementMap(
413  j,StdRegions::eDir1FwdDir1_Dir2FwdDir2,elmMap2,elmSign2);
414 
415  for (k = 0; k < elmMap1.num_elements(); ++k)
416  {
417  // Find the elemental co-efficient in the original
418  // mapping.
419  int idx = -1;
420  for (int l = 0; l < elmMap2.num_elements(); ++l)
421  {
422  if (elmMap1[k] == elmMap2[l])
423  {
424  idx = l;
425  break;
426  }
427  }
428 
429  ASSERTL2(idx != -1, "Problem with face to element map!");
430  orientMap[k] = idx;
431  }
432 
433  for(k = 0; k < order_e; ++k)
434  {
435  m_localToGlobalBndMap [k+cnt] = gid + orientMap[k];
436  m_localToGlobalBndSign[k+cnt] = elmSign2[orientMap[k]];
437  }
438  }
439 
440  cnt += order_e;
441  }
442  }
443 
444  // set up m_bndCondCoeffsToGlobalCoeffsMap to align with map
445  cnt = 0;
446  for(i = 0; i < nbnd; ++i)
447  {
448  cnt += bndCondExp[i]->GetNcoeffs();
449  }
450 
451  m_bndCondCoeffsToGlobalCoeffsMap = Array<OneD, int>(cnt);
452 
453  // Number of boundary expansions
454  int nbndexp = 0, bndOffset, bndTotal = 0;
455  for(cnt = i = 0; i < nbnd; ++i)
456  {
457  for(j = 0; j < bndCondExp[i]->GetExpSize(); ++j)
458  {
459  bndExp = bndCondExp[i]->GetExp(j);
460  id = bndExp->GetGeom()->GetGlobalID();
461  gid = traceElmtGid[meshTraceId.find(id)->second];
462  bndOffset = bndCondExp[i]->GetCoeff_Offset(j) + bndTotal;
463 
464  // Since boundary information is defined to be aligned with
465  // the geometry just use forward/forward (both coordinate
466  // directions) defintiion for gid's
467  for(k = 0; k < bndExp->GetNcoeffs(); ++k)
468  {
469  m_bndCondCoeffsToGlobalCoeffsMap[bndOffset+k] = gid + k;
470  }
471  }
472 
473  nbndexp += bndCondExp[i]->GetExpSize();
474  bndTotal += bndCondExp[i]->GetNcoeffs();
475  }
476 
477  m_numGlobalBndCoeffs = trace->GetNcoeffs();
479 
481 
486  && nGraphVerts)
487  {
488  if (m_staticCondLevel < (bottomUpGraph->GetNlevels()-1))
489  {
490  Array<OneD, int> vwgts_perm(nGraphVerts);
491 
492  for(int i = 0; i < nGraphVerts; i++)
493  {
494  vwgts_perm[i] = vwgts[perm[i]];
495  }
496 
497  bottomUpGraph->ExpandGraphWithVertexWeights(vwgts_perm);
499  AllocateSharedPtr(this, bottomUpGraph);
500  }
501  }
502 
503  cnt = 0;
504  m_bndCondTraceToGlobalTraceMap = Array<OneD, int>(nbndexp);
505  for(i = 0; i < bndCondExp.num_elements(); ++i)
506  {
507  for(j = 0; j < bndCondExp[i]->GetExpSize(); ++j)
508  {
509  bndExp = bndCondExp[i]->GetExp(j);
510  traceGeom = bndExp->GetGeom();
511  id = traceGeom->GetGlobalID();
513  meshTraceId.find(id)->second;
514  }
515  }
516 
517  // Now set up mapping from global coefficients to universal.
518  ExpListSharedPtr tr = boost::dynamic_pointer_cast<ExpList>(trace);
519  SetUpUniversalDGMap (locExp);
520  SetUpUniversalTraceMap(locExp, tr, periodicTrace);
521 
522  m_hash = boost::hash_range(m_localToGlobalBndMap.begin(),
523  m_localToGlobalBndMap.end());
524  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
bool m_signChange
Flag indicating if modes require sign reversal.
Definition: AssemblyMap.h:347
int m_numGlobalBndCoeffs
Total number of global boundary coefficients.
Definition: AssemblyMap.h:316
void MultiLevelBisectionReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm, BottomUpSubStructuredGraphSharedPtr &substructgraph, std::set< int > partVerts, int mdswitch)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Array< OneD, int > m_bndCondTraceToGlobalTraceMap
Integer map of bnd cond trace number to global trace number.
Definition: AssemblyMap.h:358
Principle Modified Functions .
Definition: BasisType.h:49
boost::shared_ptr< BottomUpSubStructuredGraph > BottomUpSubStructuredGraphSharedPtr
Lagrange Polynomials using the Gauss points .
Definition: BasisType.h:54
int m_numLocalCoeffs
Total number of local coefficients.
Definition: AssemblyMap.h:333
void CuthillMckeeReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm)
std::vector< ExpansionSharedPtr > ExpansionVector
Definition: Expansion.h:70
AssemblyMapSharedPtr m_nextLevelLocalToGlobalMap
Map from the patches of the previous level to the patches of the current level.
Definition: AssemblyMap.h:397
size_t m_hash
Hash for map.
Definition: AssemblyMap.h:311
void SetUpUniversalTraceMap(const ExpList &locExp, const ExpListSharedPtr trace, const PeriodicMap &perMap=NullPeriodicMap)
Array< OneD, unsigned int > m_numLocalBndCoeffsPerPatch
The number of bnd dofs per patch.
Definition: AssemblyMap.h:390
GlobalSysSolnType m_solnType
The solution type of the global system.
Definition: AssemblyMap.h:365
int m_numGlobalDirBndCoeffs
Number of Global Dirichlet Boundary Coefficients.
Definition: AssemblyMap.h:320
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void SetUpUniversalDGMap(const ExpList &locExp)
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
Array< OneD, unsigned int > m_numLocalIntCoeffsPerPatch
The number of int dofs per patch.
Definition: AssemblyMap.h:392
int m_lowestStaticCondLevel
Lowest static condensation level.
Definition: AssemblyMap.h:399
void CalculateBndSystemBandWidth()
Calculates the bandwidth of the boundary system.
Array< OneD, int > m_localToGlobalBndMap
Integer map of local boundary coeffs to global space.
Definition: AssemblyMap.h:350
int m_numLocalDirBndCoeffs
Number of Local Dirichlet Boundary Coefficients.
Definition: AssemblyMap.h:318
Array< OneD, int > m_bndCondCoeffsToGlobalCoeffsMap
Integer map of bnd cond coeffs to global coefficients.
Definition: AssemblyMap.h:354
int m_numLocalBndCoeffs
Number of local boundary coefficients.
Definition: AssemblyMap.h:314
int m_staticCondLevel
The level of recursion in the case of multi-level static condensation.
Definition: AssemblyMap.h:386
Array< OneD, NekDouble > m_localToGlobalBndSign
Integer sign of local boundary coeffs to global space.
Definition: AssemblyMap.h:352
AssemblyMap()
Default constructor.
Definition: AssemblyMap.cpp:79
Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > m_elmtToTrace
list of edge expansions for a given element
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
int m_numGlobalCoeffs
Total number of global coefficients.
Definition: AssemblyMap.h:344
Lagrange for SEM basis .
Definition: BasisType.h:53
boost::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53
int m_numPatches
The number of patches (~elements) in the current level.
Definition: AssemblyMap.h:388
void NoReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm)
int m_numDirichletBndPhys
Number of physical dirichlet boundary values in trace.
Definition: AssemblyMapDG.h:97
Nektar::MultiRegions::AssemblyMapDG::~AssemblyMapDG ( )
virtual

Destructor.

Definition at line 66 of file AssemblyMapDG.cpp.

67  {
68  }

Member Function Documentation

Array< OneD, LocalRegions::ExpansionSharedPtr > & Nektar::MultiRegions::AssemblyMapDG::GetElmtToTrace ( const int  i)

Definition at line 1038 of file AssemblyMapDG.cpp.

References ASSERTL1, and m_elmtToTrace.

1039  {
1040  ASSERTL1(i >= 0 && i < m_elmtToTrace.num_elements(),
1041  "i is out of range");
1042  return m_elmtToTrace[i];
1043  }
Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > m_elmtToTrace
list of edge expansions for a given element
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > & Nektar::MultiRegions::AssemblyMapDG::GetElmtToTrace ( )

Definition at line 1046 of file AssemblyMapDG.cpp.

References m_elmtToTrace.

1047  {
1048  return m_elmtToTrace;
1049  }
Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > m_elmtToTrace
list of edge expansions for a given element
int Nektar::MultiRegions::AssemblyMapDG::GetNumDirichletBndPhys ( )

Return the number of boundary segments on which Dirichlet boundary conditions are imposed.

Definition at line 1032 of file AssemblyMapDG.cpp.

References m_numDirichletBndPhys.

1033  {
1034  return m_numDirichletBndPhys;
1035  }
int m_numDirichletBndPhys
Number of physical dirichlet boundary values in trace.
Definition: AssemblyMapDG.h:97
int Nektar::MultiRegions::AssemblyMapDG::GetTraceToUniversalMap ( int  i)

Definition at line 1022 of file AssemblyMapDG.cpp.

References m_traceToUniversalMap.

1023  {
1024  return m_traceToUniversalMap[i];
1025  }
Array< OneD, int > m_traceToUniversalMap
Integer map of process trace space quadrature points to universal space.
int Nektar::MultiRegions::AssemblyMapDG::GetTraceToUniversalMapUnique ( int  i)

Definition at line 1027 of file AssemblyMapDG.cpp.

References m_traceToUniversalMapUnique.

1028  {
1029  return m_traceToUniversalMapUnique[i];
1030  }
Array< OneD, int > m_traceToUniversalMapUnique
Integer map of unique process trace space quadrature points to universal space (signed).
void Nektar::MultiRegions::AssemblyMapDG::RealignTraceElement ( Array< OneD, int > &  toAlign,
StdRegions::Orientation  orient,
int  nquad1,
int  nquad2 = 0 
)
protected

Definition at line 839 of file AssemblyMapDG.cpp.

References ASSERTL1, Nektar::StdRegions::eBackwards, Nektar::StdRegions::eDir1BwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1BwdDir1_Dir2FwdDir2, Nektar::StdRegions::eDir1BwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1BwdDir2_Dir2FwdDir1, Nektar::StdRegions::eDir1FwdDir1_Dir2BwdDir2, Nektar::StdRegions::eDir1FwdDir2_Dir2BwdDir1, Nektar::StdRegions::eDir1FwdDir2_Dir2FwdDir1, Nektar::StdRegions::eForwards, and Vmath::Vcopy().

Referenced by SetUpUniversalTraceMap().

844  {
845  if (orient == StdRegions::eBackwards)
846  {
847  ASSERTL1(nquad2 == 0, "nquad2 != 0 for reorienation");
848  for (int i = 0; i < nquad1/2; ++i)
849  {
850  swap(toAlign[i], toAlign[nquad1-1-i]);
851  }
852  }
853  else if (orient != StdRegions::eForwards)
854  {
855  ASSERTL1(nquad2 != 0, "nquad2 == 0 for reorienation");
856 
857  Array<OneD, int> tmp(nquad1*nquad2);
858 
859  // Copy transpose.
860  if (orient == StdRegions::eDir1FwdDir2_Dir2FwdDir1 ||
864  {
865  for (int i = 0; i < nquad2; ++i)
866  {
867  for (int j = 0; j < nquad1; ++j)
868  {
869  tmp[i*nquad1 + j] = toAlign[j*nquad2 + i];
870  }
871  }
872  }
873  else
874  {
875  for (int i = 0; i < nquad2; ++i)
876  {
877  for (int j = 0; j < nquad1; ++j)
878  {
879  tmp[i*nquad1 + j] = toAlign[i*nquad1 + j];
880  }
881  }
882  }
883 
884  if (orient == StdRegions::eDir1BwdDir1_Dir2FwdDir2 ||
888  {
889  // Reverse x direction
890  for (int i = 0; i < nquad2; ++i)
891  {
892  for (int j = 0; j < nquad1/2; ++j)
893  {
894  swap(tmp[i*nquad1 + j],
895  tmp[i*nquad1 + nquad1-j-1]);
896  }
897  }
898  }
899 
900  if (orient == StdRegions::eDir1FwdDir1_Dir2BwdDir2 ||
904  {
905  // Reverse y direction
906  for (int j = 0; j < nquad1; ++j)
907  {
908  for (int i = 0; i < nquad2/2; ++i)
909  {
910  swap(tmp[i*nquad1 + j],
911  tmp[(nquad2-i-1)*nquad1 + j]);
912  }
913  }
914  }
915  Vmath::Vcopy(nquad1*nquad2, tmp, 1, toAlign, 1);
916  }
917  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:228
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
void Nektar::MultiRegions::AssemblyMapDG::SetUpUniversalDGMap ( const ExpList locExp)
protected

Constructs a mapping between the process-local global numbering and a universal numbering of the trace space expansion. The universal numbering is defined by the mesh edge IDs to enforce consistency across processes.

Parameters
locExpList of local elemental expansions.

Definition at line 534 of file AssemblyMapDG.cpp.

References ASSERTL2, Nektar::StdRegions::eDir1FwdDir1_Dir2FwdDir2, Nektar::StdRegions::eForwards, Nektar::MultiRegions::ExpList::GetExp(), Nektar::LocalRegions::PointExp::GetGeom(), Nektar::LocalRegions::Expansion1D::GetGeom1D(), Nektar::LocalRegions::Expansion2D::GetGeom2D(), Nektar::MultiRegions::ExpList::GetOffset_Elmt_Id(), Gs::Init(), Nektar::MultiRegions::AssemblyMap::m_bndGsh, Nektar::MultiRegions::AssemblyMap::m_comm, m_elmtToTrace, Nektar::MultiRegions::AssemblyMap::m_globalToUniversalBndMap, Nektar::MultiRegions::AssemblyMap::m_globalToUniversalBndMapUnique, Nektar::MultiRegions::AssemblyMap::m_gsh, Nektar::MultiRegions::AssemblyMap::m_localToGlobalBndMap, Nektar::MultiRegions::AssemblyMap::m_numGlobalBndCoeffs, Nektar::LibUtilities::ReduceMax, and Gs::Unique().

Referenced by AssemblyMapDG().

535  {
537  int eid = 0;
538  int cnt = 0;
539  int id = 0;
540  int order_e = 0;
541  int vGlobalId = 0;
542  int maxDof = 0;
543  int dof = 0;
544  int nDim = 0;
545  int i,j,k;
546 
547  const LocalRegions::ExpansionVector &locExpVector = *(locExp.GetExp());
548 
549  // Initialise the global to universal maps.
552 
553  // Loop over all the elements in the domain and compute max
554  // DOF. Reduce across all processes to get universal maximum.
555  for(i = 0; i < locExpVector.size(); ++i)
556  {
557  locExpansion = locExpVector[i];
558  nDim = locExpansion->GetShapeDimension();
559 
560  // Loop over all edges of element i
561  if (nDim == 1)
562  {
563  maxDof = (1 > maxDof ? 1 : maxDof);
564  }
565  else if (nDim == 2)
566  {
567  for (j = 0; j < locExpansion->GetNedges(); ++j)
568  {
569  dof = locExpansion->GetEdgeNcoeffs(j);
570  maxDof = (dof > maxDof ? dof : maxDof);
571  }
572  }
573  else if (nDim == 3)
574  {
575  for (j = 0; j < locExpansion->GetNfaces(); ++j)
576  {
577  dof = locExpansion->GetFaceNcoeffs(j);
578  maxDof = (dof > maxDof ? dof : maxDof);
579  }
580  }
581  }
582  m_comm->AllReduce(maxDof, LibUtilities::ReduceMax);
583 
584  // Now have trace edges Gid position
585  cnt = 0;
586  for(i = 0; i < locExpVector.size(); ++i)
587  {
588  // Order list according to m_offset_elmt_id details in Exp
589  // so that triangules are listed first and then quads
590  eid = locExp.GetOffset_Elmt_Id(i);
591  locExpansion = locExpVector[eid];
592  nDim = locExpansion->GetShapeDimension();
593 
594  // Populate mapping for each edge of the element.
595  if (nDim == 1)
596  {
597  int nverts = locExpansion->GetNverts();
598  for(j = 0; j < nverts; ++j)
599  {
600  LocalRegions::PointExpSharedPtr locPointExp =
601  m_elmtToTrace[eid][j]->as<LocalRegions::PointExp>();
602  id = locPointExp->GetGeom()->GetGlobalID();
603  vGlobalId = m_localToGlobalBndMap[cnt+j];
604  m_globalToUniversalBndMap[vGlobalId]
605  = id * maxDof + j + 1;
606  }
607  cnt += nverts;
608  }
609  else if (nDim == 2)
610  {
611  for(j = 0; j < locExpansion->GetNedges(); ++j)
612  {
614  m_elmtToTrace[eid][j]->as<LocalRegions::SegExp>();
615 
616  id = locSegExp->GetGeom1D()->GetEid();
617  order_e = locExpansion->GetEdgeNcoeffs(j);
618 
619  map<int,int> orientMap;
620  Array<OneD, unsigned int> map1(order_e), map2(order_e);
621  Array<OneD, int> sign1(order_e), sign2(order_e);
622 
623  locExpansion->GetEdgeToElementMap(j, StdRegions::eForwards, map1, sign1);
624  locExpansion->GetEdgeToElementMap(j, locExpansion->GetEorient(j), map2, sign2);
625 
626  for (k = 0; k < map1.num_elements(); ++k)
627  {
628  // Find the elemental co-efficient in the original
629  // mapping.
630  int idx = -1;
631  for (int l = 0; l < map2.num_elements(); ++l)
632  {
633  if (map1[k] == map2[l])
634  {
635  idx = l;
636  break;
637  }
638  }
639 
640  ASSERTL2(idx != -1, "Problem with face to element map!");
641  orientMap[k] = idx;
642  }
643 
644  for(k = 0; k < order_e; ++k)
645  {
646  vGlobalId = m_localToGlobalBndMap[k+cnt];
647  m_globalToUniversalBndMap[vGlobalId]
648  = id * maxDof + orientMap[k] + 1;
649  }
650  cnt += order_e;
651  }
652  }
653  else if (nDim == 3)
654  {
655  for(j = 0; j < locExpansion->GetNfaces(); ++j)
656  {
658  m_elmtToTrace[eid][j]
659  ->as<LocalRegions::Expansion2D>();
660 
661  id = locFaceExp->GetGeom2D()->GetFid();
662  order_e = locExpansion->GetFaceNcoeffs(j);
663 
664  map<int,int> orientMap;
665  Array<OneD, unsigned int> map1(order_e), map2(order_e);
666  Array<OneD, int> sign1(order_e), sign2(order_e);
667 
668  locExpansion->GetFaceToElementMap(j, StdRegions::eDir1FwdDir1_Dir2FwdDir2, map1, sign1);
669  locExpansion->GetFaceToElementMap(j, locExpansion->GetForient(j), map2, sign2);
670 
671  for (k = 0; k < map1.num_elements(); ++k)
672  {
673  // Find the elemental co-efficient in the original
674  // mapping.
675  int idx = -1;
676  for (int l = 0; l < map2.num_elements(); ++l)
677  {
678  if (map1[k] == map2[l])
679  {
680  idx = l;
681  break;
682  }
683  }
684 
685  ASSERTL2(idx != -1, "Problem with face to element map!");
686  orientMap[k] = idx;
687  }
688 
689  for(k = 0; k < order_e; ++k)
690  {
691  vGlobalId = m_localToGlobalBndMap[k+cnt];
692  m_globalToUniversalBndMap[vGlobalId]
693  = id * maxDof + orientMap[k] + 1;
694  }
695  cnt += order_e;
696  }
697  }
698  }
699 
700  // Initialise GSlib and populate the unique map.
701  Array<OneD, long> tmp(m_globalToUniversalBndMap.num_elements());
702  for (i = 0; i < m_globalToUniversalBndMap.num_elements(); ++i)
703  {
704  tmp[i] = m_globalToUniversalBndMap[i];
705  }
706  m_bndGsh = m_gsh = Gs::Init(tmp, m_comm);
707  Gs::Unique(tmp, m_comm);
708  for (i = 0; i < m_globalToUniversalBndMap.num_elements(); ++i)
709  {
710  m_globalToUniversalBndMapUnique[i] = (tmp[i] >= 0 ? 1 : 0);
711  }
712  }
int m_numGlobalBndCoeffs
Total number of global boundary coefficients.
Definition: AssemblyMap.h:316
LibUtilities::CommSharedPtr m_comm
Communicator.
Definition: AssemblyMap.h:308
std::vector< ExpansionSharedPtr > ExpansionVector
Definition: Expansion.h:70
static gs_data * Init(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm, bool verbose=true)
Initialise Gather-Scatter map.
Definition: GsLib.hpp:166
boost::shared_ptr< SegExp > SegExpSharedPtr
Definition: SegExp.h:270
static void Unique(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm)
Updates pId to negate all-but-one references to each universal ID.
Definition: GsLib.hpp:200
boost::shared_ptr< PointExp > PointExpSharedPtr
Definition: PointExp.h:131
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
Array< OneD, int > m_localToGlobalBndMap
Integer map of local boundary coeffs to global space.
Definition: AssemblyMap.h:350
Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > m_elmtToTrace
list of edge expansions for a given element
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:250
Array< OneD, int > m_globalToUniversalBndMap
Integer map of process coeffs to universal space.
Definition: AssemblyMap.h:360
Array< OneD, int > m_globalToUniversalBndMapUnique
Integer map of unique process coeffs to universal space (signed)
Definition: AssemblyMap.h:362
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr
Definition: Expansion1D.h:49
void Nektar::MultiRegions::AssemblyMapDG::SetUpUniversalTraceMap ( const ExpList locExp,
const ExpListSharedPtr  trace,
const PeriodicMap perMap = NullPeriodicMap 
)
protected

Definition at line 714 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::ExpList::GetExp(), Nektar::MultiRegions::_PeriodicEntity::id, Gs::Init(), Nektar::MultiRegions::_PeriodicEntity::isLocal, Nektar::MultiRegions::AssemblyMap::m_comm, m_traceGsh, m_traceToUniversalMap, m_traceToUniversalMapUnique, RealignTraceElement(), Nektar::LibUtilities::ReduceMax, and Gs::Unique().

Referenced by AssemblyMapDG().

718  {
719  Array<OneD, int> tmp;
721  int i;
722  int maxQuad = 0, quad = 0, nDim = 0, eid = 0, offset = 0;
723 
724  const LocalRegions::ExpansionVector &locExpVector = *(locExp.GetExp());
725 
726  int nTracePhys = trace->GetTotPoints();
727 
728  // Initialise the trace to universal maps.
730  Nektar::Array<OneD, int>(nTracePhys, -1);
732  Nektar::Array<OneD, int>(nTracePhys, -1);
733 
734  // Assume that each element of the expansion is of the same
735  // dimension.
736  nDim = locExpVector[0]->GetShapeDimension();
737 
738  if (nDim == 1)
739  {
740  maxQuad = (1 > maxQuad ? 1 : maxQuad);
741  }
742  else
743  {
744  for (i = 0; i < trace->GetExpSize(); ++i)
745  {
746  quad = trace->GetExp(i)->GetTotPoints();
747  if (quad > maxQuad)
748  {
749  maxQuad = quad;
750  }
751  }
752  }
753  m_comm->AllReduce(maxQuad, LibUtilities::ReduceMax);
754 
755  if (nDim == 1)
756  {
757  for (int i = 0; i < trace->GetExpSize(); ++i)
758  {
759  eid = trace->GetExp(i)->GetGeom()->GetGlobalID();
760  offset = trace->GetPhys_Offset(i);
761 
762  // Check to see if this vert is periodic. If it is, then we
763  // need use the unique eid of the two points
764  PeriodicMap::const_iterator it = perMap.find(eid);
765  if (perMap.count(eid) > 0)
766  {
767  PeriodicEntity ent = it->second[0];
768  if (ent.isLocal == false) // Not sure if true in 1D
769  {
770  eid = min(eid, ent.id);
771  }
772  }
773 
774  m_traceToUniversalMap[offset] = eid*maxQuad+1;
775  }
776  }
777  else
778  {
779  for (int i = 0; i < trace->GetExpSize(); ++i)
780  {
781  eid = trace->GetExp(i)->GetGeom()->GetGlobalID();
782  offset = trace->GetPhys_Offset(i);
783  quad = trace->GetExp(i)->GetTotPoints();
784 
785  // Check to see if this edge is periodic. If it is, then we
786  // need to reverse the trace order of one edge only in the
787  // universal map so that the data are reversed w.r.t each
788  // other. We do this by using the minimum of the two IDs.
789  PeriodicMap::const_iterator it = perMap.find(eid);
790  bool realign = false;
791  if (perMap.count(eid) > 0)
792  {
793  PeriodicEntity ent = it->second[0];
794  if (ent.isLocal == false)
795  {
796  realign = eid == min(eid, ent.id);
797  eid = min(eid, ent.id);
798  }
799  }
800 
801  for (int j = 0; j < quad; ++j)
802  {
803  m_traceToUniversalMap[j+offset] = eid*maxQuad+j+1;
804  }
805 
806  if (realign)
807  {
808  if (nDim == 2)
809  {
811  tmp = m_traceToUniversalMap+offset,
812  it->second[0].orient, quad);
813  }
814  else
815  {
817  tmp = m_traceToUniversalMap+offset,
818  it->second[0].orient,
819  trace->GetExp(i)->GetNumPoints(0),
820  trace->GetExp(i)->GetNumPoints(1));
821  }
822  }
823  }
824  }
825 
826  Array<OneD, long> tmp2(nTracePhys);
827  for (int i = 0; i < nTracePhys; ++i)
828  {
829  tmp2[i] = m_traceToUniversalMap[i];
830  }
831  m_traceGsh = Gs::Init(tmp2, m_comm);
832  Gs::Unique(tmp2, m_comm);
833  for (int i = 0; i < nTracePhys; ++i)
834  {
835  m_traceToUniversalMapUnique[i] = tmp2[i];
836  }
837  }
LibUtilities::CommSharedPtr m_comm
Communicator.
Definition: AssemblyMap.h:308
Array< OneD, int > m_traceToUniversalMap
Integer map of process trace space quadrature points to universal space.
std::vector< ExpansionSharedPtr > ExpansionVector
Definition: Expansion.h:70
static gs_data * Init(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm, bool verbose=true)
Initialise Gather-Scatter map.
Definition: GsLib.hpp:166
static void Unique(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm)
Updates pId to negate all-but-one references to each universal ID.
Definition: GsLib.hpp:200
boost::shared_ptr< Expansion > ExpansionSharedPtr
Definition: Expansion.h:68
Array< OneD, int > m_traceToUniversalMapUnique
Integer map of unique process trace space quadrature points to universal space (signed).
struct Nektar::MultiRegions::_PeriodicEntity PeriodicEntity
void RealignTraceElement(Array< OneD, int > &toAlign, StdRegions::Orientation orient, int nquad1, int nquad2=0)
void Nektar::MultiRegions::AssemblyMapDG::UniversalTraceAssemble ( Array< OneD, NekDouble > &  pGlobal) const

Definition at line 919 of file AssemblyMapDG.cpp.

References Gs::Gather(), Gs::gs_add, and m_traceGsh.

921  {
922  Gs::Gather(pGlobal, Gs::gs_add, m_traceGsh);
923  }
static void Gather(Nektar::Array< OneD, NekDouble > pU, gs_op pOp, gs_data *pGsh, Nektar::Array< OneD, NekDouble > pBuffer=NullNekDouble1DArray)
Performs a gather-scatter operation of the provided values.
Definition: GsLib.hpp:239
void Nektar::MultiRegions::AssemblyMapDG::v_Assemble ( const Array< OneD, const NekDouble > &  loc,
Array< OneD, NekDouble > &  global 
) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 991 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::AssembleBnd().

994  {
995  AssembleBnd(loc,global);
996  }
void AssembleBnd(const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, int offset) const
void Nektar::MultiRegions::AssemblyMapDG::v_Assemble ( const NekVector< NekDouble > &  loc,
NekVector< NekDouble > &  global 
) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 998 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::AssembleBnd().

1001  {
1002  AssembleBnd(loc,global);
1003  }
void AssembleBnd(const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, int offset) const
int Nektar::MultiRegions::AssemblyMapDG::v_GetFullSystemBandWidth ( ) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 1017 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::GetBndSystemBandWidth().

1018  {
1019  return GetBndSystemBandWidth();
1020  }
int GetBndSystemBandWidth() const
Returns the bandwidth of the boundary system.
int Nektar::MultiRegions::AssemblyMapDG::v_GetGlobalToUniversalMap ( const int  i) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 930 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::m_globalToUniversalBndMap.

931  {
932  return m_globalToUniversalBndMap[i];
933  }
Array< OneD, int > m_globalToUniversalBndMap
Integer map of process coeffs to universal space.
Definition: AssemblyMap.h:360
const Array< OneD, const int > & Nektar::MultiRegions::AssemblyMapDG::v_GetGlobalToUniversalMap ( void  )
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 945 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::m_globalToUniversalBndMap.

946  {
948  }
Array< OneD, int > m_globalToUniversalBndMap
Integer map of process coeffs to universal space.
Definition: AssemblyMap.h:360
int Nektar::MultiRegions::AssemblyMapDG::v_GetGlobalToUniversalMapUnique ( const int  i) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 935 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::m_globalToUniversalBndMapUnique.

936  {
938  }
Array< OneD, int > m_globalToUniversalBndMapUnique
Integer map of unique process coeffs to universal space (signed)
Definition: AssemblyMap.h:362
const Array< OneD, const int > & Nektar::MultiRegions::AssemblyMapDG::v_GetGlobalToUniversalMapUnique ( void  )
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 950 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::m_globalToUniversalBndMapUnique.

951  {
953  }
Array< OneD, int > m_globalToUniversalBndMapUnique
Integer map of unique process coeffs to universal space (signed)
Definition: AssemblyMap.h:362
int Nektar::MultiRegions::AssemblyMapDG::v_GetLocalToGlobalMap ( const int  i) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 925 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::m_localToGlobalBndMap.

926  {
927  return m_localToGlobalBndMap[i];
928  }
Array< OneD, int > m_localToGlobalBndMap
Integer map of local boundary coeffs to global space.
Definition: AssemblyMap.h:350
const Array< OneD, const int > & Nektar::MultiRegions::AssemblyMapDG::v_GetLocalToGlobalMap ( void  )
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 940 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::m_localToGlobalBndMap.

941  {
942  return m_localToGlobalBndMap;
943  }
Array< OneD, int > m_localToGlobalBndMap
Integer map of local boundary coeffs to global space.
Definition: AssemblyMap.h:350
NekDouble Nektar::MultiRegions::AssemblyMapDG::v_GetLocalToGlobalSign ( const int  i) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 955 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::GetLocalToGlobalBndSign().

957  {
958  return GetLocalToGlobalBndSign(i);
959  }
Array< OneD, const NekDouble > GetLocalToGlobalBndSign() const
Retrieve the sign change for all local boundary modes.
void Nektar::MultiRegions::AssemblyMapDG::v_GlobalToLocal ( const Array< OneD, const NekDouble > &  global,
Array< OneD, NekDouble > &  loc 
) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 977 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::GlobalToLocalBnd().

980  {
981  GlobalToLocalBnd(global,loc);
982  }
void GlobalToLocalBnd(const NekVector< NekDouble > &global, NekVector< NekDouble > &loc, int offset) const
void Nektar::MultiRegions::AssemblyMapDG::v_GlobalToLocal ( const NekVector< NekDouble > &  global,
NekVector< NekDouble > &  loc 
) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 984 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::GlobalToLocalBnd().

987  {
988  GlobalToLocalBnd(global,loc);
989  }
void GlobalToLocalBnd(const NekVector< NekDouble > &global, NekVector< NekDouble > &loc, int offset) const
void Nektar::MultiRegions::AssemblyMapDG::v_LocalToGlobal ( const Array< OneD, const NekDouble > &  loc,
Array< OneD, NekDouble > &  global,
bool  useComm 
) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 961 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::AssembleBnd().

965  {
966  AssembleBnd(loc,global);
967  }
void AssembleBnd(const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, int offset) const
void Nektar::MultiRegions::AssemblyMapDG::v_LocalToGlobal ( const NekVector< NekDouble > &  loc,
NekVector< NekDouble > &  global,
bool  useComm 
) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 969 of file AssemblyMapDG.cpp.

References Nektar::MultiRegions::AssemblyMap::AssembleBnd().

973  {
974  AssembleBnd(loc,global);
975  }
void AssembleBnd(const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, int offset) const
void Nektar::MultiRegions::AssemblyMapDG::v_UniversalAssemble ( Array< OneD, NekDouble > &  pGlobal) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 1005 of file AssemblyMapDG.cpp.

References Gs::Gather(), Gs::gs_add, and Nektar::MultiRegions::AssemblyMap::m_gsh.

1007  {
1008  Gs::Gather(pGlobal, Gs::gs_add, m_gsh);
1009  }
static void Gather(Nektar::Array< OneD, NekDouble > pU, gs_op pOp, gs_data *pGsh, Nektar::Array< OneD, NekDouble > pBuffer=NullNekDouble1DArray)
Performs a gather-scatter operation of the provided values.
Definition: GsLib.hpp:239
void Nektar::MultiRegions::AssemblyMapDG::v_UniversalAssemble ( NekVector< NekDouble > &  pGlobal) const
protectedvirtual

Reimplemented from Nektar::MultiRegions::AssemblyMap.

Definition at line 1011 of file AssemblyMapDG.cpp.

References Nektar::NekVector< DataType >::GetPtr(), and Nektar::MultiRegions::AssemblyMap::UniversalAssemble().

1013  {
1014  UniversalAssemble(pGlobal.GetPtr());
1015  }
void UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
Array< OneD, DataType > & GetPtr()
Definition: NekVector.cpp:230

Member Data Documentation

Array<OneD, Array<OneD, LocalRegions::ExpansionSharedPtr> > Nektar::MultiRegions::AssemblyMapDG::m_elmtToTrace
protected

list of edge expansions for a given element

Definition at line 100 of file AssemblyMapDG.h.

Referenced by AssemblyMapDG(), GetElmtToTrace(), and SetUpUniversalDGMap().

int Nektar::MultiRegions::AssemblyMapDG::m_numDirichletBndPhys
protected

Number of physical dirichlet boundary values in trace.

Definition at line 97 of file AssemblyMapDG.h.

Referenced by AssemblyMapDG(), and GetNumDirichletBndPhys().

Gs::gs_data* Nektar::MultiRegions::AssemblyMapDG::m_traceGsh
protected

Definition at line 94 of file AssemblyMapDG.h.

Referenced by SetUpUniversalTraceMap(), and UniversalTraceAssemble().

Array<OneD,int> Nektar::MultiRegions::AssemblyMapDG::m_traceToUniversalMap
protected

Integer map of process trace space quadrature points to universal space.

Definition at line 103 of file AssemblyMapDG.h.

Referenced by GetTraceToUniversalMap(), and SetUpUniversalTraceMap().

Array<OneD,int> Nektar::MultiRegions::AssemblyMapDG::m_traceToUniversalMapUnique
protected

Integer map of unique process trace space quadrature points to universal space (signed).

Definition at line 106 of file AssemblyMapDG.h.

Referenced by GetTraceToUniversalMapUnique(), and SetUpUniversalTraceMap().