44#include <boost/config.hpp>
45#include <boost/graph/adjacency_list.hpp>
65 const PeriodicMap &periodicTrace,
const std::string variable)
68 int i, j, k, cnt, id, id1, gid;
70 int nTraceExp = trace->GetExpSize();
71 int nbnd = bndCondExp.size();
78 int nel = expList.size();
80 map<int, int> meshTraceId;
85 for (i = 0; i < nTraceExp; ++i)
87 meshTraceId[trace->GetExp(i)->GetGeom()->GetGlobalID()] = i;
92 for (i = 0; i < nel; ++i)
94 cnt += expList[i]->GetNtraces();
102 for (cnt = i = 0; i < nel; ++i)
107 for (j = 0; j < exp->GetNtraces(); ++j)
109 id = exp->GetGeom()->GetTid(j);
111 if (meshTraceId.count(
id) > 0)
114 trace->GetExp(meshTraceId.find(
id)->second);
118 ASSERTL0(
false,
"Failed to find trace map");
122 cnt += exp->GetNtraces();
127 for (i = 0; i < nbnd; ++i)
133 cnt += bndCondExp[i]->GetExpSize();
141 for (i = 0; i < bndCondExp.size(); ++i)
143 for (j = 0; j < bndCondExp[i]->GetExpSize(); ++j)
145 bndExp = bndCondExp[i]->GetExp(j);
146 traceGeom = bndExp->GetGeom();
147 id = traceGeom->GetGlobalID();
149 if (bndCond[i]->GetBoundaryConditionType() ==
168 for (i = 0; i < nel; ++i)
170 int BndCoeffs = expList[i]->NumDGBndryCoeffs();
189 typedef boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS>
192 BoostGraph boostGraphObj;
193 int trace_id, trace_id1;
198 for (i = 0; i < nTraceExp; ++i)
200 id = trace->GetExp(i)->GetGeom()->GetGlobalID();
202 if (dirTrace.count(
id) == 0)
206 boost::add_vertex(boostGraphObj);
207 traceElmtGid[i] = cnt++;
212 traceElmtGid[i] = dirOffset;
213 dirOffset += trace->GetExp(i)->GetNcoeffs();
219 for (i = 0; i < nel; ++i)
223 for (j = 0; j < exp->GetNtraces(); ++j)
227 id = traceGeom->GetGlobalID();
228 trace_id = meshTraceId.find(
id)->second;
230 if (dirTrace.count(
id) == 0)
232 for (k = j + 1; k < exp->GetNtraces(); ++k)
235 id1 = traceGeom->GetGlobalID();
236 trace_id1 = meshTraceId.find(id1)->second;
238 if (dirTrace.count(id1) == 0)
240 boost::add_edge((
size_t)traceElmtGid[trace_id],
241 (
size_t)traceElmtGid[trace_id1],
249 int nGraphVerts = nTraceExp - nDir;
255 for (i = 0; i < nGraphVerts; ++i)
257 vwgts[i] = trace->GetExp(i + nDir)->GetNcoeffs();
291 ASSERTL0(
false,
"Unrecognised solution type");
299 for (i = 0; i < nTraceExp - nDir; ++i)
301 traceElmtGid[perm[i] + nDir] = cnt;
302 cnt += trace->GetExp(perm[i] + nDir)->GetNcoeffs();
307 for (i = 0; i < nel; ++i)
311 for (j = 0; j < exp->GetNtraces(); ++j)
314 id = traceGeom->GetGlobalID();
315 gid = traceElmtGid[meshTraceId.find(
id)->second];
317 const int nDim = exp->GetNumBases();
326 order_e = exp->GetTraceNcoeffs(j);
330 for (k = 0; k < order_e; ++k)
344 for (k = 2; k < order_e; ++k)
350 for (k = 3; k < order_e; k += 2)
359 for (k = 0; k < order_e; ++k)
369 for (k = 0; k < order_e; ++k)
378 ASSERTL0(
false,
"Boundary type not permitted");
385 order_e = exp->GetTraceNcoeffs(j);
387 std::map<int, int> orientMap;
398 exp->GetTraceToElementMap(j, elmMap1, elmSign1, fo);
399 exp->GetTraceToElementMap(j, elmMap2, elmSign2,
402 for (k = 0; k < elmMap1.size(); ++k)
407 for (
int l = 0; l < elmMap2.size(); ++l)
409 if (elmMap1[k] == elmMap2[l])
416 ASSERTL2(idx != -1,
"Problem with face to element map!");
420 for (k = 0; k < order_e; ++k)
453 for (i = 0; i < nbnd; ++i)
459 cnt += bndCondExp[i]->GetNcoeffs();
460 nbndexp += bndCondExp[i]->GetExpSize();
467 for (i = 0; i < bndCondExp.size(); ++i)
474 for (j = 0; j < bndCondExp[i]->GetExpSize(); ++j)
476 bndExp = bndCondExp[i]->GetExp(j);
477 id = bndExp->GetGeom()->GetGlobalID();
479 int meshId = meshTraceId.find(
id)->second;
485 traceOffset = traceElmtGid[meshId];
486 bndOffset = bndCondExp[i]->GetCoeff_Offset(j) + bndTotal;
488 for (k = 0; k < bndExp->GetNcoeffs(); ++k)
493 bndTotal += bndCondExp[i]->GetNcoeffs();
497 map<int, int> invLocToGloMap;
498 for (i = 0; i < nbndry; ++i)
517 locExp, tr,
m_elmtToTrace, bndCondExp, bndCond, periodicTrace));
529 for (
int i = 0; i < nGraphVerts; i++)
531 vwgts_perm[i] = vwgts[perm[i]];
534 bottomUpGraph->ExpandGraphWithVertexWeights(vwgts_perm);
575 for (i = 0; i < locExpVector.size(); ++i)
577 locExpansion = locExpVector[i];
578 nDim = locExpansion->GetShapeDimension();
583 maxDof = (1 > maxDof ? 1 : maxDof);
587 for (j = 0; j < locExpansion->GetNtraces(); ++j)
589 dof = locExpansion->GetTraceNcoeffs(j);
590 maxDof = (dof > maxDof ? dof : maxDof);
598 for (i = 0; i < locExpVector.size(); ++i)
600 locExpansion = locExpVector[i];
601 nDim = locExpansion->GetShapeDimension();
606 int nverts = locExpansion->GetNverts();
607 for (j = 0; j < nverts; ++j)
611 id = locPointExp->
GetGeom()->GetGlobalID();
619 for (j = 0; j < locExpansion->GetNtraces(); ++j)
624 id = locSegExp->
GetGeom()->GetGlobalID();
625 order_e = locExpansion->GetTraceNcoeffs(j);
627 map<int, int> orientMap;
631 locExpansion->GetTraceToElementMap(j, map1, sign1,
633 locExpansion->GetTraceToElementMap(
634 j, map2, sign2, locExpansion->GetTraceOrient(j));
636 for (k = 0; k < map1.size(); ++k)
641 for (
int l = 0; l < map2.size(); ++l)
643 if (map1[k] == map2[l])
650 ASSERTL2(idx != -1,
"Problem with face to"
655 for (k = 0; k < order_e; ++k)
659 id * maxDof + orientMap[k] + 1;
666 for (j = 0; j < locExpansion->GetNtraces(); ++j)
671 id = locFaceExp->
GetGeom()->GetGlobalID();
672 order_e = locExpansion->GetTraceNcoeffs(j);
674 map<int, int> orientMap;
678 locExpansion->GetTraceToElementMap(
680 locExpansion->GetTraceToElementMap(
681 j, map2, sign2, locExpansion->GetTraceOrient(j));
683 for (k = 0; k < map1.size(); ++k)
688 for (
int l = 0; l < map2.size(); ++l)
690 if (map1[k] == map2[l])
697 ASSERTL2(idx != -1,
"Problem with face to "
702 for (k = 0; k < order_e; ++k)
706 id * maxDof + orientMap[k] + 1;
720 bool verbose =
m_comm->IsParallelInTime()
721 ?
m_comm->GetTimeComm()->GetRank() == 0
734 int nquad1,
int nquad2)
738 ASSERTL1(nquad2 == 0,
"nquad2 != 0 for reorienation");
739 for (
int i = 0; i < nquad1 / 2; ++i)
741 swap(toAlign[i], toAlign[nquad1 - 1 - i]);
746 ASSERTL1(nquad2 != 0,
"nquad2 == 0 for reorienation");
756 for (
int i = 0; i < nquad2; ++i)
758 for (
int j = 0; j < nquad1; ++j)
760 tmp[i * nquad1 + j] = toAlign[j * nquad2 + i];
766 for (
int i = 0; i < nquad2; ++i)
768 for (
int j = 0; j < nquad1; ++j)
770 tmp[i * nquad1 + j] = toAlign[i * nquad1 + j];
781 for (
int i = 0; i < nquad2; ++i)
783 for (
int j = 0; j < nquad1 / 2; ++j)
785 swap(tmp[i * nquad1 + j], tmp[i * nquad1 + nquad1 - j - 1]);
796 for (
int j = 0; j < nquad1; ++j)
798 for (
int i = 0; i < nquad2 / 2; ++i)
800 swap(tmp[i * nquad1 + j],
801 tmp[(nquad2 - i - 1) * nquad1 + j]);
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
SpatialDomains::GeometrySharedPtr GetGeom() const
const SpatialDomains::PointGeomSharedPtr GetGeom() const
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > m_elmtToTrace
list of edge expansions for a given element
const Array< OneD, const int > & v_GetGlobalToUniversalMap() override
void v_LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm=false) const override
void v_GlobalToLocal(const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const override
static void RealignTraceElement(Array< OneD, int > &toAlign, StdRegions::Orientation orient, int nquad1, int nquad2=0)
AssemblyCommDGSharedPtr m_assemblyComm
Array< OneD, Array< OneD, LocalRegions::ExpansionSharedPtr > > & GetElmtToTrace()
const Array< OneD, const int > & v_GetLocalToGlobalMap() override
AssemblyCommDGSharedPtr GetAssemblyCommDG()
int GetNumDirichletBndPhys()
Return the number of boundary segments on which Dirichlet boundary conditions are imposed.
void v_Assemble(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const override
void SetUpUniversalDGMap(const ExpList &locExp)
int m_numDirichletBndPhys
Number of physical dirichlet boundary values in trace.
const Array< OneD, const int > & v_GetGlobalToUniversalMapUnique() override
void v_UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const override
int v_GetFullSystemBandWidth() const override
~AssemblyMapDG() override
Destructor.
AssemblyMapDG()
Default constructor.
Base class for constructing local to global mapping of degrees of freedom.
int m_lowestStaticCondLevel
Lowest static condensation level.
GlobalSysSolnType m_solnType
The solution type of the global system.
int m_numLocalCoeffs
Total number of local coefficients.
Array< OneD, int > m_bndCondCoeffsToLocalTraceMap
Integer map of bnd cond coeff to local trace coeff.
bool m_signChange
Flag indicating if modes require sign reversal.
void AssembleBnd(const NekVector< NekDouble > &loc, NekVector< NekDouble > &global, int offset) const
int m_numGlobalCoeffs
Total number of global coefficients.
Array< OneD, int > m_globalToUniversalBndMap
Integer map of process coeffs to universal space.
void CalculateBndSystemBandWidth()
Calculates the bandwidth of the boundary system.
Array< OneD, NekDouble > m_localToGlobalBndSign
Integer sign of local boundary coeffs to global space.
Array< OneD, unsigned int > m_numLocalBndCoeffsPerPatch
The number of bnd dofs per patch.
virtual const Array< OneD, NekDouble > & v_GetLocalToGlobalSign() const
int m_numLocalBndCoeffs
Number of local boundary coefficients.
AssemblyMapSharedPtr m_nextLevelLocalToGlobalMap
Map from the patches of the previous level to the patches of the current level.
int m_staticCondLevel
The level of recursion in the case of multi-level static condensation.
int m_numLocalDirBndCoeffs
Number of Local Dirichlet Boundary Coefficients.
int m_numGlobalDirBndCoeffs
Number of Global Dirichlet Boundary Coefficients.
Array< OneD, unsigned int > m_numLocalIntCoeffsPerPatch
The number of int dofs per patch.
int GetBndSystemBandWidth() const
Returns the bandwidth of the boundary system.
Array< OneD, int > m_localToGlobalBndMap
Integer map of local coeffs to global Boundary Dofs.
size_t m_hash
Hash for map.
Array< OneD, const NekDouble > GetLocalToGlobalBndSign() const
Retrieve the sign change for all local boundary modes.
Array< OneD, int > m_globalToUniversalBndMapUnique
Integer map of unique process coeffs to universal space (signed)
LibUtilities::CommSharedPtr m_comm
Communicator.
Array< OneD, int > m_localToLocalBndMap
Integer map of local boundary coeffs to local boundary system numbering.
void LocalBndToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, int offset, bool UseComm=true) const
void UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
int m_numPatches
The number of patches (~elements) in the current level.
void GlobalToLocalBnd(const NekVector< NekDouble > &global, NekVector< NekDouble > &loc, int offset) const
int m_numGlobalBndCoeffs
Total number of global boundary coefficients.
Array< OneD, int > m_bndCondIDToGlobalTraceID
Integer map of bnd cond trace number to global trace number.
Base class for all multi-elemental spectral/hp expansions.
const std::shared_ptr< LocalRegions::ExpansionVector > GetExp() const
This function returns the vector of elements in the expansion.
Array< OneD, DataType > & GetPtr()
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.
static gs_data * Init(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm, bool verbose=true)
Initialise Gather-Scatter map.
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.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
@ eGauss_Lagrange
Lagrange Polynomials using the Gauss points.
@ eGLL_Lagrange
Lagrange for SEM basis .
@ eModified_A
Principle Modified Functions .
std::shared_ptr< SegExp > SegExpSharedPtr
std::shared_ptr< PointExp > PointExpSharedPtr
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< Expansion2D > Expansion2DSharedPtr
std::vector< ExpansionSharedPtr > ExpansionVector
void NoReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm)
@ eIterativeMultiLevelStaticCond
@ eDirectMultiLevelStaticCond
@ eXxtMultiLevelStaticCond
@ ePETScMultiLevelStaticCond
std::shared_ptr< AssemblyCommDG > AssemblyCommDGSharedPtr
void CuthillMckeeReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm)
void MultiLevelBisectionReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm, BottomUpSubStructuredGraphSharedPtr &substructgraph, std::set< int > partVerts, int mdswitch)
std::shared_ptr< BottomUpSubStructuredGraph > BottomUpSubStructuredGraphSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::shared_ptr< Geometry > GeometrySharedPtr
@ eDir1BwdDir2_Dir2BwdDir1
@ eDir1FwdDir1_Dir2FwdDir2
@ eDir1BwdDir1_Dir2BwdDir2
@ eDir1BwdDir2_Dir2FwdDir1
@ eDir1FwdDir1_Dir2BwdDir2
@ eDir1BwdDir1_Dir2FwdDir2
@ eDir1FwdDir2_Dir2FwdDir1
@ eDir1FwdDir2_Dir2BwdDir1
std::size_t hash_range(Iter first, Iter last)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)