50 namespace MultiRegions
54 m_bndCondExpansions(),
62 const bool DeclareCoeffPhysArrays)
64 m_bndCondExpansions (In.m_bndCondExpansions),
65 m_bndConditions (In.m_bndConditions),
66 m_globalBndMat (In.m_globalBndMat),
67 m_traceMap (In.m_traceMap),
68 m_boundaryEdges (In.m_boundaryEdges),
69 m_periodicVerts (In.m_periodicVerts),
70 m_periodicEdges (In.m_periodicEdges),
71 m_periodicFwdCopy (In.m_periodicFwdCopy),
72 m_periodicBwdCopy (In.m_periodicBwdCopy),
73 m_leftAdjacentEdges (In.m_leftAdjacentEdges)
78 *boost::dynamic_pointer_cast<ExpList1D>(In.
m_trace),
79 DeclareCoeffPhysArrays);
86 const std::string &variable,
87 const bool SetUpJustDG,
88 const bool DeclareCoeffPhysArrays)
89 :
ExpList2D(pSession,graph2D,DeclareCoeffPhysArrays,variable),
90 m_bndCondExpansions(),
99 if(variable.compare(
"DefaultVar") != 0)
103 DeclareCoeffPhysArrays);
105 if (DeclareCoeffPhysArrays)
131 for(e = 0; e < locExpList->GetExpSize(); ++e)
134 (*m_exp)[ElmtID[cnt+e]]->
135 as<LocalRegions::Expansion2D>();
137 locExpList->GetExp(e)->
138 as<LocalRegions::Expansion1D>();
140 locExpList->GetExp(e)->
141 as<LocalRegions::Expansion> ();
143 exp2d->SetEdgeExp(EdgeID[cnt+e], exp);
144 exp1d->SetAdjacentElementExp(EdgeID[cnt+e], exp2d);
149 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
151 std::string ProjectStr =
153 if((ProjectStr ==
"MixedCGDG") ||
154 (ProjectStr ==
"Mixed_CG_Discontinuous"))
176 const std::string &variable,
177 const bool SetUpJustDG,
178 const bool DeclareCoeffPhysArrays)
184 if(variable.compare(
"DefaultVar") != 0)
189 if (DeclareCoeffPhysArrays)
217 for(e = 0; e < locExpList->GetExpSize(); ++e)
220 = (*m_exp)[ElmtID[cnt+e]]->
221 as<LocalRegions::Expansion2D>();
223 = locExpList->GetExp(e)->
224 as<LocalRegions::Expansion1D>();
226 = locExpList->GetExp(e)->
227 as<LocalRegions::Expansion> ();
229 exp2d->SetEdgeExp(EdgeID[cnt+e],exp);
230 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],exp2d);
236 if(
m_session->DefinesSolverInfo(
"PROJECTION"))
238 std::string ProjectStr =
241 if((ProjectStr ==
"MixedCGDG") ||
242 (ProjectStr ==
"Mixed_CG_Discontinuous"))
295 for(e = 0; e < locExpList->GetExpSize(); ++e)
298 = (*m_exp)[ElmtID[cnt+e]]->
299 as<LocalRegions::Expansion2D>();
301 = locExpList->GetExp(e)->
302 as<LocalRegions::Expansion1D>();
304 = locExpList->GetExp(e)->
305 as<LocalRegions::Expansion> ();
307 exp2d->SetEdgeExp(EdgeID[cnt+e],exp);
308 exp1d->SetAdjacentElementExp(EdgeID[cnt+e],exp2d);
330 "Routine currently only tested for HybridDGHelmholtz");
333 "The local to global map is not set up for the requested "
342 (*m_globalBndMat)[mkey] = glo_matrix;
346 glo_matrix = matrixIter->second;
385 &elmtToTrace = m_traceMap->GetElmtToTrace();
392 for (
int i = 0; i <
m_exp->size(); ++i)
394 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j)
401 exp2d->SetEdgeExp (j, exp );
402 exp1d->SetAdjacentElementExp(j, exp2d);
410 for (
int i = 0; i <
m_trace->GetExpSize(); ++i)
415 int offset =
m_trace->GetPhys_Offset(i);
416 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
422 if (traceGeomId != min(pIt->second[0].id, traceGeomId))
424 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
425 traceEl->GetLeftAdjacentElementEdge());
428 else if (m_traceMap->GetTraceToUniversalMapUnique(offset) < 0)
430 traceEl->GetLeftAdjacentElementExp()->NegateEdgeNormal(
431 traceEl->GetLeftAdjacentElementEdge());
446 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
453 boost::unordered_map<int,pair<int,int> > perEdgeToExpMap;
454 boost::unordered_map<int,pair<int,int> >
::iterator it2;
455 for (cnt = n = 0; n <
m_exp->size(); ++n)
457 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
460 (*
m_exp)[n]->GetGeom()->GetEid(e));
464 perEdgeToExpMap[it->first] = make_pair(n, e);
472 for (
int i = 0; i <
m_exp->size(); ++i)
474 for (
int j = 0; j < (*m_exp)[i]->GetNedges(); ++j, ++cnt)
482 for (
int n = 0; n <
m_exp->size(); ++n)
484 for (
int e = 0; e < (*m_exp)[n]->GetNedges(); ++e, ++cnt)
486 int edgeGeomId = (*m_exp)[n]->GetGeom()->GetEid(e);
487 int offset =
m_trace->GetPhys_Offset(
488 elmtToTrace[n][e]->GetElmtId());
496 it2 = perEdgeToExpMap.find(ent.
id);
498 if (it2 == perEdgeToExpMap.end())
500 if (
m_session->GetComm()->GetRowComm()->GetSize() > 1 &&
507 ASSERTL1(
false,
"Periodic edge not found!");
512 "Periodic edge in non-forward space?");
514 int offset2 =
m_trace->GetPhys_Offset(
515 elmtToTrace[it2->second.first][it2->second.second]->
520 int nquad = elmtToTrace[n][e]->GetNumPoints(0);
522 vector<int> tmpBwd(nquad);
523 vector<int> tmpFwd(nquad);
527 for (
int i = 0; i < nquad; ++i)
529 tmpBwd[i] = offset2 + i;
530 tmpFwd[i] = offset + i;
535 for (
int i = 0; i < nquad; ++i)
537 tmpBwd[i] = offset2 + i;
538 tmpFwd[i] = offset + nquad - i - 1;
542 for (
int i = 0; i < nquad; ++i)
562 bool returnval =
true;
582 int vSame = (returnval?1:0);
606 const std::string &variable,
607 const bool DeclareCoeffPhysArrays)
616 SpatialDomains::BoundaryRegionCollection::const_iterator it;
619 for (it = bregions.begin(); it != bregions.end(); ++it)
637 for (it = bregions.begin(); it != bregions.end(); ++it)
645 DeclareCoeffPhysArrays, variable);
648 m_bndConditions[cnt] = bc;
651 std::string type = m_bndConditions[cnt]->GetUserDefined();
656 if((bc->GetBoundaryConditionType() !=
658 boost::iequals(type,
"I") ||
659 boost::iequals(type,
"CalcBC"))
682 const std::string &variable)
689 = boost::dynamic_pointer_cast<
691 SpatialDomains::BoundaryRegionCollection::const_iterator it;
705 map<int,int> perComps;
706 map<int,vector<int> > allVerts;
708 map<int,StdRegions::Orientation> allEdges;
710 int region1ID, region2ID, i, j, k, cnt;
714 for(i = 0; i < (*m_exp).size(); ++i)
716 for(j = 0; j < (*m_exp)[i]->GetNverts(); ++j)
718 int id = (*m_exp)[i]->GetGeom()->GetVid(j);
724 for (it = bregions.begin(); it != bregions.end(); ++it)
727 bconditions, it->first, variable);
729 if (locBCond->GetBoundaryConditionType()
736 region1ID = it->first;
737 region2ID = boost::static_pointer_cast<
739 locBCond)->m_connectedBoundaryRegion;
744 if (vComm->GetSize() == 1)
746 cId1 = it->second->begin()->first;
747 cId2 = bregions.find(region2ID)->second->begin()->first;
751 cId1 = bndRegOrder.find(region1ID)->second[0];
752 cId2 = bndRegOrder.find(region2ID)->second[0];
756 "Boundary region "+boost::lexical_cast<
string>(
757 region1ID)+
" should only contain 1 composite.");
762 vector<unsigned int> tmpOrder;
764 for (i = 0; i < c->size(); ++i)
767 boost::dynamic_pointer_cast<
769 ASSERTL0(segGeom,
"Unable to cast to shared ptr");
772 graph2D->GetElementsFromEdge(segGeom);
774 "The periodic boundaries belong to "
775 "more than one element of the mesh");
779 (*elmt)[0]->m_Element);
781 allEdges[(*c)[i]->GetGlobalID()] =
782 geom->GetEorient((*elmt)[0]->m_EdgeIndx);
786 if (vComm->GetSize() == 1)
788 tmpOrder.push_back((*c)[i]->GetGlobalID());
791 vector<int> vertList(2);
792 vertList[0] = segGeom->GetVid(0);
793 vertList[1] = segGeom->GetVid(1);
794 allVerts[(*c)[i]->GetGlobalID()] = vertList;
797 if (vComm->GetSize() == 1)
799 compOrder[it->second->begin()->first] = tmpOrder;
804 if (perComps.count(cId1) == 0)
806 if (perComps.count(cId2) == 0)
808 perComps[cId1] = cId2;
812 std::stringstream ss;
813 ss <<
"Boundary region " << cId2 <<
" should be "
814 <<
"periodic with " << perComps[cId2] <<
" but "
815 <<
"found " << cId1 <<
" instead!";
816 ASSERTL0(perComps[cId2] == cId1, ss.str());
821 std::stringstream ss;
822 ss <<
"Boundary region " << cId1 <<
" should be "
823 <<
"periodic with " << perComps[cId1] <<
" but "
824 <<
"found " << cId2 <<
" instead!";
825 ASSERTL0(perComps[cId1] == cId1, ss.str());
830 int n = vComm->GetSize();
831 int p = vComm->GetRank();
837 edgecounts[p] = allEdges.size();
841 for (i = 1; i < n; ++i)
843 edgeoffset[i] = edgeoffset[i-1] + edgecounts[i-1];
853 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
855 edgeIds [edgeoffset[p] + i ] = sIt->first;
856 edgeOrient[edgeoffset[p] + i ] = sIt->second;
857 edgeVerts [edgeoffset[p] + i++] = allVerts[sIt->first].size();
879 for (i = 0; i < n; ++i)
881 if (edgecounts[i] > 0)
884 edgecounts[i], edgeVerts + edgeoffset[i], 1);
893 for (i = 1; i < n; ++i)
895 vertoffset[i] = vertoffset[i-1] + procVerts[i-1];
899 for (i = 0, sIt = allEdges.begin(); sIt != allEdges.end(); ++sIt)
901 for (j = 0; j < allVerts[sIt->first].size(); ++j)
903 vertIds[vertoffset[p] + i++] = allVerts[sIt->first][j];
910 map<int, StdRegions::Orientation> orientMap;
911 map<int, vector<int> > vertMap;
913 for (cnt = i = 0; i < totEdges; ++i)
915 ASSERTL0(orientMap.count(edgeIds[i]) == 0,
916 "Already found edge in orientation map!");
919 vector<int> verts(edgeVerts[i]);
921 for (j = 0; j < edgeVerts[i]; ++j)
923 verts[j] = vertIds[cnt++];
925 vertMap[edgeIds[i]] = verts;
932 map<int,int>::const_iterator oIt;
934 map<int,int> allCompPairs;
943 for (cIt = perComps.begin(); cIt != perComps.end(); ++cIt)
946 const int id1 = cIt->first;
947 const int id2 = cIt->second;
948 std::string id1s = boost::lexical_cast<
string>(id1);
949 std::string id2s = boost::lexical_cast<
string>(id2);
951 if (compMap.count(id1) > 0)
956 if (compMap.count(id2) > 0)
962 "Both composites not found on this process!");
967 map<int,int> compPairs;
970 "Unable to find composite "+id1s+
" in order map.");
972 "Unable to find composite "+id2s+
" in order map.");
973 ASSERTL0(compOrder[id1].size() == compOrder[id2].size(),
974 "Periodic composites "+id1s+
" and "+id2s+
975 " should have the same number of elements.");
977 "Periodic composites "+id1s+
" and "+id2s+
981 for (i = 0; i < compOrder[id1].size(); ++i)
983 int eId1 = compOrder[id1][i];
984 int eId2 = compOrder[id2][i];
986 ASSERTL0(compPairs.count(eId1) == 0,
989 if (compPairs.count(eId2) != 0)
991 ASSERTL0(compPairs[eId2] == eId1,
"Pairing incorrect");
993 compPairs[eId1] = eId2;
1000 for (i = 0; i < 2; ++i)
1007 if (c[i]->size() > 0)
1009 for (j = 0; j < c[i]->size(); ++j)
1011 locEdges.insert(c[i]->at(j)->GetGlobalID());
1017 for (pIt = compPairs.begin(); pIt != compPairs.end(); ++pIt)
1019 int ids [2] = {pIt->first, pIt->second};
1020 bool local[2] = {locEdges.count(pIt->first) > 0,
1021 locEdges.count(pIt->second) > 0};
1023 ASSERTL0(orientMap.count(ids[0]) > 0 &&
1024 orientMap.count(ids[1]) > 0,
1025 "Unable to find edge in orientation map.");
1027 allCompPairs[pIt->first ] = pIt->second;
1028 allCompPairs[pIt->second] = pIt->first;
1030 for (i = 0; i < 2; ++i)
1037 int other = (i+1) % 2;
1040 orientMap[ids[i]] == orientMap[ids[other]] ?
1049 for (i = 0; i < 2; ++i)
1051 int other = (i+1) % 2;
1054 orientMap[ids[i]] == orientMap[ids[other]] ?
1059 vector<int> perVerts1 = vertMap[ids[i]];
1060 vector<int> perVerts2 = vertMap[ids[other]];
1062 map<int, pair<int, bool> > tmpMap;
1066 tmpMap[perVerts1[0]] = make_pair(
1067 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1068 tmpMap[perVerts1[1]] = make_pair(
1069 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1073 tmpMap[perVerts1[0]] = make_pair(
1074 perVerts2[1], locVerts.count(perVerts2[1]) > 0);
1075 tmpMap[perVerts1[1]] = make_pair(
1076 perVerts2[0], locVerts.count(perVerts2[0]) > 0);
1079 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1084 mIt->second.second);
1088 if (perIt == periodicVerts.end())
1090 periodicVerts[mIt->first].push_back(ent2);
1091 perIt = periodicVerts.find(mIt->first);
1096 for (j = 0; j < perIt->second.size(); ++j)
1098 if (perIt->second[j].id == mIt->second.first)
1107 perIt->second.push_back(ent2);
1116 pairSizes[p] = allCompPairs.size();
1124 for (i = 1; i < n; ++i)
1126 pairOffsets[i] = pairOffsets[i-1] + pairSizes[i-1];
1132 cnt = pairOffsets[p];
1134 for (pIt = allCompPairs.begin(); pIt != allCompPairs.end(); ++pIt)
1136 first [cnt ] = pIt->first;
1137 second[cnt++] = pIt->second;
1143 allCompPairs.clear();
1145 for(cnt = 0; cnt < totPairSizes; ++cnt)
1147 allCompPairs[first[cnt]] = second[cnt];
1153 for (cnt = i = 0; i < totEdges; ++i)
1155 int edgeId = edgeIds[i];
1157 ASSERTL0(allCompPairs.count(edgeId) > 0,
1158 "Unable to find matching periodic edge.");
1160 int perEdgeId = allCompPairs[edgeId];
1162 for (j = 0; j < edgeVerts[i]; ++j, ++cnt)
1164 int vId = vertIds[cnt];
1168 if (perId == periodicVerts.end())
1175 orientMap[edgeId] == orientMap[perEdgeId] ?
1176 vertMap[perEdgeId][(j+1)%2] : vertMap[perEdgeId][j];
1180 locVerts.count(perVertexId) > 0);
1182 periodicVerts[vId].push_back(ent);
1190 for (perIt = periodicVerts.begin();
1191 perIt != periodicVerts.end(); ++perIt)
1194 for (i = 0; i < perIt->second.size(); ++i)
1196 perIt2 = periodicVerts.find(perIt->second[i].id);
1197 ASSERTL0(perIt2 != periodicVerts.end(),
1198 "Couldn't find periodic vertex.");
1200 for (j = 0; j < perIt2->second.size(); ++j)
1202 if (perIt2->second[j].id == perIt->first)
1208 for (k = 0; k < perIt->second.size(); ++k)
1210 if (perIt2->second[j].id == perIt->second[k].id)
1219 perIt->second.push_back(perIt2->second[j]);
1227 for (perIt = periodicVerts.begin();
1228 perIt != periodicVerts.end(); ++perIt)
1230 if (locVerts.count(perIt->first) > 0)
1242 as<LocalRegions::Expansion1D>();
1246 if (traceEl->GetLeftAdjacentElementEdge () == -1 ||
1247 traceEl->GetRightAdjacentElementEdge() == -1)
1257 int traceGeomId = traceEl->GetGeom1D()->GetGlobalID();
1263 fwd = traceGeomId == min(traceGeomId,pIt->second[0].id);
1267 int offset =
m_trace->GetPhys_Offset(traceEl->GetElmtId());
1270 GetTraceToUniversalMapUnique(offset) >= 0;
1274 else if (traceEl->GetLeftAdjacentElementEdge () != -1 &&
1275 traceEl->GetRightAdjacentElementEdge() != -1)
1279 (traceEl->GetLeftAdjacentElementExp().get()) ==
1284 ASSERTL2(
false,
"Unconnected trace element!");
1333 int cnt, n, e,
npts, phys_offset;
1336 boost::unordered_map<int,pair<int,int> >
::iterator it3;
1346 for(cnt = n = 0; n < nexp; ++n)
1351 for(e = 0; e < exp2d->GetNedges(); ++e, ++cnt)
1353 int offset =
m_trace->GetPhys_Offset(
1354 elmtToTrace[n][e]->GetElmtId());
1358 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1359 field + phys_offset,
1360 e_tmp = Fwd + offset);
1364 exp2d->GetEdgePhysVals(e, elmtToTrace[n][e],
1365 field + phys_offset,
1366 e_tmp = Bwd + offset);
1383 id2 =
m_trace->GetPhys_Offset(
1384 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1402 "Method not set up for non-zero Neumann "
1403 "boundary condition");
1404 id2 =
m_trace->GetPhys_Offset(
1405 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1415 "Method not set up for this boundary condition.");
1439 "Field must be in physical state to extract trace space.");
1461 int n, e, offset, phys_offset;
1467 "input array is of insufficient length");
1470 for(n = 0; n < nexp; ++n)
1474 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1476 offset =
m_trace->GetPhys_Offset(
1477 elmtToTrace[n][e]->GetElmtId());
1478 (*m_exp)[n]->GetEdgePhysVals(e, elmtToTrace[n][e],
1479 inarray + phys_offset,
1480 e_tmp = outarray + offset);
1490 int e, n, offset, t_offset;
1498 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1500 t_offset =
GetTrace()->GetPhys_Offset(
1501 elmtToTrace[n][e]->GetElmtId());
1503 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1504 e,elmtToTrace[n][e],
1507 e_outarray = outarray+offset);
1533 int e, n, offset, t_offset;
1541 for(e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1543 t_offset =
GetTrace()->GetPhys_Offset(
1544 elmtToTrace[n][e]->GetElmtId());
1545 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1546 e, elmtToTrace[n][e], Fn+t_offset,
1547 e_outarray = outarray+offset);
1580 int e,n,offset, t_offset;
1588 for (e = 0; e < (*m_exp)[n]->GetNedges(); ++e)
1590 t_offset =
GetTrace()->GetPhys_Offset(
1591 elmtToTrace[n][e]->GetElmtId());
1596 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1597 e, elmtToTrace[n][e], Fwd+t_offset,
1598 e_outarray = outarray+offset);
1602 (*m_exp)[n]->AddEdgeNormBoundaryInt(
1603 e, elmtToTrace[n][e], Bwd+t_offset,
1604 e_outarray = outarray+offset);
1619 map<int, int> globalIdMap;
1632 globalIdMap[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
1642 if(ElmtID.num_elements() != nbcs)
1647 if(EdgeID.num_elements() != nbcs)
1659 as<LocalRegions::Expansion1D>();
1662 graph2D->GetElementsFromEdge(exp1d->GetGeom1D());
1664 ElmtID[cnt] = globalIdMap[(*tmp)[0]->
1665 m_Element->GetGlobalID()];
1666 EdgeID[cnt] = (*tmp)[0]->m_EdgeIndx;
1699 int i,e,ncoeff_edge;
1709 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1713 edge_lambda = loc_lambda;
1723 int nEdges = (*m_exp)[i]->GetNedges();
1726 for(e = 0; e < nEdges; ++e)
1728 edgedir = (*m_exp)[eid]->GetEorient(e);
1729 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
1731 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
1732 elmtToTrace[eid][e]->SetCoeffsToOrientation(
1733 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
1734 edge_lambda = edge_lambda + ncoeff_edge;
1737 (*m_exp)[eid]->DGDeriv(dir,
1741 out_tmp = out_d+cnt);
1742 cnt += (*m_exp)[eid]->GetNcoeffs();
1758 int i,j,n,cnt,cnt1,nbndry;
1775 int GloBndDofs =
m_traceMap->GetNumGlobalBndCoeffs();
1776 int NumDirichlet =
m_traceMap->GetNumLocalDirBndCoeffs();
1797 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1806 for(cnt = cnt1 = n = 0; n < nexp; ++n)
1812 e_l = loc_lambda + cnt1;
1819 Floc =
Transpose(*(HDGLamToU->GetBlock(n,n)))*ElmtFce;
1838 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1847 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
1857 if(GloBndDofs - NumDirichlet > 0)
1876 m_traceMap->GlobalToLocalBnd(BndSol,loc_lambda);
1879 out = (*InvHDGHelm)*F + (*HDGLamToU)*LocLambda;
1897 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1902 m_traceMap->GlobalToLocalBnd(inarray, loc_lambda);
1903 LocLambda = (*HDGHelm) * LocLambda;
1904 m_traceMap->AssembleBnd(loc_lambda,outarray);
1922 map<int, RobinBCInfoSharedPtr> returnval;
1938 for(e = 0; e < locExpList->GetExpSize(); ++e)
1943 Array_tmp = locExpList->GetPhys() +
1944 locExpList->GetPhys_Offset(e));
1945 elmtid = ElmtID[cnt+e];
1947 if(returnval.count(elmtid) != 0)
1949 rInfo->next = returnval.find(elmtid)->second;
1951 returnval[elmtid] = rInfo;
1983 int i,cnt,e,ncoeff_edge;
1990 int eid,nq_elmt, nm_elmt;
1991 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
1996 edge_lambda = loc_lambda;
2003 nq_elmt = (*m_exp)[eid]->GetTotPoints();
2004 nm_elmt = (*m_exp)[eid]->GetNcoeffs();
2008 out_tmp = force + nm_elmt;
2011 int num_points0 = (*m_exp)[eid]->GetBasis(0)->GetNumPoints();
2012 int num_points1 = (*m_exp)[eid]->GetBasis(1)->GetNumPoints();
2013 int num_modes0 = (*m_exp)[eid]->GetBasis(0)->GetNumModes();
2014 int num_modes1 = (*m_exp)[eid]->GetBasis(1)->GetNumModes();
2019 int nEdges = (*m_exp)[i]->GetNedges();
2022 for(e = 0; e < (*m_exp)[eid]->GetNedges(); ++e)
2024 edgedir = (*m_exp)[eid]->GetEorient(e);
2025 ncoeff_edge = elmtToTrace[eid][e]->GetNcoeffs();
2027 Vmath::Vcopy(ncoeff_edge, edge_lambda, 1, edgeCoeffs[e], 1);
2028 elmtToTrace[eid][e]->SetCoeffsToOrientation(
2029 edgedir, edgeCoeffs[e], edgeCoeffs[e]);
2030 edge_lambda = edge_lambda + ncoeff_edge;
2058 ASSERTL0(
false,
"Wrong shape type, HDG postprocessing is not implemented");
2077 (*m_exp)[eid]->DGDeriv(
2079 elmtToTrace[eid], edgeCoeffs, out_tmp);
2080 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2082 ppExp->IProductWRTDerivBase(0,qrhs,force);
2086 (*m_exp)[eid]->DGDeriv(
2088 elmtToTrace[eid], edgeCoeffs, out_tmp);
2090 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2092 ppExp->IProductWRTDerivBase(1,qrhs,out_tmp);
2097 (*m_exp)[eid]->BwdTrans(
2099 force[0] = (*m_exp)[eid]->Integral(qrhs);
2113 ppExp->BwdTrans(out.
GetPtr(), work);
2114 (*m_exp)[eid]->FwdTrans(work, tmp_coeffs = outarray +
m_coeff_offset[eid]);
2132 const std::string varName,
2142 for (i = 0; i < nbnd; ++i)
2148 npoints = locExpList->GetNpoints();
2156 locExpList->GetCoords(x0, x1, x2);
2160 locExpList->GetCoords(x0, x1, x2);
2167 string filebcs = boost::static_pointer_cast<
2178 boost::static_pointer_cast<
2181 m_dirichletCondition;
2183 condition.
Evaluate(x0, x1, x2, time,
2184 locExpList->UpdatePhys());
2187 locExpList->FwdTrans_BndConstrained(
2188 locExpList->GetPhys(),
2189 locExpList->UpdateCoeffs());
2194 string filebcs = boost::static_pointer_cast<
2205 boost::static_pointer_cast<
2209 condition.
Evaluate(x0, x1, x2, time,
2210 locExpList->UpdatePhys());
2213 locExpList->IProductWRTBase(
2214 locExpList->GetPhys(),
2215 locExpList->UpdateCoeffs());
2220 string filebcs = boost::static_pointer_cast<
2231 boost::static_pointer_cast<
2235 condition.
Evaluate(x0, x1, x2, time,
2236 locExpList->UpdatePhys());
2240 boost::static_pointer_cast<
2243 locExpList->IProductWRTBase(
2244 locExpList->GetPhys(),
2245 locExpList->UpdateCoeffs());
2250 locExpList->UpdatePhys());
2254 ASSERTL0(
false,
"This type of BC not implemented yet");
2264 locExpList->FwdTrans_IterPerExp(
2265 locExpList->GetPhys(),
2266 locExpList->UpdateCoeffs());
2270 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()
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
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
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.
The base class for all shapes.
boost::shared_ptr< ExpList > & GetTrace()
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
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
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
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.
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
boost::shared_ptr< Expansion > ExpansionSharedPtr
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
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