44 #include <boost/config.hpp>
45 #include <boost/graph/adjacency_list.hpp>
46 #include <boost/graph/cuthill_mckee_ordering.hpp>
47 #include <boost/graph/properties.hpp>
48 #include <boost/graph/bandwidth.hpp>
54 namespace MultiRegions
72 AssemblyMapCG::AssemblyMapCG(
74 const std::string variable):
77 pSession->LoadParameter(
85 const bool checkIfSystemSingular,
91 set<int> &extraDirVerts,
92 set<int> &extraDirEdges,
93 int &firstNonDirGraphVertId,
100 int meshVertId, meshEdgeId, meshFaceId;
101 int meshVertId2, meshEdgeId2;
107 PeriodicMap::const_iterator pIt;
112 for(i = 0; i < bndCondExp.num_elements(); i++)
116 for(k = 0; k < bndConditions.num_elements(); ++k)
118 if (bndConditions[k][i]->GetBoundaryConditionType() ==
123 if (bndConditions[k][i]->GetBoundaryConditionType() !=
132 for (j = 0; j < bndCondExp[i]->GetNumElmts(); ++j)
135 for (k = 0; k < bndExp->GetNverts(); ++k)
137 if (vMaxVertId < bndExp->GetGeom()->GetVid(k))
139 vMaxVertId = bndExp->
GetGeom()->GetVid(k);
146 if(cnt == bndConditions.num_elements())
148 for(j = 0; j < bndCondExp[i]->GetNumElmts(); j++)
150 bndExp = bndCondExp[i]->GetExp(j);
152 for (k = 0; k < bndExp->GetNverts(); k++)
154 meshVertId = bndExp->GetGeom()->GetVid(k);
155 if (graph[0].count(meshVertId) == 0)
157 graph[0][meshVertId] = graphVertId++;
161 for (k = 0; k < bndExp->GetNedges(); k++)
163 meshEdgeId = bndExp->GetGeom()->GetEid(k);
164 if (graph[1].count(meshEdgeId) == 0)
166 graph[1][meshEdgeId] = graphVertId++;
171 meshFaceId = bndExp->GetGeom()->GetGlobalID();
172 const int bndDim = bndExp->GetNumBases();
173 if (graph[bndDim].count(meshFaceId) == 0)
175 graph[bndDim][meshFaceId] = graphVertId++;
210 int n = vComm->GetSize();
211 int p = vComm->GetRank();
220 vertcounts[
p] = graph[0].size();
221 edgecounts[
p] = graph[1].size();
225 for (i = 1; i < n; ++i)
227 vertoffsets[i] = vertoffsets[i-1] + vertcounts[i-1];
228 edgeoffsets[i] = edgeoffsets[i-1] + edgecounts[i-1];
239 for (it = graph[0].begin(), i = 0;
240 it != graph[0].end();
243 vertlist[vertoffsets[
p] + i] = it->first;
247 for (it = graph[1].begin(), i = 0;
248 it != graph[1].end();
251 edgelist[edgeoffsets[
p] + i] = it->first;
259 map<int, int> extraDirVertIds, extraDirEdgeIds;
269 for (i = 0; i < n; ++i)
276 for(j = 0; j < locExpVector.size(); j++)
278 exp = locExpVector[j];
280 for(k = 0; k < exp->GetNverts(); k++)
282 meshVertId = exp->GetGeom()->GetVid(k);
283 if(graph[0].count(meshVertId) == 0)
285 for (l = 0; l < vertcounts[i]; ++l)
287 if (vertlist[vertoffsets[i]+l] == meshVertId)
289 extraDirVertIds[meshVertId] = i;
290 graph[0][meshVertId] = graphVertId++;
297 for(k = 0; k < exp->GetNedges(); k++)
299 meshEdgeId = exp->GetGeom()->GetEid(k);
300 if(graph[1].count(meshEdgeId) == 0)
302 for (l = 0; l < edgecounts[i]; ++l)
304 if (edgelist[edgeoffsets[i]+l] == meshEdgeId)
306 extraDirEdgeIds[meshEdgeId] = i;
307 graph[1][meshEdgeId] = graphVertId++;
308 nExtraDirichlet += exp->GetEdgeNcoeffs(k)-2;
318 map<int, int>::const_iterator mapConstIt;
320 for (mapConstIt = extraDirEdgeIds.begin(), i = 0;
321 mapConstIt != extraDirEdgeIds.end(); mapConstIt++)
323 meshEdgeId = mapConstIt->first;
333 for (i = 0; i < n; ++i)
341 vertcounts[
p] = extraDirVertIds.size();
342 edgecounts[
p] = extraDirEdgeIds.size();
348 vertoffsets[0] = edgeoffsets[0] = 0;
350 for (i = 1; i < n; ++i)
352 vertoffsets[i] = vertoffsets[i-1] + vertcounts[i-1];
353 edgeoffsets[i] = edgeoffsets[i-1] + edgecounts[i-1];
361 for (it = extraDirVertIds.begin(), i = 0;
362 it != extraDirVertIds.end(); ++it, ++i)
364 vertids [vertoffsets[
p]+i] = it->first;
365 vertprocs[vertoffsets[
p]+i] = it->second;
368 for (it = extraDirEdgeIds.begin(), i = 0;
369 it != extraDirEdgeIds.end(); ++it, ++i)
371 edgeids [edgeoffsets[
p]+i] = it->first;
372 edgeprocs[edgeoffsets[
p]+i] = it->second;
382 for (i = 0; i < nTotVerts; ++i)
384 if (vComm->GetRank() == vertprocs[i])
386 extraDirVerts.insert(vertids[i]);
391 for (i = 0; i < nTotEdges; ++i)
393 if (vComm->GetRank() == edgeprocs[i])
395 extraDirEdges.insert(edgeids[i]);
406 bcminvertid[
p] = vMaxVertId;
421 if (
m_session->DefinesParameter(
"SingularVertex"))
423 m_session->LoadParameter(
"SingularVertex", meshVertId);
425 else if (vMaxVertId == -1)
428 meshVertId = locExpVector[0]->GetGeom()->GetVid(0);
434 meshVertId = bcminvertid[
p];
437 if (graph[0].count(meshVertId) == 0)
439 graph[0][meshVertId] = graphVertId++;
455 for (i = 0; i < locExpVector.size(); ++i)
457 for (j = 0; j < locExpVector[i]->GetNverts(); ++j)
459 if (locExpVector[i]->GetGeom()->GetVid(j) !=
465 if (graph[0].count(meshVertId) == 0)
467 graph[0][meshVertId] =
483 if (graph[0].count(meshVertId) == 0)
489 gId = graph[0][meshVertId];
492 for (pIt = periodicVerts.begin();
493 pIt != periodicVerts.end(); ++pIt)
500 if (pIt->first == meshVertId)
502 gId = gId < 0 ? graphVertId++ : gId;
503 graph[0][meshVertId] = gId;
505 for (i = 0; i < pIt->second.size(); ++i)
507 if (pIt->second[i].isLocal)
509 graph[0][pIt->second[i].id] = graph[0][meshVertId];
516 for (i = 0; i < pIt->second.size(); ++i)
518 if (pIt->second[i].id == meshVertId)
527 gId = gId < 0 ? graphVertId++ : gId;
528 graph[0][pIt->first] = gId;
530 for (i = 0; i < pIt->second.size(); ++i)
532 if (pIt->second[i].isLocal)
534 graph[0][pIt->second[i].id] = graph[0][pIt->first];
544 firstNonDirGraphVertId = graphVertId;
546 typedef boost::adjacency_list<
547 boost::setS, boost::vecS, boost::undirectedS> BoostGraph;
548 BoostGraph boostGraphObj;
550 vector<map<int,int> > tempGraph(3);
551 map<int, int> vwgts_map;
556 int tempGraphVertId = 0;
557 int localVertOffset = 0;
558 int localEdgeOffset = 0;
559 int localFaceOffset = 0;
577 map<int,int> EdgeSize;
578 map<int,int> FaceSize;
581 for(i = 0; i < locExpVector.size(); ++i)
583 exp = locExpVector[i];
584 nTotalVerts += exp->GetNverts();
585 nTotalEdges += exp->GetNedges();
586 nTotalFaces += exp->GetNfaces();
588 nEdges = exp->GetNedges();
589 for(j = 0; j < nEdges; ++j)
591 meshEdgeId = exp->GetGeom()->GetEid(j);
592 if (EdgeSize.count(meshEdgeId) > 0)
594 EdgeSize[meshEdgeId] =
595 min(EdgeSize[meshEdgeId],
596 exp->GetEdgeNcoeffs(j) - 2);
600 EdgeSize[meshEdgeId] = exp->GetEdgeNcoeffs(j) - 2;
604 nFaces = exp->GetNfaces();
606 for(j = 0; j < nFaces; ++j)
608 meshFaceId = exp->GetGeom()->GetFid(j);
609 if (FaceSize.count(meshFaceId) > 0)
611 FaceSize[meshFaceId] =
612 min(FaceSize[meshFaceId],
613 exp->GetFaceIntNcoeffs(j));
617 FaceSize[meshFaceId] = exp->GetFaceIntNcoeffs(j);
619 FaceSize[meshFaceId] = exp->GetFaceIntNcoeffs(j);
624 for (pIt = periodicVerts.begin(); pIt != periodicVerts.end(); ++pIt)
626 meshVertId = pIt->first;
629 if (graph[0].count(pIt->first) != 0)
631 for (i = 0; i < pIt->second.size(); ++i)
633 meshVertId2 = pIt->second[i].id;
634 if (graph[0].count(meshVertId2) == 0 &&
635 pIt->second[i].isLocal)
637 graph[0][meshVertId2] =
638 graph[0][meshVertId];
645 bool isDirichlet =
false;
646 for (i = 0; i < pIt->second.size(); ++i)
648 if (!pIt->second[i].isLocal)
653 meshVertId2 = pIt->second[i].id;
654 if (graph[0].count(meshVertId2) > 0)
663 graph[0][meshVertId] =
664 graph[0][pIt->second[i].id];
666 for (j = 0; j < pIt->second.size(); ++j)
668 meshVertId2 = pIt->second[i].id;
669 if (j == i || !pIt->second[j].isLocal ||
670 graph[0].count(meshVertId2) > 0)
675 graph[0][meshVertId2] =
676 graph[0][pIt->second[i].id];
683 for (i = 0; i < pIt->second.size(); ++i)
685 if (!pIt->second[i].isLocal)
690 if (tempGraph[0].count(pIt->second[i].id) > 0)
696 if (i == pIt->second.size())
698 boost::add_vertex(boostGraphObj);
699 tempGraph[0][meshVertId] = tempGraphVertId++;
704 tempGraph[0][meshVertId] = tempGraph[0][pIt->second[i].id];
715 for(i = 0; i < locExpVector.size(); ++i)
717 exp = locExpVector[i];
719 nVerts = exp->GetNverts();
720 for(j = 0; j < nVerts; ++j)
722 meshVertId = exp->GetGeom()->GetVid(j);
723 if(graph[0].count(meshVertId) == 0)
725 if(tempGraph[0].count(meshVertId) == 0)
727 boost::add_vertex(boostGraphObj);
728 tempGraph[0][meshVertId] = tempGraphVertId++;
731 localVerts[localVertOffset+vertCnt++] = tempGraph[0][meshVertId];
732 vwgts_map[ tempGraph[0][meshVertId] ] = 1;
736 localVertOffset+=nVerts;
740 for (pIt = periodicEdges.begin(); pIt != periodicEdges.end(); ++pIt)
742 meshEdgeId = pIt->first;
745 if (graph[1].count(pIt->first) != 0)
747 for (i = 0; i < pIt->second.size(); ++i)
749 meshEdgeId2 = pIt->second[i].id;
750 if (graph[1].count(meshEdgeId2) == 0 &&
751 pIt->second[i].isLocal)
753 graph[1][meshEdgeId2] =
754 graph[1][meshEdgeId];
761 bool isDirichlet =
false;
762 for (i = 0; i < pIt->second.size(); ++i)
764 if (!pIt->second[i].isLocal)
769 meshEdgeId2 = pIt->second[i].id;
770 if (graph[1].count(meshEdgeId2) > 0)
779 graph[1][meshEdgeId] =
780 graph[1][pIt->second[i].id];
782 for (j = 0; j < pIt->second.size(); ++j)
784 meshEdgeId2 = pIt->second[i].id;
785 if (j == i || !pIt->second[j].isLocal ||
786 graph[1].count(meshEdgeId2) > 0)
791 graph[1][meshEdgeId2] =
792 graph[1][pIt->second[i].id];
799 for (i = 0; i < pIt->second.size(); ++i)
801 if (!pIt->second[i].isLocal)
806 if (tempGraph[1].count(pIt->second[i].id) > 0)
812 if (i == pIt->second.size())
814 boost::add_vertex(boostGraphObj);
815 tempGraph[1][meshEdgeId] = tempGraphVertId++;
821 tempGraph[1][meshEdgeId] = tempGraph[1][pIt->second[i].id];
825 int nEdgeIntCoeffs, nFaceIntCoeffs;
828 for(i = 0; i < locExpVector.size(); ++i)
830 exp = locExpVector[i];
832 nEdges = exp->GetNedges();
834 for(j = 0; j < nEdges; ++j)
836 meshEdgeId = exp->GetGeom()->GetEid(j);
837 nEdgeIntCoeffs = EdgeSize[meshEdgeId];
838 if(graph[1].count(meshEdgeId) == 0)
840 if(tempGraph[1].count(meshEdgeId) == 0)
842 boost::add_vertex(boostGraphObj);
843 tempGraph[1][meshEdgeId] = tempGraphVertId++;
848 localEdges[localEdgeOffset+edgeCnt++] = tempGraph[1][meshEdgeId];
849 vwgts_map[ tempGraph[1][meshEdgeId] ] = nEdgeIntCoeffs;
853 localEdgeOffset+=nEdges;
857 for (pIt = periodicFaces.begin(); pIt != periodicFaces.end(); ++pIt)
859 if (!pIt->second[0].isLocal)
862 meshFaceId = pIt->first;
863 ASSERTL0(graph[2].count(meshFaceId) == 0,
864 "This periodic boundary edge has been specified before");
865 boost::add_vertex(boostGraphObj);
866 tempGraph[2][meshFaceId] = tempGraphVertId++;
867 nFaceIntCoeffs = FaceSize[meshFaceId];
871 else if (pIt->first < pIt->second[0].id)
873 ASSERTL0(graph[2].count(pIt->first) == 0,
874 "This periodic boundary face has been specified before");
875 ASSERTL0(graph[2].count(pIt->second[0].id) == 0,
876 "This periodic boundary face has been specified before");
878 boost::add_vertex(boostGraphObj);
879 tempGraph[2][pIt->first] = tempGraphVertId;
880 tempGraph[2][pIt->second[0].id] = tempGraphVertId++;
881 nFaceIntCoeffs = FaceSize[pIt->first];
888 for(i = 0; i < locExpVector.size(); ++i)
890 exp = locExpVector[i];
891 nFaces = exp->GetNfaces();
893 for(j = 0; j < nFaces; ++j)
895 nFaceIntCoeffs = exp->GetFaceIntNcoeffs(j);
896 meshFaceId = exp->GetGeom()->GetFid(j);
897 if(graph[2].count(meshFaceId) == 0)
899 if(tempGraph[2].count(meshFaceId) == 0)
901 boost::add_vertex(boostGraphObj);
902 tempGraph[2][meshFaceId] = tempGraphVertId++;
907 localFaces[localFaceOffset+faceCnt++] = tempGraph[2][meshFaceId];
908 vwgts_map[ tempGraph[2][meshFaceId] ] = nFaceIntCoeffs;
913 localFaceOffset+=nFaces;
919 for(i = 0; i < locExpVector.size(); ++i)
921 exp = locExpVector[i];
922 nVerts = exp->GetNverts();
923 nEdges = exp->GetNedges();
924 nFaces = exp->GetNfaces();
931 for(j = 0; j < nVerts; j++)
933 if(localVerts[j+localVertOffset]==-1)
938 for(k = 0; k < nVerts; k++)
940 if(localVerts[k+localVertOffset]==-1)
946 boost::add_edge( (
size_t) localVerts[j+localVertOffset],
947 (
size_t) localVerts[k+localVertOffset],boostGraphObj);
951 for(k = 0; k < nEdges; k++)
953 if(localEdges[k+localEdgeOffset]==-1)
957 boost::add_edge( (
size_t) localVerts[j+localVertOffset],
958 (
size_t) localEdges[k+localEdgeOffset],boostGraphObj);
961 for(k = 0; k < nFaces; k++)
963 if(localFaces[k+localFaceOffset]==-1)
967 boost::add_edge( (
size_t) localVerts[j+localVertOffset],
968 (
size_t) localFaces[k+localFaceOffset],boostGraphObj);
973 for(j = 0; j < nEdges; j++)
975 if(localEdges[j+localEdgeOffset]==-1)
980 for(k = 0; k < nEdges; k++)
982 if(localEdges[k+localEdgeOffset]==-1)
988 boost::add_edge( (
size_t) localEdges[j+localEdgeOffset],
989 (
size_t) localEdges[k+localEdgeOffset],boostGraphObj);
993 for(k = 0; k < nVerts; k++)
995 if(localVerts[k+localVertOffset]==-1)
999 boost::add_edge( (
size_t) localEdges[j+localEdgeOffset],
1000 (
size_t) localVerts[k+localVertOffset],boostGraphObj);
1003 for(k = 0; k < nFaces; k++)
1005 if(localFaces[k+localFaceOffset]==-1)
1009 boost::add_edge( (
size_t) localEdges[j+localEdgeOffset],
1010 (
size_t) localFaces[k+localFaceOffset],boostGraphObj);
1015 for(j = 0; j < nFaces; j++)
1017 if(localFaces[j+localFaceOffset]==-1)
1022 for(k = 0; k < nFaces; k++)
1024 if(localFaces[k+localFaceOffset]==-1)
1030 boost::add_edge( (
size_t) localFaces[j+localFaceOffset],
1031 (
size_t) localFaces[k+localFaceOffset],boostGraphObj);
1035 for(k = 0; k < nVerts; k++)
1037 if(localVerts[k+localVertOffset]==-1)
1041 boost::add_edge( (
size_t) localFaces[j+localFaceOffset],
1042 (
size_t) localVerts[k+localVertOffset],boostGraphObj);
1045 for(k = 0; k < nEdges; k++)
1047 if(localEdges[k+localEdgeOffset]==-1)
1051 boost::add_edge( (
size_t) localFaces[j+localFaceOffset],
1052 (
size_t) localEdges[k+localEdgeOffset],boostGraphObj);
1056 localVertOffset+=nVerts;
1057 localEdgeOffset+=nEdges;
1058 localFaceOffset+=nFaces;
1068 vector<long> procVerts, procEdges, procFaces;
1069 set <int> foundVerts, foundEdges, foundFaces;
1074 for(i = cnt = 0; i < locExpVector.size(); ++i)
1077 exp = locExpVector[elmtid];
1078 for (j = 0; j < exp->GetNverts(); ++j)
1080 int vid = exp->GetGeom()->GetVid(j)+1;
1081 if (foundVerts.count(vid) == 0)
1083 procVerts.push_back(vid);
1084 foundVerts.insert(vid);
1088 for (j = 0; j < exp->GetNedges(); ++j)
1090 int eid = exp->GetGeom()->GetEid(j)+1;
1092 if (foundEdges.count(eid) == 0)
1094 procEdges.push_back(eid);
1095 foundEdges.insert(eid);
1099 for (j = 0; j < exp->GetNfaces(); ++j)
1101 int fid = exp->GetGeom()->GetFid(j)+1;
1103 if (foundFaces.count(fid) == 0)
1105 procFaces.push_back(fid);
1106 foundFaces.insert(fid);
1111 int unique_verts = foundVerts.size();
1112 int unique_edges = foundEdges.size();
1113 int unique_faces = foundFaces.size();
1115 bool verbose =
m_session->DefinesCmdLineArgument(
"verbose");
1129 if (unique_edges > 0)
1137 if (unique_faces > 0)
1147 for (i = 0; i < unique_verts; ++i)
1151 if (graph[0].count(procVerts[i]-1) == 0)
1153 partVerts.insert(tempGraph[0][procVerts[i]-1]);
1158 for (i = 0; i < unique_edges; ++i)
1162 if (graph[1].count(procEdges[i]-1) == 0)
1164 partVerts.insert(tempGraph[1][procEdges[i]-1]);
1169 for (i = 0; i < unique_faces; ++i)
1173 if (graph[2].count(procFaces[i]-1) == 0)
1175 partVerts.insert(tempGraph[2][procFaces[i]-1]);
1181 for (pIt = periodicVerts.begin(); pIt != periodicVerts.end(); ++pIt)
1183 if (graph[0].count(pIt->first) == 0)
1185 partVerts.insert(tempGraph[0][pIt->first]);
1188 for (pIt = periodicEdges.begin(); pIt != periodicEdges.end(); ++pIt)
1190 if (graph[1].count(pIt->first) == 0)
1192 partVerts.insert(tempGraph[1][pIt->first]);
1195 for (pIt = periodicFaces.begin(); pIt != periodicFaces.end(); ++pIt)
1197 if (graph[2].count(pIt->first) == 0)
1199 partVerts.insert(tempGraph[2][pIt->first]);
1204 int nGraphVerts = tempGraphVertId;
1208 ASSERTL1(vwgts_map.size()==nGraphVerts,
"Non matching dimensions");
1209 for(i = 0; i < nGraphVerts; ++i)
1211 vwgts[i] = vwgts_map[i];
1242 boostGraphObj, perm, iperm, bottomUpGraph,
1243 partVerts, mdswitch);
1249 "Unrecognised solution type: " + std::string(
1276 for(mapIt = tempGraph[0].begin(); mapIt != tempGraph[0].end(); mapIt++)
1278 graph[0][mapIt->first] = iperm[mapIt->second] + graphVertId;
1280 for(mapIt = tempGraph[1].begin(); mapIt != tempGraph[1].end(); mapIt++)
1282 graph[1][mapIt->first] = iperm[mapIt->second] + graphVertId;
1284 for(mapIt = tempGraph[2].begin(); mapIt != tempGraph[2].end(); mapIt++)
1286 graph[2][mapIt->first] = iperm[mapIt->second] + graphVertId;
1297 const int numLocalCoeffs,
1301 const bool checkIfSystemSingular,
1302 const std::string variable,
1309 int p, q, numModes0, numModes1;
1312 int meshVertId, meshEdgeId, meshEdgeId2, meshFaceId, meshFaceId2;
1314 int nEdgeInteriorCoeffs;
1315 int firstNonDirGraphVertId;
1325 PeriodicMap::const_iterator pIt;
1329 bool verbose =
m_session->DefinesCmdLineArgument(
"verbose");
1336 vector<map<int, int> > faceModes(2);
1337 map<int, LibUtilities::ShapeType> faceType;
1339 set<int> extraDirVerts, extraDirEdges;
1344 for (i = 0; i < locExpVector.size(); ++i)
1346 exp = locExpVector[i];
1348 for(j = 0; j < exp->GetNverts(); ++j)
1350 dofs[0][exp->GetGeom()->GetVid(j)] = 1;
1353 for(j = 0; j < exp->GetNedges(); ++j)
1355 if (dofs[1].count(exp->GetGeom()->GetEid(j)) > 0)
1357 if (dofs[1][exp->GetGeom()->GetEid(j)] !=
1358 exp->GetEdgeNcoeffs(j)-2)
1363 "CG with variable order only available with modal expansion");
1365 dofs[1][exp->GetGeom()->GetEid(j)] =
1366 min(dofs[1][exp->GetGeom()->GetEid(j)],
1367 exp->GetEdgeNcoeffs(j)-2);
1371 dofs[1][exp->GetGeom()->GetEid(j)] =
1372 exp->GetEdgeNcoeffs(j) - 2;
1376 for(j = 0; j < exp->GetNfaces(); ++j)
1378 faceOrient = exp->GetGeom()->GetForient(j);
1379 meshFaceId = exp->GetGeom()->GetFid(j);
1380 exp->GetFaceNumModes(j, faceOrient, numModes0, numModes1);
1382 if (faceModes[0].count(meshFaceId) > 0)
1384 faceModes[0][meshFaceId] =
1385 min(faceModes[0][meshFaceId], numModes0);
1387 faceModes[1][meshFaceId] =
1388 min(faceModes[1][meshFaceId], numModes1);
1392 faceModes[0][meshFaceId] = numModes0;
1393 faceModes[1][meshFaceId] = numModes1;
1399 faceType[meshFaceId] =
1400 geom->GetFace(j)->GetShapeType();
1406 for (pIt = periodicEdges.begin(); pIt != periodicEdges.end(); ++pIt)
1408 for (i = 0; i < pIt->second.size(); ++i)
1410 meshEdgeId2 = pIt->second[i].id;
1411 if (dofs[1].count(meshEdgeId2) == 0)
1413 dofs[1][meshEdgeId2] = 1e6;
1417 for (pIt = periodicFaces.begin(); pIt != periodicFaces.end(); ++pIt)
1419 for (i = 0; i < pIt->second.size(); ++i)
1421 meshFaceId2 = pIt->second[i].id;
1422 if (faceModes[0].count(meshFaceId2) == 0)
1424 faceModes[0][meshFaceId2] = 1e6;
1425 faceModes[1][meshFaceId2] = 1e6;
1436 for(dofIt = dofs[1].begin(), i=0; dofIt != dofs[1].end(); dofIt++, i++)
1438 edgeId[i] = dofIt->first + 1;
1444 for (i=0; i < dofs[1].size(); i++)
1446 dofs[1][edgeId[i]-1] = (int) (edgeDof[i]+0.5);
1449 for (pIt = periodicEdges.begin(); pIt != periodicEdges.end(); ++pIt)
1451 meshEdgeId = pIt->first;
1452 for (i = 0; i < pIt->second.size(); ++i)
1454 meshEdgeId2 = pIt->second[i].id;
1455 if (dofs[1][meshEdgeId2] < dofs[1][meshEdgeId])
1457 dofs[1][meshEdgeId] = dofs[1][meshEdgeId2];
1465 for(dofIt = faceModes[0].begin(), dofIt2 = faceModes[1].begin(),i=0;
1466 dofIt != faceModes[0].end(); dofIt++, dofIt2++, i++)
1468 faceId[i] = dofIt->first+1;
1476 for (i=0; i < faceModes[0].size(); i++)
1478 faceModes[0][faceId[i]-1] = (int) (faceP[i]+0.5);
1479 faceModes[1][faceId[i]-1] = (int) (faceQ[i]+0.5);
1482 for (pIt = periodicFaces.begin(); pIt != periodicFaces.end(); ++pIt)
1484 meshFaceId = pIt->first;
1485 for (i = 0; i < pIt->second.size(); ++i)
1487 meshFaceId2 = pIt->second[i].id;
1488 if (faceModes[0][meshFaceId2] < faceModes[0][meshFaceId])
1490 faceModes[0][meshFaceId] = faceModes[0][meshFaceId2];
1492 if (faceModes[1][meshFaceId2] < faceModes[1][meshFaceId])
1494 faceModes[1][meshFaceId] = faceModes[1][meshFaceId2];
1500 for (i=0; i < faceModes[0].size(); i++)
1502 P = faceModes[0][faceId[i]-1];
1503 Q = faceModes[1][faceId[i]-1];
1507 dofs[2][faceId[i]-1] =
1514 dofs[2][faceId[i]-1] =
1525 int nExtraDirichlet;
1528 "MDSwitch", mdswitch, 10);
1531 checkIfSystemSingular, periodicVerts, periodicEdges,
1532 periodicFaces, graph, bottomUpGraph, extraDirVerts,
1533 extraDirEdges, firstNonDirGraphVertId,
1534 nExtraDirichlet, mdswitch);
1548 graph[0].size() + graph[1].size() + graph[2].size() + 1);
1550 graphVertOffset[0] = 0;
1552 for(i = 0; i < locExpVector.size(); ++i)
1554 exp = locExpVector[i];
1556 for(j = 0; j < exp->GetNverts(); ++j)
1558 meshVertId = exp->GetGeom()->GetVid(j);
1559 graphVertOffset[graph[0][meshVertId]+1] = 1;
1562 for(j = 0; j < exp->GetNedges(); ++j)
1564 nEdgeInteriorCoeffs = exp->GetEdgeNcoeffs(j) - 2;
1565 meshEdgeId = exp->GetGeom()->GetEid(j);
1566 graphVertOffset[graph[1][meshEdgeId]+1]
1567 = dofs[1][meshEdgeId];
1569 bType = exp->GetEdgeBasisType(j);
1573 if(nEdgeInteriorCoeffs &&
1581 for(j = 0; j < exp->GetNfaces(); ++j)
1583 meshFaceId = exp->GetGeom()->GetFid(j);
1584 graphVertOffset[graph[2][meshFaceId]+1] = dofs[2][meshFaceId];
1588 for(i = 1; i < graphVertOffset.num_elements(); i++)
1590 graphVertOffset[i] += graphVertOffset[i-1];
1614 locExpVector[i]->NumBndryCoeffs();
1615 m_numLocalIntCoeffsPerPatch[i] = (
unsigned int)
1616 locExpVector[i]->GetNcoeffs() -
1617 locExpVector[i]->NumBndryCoeffs();
1632 for(i = 0; i < locExpVector.size(); ++i)
1634 exp = locExpVector[i];
1636 for(j = 0; j < exp->GetNverts(); ++j)
1638 meshVertId = exp->GetGeom()->GetVid(j);
1642 graphVertOffset[graph[0][meshVertId]];
1645 for(j = 0; j < exp->GetNedges(); ++j)
1647 nEdgeInteriorCoeffs = exp->GetEdgeNcoeffs(j)-2;
1648 edgeOrient = exp->GetGeom()->GetEorient(j);
1649 meshEdgeId = exp->GetGeom()->GetEid(j);
1651 pIt = periodicEdges.find(meshEdgeId);
1656 if (pIt != periodicEdges.end())
1658 pair<int, StdRegions::Orientation> idOrient =
1660 meshEdgeId, edgeOrient, pIt->second);
1661 edgeOrient = idOrient.second;
1664 exp->GetEdgeInteriorMap(j,edgeOrient,edgeInteriorMap,edgeInteriorSign);
1667 for(k = 0; k < dofs[1][exp->GetGeom()->GetEid(j)]; ++k)
1670 graphVertOffset[graph[1][meshEdgeId]]+k;
1672 for(k = dofs[1][exp->GetGeom()->GetEid(j)]; k < nEdgeInteriorCoeffs; ++k)
1675 graphVertOffset[graph[1][meshEdgeId]];
1681 for(k = 0; k < dofs[1][exp->GetGeom()->GetEid(j)]; ++k)
1685 for(k = dofs[1][exp->GetGeom()->GetEid(j)]; k < nEdgeInteriorCoeffs; ++k)
1692 for(j = 0; j < exp->GetNfaces(); ++j)
1694 faceOrient = exp->GetGeom()->GetForient(j);
1695 meshFaceId = exp->GetGeom()->GetFid(j);
1697 pIt = periodicFaces.find(meshFaceId);
1699 if (pIt != periodicFaces.end() &&
1700 meshFaceId == min(meshFaceId, pIt->second[0].id))
1705 exp->GetFaceInteriorMap(j,faceOrient,faceInteriorMap,faceInteriorSign);
1708 exp->GetFaceNumModes(j, faceOrient, numModes0, numModes1);
1709 switch(faceType[meshFaceId])
1715 for( q = 2; q < numModes1; q++)
1717 for( p = 2; p < numModes0; p++)
1719 if( (p < faceModes[0][meshFaceId]) &&
1720 (q < faceModes[1][meshFaceId]))
1723 graphVertOffset[graph[2][meshFaceId]]+k;
1734 graphVertOffset[graph[2][meshFaceId]];
1749 for( p = 2; p < numModes0; p++)
1751 for( q = 1; q < numModes1-
p; q++)
1753 if( (p < faceModes[0][meshFaceId]) &&
1754 (p+q < faceModes[1][meshFaceId]))
1757 graphVertOffset[graph[2][meshFaceId]]+k;
1768 graphVertOffset[graph[2][meshFaceId]];
1780 ASSERTL0(
false,
"Shape not recognised");
1789 for(i = 0; i < bndCondExp.num_elements(); i++)
1791 set<int> foundExtraVerts, foundExtraEdges;
1792 for(j = 0; j < bndCondExp[i]->GetNumElmts(); j++)
1794 bndExp = bndCondExp[i]->GetExp(j);
1795 cnt = offset + bndCondExp[i]->GetCoeff_Offset(j);
1796 for(k = 0; k < bndExp->GetNverts(); k++)
1798 meshVertId = bndExp->GetGeom()->GetVid(k);
1799 m_bndCondCoeffsToGlobalCoeffsMap[cnt+bndExp->GetVertexMap(k)] = graphVertOffset[graph[0][meshVertId]];
1801 if (bndConditions[i]->GetBoundaryConditionType() !=
1808 if (iter != extraDirVerts.end() &&
1809 foundExtraVerts.count(meshVertId) == 0)
1811 int loc = bndCondExp[i]->GetCoeff_Offset(j) +
1812 bndExp->GetVertexMap(k);
1813 int gid = graphVertOffset[
1814 graph[0][meshVertId]];
1817 foundExtraVerts.insert(meshVertId);
1821 for(k = 0; k < bndExp->GetNedges(); k++)
1823 nEdgeInteriorCoeffs = bndExp->GetEdgeNcoeffs(k)-2;
1824 edgeOrient = bndExp->GetGeom()->GetEorient(k);
1825 meshEdgeId = bndExp->GetGeom()->GetEid(k);
1827 pIt = periodicEdges.find(meshEdgeId);
1832 if (pIt != periodicEdges.end())
1834 pair<int, StdRegions::Orientation> idOrient =
1836 meshEdgeId, edgeOrient, pIt->second);
1837 edgeOrient = idOrient.second;
1840 bndExp->GetEdgeInteriorMap(
1841 k,edgeOrient,edgeInteriorMap,edgeInteriorSign);
1843 for(l = 0; l < dofs[1][meshEdgeId]; ++l)
1845 m_bndCondCoeffsToGlobalCoeffsMap[cnt+edgeInteriorMap[l]] =
1846 graphVertOffset[graph[1][meshEdgeId]]+l;
1848 for(l = dofs[1][meshEdgeId]; l < nEdgeInteriorCoeffs; ++l)
1850 m_bndCondCoeffsToGlobalCoeffsMap[cnt+edgeInteriorMap[l]] =
1851 graphVertOffset[graph[1][meshEdgeId]];
1857 for(l = 0; l < dofs[1][meshEdgeId]; ++l)
1861 for(l = dofs[1][meshEdgeId]; l < nEdgeInteriorCoeffs; ++l)
1867 if (bndConditions[i]->GetBoundaryConditionType() !=
1874 if (iter != extraDirEdges.end() &&
1875 foundExtraEdges.count(meshEdgeId) == 0 &&
1876 nEdgeInteriorCoeffs > 0)
1878 for(l = 0; l < dofs[1][meshEdgeId]; ++l)
1880 int loc = bndCondExp[i]->GetCoeff_Offset(j) +
1882 int gid = graphVertOffset[
1883 graph[1][meshEdgeId]]+l;
1887 for(l = dofs[1][meshEdgeId]; l < nEdgeInteriorCoeffs; ++l)
1889 int loc = bndCondExp[i]->GetCoeff_Offset(j) +
1891 int gid = graphVertOffset[
1892 graph[1][meshEdgeId]];
1896 foundExtraEdges.insert(meshEdgeId);
1900 meshFaceId = bndExp->GetGeom()->GetGlobalID();
1902 for(k = 0; k < bndExp->GetNcoeffs(); k++)
1904 if(m_bndCondCoeffsToGlobalCoeffsMap[cnt+k] == -1)
1906 m_bndCondCoeffsToGlobalCoeffsMap[cnt+k] =
1907 graphVertOffset[graph[bndExp->GetNumBases()][meshFaceId]]+intDofCnt;
1912 offset += bndCondExp[i]->GetNcoeffs();
1952 map<int, vector<ExtraDirDof> >
::iterator Tit;
1957 for (i = 0; i < Tit->second.size(); ++i)
1959 valence[Tit->second[i].get<1>()] = 1.0;
1968 for (i = 0; i < Tit->second.size(); ++i)
1970 boost::get<2>(Tit->second.at(i)) /= valence[Tit->second.at(i).get<1>()];
1984 graph[0].size() + graph[1].size() + graph[2].size()
1985 - firstNonDirGraphVertId);
1987 for (i = 0; i < locExpVector.size(); ++i)
1989 exp = locExpVector[i];
1991 for (j = 0; j < exp->GetNverts(); ++j)
1993 meshVertId = exp->GetGeom()->GetVid(j);
1995 if (graph[0][meshVertId] >= firstNonDirGraphVertId)
1997 vwgts_perm[graph[0][meshVertId] -
1998 firstNonDirGraphVertId] =
1999 dofs[0][meshVertId];
2003 for (j = 0; j < exp->GetNedges(); ++j)
2005 meshEdgeId = exp->GetGeom()->GetEid(j);
2007 if (graph[1][meshEdgeId] >= firstNonDirGraphVertId)
2009 vwgts_perm[graph[1][meshEdgeId] -
2010 firstNonDirGraphVertId] =
2011 dofs[1][meshEdgeId];
2015 for (j = 0; j < exp->GetNfaces(); ++j)
2017 meshFaceId = exp->GetGeom()->GetFid(j);
2019 if (graph[2][meshFaceId] >= firstNonDirGraphVertId)
2021 vwgts_perm[graph[2][meshFaceId] -
2022 firstNonDirGraphVertId] =
2023 dofs[2][meshFaceId];
2028 bottomUpGraph->ExpandGraphWithVertexWeights(vwgts_perm);
2077 const vector<PeriodicEntity> &periodicEdges)
2079 int minId = periodicEdges[0].id;
2083 for (k = 1; k < periodicEdges.size(); ++k)
2085 if (periodicEdges[k].
id < minId)
2087 minId = min(minId, periodicEdges[k].
id);
2092 minId = min(minId, meshEdgeId);
2094 if (meshEdgeId != minId)
2104 return make_pair(minId, edgeOrient);
2130 int tmp1 = (int)faceOrient - 5;
2131 int tmp2 = (int)perFaceOrient - 5;
2133 int flipDir1Map [8] = {2,3,0,1,6,7,4,5};
2134 int flipDir2Map [8] = {1,0,3,2,5,4,7,6};
2135 int transposeMap[8] = {4,5,6,7,0,2,1,3};
2140 tmp1 = transposeMap[tmp1];
2144 if (tmp2 == 2 || tmp2 == 3 || tmp2 == 6 || tmp2 == 7)
2146 tmp1 = flipDir1Map[tmp1];
2152 tmp1 = flipDir2Map[tmp1];
2186 int maxBndGlobalId = 0;
2194 PeriodicMap::const_iterator pIt;
2198 const bool verbose = locExp.
GetSession()->DefinesCmdLineArgument(
"verbose");
2206 for(i = 0; i < locExpVector.size(); ++i)
2208 exp = locExpVector[i];
2209 nVert += exp->GetNverts();
2210 nEdge += exp->GetNedges();
2211 nFace += exp->GetNfaces();
2213 for(j = 0; j < exp->GetNedges(); ++j)
2215 dof = exp->GetEdgeNcoeffs(j)-2;
2216 maxEdgeDof = (dof > maxEdgeDof ? dof : maxEdgeDof);
2218 for(j = 0; j < exp->GetNfaces(); ++j)
2220 dof = exp->GetFaceIntNcoeffs(j);
2221 maxFaceDof = (dof > maxFaceDof ? dof : maxFaceDof);
2223 exp->GetInteriorMap(interiorMap);
2224 dof = interiorMap.num_elements();
2225 maxIntDof = (dof > maxIntDof ? dof : maxIntDof);
2237 for(i = 0; i < locExpVector.size(); ++i)
2239 exp = locExpVector[i];
2243 for(j = 0; j < exp->GetNverts(); ++j)
2245 meshVertId = exp->GetGeom()->GetVid(j);
2248 pIt = perVerts.find(meshVertId);
2249 if (pIt != perVerts.end())
2251 for (k = 0; k < pIt->second.size(); ++k)
2253 meshVertId = min(meshVertId, pIt->second[k].id);
2259 maxBndGlobalId = (vGlobalId > maxBndGlobalId ? vGlobalId : maxBndGlobalId);
2263 for(j = 0; j < exp->GetNedges(); ++j)
2265 meshEdgeId = exp->GetGeom()->GetEid(j);
2266 pIt = perEdges.find(meshEdgeId);
2267 edgeOrient = exp->GetGeom()->GetEorient(j);
2269 if (pIt != perEdges.end())
2271 pair<int, StdRegions::Orientation> idOrient =
2273 meshEdgeId, edgeOrient, pIt->second);
2274 meshEdgeId = idOrient.first;
2275 edgeOrient = idOrient.second;
2278 exp->GetEdgeInteriorMap(j,edgeOrient,edgeInteriorMap,edgeInteriorSign);
2279 dof = exp->GetEdgeNcoeffs(j)-2;
2283 for(k = 0, l = 0; k < dof; ++k)
2294 = nVert + meshEdgeId * maxEdgeDof + l + 1;
2296 maxBndGlobalId = (vGlobalId > maxBndGlobalId ? vGlobalId : maxBndGlobalId);
2302 for(j = 0; j < exp->GetNfaces(); ++j)
2304 faceOrient = exp->GetGeom()->GetForient(j);
2306 meshFaceId = exp->GetGeom()->GetFid(j);
2308 pIt = perFaces.find(meshFaceId);
2309 if (pIt != perFaces.end())
2311 if(meshFaceId == min(meshFaceId, pIt->second[0].id))
2315 meshFaceId = min(meshFaceId, pIt->second[0].id);
2319 exp->GetFaceInteriorMap(j,faceOrient,faceInteriorMap,faceInteriorSign);
2320 dof = exp->GetFaceIntNcoeffs(j);
2322 for(k = 0, l = 0; k < dof; ++k)
2333 = nVert + nEdge*maxEdgeDof + meshFaceId * maxFaceDof
2337 maxBndGlobalId = (vGlobalId > maxBndGlobalId ? vGlobalId : maxBndGlobalId);
2343 exp->GetInteriorMap(interiorMap);
2344 dof = interiorMap.num_elements();
2345 elementId = (exp->GetGeom())->GetGlobalID();
2346 for (k = 0; k < dof; ++k)
2350 = nVert + nEdge*maxEdgeDof + nFace*maxFaceDof + elementId*maxIntDof + k + 1;
2371 m_globalToUniversalMapUnique[i] = (tmp[i] >= 0 ? 1 : 0);
2375 m_globalToUniversalBndMapUnique[i] = (tmp2[i] >= 0 ? 1 : 0);
2394 const boost::shared_ptr<LocalRegions::ExpansionVector> exp
2396 int nelmts = exp->size();
2397 const bool verbose = locexp.
GetSession()->DefinesCmdLineArgument(
"verbose");
2402 returnval->m_solnType = solnType;
2403 returnval->m_preconType =
eNull;
2404 returnval->m_maxStaticCondLevel = 0;
2405 returnval->m_signChange =
false;
2406 returnval->m_comm =
m_comm;
2409 for (i = 0; i < nelmts; ++i)
2411 nverts += (*exp)[i]->GetNverts();
2414 returnval->m_numLocalCoeffs = nverts;
2425 for (i = 0; i < nelmts; ++i)
2427 for (j = 0; j < (*exp)[i]->GetNverts(); ++j)
2429 returnval->m_localToGlobalMap[cnt] =
2430 returnval->m_localToGlobalBndMap[cnt] =
2432 GlobCoeffs[returnval->m_localToGlobalMap[cnt]] = 1;
2435 if ((returnval->m_localToGlobalMap[cnt]) <
2438 returnval->m_numLocalDirBndCoeffs++;
2442 cnt1 += (*exp)[i]->GetNcoeffs();
2449 if (GlobCoeffs[i] != -1)
2451 GlobCoeffs[i] = cnt++;
2456 returnval->m_numGlobalCoeffs = cnt;
2461 if (GlobCoeffs[i] != -1)
2463 returnval->m_numGlobalDirBndCoeffs++;
2472 int nglocoeffs = returnval->m_numGlobalCoeffs;
2473 returnval->m_globalToUniversalMap
2475 returnval->m_globalToUniversalMapUnique
2479 for (i = 0; i < nverts; ++i)
2481 cnt = returnval->m_localToGlobalMap[i];
2482 returnval->m_localToGlobalMap[i] = GlobCoeffs[cnt];
2484 returnval->m_globalToUniversalMap[GlobCoeffs[cnt]] =
2490 for (
unsigned int i = 0; i < nglocoeffs; ++i)
2492 tmp[i] = returnval->m_globalToUniversalMap[i];
2494 returnval->m_gsh =
Gs::Init(tmp, vCommRow, verbose);
2496 for (
unsigned int i = 0; i < nglocoeffs; ++i)
2498 returnval->m_globalToUniversalMapUnique[i]
2499 = (tmp[i] >= 0 ? 1 : 0);
2504 for (i = 0; i < nverts; ++i)
2506 cnt = returnval->m_localToGlobalMap[i];
2507 returnval->m_localToGlobalMap[i] = GlobCoeffs[cnt];
2540 for(j = 0; j < locSize; j++)
2555 bwidth = (bwidth>(maxId-minId))?bwidth:(maxId-minId);
2621 if(global.data() == loc.data())
2660 if(global.data() == loc.data())
2692 if(global.data() == loc.data())
#define ASSERTL0(condition, msg)
bool m_systemSingular
Flag indicating if the system is singular or not.
bool m_signChange
Flag indicating if modes require sign reversal.
AssemblyMapCG(const LibUtilities::SessionReaderSharedPtr &pSession, const std::string variable="DefaultVar")
Default constructor.
int getNumberOfBndCoefficients(int Na, int Nb)
int m_numGlobalBndCoeffs
Total number of global boundary coefficients.
Principle Modified Functions .
int GetCoeff_Offset(int n) const
Get the start offset position for a global list of m_coeffs correspoinding to element n...
void MultiLevelBisectionReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm, BottomUpSubStructuredGraphSharedPtr &substructgraph, std::set< int > partVerts, int mdswitch)
LibUtilities::CommSharedPtr m_comm
Communicator.
static void Gather(Nektar::Array< OneD, NekDouble > pU, gs_op pOp, gs_data *pGsh, Nektar::Array< OneD, NekDouble > pBuffer=NullNekDouble1DArray)
Performs a gather-scatter operation of the provided values.
int m_maxStaticCondLevel
Maximum static condensation level.
void Gathr(int n, const T *x, const int *y, T *z)
Gather vector z[i] = x[y[i]].
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
static void Finalise(gs_data *pGsh)
Deallocates the GSLib mapping data.
boost::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
virtual int v_GetNumNonDirEdgeModes() const
Array< OneD, int > m_globalToUniversalMapUnique
Integer map of unique process coeffs to universal space (signed)
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
Array< OneD, int > m_extraDirEdges
Extra dirichlet edges in parallel.
void SetUpUniversalC0ContMap(const ExpList &locExp, const PeriodicMap &perVerts=NullPeriodicMap, const PeriodicMap &perEdges=NullPeriodicMap, const PeriodicMap &perFaces=NullPeriodicMap)
int CreateGraph(const ExpList &locExp, const BndCondExp &bndCondExp, const Array< OneD, const BndCond > &bndConditions, const bool checkIfSystemSingular, const PeriodicMap &periodicVerts, const PeriodicMap &periodicEdges, const PeriodicMap &periodicFaces, DofGraph &graph, BottomUpSubStructuredGraphSharedPtr &bottomUpGraph, std::set< int > &extraDirVerts, std::set< int > &extraDirEdges, int &firstNonDirGraphVertId, int &nExtraDirichlet, int mdswitch=1)
virtual int v_GetNumNonDirFaceModes() const
const boost::shared_ptr< LocalRegions::ExpansionVector > GetExp() const
This function returns the vector of elements in the expansion.
int m_numNonDirVertexModes
Number of non Dirichlet vertex modes.
Principle Modified Functions .
boost::shared_ptr< BottomUpSubStructuredGraph > BottomUpSubStructuredGraphSharedPtr
Array< OneD, int > m_globalToUniversalMap
Integer map of process coeffs to universal space.
int m_numNonDirEdges
Number of Dirichlet edges.
int m_numLocalCoeffs
Total number of local coefficients.
void CuthillMckeeReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm)
int m_numLocalBndCondCoeffs
Number of local boundary condition coefficients.
virtual void v_Assemble(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
virtual void v_GlobalToLocal(const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
std::map< int, std::vector< ExtraDirDof > > m_extraDirDofs
Map indicating degrees of freedom which are Dirichlet but whose value is stored on another processor...
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
int Imax(int n, const T *x, const int incx)
Return the index of the maximum element in x.
void CalculateFullSystemBandWidth()
Calculate the bandwith of the full matrix system.
std::vector< ExpansionSharedPtr > ExpansionVector
Array< OneD, int > m_localToGlobalMap
Integer map of local coeffs to global space.
virtual const Array< OneD, const int > & v_GetLocalToGlobalMap()
AssemblyMapSharedPtr m_nextLevelLocalToGlobalMap
Map from the patches of the previous level to the patches of the current level.
Base class for constructing local to global mapping of degrees of freedom.
static gs_data * Init(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm, bool verbose=true)
Initialise Gather-Scatter map.
const char *const GlobalSysSolnTypeMap[]
int m_numNonDirFaceModes
Number of non Dirichlet face modes.
size_t m_hash
Hash for map.
virtual void v_LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm) const
void UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
Base class for all multi-elemental spectral/hp expansions.
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
void LocalToGlobal(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global, bool useComm=true) const
Array< OneD, unsigned int > m_numLocalBndCoeffsPerPatch
The number of bnd dofs per patch.
virtual int v_GetNumDirFaces() const
GlobalSysSolnType m_solnType
The solution type of the global system.
Array< OneD, NekDouble > m_bndCondCoeffsToGlobalCoeffsSign
Integer map of bnd cond coeffs to global coefficients.
boost::tuple< int, int, NekDouble > ExtraDirDof
virtual AssemblyMapSharedPtr v_LinearSpaceMap(const ExpList &locexp, GlobalSysSolnType solnType)
Construct an AssemblyMapCG object which corresponds to the linear space of the current object...
int m_numGlobalDirBndCoeffs
Number of Global Dirichlet Boundary Coefficients.
Principle Modified Functions .
StdRegions::Orientation DeterminePeriodicFaceOrient(StdRegions::Orientation faceOrient, StdRegions::Orientation perFaceOrient)
Determine relative orientation between two faces.
void GlobalToLocal(const Array< OneD, const NekDouble > &global, Array< OneD, NekDouble > &loc) const
int m_numDirFaces
Number of Dirichlet faces.
virtual int v_GetNumDirEdges() const
void Scatr(int n, const T *x, const int *y, T *z)
Scatter vector z[y[i]] = x[i].
int getNumberOfCoefficients(int Na, int Nb)
static void Unique(const Nektar::Array< OneD, long > pId, const LibUtilities::CommSharedPtr &pComm)
Updates pId to negate all-but-one references to each universal ID.
boost::shared_ptr< LibUtilities::SessionReader > GetSession() const
Returns the session object.
virtual int v_GetNumNonDirFaces() const
void Assmb(int n, const T *x, const int *y, T *z)
Assemble z[y[i]] += x[i]; z should be zero'd first.
boost::shared_ptr< Expansion > ExpansionSharedPtr
virtual int v_GetFullSystemBandWidth() const
Array< OneD, unsigned int > m_numLocalIntCoeffsPerPatch
The number of int dofs per patch.
std::map< int, std::vector< PeriodicEntity > > PeriodicMap
virtual void v_UniversalAssemble(Array< OneD, NekDouble > &pGlobal) const
int m_lowestStaticCondLevel
Lowest static condensation level.
void CalculateBndSystemBandWidth()
Calculates the bandwidth of the boundary system.
Array< OneD, int > m_localToGlobalBndMap
Integer map of local boundary coeffs to global space.
int m_numLocalDirBndCoeffs
Number of Local Dirichlet Boundary Coefficients.
No Solution type specified.
virtual const Array< OneD, const int > & v_GetExtraDirEdges()
int getNumberOfBndCoefficients(int Na, int Nb)
Array< OneD, int > m_bndCondCoeffsToGlobalCoeffsMap
Integer map of bnd cond coeffs to global coefficients.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::vector< std::map< int, int > > DofGraph
int m_numLocalBndCoeffs
Number of local boundary coefficients.
int m_numDirEdges
Number of Dirichlet edges.
int m_staticCondLevel
The level of recursion in the case of multi-level static condensation.
Array< OneD, NekDouble > m_localToGlobalBndSign
Integer sign of local boundary coeffs to global space.
SpatialDomains::GeometrySharedPtr GetGeom() const
Array< OneD, NekDouble > m_localToGlobalSign
Integer sign of local coeffs to global space.
int getNumberOfCoefficients(int Na, int Nb)
int m_numNonDirEdgeModes
Number of non Dirichlet edge modes.
virtual int v_GetNumNonDirVertexModes() const
LibUtilities::SessionReaderSharedPtr m_session
Session object.
Array< OneD, int > m_globalToUniversalBndMap
Integer map of process coeffs to universal space.
Array< OneD, int > m_globalToUniversalBndMapUnique
Integer map of unique process coeffs to universal space (signed)
virtual ~AssemblyMapCG()
Destructor.
void UniversalAssembleBnd(Array< OneD, NekDouble > &pGlobal) const
int m_numGlobalCoeffs
Total number of global coefficients.
pair< int, StdRegions::Orientation > DeterminePeriodicEdgeOrientId(int meshEdgeId, StdRegions::Orientation edgeOrient, const vector< PeriodicEntity > &periodicEdges)
Determine orientation of an edge to its periodic equivalents, as well as the ID of the representative...
int m_numNonDirFaces
Number of Dirichlet faces.
virtual const Array< OneD, NekDouble > & v_GetLocalToGlobalSign() const
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMapUnique()
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.
virtual int v_GetNumNonDirEdges() const
boost::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr
virtual const Array< OneD, const int > & v_GetGlobalToUniversalMap()
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
int m_fullSystemBandWidth
Bandwith of the full matrix system (no static condensation).
void Assemble(const Array< OneD, const NekDouble > &loc, Array< OneD, NekDouble > &global) const
Array< OneD, DataType > & GetPtr()
int m_numPatches
The number of patches (~elements) in the current level.
void NoReordering(const BoostGraph &graph, Array< OneD, int > &perm, Array< OneD, int > &iperm)
boost::shared_ptr< Geometry3D > Geometry3DSharedPtr