57 "Refines a prismatic boundary layer.");
61 int **ret =
new int*[lda];
62 for (
int i = 0; i < lda; ++i)
65 ret[i][0] = arr[i][0];
66 ret[i][1] = arr[i][1];
73 int **ret =
new int*[lda];
74 for (
int i = 0; i < lda; ++i)
77 ret[i][0] = arr[i][0];
78 ret[i][1] = arr[i][1];
79 ret[i][2] = arr[i][2];
80 ret[i][3] = arr[i][3];
110 "Number of layers to refine.");
112 "Number of points in high order elements.");
114 "Tag identifying surface connected to prism.");
116 "Ratio to use in geometry progression.");
128 cout <<
"ProcessBL: Refining prismatic boundary layer..."
133 set<LibUtilities::ShapeType> validElTypes;
137 int nodeId =
m_mesh->m_vertexSet.size();
138 int nl =
m_config[
"layers"].as<
int>();
145 bool ratioIsString =
false;
147 if (
m_config[
"r"].isType<NekDouble>())
153 std::string rstr =
m_config[
"r"].as<
string>();
154 rExprId = rEval.DefineFunction(
"x y z", rstr);
155 ratioIsString =
true;
159 int prismFaceNodes[5][4] = {
160 {0,1,2,3},{0,1,4,-1},{1,2,5,4},{3,2,5,-1},{0,3,5,4}};
161 int hexFaceNodes [6][4] = {
162 {0,1,2,3},{0,1,5,4},{1,2,6,5},{3,2,6,7},{0,3,7,4},{4,5,6,7}};
163 map<LibUtilities::ShapeType, int **> faceNodeMap;
172 boost::unordered_map<int, int> splitEls;
180 map<LibUtilities::ShapeType, map<int, SplitMapHelper> > splitMap;
184 int splitMapEdgePrism [6] = {0, 2, 4, 5, 6, 7};
185 int splitMapOffsetPrism[6] = {0, nq, 0, nq-1, nq+nq-1, nq};
186 int splitMapIncPrism [6] = {1, 1, po, po, po, po};
187 int splitMapBFacesPrism[3] = {0, 2, 4};
188 int splitMapConnPrism [6][2] = {{0,0}, {1,0}, {1,1},
189 {0,1}, {2,0}, {2,1}};
191 splitPrism.layerOff = nq;
192 splitPrism.edge = splitMapEdgePrism;
193 splitPrism.offset = splitMapOffsetPrism;
194 splitPrism.inc = splitMapIncPrism;
195 splitPrism.conn =
helper2d(6, splitMapConnPrism);
196 splitPrism.bfacesSize = 3;
197 splitPrism.bfaces = splitMapBFacesPrism;
204 int splitMapEdgeHex0 [8] = {0, 1, 2, 3, 8, 9, 10, 11};
205 int splitMapOffsetHex0[8] = {0, nq-1, tl-1, ho, tl, tl+nq-1, 2*tl-1, tl+ho};
206 int splitMapIncHex0 [8] = {1, nq, -1, -nq, 1, nq, -1, -nq};
207 int splitMapBFacesHex0[4] = {1, 2, 3, 4};
208 int splitMapConnHex0 [8][2] = {{0,0}, {1,0}, {2,0}, {3,0},
209 {0,1}, {1,1}, {2,1}, {3,1}};
212 splitHex0.
edge = splitMapEdgeHex0;
213 splitHex0.
offset = splitMapOffsetHex0;
214 splitHex0.
inc = splitMapIncHex0;
217 splitHex0.
bfaces = splitMapBFacesHex0;
231 map<LibUtilities::ShapeType, map<int, SplitEdgeHelper> > splitEdge;
233 int splitPrismEdges [3] = {3, 1, 8};
234 int splitPrismEdgeVert[3][2] = {{0,3}, {1,2}, {4,5}};
235 int splitPrismOffset [3] = {0, nq-1, nq*(nl+1)*(nq-1)};
236 int splitPrismInc [3] = {nq, nq, nq};
238 splitPrismEdge.
size = 3;
239 splitPrismEdge.
edge = splitPrismEdges;
241 splitPrismEdge.
offset = splitPrismOffset;
242 splitPrismEdge.
inc = splitPrismInc;
246 int splitHex0Edges [4] = {4, 5, 6, 7};
247 int splitHex0EdgeVert[4][2] = {{0,4}, {1,5}, {2,6}, {3,7}};
248 int splitHex0Offset [4] = {0, nq-1, nq*nq-1, nq*(nq-1) };
249 int splitHex0Inc [4] = {nq*nq, nq*nq, nq*nq, nq*nq};
251 splitHex0Edge.
size = 4;
252 splitHex0Edge.
edge = splitHex0Edges;
254 splitHex0Edge.
offset = splitHex0Offset;
255 splitHex0Edge.
inc = splitHex0Inc;
259 map<LibUtilities::ShapeType, map<int, bool> > revPoints;
270 boost::unordered_map<int, vector<NodeSharedPtr> > edgeMap;
271 boost::unordered_map<int, vector<NodeSharedPtr> >
::iterator eIt;
273 string surf =
m_config[
"surf"].as<
string>();
276 vector<unsigned int> surfs;
278 sort(surfs.begin(), surfs.end());
282 for (
int i = 0; i <
m_mesh->m_element[
m_mesh->m_expDim].size(); ++i)
285 int nSurf = el->GetFaceCount();
287 for (
int j = 0; j < nSurf; ++j)
289 int bl = el->GetBoundaryLink(j);
296 vector<int> tags = bEl->GetTagList();
299 sort(tags.begin(), tags.end());
300 set_intersection(surfs.begin(), surfs.end(),
301 tags .begin(), tags .end(),
302 back_inserter(inter));
304 "Intersection of surfaces wrong");
306 if (inter.size() == 1)
312 cerr <<
"WARNING: Found quadrilateral face "
313 << j <<
" on surface " << surf
314 <<
" connected to prism; ignoring."
319 if (splitEls.count(el->GetId()) > 0)
321 cerr <<
"WARNING: prism already found; "
322 <<
"ignoring" << endl;
325 splitEls[el->GetId()] = j;
327 else if (validElTypes.count(el->GetConf().m_e) == 0)
329 cerr <<
"WARNING: Unsupported element type "
330 <<
"found in surface " << j <<
"; "
331 <<
"ignoring" << endl;
342 for (
int i = 0; i <
m_mesh->m_element[
m_mesh->m_expDim].size(); ++i)
348 splitEls[el->GetId()] = 1;
350 else if (validElTypes.count(el->GetConf().m_e) > 0)
352 splitEls[el->GetId()] = 0;
361 if (splitEls.size() == 0)
363 cerr <<
"WARNING: No elements detected to split." << endl;
369 vector<ElementSharedPtr> el =
m_mesh->m_element[
m_mesh->m_expDim];
373 for (
int i = 0; i < el.size(); ++i)
375 const int elId = el[i]->GetId();
376 sIt = splitEls.find(elId);
378 if (sIt == splitEls.end())
384 const int faceNum = sIt->second;
391 std::map<int, int> bLink;
394 int bl = el[i]->GetBoundaryLink(sMap.
bfaces[j]);
397 bLink[sMap.
bfaces[j]] = bl;
404 el[i]->GetGeom(
m_mesh->m_spaceDim));
408 revPoints[elType][faceNum] ?
417 int nverts = geom->GetNumVerts();
421 for(
int i = 0; i < nverts; ++i)
423 geom->GetVertex(i)->GetCoords(x1,y1,z1);
424 x += x1; y += y1; z += z1;
429 r = rEval.Evaluate(rExprId,x,y,z,0.0);
473 Array<OneD, NekDouble> x(nq*nq*(nl+1));
474 Array<OneD, NekDouble> y(nq*nq*(nl+1));
475 Array<OneD, NekDouble> z(nq*nq*(nl+1));
478 int nSplitEdge = sEdge.
size;
479 vector<vector<NodeSharedPtr> > edgeNodes(nSplitEdge);
482 for (
int j = 0; j < nSplitEdge; ++j)
484 int locEdge = sEdge.
edge[j];
485 int edgeId = el[i]->GetEdge(locEdge)->m_id;
489 eIt = edgeMap.find(edgeId);
491 if (eIt == edgeMap.end())
494 edgeNodes[j].resize(nl+1);
498 edgeNodes[j][0] = el[i]->GetVertex(sEdge.
edgeVert[j][0]);
499 edgeNodes[j][nl] = el[i]->GetVertex(sEdge.
edgeVert[j][1]);
513 x1 = x[sEdge.
offset[j]+nl*nq];
514 y1 = y[sEdge.
offset[j]+nl*nq];
515 z1 = z[sEdge.
offset[j]+nl*nq];
523 rnew = rEval.Evaluate(rExprId,xm,ym,zm,0.0);
530 const Array<OneD, const NekDouble> z = newP->GetZ();
533 for (
int k = 1; k < nl; ++k)
535 xm = 0.5*(1+z[k])*(x1-x0) + x0;
536 ym = 0.5*(1+z[k])*(y1-y0) + y0;
537 zm = 0.5*(1+z[k])*(z1-z0) + z0;
539 new Node(nodeId++, xm,ym,zm));
545 for (
int k = 1; k < nl; ++k)
547 int pos = sEdge.
offset[j] + k*sEdge.
inc[j];
549 new Node(nodeId++, x[pos], y[pos], z[pos]));
554 edgeMap[edgeId] = edgeNodes[j];
558 edgeNodes[j] = eIt->second;
563 for (
int j = 0; j < nl; ++j)
570 vector<NodeSharedPtr> nodeList(sMap.
size);
571 for (
int k = 0; k < sMap.
size; ++k)
574 edgeNodes[sMap.
conn[k][0]][j + sMap.
conn[k][1]];
578 ElmtConfig conf(elType, 1,
true,
true,
false);
581 elType, conf, nodeList, el[i]->GetTagList());
584 for (
int l = 0; l < sMap.
size; ++l)
588 for (
int k = 1; k < nq-1; ++k)
590 int pos = offset + sMap.
offset[l] + k*sMap.
inc[l];
591 HOedge->m_edgeNodes.push_back(
593 new Node(nodeId++,x[pos],y[pos],z[pos])));
595 HOedge->m_curveType = pt;
601 for (it = bLink.begin(); it != bLink.end(); ++it)
610 for (
int k = 0; k < 4; ++k)
613 k, nodeList[faceNodeMap[elType][fid][k]]);
619 vector<NodeSharedPtr> qNodeList(4);
620 for (
int k = 0; k < 4; ++k)
622 qNodeList[k] = nodeList[faceNodeMap[elType][fid][k]];
625 tagBE =
m_mesh->m_element[
m_mesh->m_expDim-1][bl]->GetTagList();
630 m_mesh->m_element[
m_mesh->m_expDim-1].push_back(boundaryElmt);