41 #include <boost/config.hpp>
42 #include <boost/graph/adjacency_list.hpp>
43 #include <boost/graph/cuthill_mckee_ordering.hpp>
44 #include <boost/graph/properties.hpp>
45 #include <boost/graph/bandwidth.hpp>
49 namespace MultiRegions
69 const std::string variable):
81 const int numLocalCoeffs,
83 const Array<OneD, const ExpListSharedPtr> &bndCondExp,
84 const Array<OneD, const SpatialDomains::BoundaryConditionShPtr>
89 const bool checkIfSystemSingular,
90 const std::string variable):
100 checkIfSystemSingular);
111 const int numLocalCoeffs,
171 const int numLocalCoeffs,
173 const Array<OneD, const ExpListSharedPtr> &bndCondExp,
174 const Array<OneD, const SpatialDomains::BoundaryConditionShPtr> &bndConditions,
178 const bool checkIfSystemSingular)
189 int nEdgeInteriorCoeffs;
190 int nFaceInteriorCoeffs;
191 int firstNonDirGraphVertId;
192 int nLocBndCondDofs = 0;
193 int nLocDirBndCondDofs = 0;
200 Array<OneD, unsigned int> edgeInteriorMap;
201 Array<OneD, int> edgeInteriorSign;
202 Array<OneD, unsigned int> faceInteriorMap;
203 Array<OneD, int> faceInteriorSign;
204 PeriodicMap::const_iterator pIt;
211 map<int,int> vertReorderedGraphVertId;
212 map<int,int> edgeReorderedGraphVertId;
213 map<int,int> faceReorderedGraphVertId;
215 map<int,int>::const_iterator mapConstIt;
216 map<int,pair<int, StdRegions::Orientation> >::const_iterator mapFaceIt;
218 bool systemSingular = (checkIfSystemSingular)?
true:
false;
223 for(i = 0; i < bndCondExp.num_elements(); i++)
227 for(j = 0; j < bndCondExp[i]->GetNumElmts(); j++)
229 bndCondFaceExp = bndCondExp[i]->GetExp(j)
232 if (bndConditions[i]->GetBoundaryConditionType() ==
235 for(k = 0; k < bndCondFaceExp->GetNverts(); k++)
237 meshVertId = bndCondFaceExp->
GetGeom2D()->GetVid(k);
238 if(vertReorderedGraphVertId.count(meshVertId) == 0)
240 vertReorderedGraphVertId[meshVertId] = graphVertId++;
244 for(k = 0; k < bndCondFaceExp->GetNedges(); k++)
246 meshEdgeId = bndCondFaceExp->GetGeom2D()->GetEid(k);
247 if(edgeReorderedGraphVertId.count(meshEdgeId) == 0)
249 edgeReorderedGraphVertId[meshEdgeId] = graphVertId++;
252 meshFaceId = bndCondFaceExp->GetGeom2D()->GetFid();
253 faceReorderedGraphVertId[meshFaceId] = graphVertId++;
254 nLocDirBndCondDofs += bndCondFaceExp->GetNcoeffs();
256 if (bndConditions[i]->GetBoundaryConditionType() !=
258 checkIfSystemSingular ==
true)
260 systemSingular =
false;
262 nLocBndCondDofs += bndCondFaceExp->GetNcoeffs();
276 int n =
m_comm->GetSize();
277 int p =
m_comm->GetRank();
283 Array<OneD, int> vertcounts (n, 0);
284 Array<OneD, int> vertoffsets(n, 0);
285 Array<OneD, int> edgecounts (n, 0);
286 Array<OneD, int> edgeoffsets(n, 0);
287 vertcounts[p] = vertReorderedGraphVertId.size();
288 edgecounts[p] = edgeReorderedGraphVertId.size();
292 for (i = 1; i < n; ++i)
294 vertoffsets[i] = vertoffsets[i-1] + vertcounts[i-1];
295 edgeoffsets[i] = edgeoffsets[i-1] + edgecounts[i-1];
301 Array<OneD, int> vertlist(nTotVerts, 0);
302 Array<OneD, int> edgelist(nTotEdges, 0);
305 for (it = vertReorderedGraphVertId.begin(), i = 0;
306 it != vertReorderedGraphVertId.end();
309 vertlist[vertoffsets[p] + i] = it->first;
313 for (it = edgeReorderedGraphVertId.begin(), i = 0;
314 it != edgeReorderedGraphVertId.end();
317 edgelist[edgeoffsets[p] + i] = it->first;
325 int nExtraDirichlet = 0;
326 map<int, int> extraDirVertIds, extraDirEdgeIds;
336 for (i = 0; i < n; ++i)
343 for(j = 0; j < locExpVector.size(); j++)
348 for(k = 0; k < locExpansion->GetNverts(); k++)
350 meshVertId = locExpansion->
GetGeom3D()->GetVid(k);
351 if(vertReorderedGraphVertId.count(meshVertId) == 0)
353 for (l = 0; l < vertcounts[i]; ++l)
355 if (vertlist[vertoffsets[i]+l] == meshVertId)
357 extraDirVertIds[meshVertId] = i;
358 vertReorderedGraphVertId[meshVertId] = graphVertId++;
365 for(k = 0; k < locExpansion->GetNedges(); k++)
367 meshEdgeId = locExpansion->GetGeom3D()->GetEid(k);
368 if(edgeReorderedGraphVertId.count(meshEdgeId) == 0)
370 for (l = 0; l < edgecounts[i]; ++l)
372 if (edgelist[edgeoffsets[i]+l] == meshEdgeId)
374 extraDirEdgeIds[meshEdgeId] = i;
375 edgeReorderedGraphVertId[meshEdgeId] = graphVertId++;
376 nExtraDirichlet += locExpansion->GetEdgeNcoeffs(k) - 2;
386 int m_extradiredges = extraDirEdgeIds.size();
389 for (mapConstIt = extraDirEdgeIds.begin();
390 mapConstIt != extraDirEdgeIds.end(); mapConstIt++)
392 meshEdgeId = mapConstIt->first;
402 for (i = 0; i < n; ++i)
410 vertcounts[p] = extraDirVertIds.size();
411 edgecounts[p] = extraDirEdgeIds.size();
417 vertoffsets[0] = edgeoffsets[0] = 0;
419 for (i = 1; i < n; ++i)
421 vertoffsets[i] = vertoffsets[i-1] + vertcounts[i-1];
422 edgeoffsets[i] = edgeoffsets[i-1] + edgecounts[i-1];
425 Array<OneD, int> vertids (nTotVerts, 0);
426 Array<OneD, int> edgeids (nTotEdges, 0);
427 Array<OneD, int> vertprocs(nTotVerts, 0);
428 Array<OneD, int> edgeprocs(nTotEdges, 0);
430 for (it = extraDirVertIds.begin(), i = 0;
431 it != extraDirVertIds.end(); ++it, ++i)
433 vertids [vertoffsets[p]+i] = it->first;
434 vertprocs[vertoffsets[p]+i] = it->second;
437 for (it = extraDirEdgeIds.begin(), i = 0;
438 it != extraDirEdgeIds.end(); ++it, ++i)
440 edgeids [edgeoffsets[p]+i] = it->first;
441 edgeprocs[edgeoffsets[p]+i] = it->second;
449 set<int> extraDirVerts;
450 set<int> extraDirEdges;
453 for (i = 0; i < nTotVerts; ++i)
455 if (
m_comm->GetRank() == vertprocs[i])
457 extraDirVerts.insert(vertids[i]);
462 for (i = 0; i < nTotEdges; ++i)
464 if (
m_comm->GetRank() == edgeprocs[i])
466 extraDirEdges.insert(edgeids[i]);
471 int s = (systemSingular ? 1 : 0);
473 systemSingular = (s == 1 ?
true :
false);
476 Array<OneD, int> bccounts(n, 0);
477 bccounts[p] = bndCondExp.num_elements();
489 if(systemSingular ==
true && checkIfSystemSingular && maxBCIdx == p)
491 if(
m_session->DefinesParameter(
"SingularElement"))
494 m_session->LoadParameter(
"SingularElement", s_eid);
496 ASSERTL1(s_eid < locExpVector.size(),
497 "SingularElement Parameter is too large");
499 meshVertId = locExpVector[s_eid]
501 ->GetGeom2D()->GetVid(0);
503 else if (bndCondExp.num_elements() == 0)
506 meshVertId = locExpVector[0]->
GetGeom()->GetVid(0);
511 bndCondFaceExp = bndCondExp[bndCondExp.num_elements()-1]
515 meshVertId = bndCondFaceExp->
GetGeom2D()->GetVid(0);
518 if(vertReorderedGraphVertId.count(meshVertId) == 0)
520 vertReorderedGraphVertId[meshVertId] = graphVertId++;
529 if(systemSingular ==
true && checkIfSystemSingular)
536 for (i = 0; i < locExpVector.size(); ++i)
538 for (j = 0; j < locExpVector[i]->GetNverts(); ++j)
540 if (locExpVector[i]->GetGeom()->GetVid(j) !=
546 if (vertReorderedGraphVertId.count(meshVertId) == 0)
548 vertReorderedGraphVertId[meshVertId] =
564 if (vertReorderedGraphVertId.count(meshVertId) == 0)
570 gId = vertReorderedGraphVertId[meshVertId];
573 for (pIt = periodicVerts.begin();
574 pIt != periodicVerts.end(); ++pIt)
581 if (pIt->first == meshVertId)
583 vertReorderedGraphVertId[meshVertId] =
584 gId < 0 ? graphVertId++ : gId;
586 for (i = 0; i < pIt->second.size(); ++i)
588 if (pIt->second[i].isLocal)
590 vertReorderedGraphVertId[pIt->second[i].id] =
598 for (i = 0; i < pIt->second.size(); ++i)
600 if (pIt->second[i].id == meshVertId)
609 vertReorderedGraphVertId[pIt->first] =
610 gId < 0 ? graphVertId++ : gId;
612 for (i = 0; i < pIt->second.size(); ++i)
614 if (pIt->second[i].isLocal)
616 vertReorderedGraphVertId[
617 pIt->second[i].id] = gId;
626 firstNonDirGraphVertId = graphVertId;
633 typedef boost::adjacency_list<
634 boost::setS, boost::vecS, boost::undirectedS> BoostGraph;
635 BoostGraph boostGraphObj;
637 map<int, int> vertTempGraphVertId;
638 map<int, int> edgeTempGraphVertId;
639 map<int, int> faceTempGraphVertId;
640 map<int, int> vwgts_map;
641 Array<OneD, int> localVerts;
642 Array<OneD, int> localEdges;
643 Array<OneD, int> localFaces;
645 int tempGraphVertId = 0;
646 int localVertOffset = 0;
647 int localEdgeOffset = 0;
648 int localFaceOffset = 0;
667 map<int,int> EdgeSize;
668 map<int,int> FaceSize;
671 for(i = 0; i < locExpVector.size(); ++i)
676 nTotalVerts += locExpansion->GetNverts();
677 nTotalEdges += locExpansion->GetNedges();
678 nTotalFaces += locExpansion->GetNfaces();
680 nEdges = locExpansion->GetNedges();
681 for(j = 0; j < nEdges; ++j)
683 nEdgeInteriorCoeffs = locExpansion->GetEdgeNcoeffs(j) - 2;
684 meshEdgeId = locExpansion->GetGeom3D()->GetEid(j);
685 EdgeSize[meshEdgeId] = nEdgeInteriorCoeffs;
688 nFaces = locExpansion->GetNfaces();
690 for(j = 0; j < nFaces; ++j)
692 nFaceInteriorCoeffs = locExpansion->GetFaceIntNcoeffs(j);
693 meshFaceId = locExpansion->GetGeom3D()->GetFid(j);
694 FaceSize[meshFaceId] = nFaceInteriorCoeffs;
701 for (pIt = periodicVerts.begin(); pIt != periodicVerts.end(); ++pIt)
703 meshVertId = pIt->first;
706 if (vertReorderedGraphVertId.count(pIt->first) != 0)
708 for (i = 0; i < pIt->second.size(); ++i)
710 meshVertId2 = pIt->second[i].id;
711 if (vertReorderedGraphVertId.count(meshVertId2) == 0 &&
712 pIt->second[i].isLocal)
714 vertReorderedGraphVertId[meshVertId2] =
715 vertReorderedGraphVertId[meshVertId];
722 bool isDirichlet =
false;
723 for (i = 0; i < pIt->second.size(); ++i)
725 if (!pIt->second[i].isLocal)
730 meshVertId2 = pIt->second[i].id;
731 if (vertReorderedGraphVertId.count(meshVertId2) > 0)
740 vertReorderedGraphVertId[meshVertId] =
741 vertReorderedGraphVertId[pIt->second[i].id];
743 for (j = 0; j < pIt->second.size(); ++j)
745 meshVertId2 = pIt->second[i].id;
746 if (j == i || !pIt->second[j].isLocal ||
747 vertReorderedGraphVertId.count(meshVertId2) > 0)
752 vertReorderedGraphVertId[meshVertId2] =
753 vertReorderedGraphVertId[pIt->second[i].id];
760 for (i = 0; i < pIt->second.size(); ++i)
762 if (!pIt->second[i].isLocal)
767 if (vertTempGraphVertId.count(pIt->second[i].id) > 0)
773 if (i == pIt->second.size())
775 vertTempGraphVertId[meshVertId] = tempGraphVertId++;
780 vertTempGraphVertId[meshVertId] =
781 vertTempGraphVertId[pIt->second[i].id];
787 localVerts = Array<OneD, int>(nTotalVerts,-1);
788 localEdges = Array<OneD, int>(nTotalEdges,-1);
789 localFaces = Array<OneD, int>(nTotalFaces,-1);
792 for(i = 0; i < locExpVector.size(); ++i)
798 nVerts = locExpansion->GetNverts();
799 for(j = 0; j < nVerts; ++j)
801 meshVertId = locExpansion->GetGeom3D()->GetVid(j);
802 if(vertReorderedGraphVertId.count(meshVertId) == 0)
804 if(vertTempGraphVertId.count(meshVertId) == 0)
806 boost::add_vertex(boostGraphObj);
807 vertTempGraphVertId[meshVertId] = tempGraphVertId++;
810 localVerts[localVertOffset+vertCnt++] = vertTempGraphVertId[meshVertId];
811 vwgts_map[ vertTempGraphVertId[meshVertId] ] = 1;
817 ASSERTL0(
false,
"dynamic cast to a local 3D expansion failed");
819 localVertOffset+=nVerts;
823 for (pIt = periodicEdges.begin(); pIt != periodicEdges.end(); ++pIt)
825 meshEdgeId = pIt->first;
828 if (edgeReorderedGraphVertId.count(pIt->first) != 0)
830 for (i = 0; i < pIt->second.size(); ++i)
832 meshEdgeId2 = pIt->second[i].id;
833 if (edgeReorderedGraphVertId.count(meshEdgeId2) == 0 &&
834 pIt->second[i].isLocal)
836 edgeReorderedGraphVertId[meshEdgeId2] =
837 edgeReorderedGraphVertId[meshEdgeId];
844 bool isDirichlet =
false;
845 for (i = 0; i < pIt->second.size(); ++i)
847 if (!pIt->second[i].isLocal)
852 meshEdgeId2 = pIt->second[i].id;
853 if (edgeReorderedGraphVertId.count(meshEdgeId2) > 0)
862 edgeReorderedGraphVertId[meshEdgeId] =
863 edgeReorderedGraphVertId[pIt->second[i].id];
865 for (j = 0; j < pIt->second.size(); ++j)
867 meshEdgeId2 = pIt->second[i].id;
868 if (j == i || !pIt->second[j].isLocal ||
869 edgeReorderedGraphVertId.count(meshEdgeId2) > 0)
874 edgeReorderedGraphVertId[meshEdgeId2] =
875 edgeReorderedGraphVertId[pIt->second[i].id];
882 for (i = 0; i < pIt->second.size(); ++i)
884 if (!pIt->second[i].isLocal)
889 if (edgeTempGraphVertId.count(pIt->second[i].id) > 0)
895 if (i == pIt->second.size())
897 edgeTempGraphVertId[meshEdgeId] = tempGraphVertId++;
898 nEdgeInteriorCoeffs = EdgeSize[meshEdgeId];
904 edgeTempGraphVertId[meshEdgeId] = edgeTempGraphVertId[pIt->second[i].id];
909 for(i = 0; i < locExpVector.size(); ++i)
915 nEdges = locExpansion->GetNedges();
917 for(j = 0; j < nEdges; ++j)
919 nEdgeInteriorCoeffs = locExpansion->GetEdgeNcoeffs(j) - 2;
920 meshEdgeId = locExpansion->GetGeom3D()->GetEid(j);
921 if(edgeReorderedGraphVertId.count(meshEdgeId) == 0)
923 if(edgeTempGraphVertId.count(meshEdgeId) == 0)
925 boost::add_vertex(boostGraphObj);
926 edgeTempGraphVertId[meshEdgeId] = tempGraphVertId++;
931 localEdges[localEdgeOffset+edgeCnt++] = edgeTempGraphVertId[meshEdgeId];
932 vwgts_map[ edgeTempGraphVertId[meshEdgeId] ] = nEdgeInteriorCoeffs;
938 ASSERTL0(
false,
"dynamic cast to a local 3D expansion failed");
940 localEdgeOffset+=nEdges;
944 for (pIt = periodicFaces.begin(); pIt != periodicFaces.end(); ++pIt)
946 if (!pIt->second[0].isLocal)
949 meshFaceId = pIt->first;
950 ASSERTL0(faceReorderedGraphVertId.count(meshFaceId) == 0,
951 "This periodic boundary edge has been specified before");
952 faceTempGraphVertId[meshFaceId] = tempGraphVertId++;
953 nFaceInteriorCoeffs = FaceSize[meshFaceId];
957 else if (pIt->first < pIt->second[0].id)
959 ASSERTL0(faceReorderedGraphVertId.count(pIt->first) == 0,
960 "This periodic boundary face has been specified before");
961 ASSERTL0(faceReorderedGraphVertId.count(pIt->second[0].id) == 0,
962 "This periodic boundary face has been specified before");
964 faceTempGraphVertId[pIt->first] = tempGraphVertId;
965 faceTempGraphVertId[pIt->second[0].id] = tempGraphVertId++;
966 nFaceInteriorCoeffs = FaceSize[pIt->first];
973 for(i = 0; i < locExpVector.size(); ++i)
978 nFaces = locExpansion->GetNfaces();
980 for(j = 0; j < nFaces; ++j)
982 nFaceInteriorCoeffs = locExpansion->GetFaceIntNcoeffs(j);
983 meshFaceId = locExpansion->GetGeom3D()->GetFid(j);
984 if(faceReorderedGraphVertId.count(meshFaceId) == 0)
986 if(faceTempGraphVertId.count(meshFaceId) == 0)
988 boost::add_vertex(boostGraphObj);
989 faceTempGraphVertId[meshFaceId] = tempGraphVertId++;
994 localFaces[localFaceOffset+faceCnt++] = faceTempGraphVertId[meshFaceId];
995 vwgts_map[ faceTempGraphVertId[meshFaceId] ] = nFaceInteriorCoeffs;
1002 ASSERTL0(
false,
"dynamic cast to a local 3D expansion failed");
1004 localFaceOffset+=nFaces;
1010 for(i = 0; i < locExpVector.size(); ++i)
1015 nVerts = locExpansion->GetNverts();
1016 nEdges = locExpansion->GetNedges();
1017 nFaces = locExpansion->GetNfaces();
1024 for(j = 0; j < nVerts; j++)
1026 if(localVerts[j+localVertOffset]==-1)
1031 for(k = 0; k < nVerts; k++)
1033 if(localVerts[k+localVertOffset]==-1)
1039 boost::add_edge( (
size_t) localVerts[j+localVertOffset],
1040 (
size_t) localVerts[k+localVertOffset],boostGraphObj);
1044 for(k = 0; k < nEdges; k++)
1046 if(localEdges[k+localEdgeOffset]==-1)
1050 boost::add_edge( (
size_t) localVerts[j+localVertOffset],
1051 (
size_t) localEdges[k+localEdgeOffset],boostGraphObj);
1054 for(k = 0; k < nFaces; k++)
1056 if(localFaces[k+localFaceOffset]==-1)
1060 boost::add_edge( (
size_t) localVerts[j+localVertOffset],
1061 (
size_t) localFaces[k+localFaceOffset],boostGraphObj);
1066 for(j = 0; j < nEdges; j++)
1068 if(localEdges[j+localEdgeOffset]==-1)
1073 for(k = 0; k < nEdges; k++)
1075 if(localEdges[k+localEdgeOffset]==-1)
1081 boost::add_edge( (
size_t) localEdges[j+localEdgeOffset],
1082 (
size_t) localEdges[k+localEdgeOffset],boostGraphObj);
1086 for(k = 0; k < nVerts; k++)
1088 if(localVerts[k+localVertOffset]==-1)
1092 boost::add_edge( (
size_t) localEdges[j+localEdgeOffset],
1093 (
size_t) localVerts[k+localVertOffset],boostGraphObj);
1096 for(k = 0; k < nFaces; k++)
1098 if(localFaces[k+localFaceOffset]==-1)
1102 boost::add_edge( (
size_t) localEdges[j+localEdgeOffset],
1103 (
size_t) localFaces[k+localFaceOffset],boostGraphObj);
1108 for(j = 0; j < nFaces; j++)
1110 if(localFaces[j+localFaceOffset]==-1)
1115 for(k = 0; k < nFaces; k++)
1117 if(localFaces[k+localFaceOffset]==-1)
1123 boost::add_edge( (
size_t) localFaces[j+localFaceOffset],
1124 (
size_t) localFaces[k+localFaceOffset],boostGraphObj);
1128 for(k = 0; k < nVerts; k++)
1130 if(localVerts[k+localVertOffset]==-1)
1134 boost::add_edge( (
size_t) localFaces[j+localFaceOffset],
1135 (
size_t) localVerts[k+localVertOffset],boostGraphObj);
1138 for(k = 0; k < nEdges; k++)
1140 if(localEdges[k+localEdgeOffset]==-1)
1144 boost::add_edge( (
size_t) localFaces[j+localFaceOffset],
1145 (
size_t) localEdges[k+localEdgeOffset],boostGraphObj);
1151 ASSERTL0(
false,
"dynamic cast to a local 3D expansion failed");
1153 localVertOffset+=nVerts;
1154 localEdgeOffset+=nEdges;
1155 localFaceOffset+=nFaces;
1164 vector<long> procVerts, procEdges, procFaces;
1165 set <int> foundVerts, foundEdges, foundFaces;
1170 for(i = cnt = 0; i < locExpVector.size(); ++i)
1173 if((locExpansion = locExpVector[elmtid]
1174 ->as<LocalRegions::Expansion3D>()))
1176 for (j = 0; j < locExpansion->GetNverts(); ++j)
1178 int vid = locExpansion->GetGeom3D()->GetVid(j)+1;
1180 if (foundVerts.count(vid) == 0)
1182 procVerts.push_back(vid);
1183 foundVerts.insert(vid);
1187 for (j = 0; j < locExpansion->GetNedges(); ++j)
1189 int eid = locExpansion->GetGeom3D()->GetEid(j)+1;
1191 if (foundEdges.count(eid) == 0)
1193 procEdges.push_back(eid);
1194 foundEdges.insert(eid);
1198 for (j = 0; j < locExpansion->GetNfaces(); ++j)
1200 int fid = locExpansion->GetGeom3D()->GetFid(j)+1;
1202 if (foundFaces.count(fid) == 0)
1204 procFaces.push_back(fid);
1205 foundFaces.insert(fid);
1212 "dynamic cast to a local 3D expansion failed");
1216 int unique_verts = foundVerts.size();
1217 int unique_edges = foundEdges.size();
1218 int unique_faces = foundFaces.size();
1224 Array<OneD, long> vertArray(unique_verts, &procVerts[0]);
1225 Array<OneD, long> edgeArray(unique_edges, &procEdges[0]);
1226 Array<OneD, long> faceArray(unique_faces, &procFaces[0]);
1230 Array<OneD, NekDouble> tmp4(unique_verts, 1.0);
1231 Array<OneD, NekDouble> tmp5(unique_edges, 1.0);
1232 Array<OneD, NekDouble> tmp6(unique_faces, 1.0);
1239 for (i = 0; i < unique_verts; ++i)
1243 if (vertReorderedGraphVertId.count(procVerts[i]-1) == 0)
1245 partVerts.insert(vertTempGraphVertId[procVerts[i]-1]);
1250 for (i = 0; i < unique_edges; ++i)
1254 if (edgeReorderedGraphVertId.count(procEdges[i]-1) == 0)
1256 partVerts.insert(edgeTempGraphVertId[procEdges[i]-1]);
1261 for (i = 0; i < unique_faces; ++i)
1265 if (faceReorderedGraphVertId.count(procFaces[i]-1) == 0)
1267 partVerts.insert(faceTempGraphVertId[procFaces[i]-1]);
1277 int nGraphVerts = tempGraphVertId;
1278 Array<OneD, int> perm(nGraphVerts);
1279 Array<OneD, int> iperm(nGraphVerts);
1280 Array<OneD, int> vwgts(nGraphVerts);
1281 ASSERTL1(vwgts_map.size()==nGraphVerts,
"Non matching dimensions");
1282 for(i = 0; i < nGraphVerts; ++i)
1284 vwgts[i] = vwgts_map[i];
1338 for(mapIt = vertTempGraphVertId.begin(); mapIt != vertTempGraphVertId.end(); mapIt++)
1340 vertReorderedGraphVertId[mapIt->first] = iperm[mapIt->second] + graphVertId;
1342 for(mapIt = edgeTempGraphVertId.begin(); mapIt != edgeTempGraphVertId.end(); mapIt++)
1344 edgeReorderedGraphVertId[mapIt->first] = iperm[mapIt->second] + graphVertId;
1346 for(mapIt = faceTempGraphVertId.begin(); mapIt != faceTempGraphVertId.end(); mapIt++)
1348 faceReorderedGraphVertId[mapIt->first] = iperm[mapIt->second] + graphVertId;
1363 Array<OneD, int> graphVertOffset(vertReorderedGraphVertId.size()+
1364 edgeReorderedGraphVertId.size()+
1365 faceReorderedGraphVertId.size()+1);
1366 graphVertOffset[0] = 0;
1368 for(i = 0; i < locExpVector.size(); ++i)
1373 for(j = 0; j < locExpansion->GetNverts(); ++j)
1375 meshVertId = locExpansion->
GetGeom3D()->GetVid(j);
1376 graphVertOffset[vertReorderedGraphVertId[meshVertId]+1] = 1;
1379 for(j = 0; j < locExpansion->GetNedges(); ++j)
1381 nEdgeInteriorCoeffs = locExpansion->GetEdgeNcoeffs(j) - 2;
1382 meshEdgeId = locExpansion->GetGeom3D()->GetEid(j);
1383 graphVertOffset[edgeReorderedGraphVertId[meshEdgeId]+1] = nEdgeInteriorCoeffs;
1385 bType = locExpansion->GetEdgeBasisType(j);
1387 if( (nEdgeInteriorCoeffs+2 >= 4)&&
1395 for(j = 0; j < locExpansion->GetNfaces(); ++j)
1397 nFaceInteriorCoeffs = locExpansion->GetFaceIntNcoeffs(j);
1398 meshFaceId = locExpansion->GetGeom3D()->GetFid(j);
1399 graphVertOffset[faceReorderedGraphVertId[meshFaceId]+1] = nFaceInteriorCoeffs;
1403 for(i = 1; i < graphVertOffset.num_elements(); i++)
1405 graphVertOffset[i] += graphVertOffset[i-1];
1430 m_numLocalIntCoeffsPerPatch[i] = (
unsigned int)
1447 for(i = 0; i < locExpVector.size(); ++i)
1451 for(j = 0; j < locExpansion->GetNverts(); ++j)
1453 meshVertId = locExpansion->GetGeom3D()->GetVid(j);
1457 graphVertOffset[vertReorderedGraphVertId[meshVertId]];
1460 for(j = 0; j < locExpansion->GetNedges(); ++j)
1462 nEdgeInteriorCoeffs = locExpansion->GetEdgeNcoeffs(j)-2;
1463 edgeOrient = locExpansion->GetGeom3D()->GetEorient(j);
1464 meshEdgeId = locExpansion->GetGeom3D()->GetEid(j);
1466 pIt = periodicEdges.find(meshEdgeId);
1471 if (pIt != periodicEdges.end())
1473 int minId = pIt->second[0].id;
1475 for (k = 1; k < pIt->second.size(); ++k)
1477 if (pIt->second[k].id < minId)
1479 minId = min(minId, pIt->second[k].id);
1484 if( meshEdgeId != min(minId, meshEdgeId))
1496 locExpansion->GetEdgeInteriorMap(j,edgeOrient,edgeInteriorMap,edgeInteriorSign);
1499 for(k = 0; k < nEdgeInteriorCoeffs; ++k)
1502 graphVertOffset[edgeReorderedGraphVertId[meshEdgeId]]+k;
1508 for(k = 0; k < nEdgeInteriorCoeffs; ++k)
1515 for(j = 0; j < locExpansion->GetNfaces(); ++j)
1517 nFaceInteriorCoeffs = locExpansion->GetFaceIntNcoeffs(j);
1518 faceOrient = locExpansion->GetGeom3D()->GetFaceOrient(j);
1519 meshFaceId = locExpansion->GetGeom3D()->GetFid(j);
1521 pIt = periodicFaces.find(meshFaceId);
1523 if (pIt != periodicFaces.end() &&
1524 meshFaceId == min(meshFaceId, pIt->second[0].id))
1529 locExpansion->GetFaceInteriorMap(j,faceOrient,faceInteriorMap,faceInteriorSign);
1532 for(k = 0; k < nFaceInteriorCoeffs; ++k)
1535 graphVertOffset[faceReorderedGraphVertId[meshFaceId]]+k;
1540 for(k = 0; k < nFaceInteriorCoeffs; ++k)
1551 for(i = 0; i < bndCondExp.num_elements(); i++)
1553 set<int> foundExtraVerts, foundExtraEdges;
1554 for(j = 0; j < bndCondExp[i]->GetNumElmts(); j++)
1556 bndCondFaceExp = bndCondExp[i]->GetExp(j)
1558 cnt = offset + bndCondExp[i]->GetCoeff_Offset(j);
1559 for(k = 0; k < bndCondFaceExp->GetNverts(); k++)
1561 meshVertId = bndCondFaceExp->
GetGeom2D()->GetVid(k);
1562 m_bndCondCoeffsToGlobalCoeffsMap[cnt+bndCondFaceExp->
GetVertexMap(k)] = graphVertOffset[vertReorderedGraphVertId[meshVertId]];
1564 if (bndConditions[i]->GetBoundaryConditionType() !=
1571 if (iter != extraDirVerts.end() &&
1572 foundExtraVerts.count(meshVertId) == 0)
1574 int loc = bndCondExp[i]->GetCoeff_Offset(j) +
1575 bndCondFaceExp->GetVertexMap(k);
1576 int gid = graphVertOffset[
1577 vertReorderedGraphVertId[meshVertId]];
1580 foundExtraVerts.insert(meshVertId);
1584 for(k = 0; k < bndCondFaceExp->GetNedges(); k++)
1586 nEdgeInteriorCoeffs = bndCondFaceExp->GetEdgeNcoeffs(k)-2;
1587 edgeOrient = bndCondFaceExp->GetGeom2D()->GetEorient(k);
1588 meshEdgeId = bndCondFaceExp->GetGeom2D()->GetEid(k);
1590 pIt = periodicEdges.find(meshEdgeId);
1595 if (pIt != periodicEdges.end())
1597 int minId = pIt->second[0].id;
1599 for (l = 1; l < pIt->second.size(); ++l)
1601 if (pIt->second[l].id < minId)
1603 minId = min(minId, pIt->second[l].id);
1609 meshEdgeId != min(minId, meshEdgeId))
1615 bndCondFaceExp->GetEdgeInteriorMap(
1616 k,edgeOrient,edgeInteriorMap,edgeInteriorSign);
1618 for(l = 0; l < nEdgeInteriorCoeffs; ++l)
1620 m_bndCondCoeffsToGlobalCoeffsMap[cnt+edgeInteriorMap[l]] =
1621 graphVertOffset[edgeReorderedGraphVertId[meshEdgeId]]+l;
1627 for(l = 0; l < nEdgeInteriorCoeffs; ++l)
1633 if (bndConditions[i]->GetBoundaryConditionType() !=
1640 if (iter != extraDirEdges.end() &&
1641 foundExtraEdges.count(meshEdgeId) == 0 &&
1642 nEdgeInteriorCoeffs > 0)
1644 for(l = 0; l < nEdgeInteriorCoeffs; ++l)
1646 int loc = bndCondExp[i]->GetCoeff_Offset(j) +
1648 int gid = graphVertOffset[
1649 edgeReorderedGraphVertId[meshEdgeId]]+l;
1653 foundExtraEdges.insert(meshEdgeId);
1657 meshFaceId = bndCondFaceExp->GetGeom2D()->GetFid();
1659 for(k = 0; k < bndCondFaceExp->GetNcoeffs(); k++)
1661 if(m_bndCondCoeffsToGlobalCoeffsMap[cnt+k] == -1)
1663 m_bndCondCoeffsToGlobalCoeffsMap[cnt+k] =
1664 graphVertOffset[faceReorderedGraphVertId[meshFaceId]]+intDofCnt;
1669 offset += bndCondExp[i]->GetNcoeffs();
1709 map<int, vector<ExtraDirDof> >
::iterator Tit;
1714 for (i = 0; i < Tit->second.size(); ++i)
1716 valence[Tit->second[i].get<1>()] = 1.0;
1725 for (i = 0; i < Tit->second.size(); ++i)
1727 boost::get<2>(Tit->second.at(i)) /= valence[Tit->second.at(i).get<1>()];
1739 Array<OneD, int> vwgts_perm(nGraphVerts);
1740 for(i = 0; i < nGraphVerts; ++i)
1742 vwgts_perm[i] = vwgts[perm[i]];
1745 bottomUpGraph->ExpandGraphWithVertexWeights(vwgts_perm);
1747 AssemblyMap>::AllocateSharedPtr(
this,bottomUpGraph);
1756 m_comm->GetRowComm()->AllReduce(hash,