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_globalToUniversalBndMap(oldLevelMap->GetGlobalToUniversalBndMap()),
171 m_globalToUniversalBndMapUnique(oldLevelMap->GetGlobalToUniversalBndMapUnique()),
172 m_solnType(oldLevelMap->m_solnType),
173 m_preconType(oldLevelMap->m_preconType),
174 m_iterativeTolerance(oldLevelMap->m_iterativeTolerance),
175 m_successiveRHS(oldLevelMap->m_successiveRHS),
176 m_gsh(oldLevelMap->m_gsh),
177 m_bndGsh(oldLevelMap->m_bndGsh),
178 m_lowestStaticCondLevel(oldLevelMap->m_lowestStaticCondLevel)
199 int newLevel = staticCondLevelOld+1;
209 Array<OneD, NekDouble> globPatchMask (numGlobalBndCoeffsOld,-1.0);
210 Array<OneD, NekDouble> globHomPatchMask (globPatchMask+numGlobalDirBndCoeffsOld);
211 Array<OneD, NekDouble> locPatchMask_NekDouble(numLocalBndCoeffsOld,-3.0);
212 Array<OneD, int> locPatchMask (numLocalBndCoeffsOld);
220 multiLevelGraph->MaskPatches(newLevel,globHomPatchMask);
239 int numPatchesWithIntNew = multiLevelGraph->GetNpatchesWithInterior(newLevel);
240 int numPatchesNew = numPatchesWithIntNew;
244 map<int, int> numLocalBndCoeffsPerPatchNew;
245 for(
int i = 0; i < numPatchesNew; i++)
247 numLocalBndCoeffsPerPatchNew[i] = 0;
253 for(i = cnt = 0; i < numPatchesOld; i++)
266 minval = *min_element(&locPatchMask[cnt],
267 &locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
268 maxval = *max_element(&locPatchMask[cnt],
269 &locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
270 ASSERTL0((minval==maxval)||(minval==-1),
"These values should never be the same");
274 curPatch = numPatchesNew;
275 numLocalBndCoeffsPerPatchNew[curPatch] = 0;
283 for(j = 0; j < numLocalBndCoeffsPerPatchOld[i]; j++ )
285 ASSERTL0((locPatchMask[cnt]==maxval)||(locPatchMask[cnt]==minval),
286 "These values should never be the same");
287 if(locPatchMask[cnt] == -1)
289 ++numLocalBndCoeffsPerPatchNew[curPatch];
306 multiLevelGraph->GetNintDofsPerPatch(newLevel,m_numLocalIntCoeffsPerPatch);
314 "This method should only be called for in "
315 "case of multi-level static condensation.");
334 Array<OneD, int> numLocalBndCoeffsPerPatchOffset(m_numPatches+1,0);
335 for(
int i = 1; i < m_numPatches+1; i++)
337 numLocalBndCoeffsPerPatchOffset[i] += numLocalBndCoeffsPerPatchOffset[i-1] + numLocalBndCoeffsPerPatchNew[i-1];
340 int additionalPatchCnt = numPatchesWithIntNew;
345 Array<OneD, int> bndDofPerPatchCnt(m_numPatches,0);
346 for(i = cnt = 0; i < numPatchesOld; i++)
348 minval = *min_element(&locPatchMask[cnt],&locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
349 maxval = *max_element(&locPatchMask[cnt],&locPatchMask[cnt]+numLocalBndCoeffsPerPatchOld[i]);
350 ASSERTL0((minval==maxval)||(minval==-1),
"These values should never be the same");
354 curPatch = additionalPatchCnt;
355 additionalPatchCnt++;
362 for(j = 0; j < numLocalBndCoeffsPerPatchOld[i]; j++ )
364 ASSERTL0((locPatchMask[cnt]==maxval)||(locPatchMask[cnt]==minval),
365 "These values should never be the same");
369 if(locPatchMask[cnt] == -1)
371 newid = numLocalBndCoeffsPerPatchOffset[curPatch];
379 blockid = bndDofPerPatchCnt[curPatch];
383 numLocalBndCoeffsPerPatchOffset[curPatch]++;
384 bndDofPerPatchCnt[curPatch]++;
396 sign = isBndDof?1.0:
sign;
448 for(j = 0; j < locSize; j++)
463 bwidth = (bwidth>(maxId-minId))?bwidth:(maxId-minId);
474 ASSERTL0(
false,
"Not defined for this type of mapping.");
480 ASSERTL0(
false,
"Not defined for this type of mapping.");
486 ASSERTL0(
false,
"Not defined for this type of mapping.");
492 ASSERTL0(
false,
"Not defined for this type of mapping.");
493 static Array<OneD,const int> result;
499 ASSERTL0(
false,
"Not defined for this type of mapping.");
500 static Array<OneD, const int> result;
506 ASSERTL0(
false,
"Not defined for this type of mapping.");
507 static Array<OneD, const int> result;
513 ASSERTL0(
false,
"Not defined for this type of mapping.");
519 ASSERTL0(
false,
"Not defined for this type of mapping.");
520 static Array<OneD, NekDouble> result;
525 const Array<OneD, const NekDouble>& loc,
526 Array<OneD, NekDouble>& global)
const
528 ASSERTL0(
false,
"Not defined for this type of mapping.");
535 ASSERTL0(
false,
"Not defined for this type of mapping.");
539 const Array<OneD, const NekDouble>& global,
540 Array<OneD, NekDouble>& loc)
const
542 ASSERTL0(
false,
"Not defined for this type of mapping.");
549 ASSERTL0(
false,
"Not defined for this type of mapping.");
553 const Array<OneD, const NekDouble> &loc,
554 Array<OneD, NekDouble> &global)
const
556 ASSERTL0(
false,
"Not defined for this type of mapping.");
563 ASSERTL0(
false,
"Not defined for this type of mapping.");
567 Array<OneD, NekDouble>& pGlobal)
const
581 Array<OneD, NekDouble>& pGlobal,
590 ASSERTL0(
false,
"Not defined for this type of mapping.");
596 ASSERTL0(
false,
"Not defined for this type of mapping.");
602 ASSERTL0(
false,
"Not defined for this type of mapping.");
608 ASSERTL0(
false,
"Not defined for this type of mapping.");
614 ASSERTL0(
false,
"Not defined for this type of mapping.");
620 ASSERTL0(
false,
"Not defined for this type of mapping.");
626 ASSERTL0(
false,
"Not defined for this type of mapping.");
632 ASSERTL0(
false,
"Not defined for this type of mapping.");
638 ASSERTL0(
false,
"Not defined for this type of mapping.");
639 static Array<OneD, const int> result;
646 ASSERTL0(
false,
"Not defined for this sub class");
647 static boost::shared_ptr<AssemblyMap> result;
702 const Array<OneD, const NekDouble>& loc,
703 Array<OneD, NekDouble>& global)
const
716 const Array<OneD, const NekDouble>& global,
717 Array<OneD, NekDouble>& loc)
const
730 const Array<OneD, const NekDouble> &loc,
731 Array<OneD, NekDouble> &global)
const
744 Array<OneD, NekDouble>& pGlobal)
const
756 Array<OneD, NekDouble>& pGlobal,
817 const Array<OneD,const int>&
829 Array<OneD, const NekDouble>
869 "Index out of range.");
876 return m_bndCondTraceToGlobalTraceMap;
891 const Array<OneD,const int>&
952 const Array<OneD, const NekDouble>& global,
953 Array<OneD,NekDouble>& loc,
int offset)
const
974 const Array<OneD, const NekDouble>& global,
975 Array<OneD,NekDouble>& loc)
const
1000 const Array<OneD, const NekDouble>& loc,
1001 Array<OneD,NekDouble>& global,
1032 const Array<OneD, const NekDouble>& loc,
1033 Array<OneD,NekDouble>& global)
const
1066 const Array<OneD,const NekDouble>& loc,
1067 Array<OneD, NekDouble>& global,
int offset)
const
1087 const Array<OneD, const NekDouble>& loc,
1088 Array<OneD, NekDouble>& global)
const
1108 Array<OneD, NekDouble>& pGlobal)
const
1122 Array<OneD, NekDouble>& pGlobal,
1125 Array<OneD, NekDouble> tmp(offset);
1126 if (offset > 0)
Vmath::Vcopy(offset, pGlobal, 1, tmp, 1);
1128 if (offset > 0)
Vmath::Vcopy(offset, tmp, 1, pGlobal, 1);
1146 const Array<OneD,const unsigned int>&
1153 const Array<OneD,const unsigned int>&
1199 const Array<OneD, const NekDouble>& global,
1200 Array<OneD,NekDouble>& loc)
1209 std::ostream &out, std::string variable)
const
1213 bool isRoot = vRowComm->GetRank() == 0;
1214 int n = vRowComm->GetSize();
1218 int globBndCnt = 0, globDirCnt = 0;
1237 Array<OneD, NekDouble> tmpGlob(m_numGlobalBndCoeffs, 0.0);
1240 int totGlobDof = globCnt;
1241 int totGlobBndDof = globBndCnt;
1242 int totGlobDirDof = globDirCnt;
1247 int meanValence = 0;
1249 int minValence = 10000000;
1257 if (tmpGlob[i] > maxValence)
1259 maxValence = tmpGlob[i];
1261 if (tmpGlob[i] < minValence)
1263 minValence = tmpGlob[i];
1265 meanValence += tmpGlob[i];
1278 meanValence /= totGlobBndDof;
1282 out <<
"Assembly map statistics for field " << variable <<
":"
1284 out <<
" - Number of local/global dof : "
1285 << totLocalDof <<
" " << totGlobDof << endl;
1286 out <<
" - Number of local/global boundary dof : "
1287 << totLocalBndDof <<
" " << totGlobBndDof << endl;
1288 out <<
" - Number of local/global Dirichlet dof : "
1289 << totLocalDirDof <<
" " << totGlobDirDof << endl;
1290 out <<
" - dof valency (min/max/mean) : "
1291 << minValence <<
" " << maxValence <<
" " << meanValence
1298 Array<OneD, NekDouble> tmp(1);
1300 for (i = 1; i < n; ++i)
1302 vRowComm->Recv(i, tmp);
1304 mean2 += tmp[0]*tmp[0];
1306 if (tmp[0] > maxval)
1310 if (tmp[0] < minval)
1316 out <<
" - Local dof dist. (min/max/mean/dev) : "
1317 << minval <<
" " << maxval <<
" " << (mean / n) <<
" "
1318 << sqrt(mean2/n - mean*mean/n/n) << endl;
1323 mean2 = mean * mean;
1325 for (i = 1; i < n; ++i)
1327 vRowComm->Recv(i, tmp);
1329 mean2 += tmp[0]*tmp[0];
1331 if (tmp[0] > maxval)
1335 if (tmp[0] < minval)
1341 out <<
" - Local bnd dof dist. (min/max/mean/dev) : "
1342 << minval <<
" " << maxval <<
" " << (mean / n) <<
" "
1343 << sqrt(mean2/n - mean*mean/n/n) << endl;
1348 Array<OneD, NekDouble> tmp(1);
1350 vRowComm->Send(0, tmp);
1353 vRowComm->Send(0, tmp);