40 namespace MultiRegions
57 return int(x > 0.0 ? x + 0.5 : x - 0.5);
63 int size = inarray.num_elements();
64 ASSERTL1(outarray.num_elements()>=size,
"Array sizes not compatible");
67 for(
int i = 0; i < size; i++)
70 outarray[i] = int(x > 0.0 ? x + 0.5 : x - 0.5);
81 m_numLocalBndCoeffs(0),
82 m_numGlobalBndCoeffs(0),
83 m_numLocalDirBndCoeffs(0),
84 m_numGlobalDirBndCoeffs(0),
86 m_bndSystemBandWidth(0),
95 const std::string variable):
97 m_comm(pSession->GetComm()),
99 m_numLocalBndCoeffs(0),
100 m_numGlobalBndCoeffs(0),
101 m_numLocalDirBndCoeffs(0),
102 m_numGlobalDirBndCoeffs(0),
103 m_bndSystemBandWidth(0),
115 if(pSession->DefinesGlobalSysSolnInfo(variable,
"GlobalSysSoln"))
117 std::string sysSoln = pSession->GetGlobalSysSolnInfo(variable,
120 "GlobalSysSoln", sysSoln);
123 if(pSession->DefinesGlobalSysSolnInfo(variable,
"Preconditioner"))
125 std::string precon = pSession->GetGlobalSysSolnInfo(variable,
128 "Preconditioner", precon);
131 if(pSession->DefinesGlobalSysSolnInfo(variable,
132 "IterativeSolverTolerance"))
135 pSession->GetGlobalSysSolnInfo(variable,
136 "IterativeSolverTolerance").c_str());
140 pSession->LoadParameter(
"IterativeSolverTolerance",
146 if(pSession->DefinesGlobalSysSolnInfo(variable,
"SuccessiveRHS"))
149 pSession->GetGlobalSysSolnInfo(variable,
150 "SuccessiveRHS").c_str());
154 pSession->LoadParameter(
"SuccessiveRHS",
167 m_session(oldLevelMap->m_session),
168 m_comm(oldLevelMap->GetComm()),
170 m_solnType(oldLevelMap->m_solnType),
171 m_preconType(oldLevelMap->m_preconType),
172 m_iterativeTolerance(oldLevelMap->m_iterativeTolerance),
173 m_successiveRHS(oldLevelMap->m_successiveRHS),
174 m_gsh(oldLevelMap->m_gsh),
175 m_bndGsh(oldLevelMap->m_bndGsh),
176 m_lowestStaticCondLevel(oldLevelMap->m_lowestStaticCondLevel)
197 int newLevel = staticCondLevelOld+1;
207 Array<OneD, NekDouble> globPatchMask (numGlobalBndCoeffsOld,-1.0);
208 Array<OneD, NekDouble> globHomPatchMask (globPatchMask+numGlobalDirBndCoeffsOld);
209 Array<OneD, NekDouble> locPatchMask_NekDouble(numLocalBndCoeffsOld,-3.0);
210 Array<OneD, int> locPatchMask (numLocalBndCoeffsOld);
218 multiLevelGraph->MaskPatches(newLevel,globHomPatchMask);
237 int numPatchesWithIntNew = multiLevelGraph->GetNpatchesWithInterior(newLevel);
238 int numPatchesNew = numPatchesWithIntNew;
242 map<int, int> numLocalBndCoeffsPerPatchNew;
243 for(
int i = 0; i < numPatchesNew; i++)
245 numLocalBndCoeffsPerPatchNew[i] = 0;
251 for(i = cnt = 0; i < numPatchesOld; i++)
264 minval = *min_element(&locPatchMask[cnt],
265 &locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
266 maxval = *max_element(&locPatchMask[cnt],
267 &locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
268 ASSERTL0((minval==maxval)||(minval==-1),
"These values should never be the same");
272 curPatch = numPatchesNew;
273 numLocalBndCoeffsPerPatchNew[curPatch] = 0;
281 for(j = 0; j < numLocalBndCoeffsPerPatchOld[i]; j++ )
283 ASSERTL0((locPatchMask[cnt]==maxval)||(locPatchMask[cnt]==minval),
284 "These values should never be the same");
285 if(locPatchMask[cnt] == -1)
287 ++numLocalBndCoeffsPerPatchNew[curPatch];
304 multiLevelGraph->GetNintDofsPerPatch(newLevel,m_numLocalIntCoeffsPerPatch);
312 "This method should only be called for in "
313 "case of multi-level static condensation.");
337 Array<OneD, int> numLocalBndCoeffsPerPatchOffset(m_numPatches+1,0);
338 for(
int i = 1; i < m_numPatches+1; i++)
340 numLocalBndCoeffsPerPatchOffset[i] += numLocalBndCoeffsPerPatchOffset[i-1] + numLocalBndCoeffsPerPatchNew[i-1];
343 int additionalPatchCnt = numPatchesWithIntNew;
348 Array<OneD, int> bndDofPerPatchCnt(m_numPatches,0);
349 for(i = cnt = 0; i < numPatchesOld; i++)
351 minval = *min_element(&locPatchMask[cnt],&locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
352 maxval = *max_element(&locPatchMask[cnt],&locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
353 ASSERTL0((minval==maxval)||(minval==-1),
"These values should never be the same");
357 curPatch = additionalPatchCnt;
358 additionalPatchCnt++;
365 for(j = 0; j < numLocalBndCoeffsPerPatchOld[i]; j++ )
367 ASSERTL0((locPatchMask[cnt]==maxval)||(locPatchMask[cnt]==minval),
368 "These values should never be the same");
372 if(locPatchMask[cnt] == -1)
374 newid = numLocalBndCoeffsPerPatchOffset[curPatch];
382 blockid = bndDofPerPatchCnt[curPatch];
386 numLocalBndCoeffsPerPatchOffset[curPatch]++;
387 bndDofPerPatchCnt[curPatch]++;
399 sign = isBndDof?1.0:
sign;
451 for(j = 0; j < locSize; j++)
466 bwidth = (bwidth>(maxId-minId))?bwidth:(maxId-minId);
477 ASSERTL0(
false,
"Not defined for this type of mapping.");
483 ASSERTL0(
false,
"Not defined for this type of mapping.");
489 ASSERTL0(
false,
"Not defined for this type of mapping.");
495 ASSERTL0(
false,
"Not defined for this type of mapping.");
496 static Array<OneD,const int> result;
502 ASSERTL0(
false,
"Not defined for this type of mapping.");
503 static Array<OneD, const int> result;
509 ASSERTL0(
false,
"Not defined for this type of mapping.");
510 static Array<OneD, const int> result;
516 ASSERTL0(
false,
"Not defined for this type of mapping.");
522 ASSERTL0(
false,
"Not defined for this type of mapping.");
523 static Array<OneD, NekDouble> result;
528 const Array<OneD, const NekDouble>& loc,
529 Array<OneD, NekDouble>& global)
const
531 ASSERTL0(
false,
"Not defined for this type of mapping.");
538 ASSERTL0(
false,
"Not defined for this type of mapping.");
542 const Array<OneD, const NekDouble>& global,
543 Array<OneD, NekDouble>& loc)
const
545 ASSERTL0(
false,
"Not defined for this type of mapping.");
552 ASSERTL0(
false,
"Not defined for this type of mapping.");
556 const Array<OneD, const NekDouble> &loc,
557 Array<OneD, NekDouble> &global)
const
559 ASSERTL0(
false,
"Not defined for this type of mapping.");
566 ASSERTL0(
false,
"Not defined for this type of mapping.");
570 Array<OneD, NekDouble>& pGlobal)
const
584 Array<OneD, NekDouble>& pGlobal,
593 ASSERTL0(
false,
"Not defined for this type of mapping.");
599 ASSERTL0(
false,
"Not defined for this type of mapping.");
605 ASSERTL0(
false,
"Not defined for this type of mapping.");
611 ASSERTL0(
false,
"Not defined for this type of mapping.");
617 ASSERTL0(
false,
"Not defined for this type of mapping.");
623 ASSERTL0(
false,
"Not defined for this type of mapping.");
629 ASSERTL0(
false,
"Not defined for this type of mapping.");
635 ASSERTL0(
false,
"Not defined for this type of mapping.");
641 ASSERTL0(
false,
"Not defined for this type of mapping.");
642 static Array<OneD, const int> result;
649 ASSERTL0(
false,
"Not defined for this sub class");
650 static boost::shared_ptr<AssemblyMap> result;
705 const Array<OneD, const NekDouble>& loc,
706 Array<OneD, NekDouble>& global)
const
719 const Array<OneD, const NekDouble>& global,
720 Array<OneD, NekDouble>& loc)
const
733 const Array<OneD, const NekDouble> &loc,
734 Array<OneD, NekDouble> &global)
const
747 Array<OneD, NekDouble>& pGlobal)
const
759 Array<OneD, NekDouble>& pGlobal,
820 const Array<OneD,const int>&
832 Array<OneD, const NekDouble>
872 "Index out of range.");
879 return m_bndCondTraceToGlobalTraceMap;
894 const Array<OneD,const int>&
955 const Array<OneD, const NekDouble>& global,
956 Array<OneD,NekDouble>& loc,
int offset)
const
977 const Array<OneD, const NekDouble>& global,
978 Array<OneD,NekDouble>& loc)
const
1003 const Array<OneD, const NekDouble>& loc,
1004 Array<OneD,NekDouble>& global,
1035 const Array<OneD, const NekDouble>& loc,
1036 Array<OneD,NekDouble>& global)
const
1069 const Array<OneD,const NekDouble>& loc,
1070 Array<OneD, NekDouble>& global,
int offset)
const
1090 const Array<OneD, const NekDouble>& loc,
1091 Array<OneD, NekDouble>& global)
const
1111 Array<OneD, NekDouble>& pGlobal)
const
1125 Array<OneD, NekDouble>& pGlobal,
1128 Array<OneD, NekDouble> tmp(offset);
1129 if (offset > 0)
Vmath::Vcopy(offset, pGlobal, 1, tmp, 1);
1131 if (offset > 0)
Vmath::Vcopy(offset, tmp, 1, pGlobal, 1);
1149 const Array<OneD,const unsigned int>&
1156 const Array<OneD,const unsigned int>&
1202 const Array<OneD, const NekDouble>& global,
1203 Array<OneD,NekDouble>& loc)
1212 std::ostream &out, std::string variable)
const
1216 bool isRoot = vRowComm->GetRank() == 0;
1217 int n = vRowComm->GetSize();
1221 int globBndCnt = 0, globDirCnt = 0;
1240 Array<OneD, NekDouble> tmpGlob(m_numGlobalBndCoeffs, 0.0);
1245 int totGlobDof = globCnt;
1246 int totGlobBndDof = globBndCnt;
1247 int totGlobDirDof = globDirCnt;
1252 int meanValence = 0;
1254 int minValence = 10000000;
1262 if (tmpGlob[i] > maxValence)
1264 maxValence = tmpGlob[i];
1266 if (tmpGlob[i] < minValence)
1268 minValence = tmpGlob[i];
1270 meanValence += tmpGlob[i];
1283 meanValence /= totGlobBndDof;
1287 out <<
"Assembly map statistics for field " << variable <<
":"
1289 out <<
" - Number of local/global dof : "
1290 << totLocalDof <<
" " << totGlobDof << endl;
1291 out <<
" - Number of local/global boundary dof : "
1292 << totLocalBndDof <<
" " << totGlobBndDof << endl;
1293 out <<
" - Number of local/global Dirichlet dof : "
1294 << totLocalDirDof <<
" " << totGlobDirDof << endl;
1295 out <<
" - dof valency (min/max/mean) : "
1296 << minValence <<
" " << maxValence <<
" " << meanValence
1303 Array<OneD, NekDouble> tmp(1);
1305 for (i = 1; i < n; ++i)
1307 vRowComm->Recv(i, tmp);
1309 mean2 += tmp[0]*tmp[0];
1311 if (tmp[0] > maxval)
1315 if (tmp[0] < minval)
1321 out <<
" - Local dof dist. (min/max/mean/dev) : "
1322 << minval <<
" " << maxval <<
" " << (mean / n) <<
" "
1323 << sqrt(mean2/n - mean*mean/n/n) << endl;
1328 mean2 = mean * mean;
1330 for (i = 1; i < n; ++i)
1332 vRowComm->Recv(i, tmp);
1334 mean2 += tmp[0]*tmp[0];
1336 if (tmp[0] > maxval)
1340 if (tmp[0] < minval)
1346 out <<
" - Local bnd dof dist. (min/max/mean/dev) : "
1347 << minval <<
" " << maxval <<
" " << (mean / n) <<
" "
1348 << sqrt(mean2/n - mean*mean/n/n) << endl;
1353 Array<OneD, NekDouble> tmp(1);
1355 vRowComm->Send(0, tmp);
1358 vRowComm->Send(0, tmp);