46 #include <boost/assign/std/vector.hpp>
47 #include <boost/tuple/tuple.hpp>
53 namespace MultiRegions
65 DisContField3D::DisContField3D() :
67 m_bndCondExpansions (),
80 const std::string &variable,
81 const bool SetUpJustDG)
82 :
ExpList3D (pSession, graph3D, variable),
83 m_bndCondExpansions(),
88 if (variable.compare(
"DefaultVar") != 0)
115 for(f = 0; f < locExpList->GetExpSize(); ++f)
118 = (*m_exp)[ElmtID[cnt+f]]->
119 as<LocalRegions::Expansion3D>();
121 = locExpList->GetExp(f)->
122 as<LocalRegions::Expansion2D>();
124 exp3d->SetFaceExp(FaceID[cnt+f],exp2d);
125 exp2d->SetAdjacentElementExp(FaceID[cnt+f],exp3d);
139 const std::string &variable,
140 const bool SetUpJustDG)
170 for(f = 0; f < locExpList->GetExpSize(); ++f)
173 = (*m_exp)[ElmtID[cnt+f]]->
174 as<LocalRegions::Expansion3D>();
176 = locExpList->GetExp(f)->
177 as<LocalRegions::Expansion2D>();
179 exp3d->SetFaceExp(FaceID[cnt+f],exp2d);
180 exp2d->SetAdjacentElementExp(FaceID[cnt+f],exp3d);
215 for(f = 0; f < locExpList->GetExpSize(); ++f)
218 = (*m_exp)[ElmtID[cnt+f]]->
219 as<LocalRegions::Expansion3D>();
221 = locExpList->GetExp(f)->
222 as<LocalRegions::Expansion2D>();
224 exp3d->SetFaceExp(FaceID[cnt+f], exp2d);
225 exp2d->SetAdjacentElementExp(FaceID[cnt+f], exp3d);
231 if (
m_session->DefinesSolverInfo(
"PROJECTION"))
233 std::string ProjectStr =
235 if (ProjectStr ==
"MixedCGDG" ||
236 ProjectStr ==
"Mixed_CG_Discontinuous")
258 m_bndCondExpansions (In.m_bndCondExpansions),
259 m_bndConditions (In.m_bndConditions),
260 m_globalBndMat (In.m_globalBndMat),
261 m_trace (In.m_trace),
262 m_traceMap (In.m_traceMap),
263 m_locTraceToTraceMap (In.m_locTraceToTraceMap),
264 m_periodicFaces (In.m_periodicFaces),
265 m_periodicEdges (In.m_periodicEdges),
266 m_periodicVerts (In.m_periodicVerts)
281 "Routine currently only tested for HybridDGHelmholtz");
284 "The local to global map is not set up for the requested "
293 (*m_globalBndMat)[mkey] = glo_matrix;
297 glo_matrix = matrixIter->second;
324 bool UseGenSegExp =
true;
343 for (
int i = 0; i <
m_exp->size(); ++i)
345 for (
int j = 0; j < (*m_exp)[i]->GetNfaces(); ++j)
351 exp3d->SetFaceExp (j, exp2d);
360 for (
int i = 0; i <
m_trace->GetExpSize(); ++i)
365 int offset =
m_trace->GetPhys_Offset(i);
366 int traceGeomId = traceEl->GetGeom2D()->GetGlobalID();
372 if (traceGeomId != min(pIt->second[0].id, traceGeomId))
374 traceEl->GetLeftAdjacentElementExp()->NegateFaceNormal(
375 traceEl->GetLeftAdjacentElementFace());
378 else if (
m_traceMap->GetTraceToUniversalMapUnique(offset) < 0)
380 traceEl->GetLeftAdjacentElementExp()->NegateFaceNormal(
381 traceEl->GetLeftAdjacentElementFace());
396 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
403 boost::unordered_map<int,pair<int,int> > perFaceToExpMap;
404 boost::unordered_map<int,pair<int,int> >
::iterator it2;
407 for (
int n = 0; n <
m_exp->size(); ++n)
410 for (
int e = 0; e < exp3d->GetNfaces(); ++e, ++cnt)
413 exp3d->GetGeom3D()->GetFid(e));
417 perFaceToExpMap[it->first] = make_pair(n, e);
425 for (
int i = 0; i <
m_exp->size(); ++i)
427 for (
int j = 0; j < (*m_exp)[i]->GetNfaces(); ++j, ++cnt)
435 for (
int n = 0; n <
m_exp->size(); ++n)
438 for (
int e = 0; e < exp3d->GetNfaces(); ++e, ++cnt)
440 int faceGeomId = exp3d->
GetGeom3D()->GetFid(e);
441 int offset =
m_trace->GetPhys_Offset(
442 elmtToTrace[n][e]->GetElmtId());
450 it2 = perFaceToExpMap.find(ent.
id);
452 if (it2 == perFaceToExpMap.end())
454 if (
m_session->GetComm()->GetSize() > 1 &&
461 ASSERTL1(
false,
"Periodic edge not found!");
466 "Periodic face in non-forward space?");
468 int offset2 =
m_trace->GetPhys_Offset(
469 elmtToTrace[it2->second.first][it2->second.second]->
474 int nquad1 = elmtToTrace[n][e]->GetNumPoints(0);
475 int nquad2 = elmtToTrace[n][e]->GetNumPoints(1);
477 vector<int> tmpBwd(nquad1*nquad2);
478 vector<int> tmpFwd(nquad1*nquad2);
485 for (
int i = 0; i < nquad2; ++i)
487 for (
int j = 0; j < nquad1; ++j)
489 tmpBwd[i*nquad1+j] = offset2 + i*nquad1+j;
490 tmpFwd[i*nquad1+j] = offset + j*nquad2+i;
496 for (
int i = 0; i < nquad2; ++i)
498 for (
int j = 0; j < nquad1; ++j)
500 tmpBwd[i*nquad1+j] = offset2 + i*nquad1+j;
501 tmpFwd[i*nquad1+j] = offset + i*nquad1+j;
512 for (
int i = 0; i < nquad2; ++i)
514 for (
int j = 0; j < nquad1/2; ++j)
516 swap(tmpFwd[i*nquad1 + j],
517 tmpFwd[i*nquad1 + nquad1-j-1]);
528 for (
int j = 0; j < nquad1; ++j)
530 for (
int i = 0; i < nquad2/2; ++i)
532 swap(tmpFwd[i*nquad1 + j],
533 tmpFwd[(nquad2-i-1)*nquad1 + j]);
538 for (
int i = 0; i < nquad1*nquad2; ++i)
564 bool returnval =
true;
584 int vSame = returnval ? 1 : 0;
605 const std::string &variable)
615 SpatialDomains::BoundaryRegionCollection::const_iterator it;
618 for (it = bregions.begin(); it != bregions.end(); ++it)
622 if (boundaryCondition->GetBoundaryConditionType() !=
635 for (it = bregions.begin(); it != bregions.end(); ++it)
638 bconditions, it->first, variable);
640 if(locBCond->GetBoundaryConditionType()
648 if(locBCond->GetBoundaryConditionType() !=
655 m_bndConditions[cnt++] = locBCond;
669 const std::string &variable)
676 = boost::dynamic_pointer_cast<
678 SpatialDomains::BoundaryRegionCollection::const_iterator it;
701 map<int,int> perComps;
702 map<int,vector<int> > allVerts;
703 map<int,SpatialDomains::PointGeomVector> allCoord;
704 map<int,vector<int> > allEdges;
705 map<int,vector<StdRegions::Orientation> > allOrient;
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);
722 for(j = 0; j < (*m_exp)[i]->GetNedges(); ++j)
724 int id = (*m_exp)[i]->GetGeom()->GetEid(j);
732 for (it = bregions.begin(); it != bregions.end(); ++it)
735 bconditions, it->first, variable);
737 if (locBCond->GetBoundaryConditionType()
744 region1ID = it->first;
745 region2ID = boost::static_pointer_cast<
747 locBCond)->m_connectedBoundaryRegion;
751 "Boundary region "+boost::lexical_cast<
string>(
752 region1ID)+
" should only contain 1 composite.");
760 if (vComm->GetSize() == 1)
762 cId1 = it->second->begin()->first;
763 cId2 = bregions.find(region2ID)->second->begin()->first;
767 cId1 = bndRegOrder.find(region1ID)->second[0];
768 cId2 = bndRegOrder.find(region2ID)->second[0];
772 vector<unsigned int> tmpOrder;
778 for (i = 0; i < c->size(); ++i)
781 boost::dynamic_pointer_cast<
783 ASSERTL1(faceGeom,
"Unable to cast to shared ptr");
786 int faceId = (*c)[i]->GetGlobalID();
787 locFaces.insert(faceId);
791 if (vComm->GetSize() == 1)
793 tmpOrder.push_back((*c)[i]->GetGlobalID());
798 vector<int> vertList, edgeList;
800 vector<StdRegions::Orientation> orientVec;
801 for (j = 0; j < faceGeom->GetNumVerts(); ++j)
803 vertList .push_back(faceGeom->GetVid (j));
804 edgeList .push_back(faceGeom->GetEid (j));
805 coordVec .push_back(faceGeom->GetVertex(j));
806 orientVec.push_back(faceGeom->GetEorient(j));
809 allVerts [faceId] = vertList;
810 allEdges [faceId] = edgeList;
811 allCoord [faceId] = coordVec;
812 allOrient[faceId] = orientVec;
817 if (vComm->GetSize() == 1)
819 compOrder[it->second->begin()->first] = tmpOrder;
825 if (perComps.count(cId1) == 0)
827 if (perComps.count(cId2) == 0)
829 perComps[cId1] = cId2;
833 std::stringstream ss;
834 ss <<
"Boundary region " << cId2 <<
" should be "
835 <<
"periodic with " << perComps[cId2] <<
" but "
836 <<
"found " << cId1 <<
" instead!";
837 ASSERTL0(perComps[cId2] == cId1, ss.str());
842 std::stringstream ss;
843 ss <<
"Boundary region " << cId1 <<
" should be "
844 <<
"periodic with " << perComps[cId1] <<
" but "
845 <<
"found " << cId2 <<
" instead!";
846 ASSERTL0(perComps[cId1] == cId1, ss.str());
852 int n = vComm->GetSize();
853 int p = vComm->GetRank();
861 facecounts[p] = locFaces.size();
867 for (i = 1; i < n; ++i)
869 faceoffset[i] = faceoffset[i-1] + facecounts[i-1];
884 for (i = 0, sIt = locFaces.begin(); sIt != locFaces.end(); ++sIt)
886 faceIds [faceoffset[p] + i ] = *sIt;
887 faceVerts[faceoffset[p] + i++] = allVerts[*sIt].size();
910 for (i = 0; i < n; ++i)
912 if (facecounts[i] > 0)
915 facecounts[i], faceVerts + faceoffset[i], 1);
926 for (i = 1; i < n; ++i)
928 vertoffset[i] = vertoffset[i-1] + procVerts[i-1];
942 for (cnt = 0, sIt = locFaces.begin();
943 sIt != locFaces.end(); ++sIt)
945 for (j = 0; j < allVerts[*sIt].size(); ++j)
947 int vertId = allVerts[*sIt][j];
948 vertIds[vertoffset[p] + cnt ] = vertId;
949 vertX [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(0);
950 vertY [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(1);
951 vertZ [vertoffset[p] + cnt ] = (*allCoord[*sIt][j])(2);
952 edgeIds[vertoffset[p] + cnt ] = allEdges [*sIt][j];
953 edgeOrt[vertoffset[p] + cnt++] = allOrient[*sIt][j];
968 map<int, vector<int> > vertMap;
969 map<int, vector<int> > edgeMap;
970 map<int, SpatialDomains::PointGeomVector> coordMap;
976 map<int, SpatialDomains::PointGeomSharedPtr> vCoMap;
977 map<int, pair<int, int> > eIdMap;
979 for (cnt = i = 0; i < totFaces; ++i)
981 vector<int> edges(faceVerts[i]);
982 vector<int> verts(faceVerts[i]);
988 for (j = 0; j < faceVerts[i]; ++j, ++cnt)
990 edges[j] = edgeIds[cnt];
991 verts[j] = vertIds[cnt];
994 3, verts[j], vertX[cnt], vertY[cnt], vertZ[cnt]);
995 vCoMap[vertIds[cnt]] = coord[j];
998 pair<map<int, pair<int, int> >
::iterator,
bool> testIns =
999 eIdMap.insert(make_pair(
1001 make_pair(vertIds[tmp+j],
1002 vertIds[tmp+((j+1) % faceVerts[i])])));
1004 if (testIns.second ==
false)
1016 swap(testIns.first->second.first,
1017 testIns.first->second.second);
1021 vertMap [faceIds[i]] = verts;
1022 edgeMap [faceIds[i]] = edges;
1023 coordMap[faceIds[i]] = coord;
1030 map<int,int>::const_iterator oIt;
1044 map<int, map<StdRegions::Orientation, vector<int> > > vmap;
1045 map<int, map<StdRegions::Orientation, vector<int> > > emap;
1047 map<StdRegions::Orientation, vector<int> > quadVertMap;
1057 map<StdRegions::Orientation, vector<int> > quadEdgeMap;
1067 map<StdRegions::Orientation, vector<int> > triVertMap;
1071 map<StdRegions::Orientation, vector<int> > triEdgeMap;
1075 vmap[3] = triVertMap;
1076 vmap[4] = quadVertMap;
1077 emap[3] = triEdgeMap;
1078 emap[4] = quadEdgeMap;
1080 map<int,int> allCompPairs;
1085 for (cIt = perComps.begin(); cIt != perComps.end(); ++cIt)
1088 const int id1 = cIt->first;
1089 const int id2 = cIt->second;
1090 std::string id1s = boost::lexical_cast<
string>(id1);
1091 std::string id2s = boost::lexical_cast<
string>(id2);
1093 if (compMap.count(id1) > 0)
1095 c[0] = compMap[id1];
1098 if (compMap.count(id2) > 0)
1100 c[1] = compMap[id2];
1104 "Neither composite not found on this process!");
1109 map<int,int> compPairs;
1112 "Unable to find composite "+id1s+
" in order map.");
1114 "Unable to find composite "+id2s+
" in order map.");
1115 ASSERTL0(compOrder[id1].size() == compOrder[id2].size(),
1116 "Periodic composites "+id1s+
" and "+id2s+
1117 " should have the same number of elements.");
1118 ASSERTL0(compOrder[id1].size() > 0,
1119 "Periodic composites "+id1s+
" and "+id2s+
1123 for (i = 0; i < compOrder[id1].size(); ++i)
1125 int eId1 = compOrder[id1][i];
1126 int eId2 = compOrder[id2][i];
1128 ASSERTL0(compPairs.count(eId1) == 0,
1132 if (compPairs.count(eId2) != 0)
1134 ASSERTL0(compPairs[eId2] == eId1,
"Pairing incorrect");
1136 compPairs[eId1] = eId2;
1142 for (pIt = compPairs.begin(); pIt != compPairs.end(); ++pIt)
1144 int ids [2] = {pIt->first, pIt->second};
1145 bool local[2] = {locFaces.count(pIt->first) > 0,
1146 locFaces.count(pIt->second) > 0};
1148 ASSERTL0(coordMap.count(ids[0]) > 0 &&
1149 coordMap.count(ids[1]) > 0,
1150 "Unable to find face in coordinate map");
1152 allCompPairs[pIt->first ] = pIt->second;
1153 allCompPairs[pIt->second] = pIt->first;
1158 = { coordMap[ids[0]], coordMap[ids[1]] };
1160 ASSERTL0(tmpVec[0].size() == tmpVec[1].size(),
1161 "Two periodic faces have different number "
1172 for (i = 0; i < 2; ++i)
1180 int other = (i+1) % 2;
1183 if (tmpVec[0].size() == 3)
1186 tmpVec[i], tmpVec[other]);
1191 tmpVec[i], tmpVec[other]);
1201 int nFaceVerts = vertMap[ids[0]].size();
1204 for (i = 0; i < 2; ++i)
1206 int other = (i+1) % 2;
1209 if (tmpVec[0].size() == 3)
1212 tmpVec[i], tmpVec[other]);
1217 tmpVec[i], tmpVec[other]);
1220 if (nFaceVerts == 3)
1225 "Unsupported face orientation for face "+
1226 boost::lexical_cast<string>(ids[i]));
1230 vector<int> per1 = vertMap[ids[i]];
1231 vector<int> per2 = vertMap[ids[other]];
1235 map<int, pair<int, bool> > tmpMap;
1240 for (j = 0; j < nFaceVerts; ++j)
1242 int v = vmap[nFaceVerts][o][j];
1243 tmpMap[per1[j]] = make_pair(
1244 per2[v], locVerts.count(per2[v]) > 0);
1248 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1252 mIt->second.second);
1258 if (perIt == periodicVerts.end())
1262 periodicVerts[mIt->first].push_back(ent2);
1263 perIt = periodicVerts.find(mIt->first);
1270 for (k = 0; k < perIt->second.size(); ++k)
1272 if (perIt->second[k].id == mIt->second.first)
1278 if (k == perIt->second.size())
1280 perIt->second.push_back(ent2);
1288 for (i = 0; i < 2; ++i)
1290 int other = (i+1) % 2;
1292 if (tmpVec[0].size() == 3)
1295 tmpVec[i], tmpVec[other]);
1300 tmpVec[i], tmpVec[other]);
1303 vector<int> per1 = edgeMap[ids[i]];
1304 vector<int> per2 = edgeMap[ids[other]];
1306 map<int, pair<int, bool> > tmpMap;
1309 for (j = 0; j < nFaceVerts; ++j)
1311 int e = emap[nFaceVerts][o][j];
1312 tmpMap[per1[j]] = make_pair(
1313 per2[e], locEdges.count(per2[e]) > 0);
1316 for (mIt = tmpMap.begin(); mIt != tmpMap.end(); ++mIt)
1322 mIt->second.second);
1326 if (perIt == periodicEdges.end())
1328 periodicEdges[mIt->first].push_back(ent2);
1329 perIt = periodicEdges.find(mIt->first);
1333 for (k = 0; k < perIt->second.size(); ++k)
1335 if (perIt->second[k].id == mIt->second.first)
1341 if (k == perIt->second.size())
1343 perIt->second.push_back(ent2);
1352 pairSizes[p] = allCompPairs.size();
1360 for (i = 1; i < n; ++i)
1362 pairOffsets[i] = pairOffsets[i-1] + pairSizes[i-1];
1368 cnt = pairOffsets[p];
1370 for (pIt = allCompPairs.begin(); pIt != allCompPairs.end(); ++pIt)
1372 first [cnt ] = pIt->first;
1373 second[cnt++] = pIt->second;
1379 allCompPairs.clear();
1381 for(cnt = 0; cnt < totPairSizes; ++cnt)
1383 allCompPairs[first[cnt]] = second[cnt];
1390 for (cnt = i = 0; i < totFaces; ++i)
1392 int faceId = faceIds[i];
1394 ASSERTL0(allCompPairs.count(faceId) > 0,
1395 "Unable to find matching periodic face.");
1397 int perFaceId = allCompPairs[faceId];
1399 for (j = 0; j < faceVerts[i]; ++j, ++cnt)
1401 int vId = vertIds[cnt];
1405 if (perId == periodicVerts.end())
1413 = { coordMap[faceId], coordMap[perFaceId] };
1415 int nFaceVerts = tmpVec[0].size();
1418 tmpVec[0], tmpVec[1]) :
1420 tmpVec[0], tmpVec[1]);
1424 int perVertexId = vertMap[perFaceId][vmap[nFaceVerts][o][j]];
1429 locVerts.count(perVertexId) > 0);
1431 periodicVerts[vId].push_back(ent);
1434 int eId = edgeIds[cnt];
1436 perId = periodicEdges.find(eId);
1438 if (perId == periodicEdges.end())
1446 = { coordMap[faceId], coordMap[perFaceId] };
1448 int nFaceEdges = tmpVec[0].size();
1451 tmpVec[0], tmpVec[1]) :
1453 tmpVec[0], tmpVec[1]);
1457 int perEdgeId = edgeMap[perFaceId][emap[nFaceEdges][o][j]];
1462 locEdges.count(perEdgeId) > 0);
1464 periodicEdges[eId].push_back(ent);
1472 for (perIt = periodicVerts.begin();
1473 perIt != periodicVerts.end(); ++perIt)
1476 for (i = 0; i < perIt->second.size(); ++i)
1479 perIt2 = periodicVerts.find(perIt->second[i].id);
1480 ASSERTL0(perIt2 != periodicVerts.end(),
1481 "Couldn't find periodic vertex.");
1486 for (j = 0; j < perIt2->second.size(); ++j)
1488 if (perIt2->second[j].id == perIt->first)
1493 for (k = 0; k < perIt->second.size(); ++k)
1495 if (perIt2->second[j].id == perIt->second[k].id)
1501 if (k == perIt->second.size())
1503 perIt->second.push_back(perIt2->second[j]);
1509 for (perIt = periodicEdges.begin();
1510 perIt != periodicEdges.end(); ++perIt)
1512 for (i = 0; i < perIt->second.size(); ++i)
1514 perIt2 = periodicEdges.find(perIt->second[i].id);
1515 ASSERTL0(perIt2 != periodicEdges.end(),
1516 "Couldn't find periodic edge.");
1518 for (j = 0; j < perIt2->second.size(); ++j)
1520 if (perIt2->second[j].id == perIt->first)
1525 for (k = 0; k < perIt->second.size(); ++k)
1527 if (perIt2->second[j].id == perIt->second[k].id)
1533 if (k == perIt->second.size())
1535 perIt->second.push_back(perIt2->second[j]);
1542 for (perIt = periodicEdges.begin();
1543 perIt != periodicEdges.end(); perIt++)
1547 = eIdMap.find(perIt->first);
1549 *vCoMap[eIt->second.first],
1550 *vCoMap[eIt->second.second]
1556 for (i = 0; i < perIt->second.size(); ++i)
1558 eIt = eIdMap.find(perIt->second[i].id);
1561 *vCoMap[eIt->second.first],
1562 *vCoMap[eIt->second.second]
1565 NekDouble cx = 0.5*(w[0](0)-v[0](0)+w[1](0)-v[1](0));
1566 NekDouble cy = 0.5*(w[0](1)-v[0](1)+w[1](1)-v[1](1));
1567 NekDouble cz = 0.5*(w[0](2)-v[0](2)+w[1](2)-v[1](2));
1569 int vMap[2] = {-1,-1};
1570 for (j = 0; j < 2; ++j)
1575 for (k = 0; k < 2; ++k)
1581 if (sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)+(z1-z)*(z1-z))
1591 ASSERTL0(vMap[0] >= 0 && vMap[1] >= 0,
1592 "Unable to align periodic vertices.");
1593 ASSERTL0((vMap[0] == 0 || vMap[0] == 1) &&
1594 (vMap[1] == 0 || vMap[1] == 1) &&
1595 (vMap[0] != vMap[1]),
1596 "Unable to align periodic vertices.");
1609 for (perIt = periodicVerts.begin();
1610 perIt != periodicVerts.end(); ++perIt)
1612 if (locVerts.count(perIt->first) > 0)
1618 for (perIt = periodicEdges.begin();
1619 perIt != periodicEdges.end(); ++perIt)
1621 if (locEdges.count(perIt->first) > 0)
1633 as<LocalRegions::Expansion2D>();
1635 int offset =
m_trace->GetPhys_Offset(traceEl->GetElmtId());
1638 if (traceEl->GetLeftAdjacentElementFace () == -1 ||
1639 traceEl->GetRightAdjacentElementFace() == -1)
1649 int traceGeomId = traceEl->GetGeom2D()->GetGlobalID();
1655 fwd = traceGeomId == min(traceGeomId,pIt->second[0].id);
1660 GetTraceToUniversalMapUnique(offset) >= 0;
1664 else if (traceEl->GetLeftAdjacentElementFace () != -1 &&
1665 traceEl->GetRightAdjacentElementFace() != -1)
1669 (traceEl->GetLeftAdjacentElementExp().get()) ==
1674 ASSERTL2(
false,
"Unconnected trace element!");
1716 int n, cnt,
npts, e;
1728 GetNFwdLocTracePts();
1744 id2 =
m_trace->GetPhys_Offset(
1745 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1762 id2 =
m_trace->GetPhys_Offset(
1763 m_traceMap->GetBndCondTraceToGlobalTraceMap(cnt+e));
1778 ASSERTL0(
false,
"Method only set up for Dirichlet, Neumann "
1779 "and Robin conditions.");
1803 "Field is not in physical space.");
1813 Vmath::Zero(outarray.num_elements(), outarray, 1);
1821 m_traceMap->UniversalTraceAssemble(outarray);
1849 m_trace->IProductWRTBase(Fn, Fcoeffs);
1884 m_trace->IProductWRTBase(Fwd,Coeffs);
1886 m_trace->IProductWRTBase(Bwd,Coeffs);
1898 map<int,int> globalIdMap;
1913 globalIdMap[exp3d->GetGeom3D()->GetGlobalID()] = i;
1923 if(ElmtID.num_elements() != nbcs)
1928 if(FaceID.num_elements() != nbcs)
1939 as<LocalRegions::Expansion2D>();
1942 graph3D->GetElementsFromFace(exp2d->GetGeom2D());
1944 ElmtID[cnt] = globalIdMap[(*tmp)[0]->
1945 m_Element->GetGlobalID()];
1946 FaceID[cnt] = (*tmp)[0]->m_FaceIndx;
1952 boost::shared_ptr<ExpList> &result)
1955 int offsetOld, offsetNew;
1957 std::vector<unsigned int> eIDs;
1963 for (cnt = n = 0; n < i; ++n)
1971 eIDs.push_back(ElmtID[cnt+n]);
1979 for (n = 0; n < result->GetExpSize(); ++n)
1981 nq =
GetExp(ElmtID[cnt+n])->GetTotPoints();
1983 offsetNew = result->GetPhys_Offset(n);
1985 tmp2 = result->UpdatePhys()+ offsetNew, 1);
1987 nq =
GetExp(ElmtID[cnt+n])->GetNcoeffs();
1989 offsetNew = result->GetCoeff_Offset(n);
1991 tmp2 = result->UpdateCoeffs()+ offsetNew, 1);
2020 int i,j,n,cnt,cnt1,nbndry;
2037 int GloBndDofs =
m_traceMap->GetNumGlobalBndCoeffs();
2038 int NumDirichlet =
m_traceMap->GetNumLocalDirBndCoeffs();
2056 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2065 for(cnt = cnt1 = n = 0; n < nexp; ++n)
2071 e_l = loc_lambda + cnt1;
2078 Floc =
Transpose(*(HDGLamToU->GetBlock(n,n)))*ElmtFce;
2096 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
2105 id =
m_traceMap->GetBndCondCoeffsToGlobalCoeffsMap(cnt++);
2115 if(GloBndDofs - NumDirichlet > 0)
2132 m_traceMap->GlobalToLocalBnd(BndSol,loc_lambda);
2135 out = (*InvHDGHelm)*F + (*HDGLamToU)*LocLambda;
2152 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2157 m_traceMap->GlobalToLocalBnd(inarray, loc_lambda);
2158 LocLambda = (*HDGHelm) * LocLambda;
2159 m_traceMap->AssembleBnd(loc_lambda,outarray);
2178 map<int, RobinBCInfoSharedPtr> returnval;
2193 for(e = 0; e < locExpList->GetExpSize(); ++e)
2196 elmtid = ElmtID[cnt+e];
2198 if(returnval.count(elmtid) != 0)
2200 rInfo->next = returnval.find(elmtid)->second;
2202 returnval[elmtid] = rInfo;
2234 int i,cnt,f,ncoeff_face;
2239 int eid,nq_elmt, nm_elmt;
2240 int LocBndCoeffs =
m_traceMap->GetNumLocalBndCoeffs();
2245 face_lambda = loc_lambda;
2254 nq_elmt = (*m_exp)[eid]->GetTotPoints();
2255 nm_elmt = (*m_exp)[eid]->GetNcoeffs();
2259 out_tmp = force + nm_elmt;
2262 int num_points0 = (*m_exp)[eid]->GetBasis(0)->GetNumPoints();
2263 int num_points1 = (*m_exp)[eid]->GetBasis(1)->GetNumPoints();
2264 int num_points2 = (*m_exp)[eid]->GetBasis(2)->GetNumPoints();
2265 int num_modes0 = (*m_exp)[eid]->GetBasis(0)->GetNumModes();
2266 int num_modes1 = (*m_exp)[eid]->GetBasis(1)->GetNumModes();
2267 int num_modes2 = (*m_exp)[eid]->GetBasis(2)->GetNumModes();
2272 int nFaces = (*m_exp)[eid]->GetNfaces();
2274 for(f = 0; f < nFaces; ++f)
2276 ncoeff_face = elmtToTrace[eid][f]->GetNcoeffs();
2278 Vmath::Vcopy(ncoeff_face, face_lambda, 1, faceCoeffs[f], 1);
2279 exp->SetFaceToGeomOrientation(f, faceCoeffs[f]);
2280 face_lambda = face_lambda + ncoeff_face;
2324 ASSERTL0(
false,
"Wrong shape type, HDG postprocessing is not implemented");
2330 (*m_exp)[eid]->DGDeriv(
2332 elmtToTrace[eid], faceCoeffs, out_tmp);
2333 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2334 ppExp->IProductWRTDerivBase(0,qrhs,force);
2338 (*m_exp)[eid]->DGDeriv(
2340 elmtToTrace[eid], faceCoeffs, out_tmp);
2341 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2342 ppExp->IProductWRTDerivBase(1,qrhs,out_tmp);
2347 (*m_exp)[eid]->DGDeriv(
2349 elmtToTrace[eid], faceCoeffs, out_tmp);
2350 (*m_exp)[eid]->BwdTrans(out_tmp,qrhs);
2351 ppExp->IProductWRTDerivBase(2,qrhs,out_tmp);
2355 (*m_exp)[eid]->BwdTrans(
2357 force[0] = (*m_exp)[eid]->Integral(qrhs);
2371 ppExp->BwdTrans(out.
GetPtr(), work);
2372 (*m_exp)[eid]->FwdTrans(work,
2411 const std::string varName,
2420 for (i = 0; i < nbnd; ++i)
2425 npoints = locExpList->GetNpoints();
2432 locExpList->GetCoords(x0, x1, x2);
2437 string filebcs = boost::static_pointer_cast<
2441 string exprbcs = boost::static_pointer_cast<
2448 valuesFile = locExpList->GetPhys();
2457 condition.
Evaluate(x0, x1, x2, time, valuesExp);
2460 Vmath::Vmul(npoints, valuesExp, 1, valuesFile, 1, locExpList->UpdatePhys(), 1);
2462 locExpList->FwdTrans_BndConstrained(
2463 locExpList->GetPhys(),
2464 locExpList->UpdateCoeffs());
2469 string filebcs = boost::static_pointer_cast<
2485 condition.
Evaluate(x0, x1, x2, time,
2486 locExpList->UpdatePhys());
2488 locExpList->IProductWRTBase(locExpList->GetPhys(),
2489 locExpList->UpdateCoeffs());
2496 string filebcs = boost::static_pointer_cast<
2511 condition.
Evaluate(x0, x1, x2, time,
2512 locExpList->UpdatePhys());
2521 locExpList->IProductWRTBase(locExpList->GetPhys(),
2522 locExpList->UpdateCoeffs());
2527 locExpList->UpdatePhys());
2532 ASSERTL0(
false,
"This type of BC not implemented yet");
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
const DNekScalBlkMatSharedPtr & GetBlockMatrix(const GlobalMatrixKey &gkey)
boost::shared_ptr< MeshGraph3D > MeshGraph3DSharedPtr
const Array< OneD, const NekDouble > & GetCoeffs() const
This function returns (a reference to) the array (implemented as m_coeffs) containing all local expa...
#define ASSERTL0(condition, msg)
virtual void v_Reset()
Reset geometry information, metrics, matrix managers and geometry information.
virtual ~DisContField3D()
Destructor.
GlobalLinSysSharedPtr GetGlobalBndLinSys(const GlobalLinSysKey &mkey)
boost::shared_ptr< ElementFaceVector > ElementFaceVectorSharedPtr
virtual void v_ExtractTracePhys(Array< OneD, NekDouble > &outarray)
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndCondExpansions
An object which contains the discretised boundary conditions.
int GetCoeff_Offset(int n) const
Get the start offset position for a global list of m_coeffs correspoinding to element n...
virtual void v_GetBndElmtExpansion(int i, boost::shared_ptr< ExpList > &result)
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
std::vector< PointGeomSharedPtr > PointGeomVector
void SetAdjacentElementExp(int face, Expansion3DSharedPtr &f)
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...
bool IsLeftAdjacentFace(const int n, const int e)
const BoundaryConditionCollection & GetBoundaryConditions(void) const
void ExtractFileBCs(const std::string &fileName, const std::string &varName, const boost::shared_ptr< ExpList > locExpList)
GlobalLinSysMapShPtr m_globalBndMat
boost::shared_ptr< RobinBCInfo > RobinBCInfoSharedPtr
SpatialDomains::Geometry3DSharedPtr GetGeom3D() const
const boost::shared_ptr< LocalRegions::ExpansionVector > GetExp() const
This function returns the vector of elements in the expansion.
std::set< int > m_boundaryFaces
A set storing the global IDs of any boundary faces.
PeriodicMap m_periodicFaces
A map which identifies pairs of periodic faces.
virtual void v_GetFwdBwdTracePhys(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...
std::map< int, std::vector< unsigned int > > BndRegionOrdering
std::map< ConstFactorType, NekDouble > ConstFactorMap
void GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &EdgeID)
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
void EvaluateHDGPostProcessing(Array< OneD, NekDouble > &outarray)
Evaluate HDG post-processing to increase polynomial order of solution.
std::map< int, std::vector< unsigned int > > CompositeOrdering
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.
void ApplyGeomInfo()
Apply geometry information to each expansion.
boost::shared_ptr< HexGeom > HexGeomSharedPtr
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
int GetExpSize(void)
This function returns the number of elements in the expansion.
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)
This function evaluates the boundary conditions at a certain time-level.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
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, .
Principle Orthogonal Functions .
void FindPeriodicFaces(const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
Determine the periodic faces, edges and vertices for the given graph.
vector< bool > m_leftAdjacentFaces
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
virtual map< int, RobinBCInfoSharedPtr > v_GetRobinBCInfo()
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
static StdRegions::Orientation GetFaceOrientation(const QuadGeom &face1, const QuadGeom &face2)
Get the orientation of face1.
The base class for all shapes.
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
DisContField3D()
Default constructor.
virtual const vector< bool > & v_GetLeftAdjacentFaces(void) const
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
vector< int > m_periodicBwdCopy
boost::shared_ptr< Expansion3D > Expansion3DSharedPtr
LocTraceToTraceMapSharedPtr m_locTraceToTraceMap
Map of local trace (the points at the face of the element) to the trace space discretisation.
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 .
Principle Orthogonal Functions .
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
SpatialDomains::MeshGraphSharedPtr m_graph
Mesh associated with this expansion list.
void GenerateBoundaryConditionExpansion(const SpatialDomains::MeshGraphSharedPtr &graph3D, const SpatialDomains::BoundaryConditions &bcs, const std::string &variable)
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...
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.
void SetUpDG(const std::string="DefaultVar")
Set up all DG member variables and maps.
boost::shared_ptr< Expansion > ExpansionSharedPtr
bool SameTypeOfBoundaryConditions(const DisContField3D &In)
std::map< int, BoundaryConditionMapShPtr > BoundaryConditionCollection
boost::shared_ptr< ExpList2D > ExpList2DSharedPtr
Shared pointer to an ExpList2D object.
boost::shared_ptr< GeometryVector > Composite
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.
const Array< OneD, const NekDouble > & GetPhys() const
This function returns (a reference to) the array (implemented as m_phys) containing the function ev...
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
LibUtilities::CommSharedPtr m_comm
Communicator.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
PeriodicMap m_periodicVerts
A map which identifies groups of periodic vertices.
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)
virtual void v_GetBoundaryToElmtMap(Array< OneD, int > &ElmtID, Array< OneD, int > &FaceID)
Set up a list of elemeent IDs and edge IDs that link to the boundary conditions.
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
virtual void v_Reset()
Reset this field, so that geometry information can be updated.
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
boost::shared_ptr< PrismGeom > PrismGeomSharedPtr
vector< int > m_periodicFwdCopy
A vector indicating degress of freedom which need to be copied from forwards to backwards space in ca...
Gauss Radau pinned at x=-1, .
Array< OneD, SpatialDomains::BoundaryConditionShPtr > m_bndConditions
An array which contains the information about the boundary condition on the different boundary region...
int GetNcoeffs(void) const
Returns the total number of local degrees of freedom .
AssemblyMapDGSharedPtr m_traceMap
boost::shared_ptr< TetGeom > TetGeomSharedPtr
Abstraction of a three-dimensional multi-elemental expansion which is merely a collection of local ex...
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.
static StdRegions::Orientation GetFaceOrientation(const TriGeom &face1, const TriGeom &face2)
const BoundaryRegionCollection & GetBoundaryRegions(void) const
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
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
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.
virtual void v_AddTraceIntegral(const Array< OneD, const NekDouble > &Fn, Array< OneD, NekDouble > &outarray)
Add trace contributions into elemental coefficient spaces.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
PeriodicMap m_periodicEdges
A map which identifies groups of periodic edges.
boost::shared_ptr< Expansion2D > Expansion2DSharedPtr