50 namespace MultiRegions
64 m_bndCondExpansions(),
72 const bool DeclareCoeffPhysArrays)
74 m_bndCondExpansions (In.m_bndCondExpansions),
75 m_bndConditions (In.m_bndConditions),
76 m_globalBndMat (In.m_globalBndMat),
77 m_traceMap (In.m_traceMap),
78 m_locTraceToTraceMap (In.m_locTraceToTraceMap),
79 m_boundaryEdges (In.m_boundaryEdges),
80 m_periodicVerts (In.m_periodicVerts),
81 m_periodicEdges (In.m_periodicEdges),
82 m_periodicFwdCopy (In.m_periodicFwdCopy),
83 m_periodicBwdCopy (In.m_periodicBwdCopy),
84 m_leftAdjacentEdges (In.m_leftAdjacentEdges)
89 *boost::dynamic_pointer_cast<ExpList1D>(In.
m_trace),
90 DeclareCoeffPhysArrays);
101 const std::string &variable,
102 const bool SetUpJustDG,
103 const bool DeclareCoeffPhysArrays)
104 :
ExpList2D(pSession, graph2D, DeclareCoeffPhysArrays, variable),
105 m_bndCondExpansions(),
114 if (variable.compare(
"DefaultVar") != 0)
118 DeclareCoeffPhysArrays);
120 if (DeclareCoeffPhysArrays)
146 for(e = 0; e < locExpList->GetExpSize(); ++e)
149 (*m_exp)[ElmtID[cnt+e]]->
150 as<LocalRegions::Expansion2D>();
152 locExpList->GetExp(e)->
153 as<LocalRegions::Expansion1D>();
155 locExpList->GetExp(e)->
156 as<LocalRegions::Expansion> ();
158 exp2d->SetEdgeExp(EdgeID[cnt+e], exp1d);
159 exp1d->SetAdjacentElementExp(EdgeID[cnt+e], exp2d);
164 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
166 std::string ProjectStr =
168 if((ProjectStr ==
"MixedCGDG") ||
169 (ProjectStr ==
"Mixed_CG_Discontinuous"))
193 const std::string &variable,
194 const bool SetUpJustDG,
195 const bool DeclareCoeffPhysArrays)
201 if(variable.compare(
"DefaultVar") != 0)
206 if (DeclareCoeffPhysArrays)
234 for(e = 0; e < locExpList->GetExpSize(); ++e)
237 = (*m_exp)[ElmtID[cnt+e]]->
238 as<LocalRegions::Expansion2D>();
240 = locExpList->GetExp(e)->
241 as<LocalRegions::Expansion1D>();
243 = locExpList->GetExp(e)->
244 as<LocalRegions::Expansion> ();
246 exp2d->SetEdgeExp(EdgeID[cnt+e], exp1d);
247 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],
255 if (
m_session->DefinesSolverInfo(
"PROJECTION"))
257 std::string ProjectStr =
260 if ((ProjectStr ==
"MixedCGDG") ||
261 (ProjectStr ==
"Mixed_CG_Discontinuous"))
316 for (e = 0; e < locExpList->GetExpSize(); ++e)
319 = (*m_exp)[ElmtID[cnt+e]]->
320 as<LocalRegions::Expansion2D>();
322 = locExpList->GetExp(e)->
323 as<LocalRegions::Expansion1D>();
325 = locExpList->GetExp(e)->
326 as<LocalRegions::Expansion> ();
328 exp2d->SetEdgeExp(EdgeID[cnt+e], exp1d);
329 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],
352 "Routine currently only tested for HybridDGHelmholtz");
355 "The local to global map is not set up for the requested "
364 (*m_globalBndMat)[mkey] = glo_matrix;
368 glo_matrix = matrixIter->second;
407 &elmtToTrace = m_traceMap->GetElmtToTrace();
414 for (
int i = 0; i <
m_exp->size(); ++i)
416 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j)
423 exp2d->SetEdgeExp (j, exp1d);
424 exp1d->SetAdjacentElementExp(j, exp2d);
432 for (
int i = 0; i <
m_trace->GetExpSize(); ++i)
437 int offset =
m_trace->GetPhys_Offset(i);
438 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
443 if (traceGeomId != min(pIt->second[0].id, traceGeomId))
445 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
446 traceEl->GetLeftAdjacentElementEdge());
449 else if (m_traceMap->GetTraceToUniversalMapUnique(offset) < 0)
451 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
452 traceEl->GetLeftAdjacentElementEdge());
467 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
474 boost::unordered_map<int,pair<int,int> > perEdgeToExpMap;
475 boost::unordered_map<int,pair<int,int> >
::iterator it2;
476 for (cnt = n = 0; n <
m_exp->size(); ++n)
478 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
481 (*
m_exp)[n]->GetGeom()->GetEid(e));
485 perEdgeToExpMap[it->first] = make_pair(n, e);
493 for (
int i = 0; i <
m_exp->size(); ++i)
495 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j, ++cnt)
503 for (
int n = 0; n <
m_exp->size(); ++n)
505 for (
int e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
507 int edgeGeomId = (*m_exp)[n]->GetGeom()->GetEid(e);
508 int offset =
m_trace->GetPhys_Offset(
509 elmtToTrace[n][e]->GetElmtId());
517 it2 = perEdgeToExpMap.find(ent.
id);
519 if (it2 == perEdgeToExpMap.end())
522 GetRowComm()->GetSize() > 1 && !ent.
isLocal)
528 ASSERTL1(
false,
"Periodic edge not found!");
533 "Periodic edge in non-forward space?");
535 int offset2 =
m_trace->GetPhys_Offset(
536 elmtToTrace[it2->second.first][it2->second.second]->
541 int nquad = elmtToTrace[n][e]->GetNumPoints(0);
543 vector<int> tmpBwd(nquad);
544 vector<int> tmpFwd(nquad);
548 for (
int i = 0; i < nquad; ++i)
550 tmpBwd[i] = offset2 + i;
551 tmpFwd[i] = offset + i;
556 for (
int i = 0; i < nquad; ++i)
558 tmpBwd[i] = offset2 + i;
559 tmpFwd[i] = offset + nquad - i - 1;
563 for (
int i = 0; i < nquad; ++i)
587 bool returnval =
true;
607 int vSame = (returnval?1:0);
631 const std::string &variable,
632 const bool DeclareCoeffPhysArrays)
641 SpatialDomains::BoundaryRegionCollection::const_iterator it;
644 for (it = bregions.begin(); it != bregions.end(); ++it)
662 for (it = bregions.begin(); it != bregions.end(); ++it)
670 DeclareCoeffPhysArrays, variable);
673 m_bndConditions[cnt] = bc;
676 std::string type = m_bndConditions[cnt]->GetUserDefined();
681 if((bc->GetBoundaryConditionType() !=
683 boost::iequals(type,
"I") ||
684 boost::iequals(type,
"CalcBC"))
707 const std::string &variable)
714 = boost::dynamic_pointer_cast<
716 SpatialDomains::BoundaryRegionCollection::const_iterator it;
730 map<int,int> perComps;
731 map<int,vector<int> > allVerts;
733 map<int,StdRegions::Orientation> allEdges;
735 int region1ID, region2ID, i, j, k, cnt;
739 for(i = 0; i < (*m_exp).size(); ++i)
741 for(j = 0; j < (*m_exp)[i]->GetNverts(); ++j)
743 int id = (*m_exp)[i]->GetGeom()->GetVid(j);
749 for (it = bregions.begin(); it != bregions.end(); ++it)
752 bconditions, it->first, variable);
754 if (locBCond->GetBoundaryConditionType()
761 region1ID = it->first;
762 region2ID = boost::static_pointer_cast<
764 locBCond)->m_connectedBoundaryRegion;
769 if (vComm->GetSize() == 1)
771 cId1 = it->second->begin()->first;
772 cId2 = bregions.find(region2ID)->second->begin()->first;
776 cId1 = bndRegOrder.find(region1ID)->second[0];
777 cId2 = bndRegOrder.find(region2ID)->second[0];
781 "Boundary region "+boost::lexical_cast<
string>(
782 region1ID)+
" should only contain 1 composite.");
787 vector<unsigned int> tmpOrder;
789 for (i = 0; i < c->size(); ++i)
792 boost::dynamic_pointer_cast<
794 ASSERTL0(segGeom,
"Unable to cast to shared ptr");
797 graph2D->GetElementsFromEdge(segGeom);
799 "The periodic boundaries belong to "
800 "more than one element of the mesh");
804 (*elmt)[0]->m_Element);
806 allEdges[(*c)[i]->GetGlobalID()] =
807 geom->GetEorient((*elmt)[0]->m_EdgeIndx);
811 if (vComm->GetSize() == 1)
813 tmpOrder.push_back((*c)[i]->GetGlobalID());
816 vector<int> vertList(2);
817 vertList[0] = segGeom->GetVid(0);
818 vertList[1] = segGeom->GetVid(1);
819 allVerts[(*c)[i]->GetGlobalID()] = vertList;
822 if (vComm->GetSize() == 1)
824 compOrder[it->second->begin()->first] = tmpOrder;
829 if (perComps.count(cId1) == 0)
831 if (perComps.count(cId2) == 0)
833 perComps[cId1] = cId2;
837 std::stringstream ss;
838 ss <<
"Boundary region " << cId2 <<
" should be "
839 <<
"periodic with " << perComps[cId2] <<
" but "
840 <<
"found " << cId1 <<
" instead!";
841 ASSERTL0(perComps[cId2] == cId1, ss.str());
846 std::stringstream ss;
847 ss <<
"Boundary region " << cId1 <<
" should be "
848 <<
"periodic with " << perComps[cId1] <<
" but "
849 <<
"found " << cId2 <<
" instead!";
850 ASSERTL0(perComps[cId1] == cId1, ss.str());
855 int n = vComm->GetSize();
856 int p = vComm->GetRank();
862 edgecounts[p] = allEdges.size();
866 for (i = 1; i < n; ++i)
868 edgeoffset[i] = edgeoffset[i-1] + edgecounts[i-1];
878 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
880 edgeIds [edgeoffset[p] + i ] = sIt->first;
881 edgeOrient[edgeoffset[p] + i ] = sIt->second;
882 edgeVerts [edgeoffset[p] + i++] = allVerts[sIt->first].size();
904 for (i = 0; i < n; ++i)
906 if (edgecounts[i] > 0)
909 edgecounts[i], edgeVerts + edgeoffset[i], 1);
918 for (i = 1; i < n; ++i)
920 vertoffset[i] = vertoffset[i-1] + procVerts[i-1];
924 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
926 for (j = 0; j < allVerts[sIt->first].size(); ++j)
928 vertIds[vertoffset[p] + i++] = allVerts[sIt->first][j];
935 map<int, StdRegions::Orientation> orientMap;
936 map<int, vector<int> > vertMap;
938 for (cnt = i = 0; i < totEdges; ++i)
940 ASSERTL0(orientMap.count(edgeIds[i]) == 0,
941 "Already found edge in orientation map!");
944 vector<int> verts(edgeVerts[i]);
946 for (j = 0; j < edgeVerts[i]; ++j)
948 verts[j] = vertIds[cnt++];
950 vertMap[edgeIds[i]] = verts;
957 map<int,int>::const_iterator oIt;
959 map<int,int> allCompPairs;
968 for (cIt = perComps.begin(); cIt != perComps.end(); ++cIt)
971 const int id1 = cIt->first;
972 const int id2 = cIt->second;
973 std::string id1s = boost::lexical_cast<
string>(id1);
974 std::string id2s = boost::lexical_cast<
string>(id2);
976 if (compMap.count(id1) > 0)
981 if (compMap.count(id2) > 0)
987 "Both composites not found on this process!");
992 map<int,int> compPairs;
995 "Unable to find composite "+id1s+
" in order map.");
997 "Unable to find composite "+id2s+
" in order map.");
998 ASSERTL0(compOrder[id1].size() == compOrder[id2].size(),
999 "Periodic composites "+id1s+
" and "+id2s+
1000 " should have the same number of elements.");
1001 ASSERTL0(compOrder[id1].size() > 0,
1002 "Periodic composites "+id1s+
" and "+id2s+
1006 for (i = 0; i < compOrder[id1].size(); ++i)
1008 int eId1 = compOrder[id1][i];
1009 int eId2 = compOrder[id2][i];
1011 ASSERTL0(compPairs.count(eId1) == 0,
1014 if (compPairs.count(eId2) != 0)
1016 ASSERTL0(compPairs[eId2] == eId1,
"Pairing incorrect");
1018 compPairs[eId1] = eId2;
1025 for (i = 0; i < 2; ++i)
1032 if (c[i]->size() > 0)
1034 for (j = 0; j < c[i]->size(); ++j)
1036 locEdges.insert(c[i]->at(j)->GetGlobalID());
1042 for (pIt = compPairs.begin(); pIt != compPairs.end(); ++pIt)
1044 int ids [2] = {pIt->first, pIt->second};
1045 bool local[2] = {locEdges.count(pIt->first) > 0,
1046 locEdges.count(pIt->second) > 0};
1048 ASSERTL0(orientMap.count(ids[0]) > 0 &&
1049 orientMap.count(ids[1]) > 0,
1050 "Unable to find edge in orientation map.");
1052 allCompPairs[pIt->first ] = pIt->second;
1053 allCompPairs[pIt->second] = pIt->first;
1055 for (i = 0; i < 2; ++i)
1062 int other = (i+1) % 2;
1065 orientMap[ids[i]] == orientMap[ids[other]] ?
1074 for (i = 0; i < 2; ++i)
1076 int other = (i+1) % 2;
1079 orientMap[ids[i]] == orientMap[ids[other]] ?
1084 vector<int> perVerts1 = vertMap[ids[i]];
1085 vector<int> perVerts2 = vertMap[ids[other]];
1087 map<int, pair<int, bool> > tmpMap;
1091 tmpMap[perVerts1[0]] = make_pair(
1092 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1093 tmpMap[perVerts1[1]] = make_pair(
1094 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1098 tmpMap[perVerts1[0]] = make_pair(
1099 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1100 tmpMap[perVerts1[1]] = make_pair(
1101 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1104 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1109 mIt->second.second);
1113 if (perIt == periodicVerts.end())
1115 periodicVerts[mIt->first].push_back(ent2);
1116 perIt = periodicVerts.find(mIt->first);
1121 for (j = 0; j < perIt->second.size(); ++j)
1123 if (perIt->second[j].id == mIt->second.first)
1132 perIt->second.push_back(ent2);
1141 pairSizes[p] = allCompPairs.size();
1149 for (i = 1; i < n; ++i)
1151 pairOffsets[i] = pairOffsets[i-1] + pairSizes[i-1];
1157 cnt = pairOffsets[p];
1159 for (pIt = allCompPairs.begin(); pIt != allCompPairs.end(); ++pIt)
1161 first [cnt ] = pIt->first;
1162 second[cnt++] = pIt->second;
1168 allCompPairs.clear();
1170 for(cnt = 0; cnt < totPairSizes; ++cnt)
1172 allCompPairs[first[cnt]] = second[cnt];
1178 for (cnt = i = 0; i < totEdges; ++i)
1180 int edgeId = edgeIds[i];
1182 ASSERTL0(allCompPairs.count(edgeId) > 0,
1183 "Unable to find matching periodic edge.");
1185 int perEdgeId = allCompPairs[edgeId];
1187 for (j = 0; j < edgeVerts[i]; ++j, ++cnt)
1189 int vId = vertIds[cnt];
1193 if (perId == periodicVerts.end())
1200 orientMap[edgeId] == orientMap[perEdgeId] ?
1201 vertMap[perEdgeId][(j+1)%2] : vertMap[perEdgeId][j];
1205 locVerts.count(perVertexId) > 0);
1207 periodicVerts[vId].push_back(ent);
1215 for (perIt = periodicVerts.begin();
1216 perIt != periodicVerts.end(); ++perIt)
1219 for (i = 0; i < perIt->second.size(); ++i)
1221 perIt2 = periodicVerts.find(perIt->second[i].id);
1222 ASSERTL0(perIt2 != periodicVerts.end(),
1223 "Couldn't find periodic vertex.");
1225 for (j = 0; j < perIt2->second.size(); ++j)
1227 if (perIt2->second[j].id == perIt->first)
1233 for (k = 0; k < perIt->second.size(); ++k)
1235 if (perIt2->second[j].id == perIt->second[k].id)
1244 perIt->second.push_back(perIt2->second[j]);
1252 for (perIt = periodicVerts.begin();
1253 perIt != periodicVerts.end(); ++perIt)
1255 if (locVerts.count(perIt->first) > 0)
1267 as<LocalRegions::Expansion1D>();
1271 if (traceEl->GetLeftAdjacentElementEdge () == -1 ||
1272 traceEl->GetRightAdjacentElementEdge() == -1)
1282 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
1288 fwd = traceGeomId == min(traceGeomId,pIt->second[0].id);
1292 int offset =
m_trace->GetPhys_Offset(traceEl->GetElmtId());
1295 GetTraceToUniversalMapUnique(offset) >= 0;
1299 else if (traceEl->GetLeftAdjacentElementEdge () != -1 &&
1300 traceEl->GetRightAdjacentElementEdge() != -1)
1304 (traceEl->GetLeftAdjacentElementExp().get()) ==
1309 ASSERTL2(
false,
"Unconnected trace element!");
1356 int cnt, n, e,
npts, phys_offset;
1375 GetNFwdLocTracePts();
1384 boost::unordered_map<int,pair<int,int> >
::iterator it3;
1390 for(cnt = n = 0; n < nexp; ++n)
1395 for(e = 0; e < exp2d->GetNedges(); ++e, ++cnt)
1397 int offset =
m_trace->GetPhys_Offset(
1398 elmtToTrace[n][e]->GetElmtId());
1402 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1403 field + phys_offset,
1404 e_tmp = Fwd + offset);
1408 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1409 field + phys_offset,
1410 e_tmp = Bwd + offset);
1430 GetBndCondTraceToGlobalTraceMap(cnt+e));
1448 "Method not set up for non-zero Neumann "
1449 "boundary condition");
1450 id2 =
m_trace->GetPhys_Offset(
1451 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1461 "Method not set up for this boundary condition.");
1485 "Field must be in physical state to extract trace space.");
1507 int n, e, offset, phys_offset;
1513 "input array is of insufficient length");
1516 for(n = 0; n < nexp; ++n)
1520 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1522 offset =
m_trace->GetPhys_Offset(
1523 elmtToTrace[n][e]->GetElmtId());
1524 (*m_exp)[n]->GetEdgePhysVals(e, elmtToTrace[n][e],
1525 inarray + phys_offset,
1526 e_tmp = outarray + offset);
1536 int e, n, offset, t_offset;
1544 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1546 t_offset =
GetTrace()->GetPhys_Offset(
1547 elmtToTrace[n][e]->GetElmtId());
1549 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1550 e,elmtToTrace[n][e],
1553 e_outarray = outarray+offset);
1584 m_trace->IProductWRTBase(Fn, Fcoeffs);
1591 int e, n, offset, t_offset;
1599 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1601 t_offset =
GetTrace()->GetPhys_Offset(
1602 elmtToTrace[n][e]->GetElmtId());
1603 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1604 e, elmtToTrace[n][e],
1606 e_outarray = outarray+offset);
1640 int e,n,offset, t_offset;
1648 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1650 t_offset =
GetTrace()->GetPhys_Offset(
1651 elmtToTrace[n][e]->GetElmtId());
1656 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1657 e, elmtToTrace[n][e], Fwd+t_offset,
1658 e_outarray = outarray+offset);
1662 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1663 e, elmtToTrace[n][e], Bwd+t_offset,
1664 e_outarray = outarray+offset);
1679 map<int, int> globalIdMap;
1692 globalIdMap[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
1702 if(ElmtID.num_elements() != nbcs)
1707 if(EdgeID.num_elements() != nbcs)
1719 as<LocalRegions::Expansion1D>();
1722 graph2D->GetElementsFromEdge(exp1d->GetGeom1D());
1724 ElmtID[cnt] = globalIdMap[(*tmp)[0]->
1725 m_Element->GetGlobalID()];
1726 EdgeID[cnt] = (*tmp)[0]->m_EdgeIndx;
1732 boost::shared_ptr<ExpList> &result)
1735 int offsetOld, offsetNew;
1737 std::vector<unsigned int> eIDs;
1743 for (cnt = n = 0; n < i; ++n)
1751 eIDs.push_back(ElmtID[cnt+n]);
1759 for (n = 0; n < result->GetExpSize(); ++n)
1761 nq =
GetExp(ElmtID[cnt+n])->GetTotPoints();
1763 offsetNew = result->GetPhys_Offset(n);
1765 tmp2 = result->UpdatePhys()+ offsetNew, 1);
1767 nq =
GetExp(ElmtID[cnt+n])->GetNcoeffs();
1769 offsetNew = result->GetCoeff_Offset(n);
1771 tmp2 = result->UpdateCoeffs()+ offsetNew, 1);
1803 int i,e,ncoeff_edge;
1813 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1817 edge_lambda = loc_lambda;
1827 int nEdges = (*m_exp)[i]->GetNedges();
1830 for(e = 0; e < nEdges; ++e)
1832 edgedir = (*m_exp)[eid]->GetEorient(e);
1833 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
1835 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
1836 elmtToTrace[eid][e]->SetCoeffsToOrientation(
1837 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
1838 edge_lambda = edge_lambda + ncoeff_edge;
1841 (*m_exp)[eid]->DGDeriv(dir,
1845 out_tmp = out_d+cnt);
1846 cnt += (*m_exp)[eid]->GetNcoeffs();
1862 int i,j,n,cnt,cnt1,nbndry;
1879 int GloBndDofs =
m_traceMap->GetNumGlobalBndCoeffs();
1880 int NumDirichlet =
m_traceMap->GetNumLocalDirBndCoeffs();
1901 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1910 for(cnt = cnt1 = n = 0; n < nexp; ++n)
1916 e_l = loc_lambda + cnt1;
1923 Floc =
Transpose(*(HDGLamToU->GetBlock(n,n)))*ElmtFce;
1942 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1951 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1961 if(GloBndDofs - NumDirichlet > 0)
1980 m_traceMap->GlobalToLocalBnd(BndSol,loc_lambda);
1983 out = (*InvHDGHelm)*F + (*HDGLamToU)*LocLambda;
2001 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2006 m_traceMap->GlobalToLocalBnd(inarray, loc_lambda);
2007 LocLambda = (*HDGHelm) * LocLambda;
2008 m_traceMap->AssembleBnd(loc_lambda,outarray);
2026 map<int, RobinBCInfoSharedPtr> returnval;
2042 for(e = 0; e < locExpList->GetExpSize(); ++e)
2047 Array_tmp = locExpList->GetPhys() +
2048 locExpList->GetPhys_Offset(e));
2049 elmtid = ElmtID[cnt+e];
2051 if(returnval.count(elmtid) != 0)
2053 rInfo->next = returnval.find(elmtid)->second;
2055 returnval[elmtid] = rInfo;
2087 int i,cnt,e,ncoeff_edge;
2094 int eid,nq_elmt, nm_elmt;
2095 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2100 edge_lambda = loc_lambda;
2107 nq_elmt = (*m_exp)[eid]->GetTotPoints();
2108 nm_elmt = (*m_exp)[eid]->GetNcoeffs();
2112 out_tmp = force + nm_elmt;
2115 int num_points0 = (*m_exp)[eid]->GetBasis(0)->GetNumPoints();
2116 int num_points1 = (*m_exp)[eid]->GetBasis(1)->GetNumPoints();
2117 int num_modes0 = (*m_exp)[eid]->GetBasis(0)->GetNumModes();
2118 int num_modes1 = (*m_exp)[eid]->GetBasis(1)->GetNumModes();
2123 int nEdges = (*m_exp)[i]->GetNedges();
2126 for(e = 0; e < (*m_exp)[eid]->GetNedges(); ++e)
2128 edgedir = (*m_exp)[eid]->GetEorient(e);
2129 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
2131 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
2132 elmtToTrace[eid][e]->SetCoeffsToOrientation(
2133 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
2134 edge_lambda = edge_lambda + ncoeff_edge;
2162 ASSERTL0(
false,
"Wrong shape type, HDG postprocessing is not implemented");
2168 (*m_exp)[eid]->DGDeriv(
2170 elmtToTrace[eid], edgeCoeffs, out_tmp);
2171 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2173 ppExp->IProductWRTDerivBase(0,qrhs,force);
2177 (*m_exp)[eid]->DGDeriv(
2179 elmtToTrace[eid], edgeCoeffs, out_tmp);
2181 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2183 ppExp->IProductWRTDerivBase(1,qrhs,out_tmp);
2188 (*m_exp)[eid]->BwdTrans(
2190 force[0] = (*m_exp)[eid]->Integral(qrhs);
2204 ppExp->BwdTrans(out.
GetPtr(), work);
2205 (*m_exp)[eid]->FwdTrans(work, tmp_coeffs = outarray +
m_coeff_offset[eid]);
2223 const std::string varName,
2233 for (i = 0; i < nbnd; ++i)
2239 npoints = locExpList->GetNpoints();
2247 locExpList->GetCoords(x0, x1, x2);
2251 locExpList->GetCoords(x0, x1, x2);
2258 string filebcs = boost::static_pointer_cast<
2269 boost::static_pointer_cast<
2272 m_dirichletCondition;
2274 condition.
Evaluate(x0, x1, x2, time,
2275 locExpList->UpdatePhys());
2278 locExpList->FwdTrans_BndConstrained(
2279 locExpList->GetPhys(),
2280 locExpList->UpdateCoeffs());
2285 string filebcs = boost::static_pointer_cast<
2296 boost::static_pointer_cast<
2300 condition.
Evaluate(x0, x1, x2, time,
2301 locExpList->UpdatePhys());
2304 locExpList->IProductWRTBase(
2305 locExpList->GetPhys(),
2306 locExpList->UpdateCoeffs());
2311 string filebcs = boost::static_pointer_cast<
2322 boost::static_pointer_cast<
2326 condition.
Evaluate(x0, x1, x2, time,
2327 locExpList->UpdatePhys());
2331 boost::static_pointer_cast<
2334 locExpList->IProductWRTBase(
2335 locExpList->GetPhys(),
2336 locExpList->UpdateCoeffs());
2341 locExpList->UpdatePhys());
2345 ASSERTL0(
false,
"This type of BC not implemented yet");
2355 locExpList->FwdTrans_IterPerExp(
2356 locExpList->GetPhys(),
2357 locExpList->UpdateCoeffs());
2361 ASSERTL0(
false,
"This type of BC not implemented yet");
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
const DNekScalBlkMatSharedPtr & GetBlockMatrix(const GlobalMatrixKey &gkey)
virtual void v_FillBndCondFromField()
const Array< OneD, const NekDouble > & GetCoeffs() const
This function returns (a reference to) the array (implemented as m_coeffs) containing all local expa...
virtual void v_ExtractTracePhys(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
This method extracts the trace (edges in 2D) from the field inarray and puts the values in outarray...
#define ASSERTL0(condition, msg)
virtual void v_Reset()
Reset geometry information, metrics, matrix managers and geometry information.
void FindPeriodicEdges(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic edges and vertices for the given graph.
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray)
int GetCoeff_Offset(int n) const
Get the start offset position for a global list of m_coeffs correspoinding to element n...
static ExpListSharedPtr NullExpListSharedPtr
void EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="", const NekDouble=NekConstants::kNekUnsetDouble, const NekDouble=NekConstants::kNekUnsetDouble)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::map< int, vector< PeriodicEntity > > PeriodicMap
bool isLocal
Flag specifying if this entity is local to this partition.
int GetPhys_Offset(int n) const
Get the start offset position for a global list of m_phys correspoinding to element n...
const BoundaryConditionCollection & GetBoundaryConditions(void) const
void ExtractFileBCs(const std::string &fileName, const std::string &varName, const boost::shared_ptr< ExpList > locExpList)
vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
void Fill(int n, const T alpha, T *x, const int incx)
Fill a vector with a constant value.
boost::shared_ptr< RobinBCInfo > RobinBCInfoSharedPtr
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
const boost::shared_ptr< LocalRegions::ExpansionVector > GetExp() const
This function returns the vector of elements in the expansion.
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
Lagrange Polynomials using the Gauss points .
virtual void v_GetBndElmtExpansion(int i, boost::shared_ptr< ExpList > &result)
PeriodicMap m_periodicEdges
A map which identifies pairs of periodic edges.
void BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
std::map< int, std::vector< unsigned int > > BndRegionOrdering
std::map< ConstFactorType, NekDouble > ConstFactorMap
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
virtual void v_AddFwdBwdTraceIntegral(const Array< OneD, const NekDouble > &Fwd, const Array< OneD, const NekDouble > &Bwd, Array< OneD, NekDouble > &outarray)
Add trace contributions into elemental coefficient spaces.
std::map< int, std::vector< unsigned int > > CompositeOrdering
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
boost::shared_ptr< MeshGraph2D > MeshGraph2DSharedPtr
int GetExpSize(void)
This function returns the number of elements in the expansion.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
Search through the edge expansions and identify which ones have Robin/Mixed type boundary conditions...
boost::shared_ptr< GlobalLinSys > GenGlobalBndLinSys(const GlobalLinSysKey &mkey, const AssemblyMapSharedPtr &locToGloMap)
Generate a GlobalLinSys from information provided by the key "mkey" and the mapping provided in LocTo...
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
Gauss Radau pinned at x=-1, .
virtual void v_HelmSolve(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const FlagList &flags, const StdRegions::ConstFactorMap &factors, const StdRegions::VarCoeffMap &varcoeff, const Array< OneD, const NekDouble > &dirForcing)
Principle Orthogonal Functions .
bool SameTypeOfBoundaryConditions(const DisContField2D &In)
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
Base class for all multi-elemental spectral/hp expansions.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
DisContField2D()
Default constructor.
The base class for all shapes.
boost::shared_ptr< ExpList > & GetTrace()
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
virtual void v_EvaluateBoundaryConditions(const NekDouble time=0.0, const std::string varName="", const NekDouble x2_in=NekConstants::kNekUnsetDouble, const NekDouble x3_in=NekConstants::kNekUnsetDouble)
boost::shared_ptr< ExpList1D > ExpList1DSharedPtr
Shared pointer to an ExpList1D object.
virtual ~DisContField2D()
Default destructor.
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
vector< int > m_periodicBwdCopy
boost::shared_ptr< SegGeom > SegGeomSharedPtr
std::set< int > m_boundaryEdges
A set storing the global IDs of any boundary edges.
int id
Geometry ID of entity.
bool m_physState
The state of the array m_phys.
NekDouble Evaluate() const
int m_ncoeffs
The total number of local degrees of freedom. m_ncoeffs .
Array< OneD, int > m_offset_elmt_id
Array containing the element id m_offset_elmt_id[n] that the n^th consecutive block of data in m_coef...
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Principle Orthogonal Functions .
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
SpatialDomains::MeshGraphSharedPtr m_graph
Mesh associated with this expansion list.
LibUtilities::SessionReaderSharedPtr m_session
Session.
Defines a specification for a set of points.
void Neg(int n, T *x, const int incx)
Negate x = -x.
boost::shared_ptr< Expansion > ExpansionSharedPtr
std::map< int, BoundaryConditionMapShPtr > BoundaryConditionCollection
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
boost::shared_ptr< GeometryVector > Composite
bool IsLeftAdjacentEdge(const int n, const int e)
virtual void v_Reset()
Reset this field, so that geometry information can be updated.
static const NekDouble kNekUnsetDouble
Describe a linear system.
std::map< int, Composite > CompositeMap
StdRegions::Orientation orient
Orientation of entity within higher dimensional entity.
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
Describes a matrix with ordering defined by a local to global map.
AssemblyMapDGSharedPtr m_traceMap
const Array< OneD, const NekDouble > & GetPhys() const
This function returns (a reference to) the array (implemented as m_phys) containing the function ev...
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
boost::shared_ptr< ElementEdgeVector > ElementEdgeVectorSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
LibUtilities::CommSharedPtr m_comm
Communicator.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
GlobalLinSysMapShPtr m_globalBndMat
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
vector< bool > m_leftAdjacentEdges
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
int GetNcoeffs(void) const
Returns the total number of local degrees of freedom .
virtual void v_GetFwdBwdTracePhys(const Array< OneD, const NekDouble > &field, Array< OneD, NekDouble > &Fwd, Array< OneD, NekDouble > &Bwd)
This method extracts the "forward" and "backward" trace data from the array field and puts the data i...
boost::shared_ptr< TriGeom > TriGeomSharedPtr
void EvaluateHDGPostProcessing(Array< OneD, NekDouble > &outarray)
Evaluate HDG post-processing to increase polynomial order of solution.
static SpatialDomains::BoundaryConditionShPtr GetBoundaryCondition(const SpatialDomains::BoundaryConditionCollection &collection, unsigned int index, const std::string &variable)
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
const BoundaryRegionCollection & GetBoundaryRegions(void) const
virtual void v_GeneralMatrixOp(const GlobalMatrixKey &gkey, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
Calculates the result of the multiplication of a global matrix of type specified by mkey with a vecto...
boost::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
boost::shared_ptr< Basis > BasisSharedPtr
T Vsum(int n, const T *x, const int incx)
Subtract return sum(x)
void Zero(int n, T *x, const int incx)
Zero vector.
boost::shared_ptr< StdExpansion > StdExpansionSharedPtr
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph2D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable, const bool DeclareCoeffPhysArrays=true)
This function discretises the boundary conditions by setting up a list of one-dimensional boundary ex...
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Set up a list of element IDs and edge IDs that link to the boundary conditions.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
boost::shared_ptr< Expansion1D > Expansion1DSharedPtr
NekDouble L2(const Array< OneD, const NekDouble > &inarray, const Array< OneD, const NekDouble > &soln=NullNekDouble1DArray)
This function calculates the error with respect to soln of the global spectral/hp element approximat...
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
NekDouble L2_DGDeriv(const int dir, const Array< OneD, const NekDouble > &soln)
Calculate the error of the derivative using the consistent DG evaluation of .
Describes the specification for a Basis.
Array< OneD, DataType > & GetPtr()
1D Gauss-Lobatto-Legendre quadrature points
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr