polyMeshGenModifierZipUpCells.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "polyMeshGenModifier.H"
29 #include "demandDrivenData.H"
30 #include "HashSet.H"
31 #include "boolList.H"
32 
33 //#define DEBUG_ZIPUP
34 
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 
37 namespace Foam
38 {
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
43 {
44  this->clearOut();
45 
46  Info<< "Zipping up topologically open cells" << endl;
47 
48  const pointFieldPMG& points = mesh_.points();
49  const cellListPMG& cells = mesh_.cells();
50 
51  faceListPMG& faces = mesh_.faces_;
52 
53  // Algorithm:
54  // Take the original mesh and visit all cells. For every cell
55  // calculate the edges of all faces on the cells. A cell is
56  // correctly topologically closed when all the edges are reference
57  // by exactly two cells. If the edges are referenced only by a
58  // single cell, additional vertices need to be inserted into some
59  // of the faces (topological closedness). If an edge is
60  // referenced by more that two faces, there is an error in
61  // topological closedness.
62  // Point insertion into the faces is done by attempting to create
63  // closed loops and inserting the intermediate points into the
64  // defining edge
65  // Note:
66  // The algorithm is recursive and changes the mesh faces in each
67  // pass. It is therefore essential to discard the addressing
68  // after every pass. The algorithm is completed when the mesh
69  // stops changing.
70  //
71 
72  label nChangedFacesInMesh;
73  label nCycles(0);
74 
75  labelHashSet problemCells;
76 
77  do
78  {
79  nChangedFacesInMesh = 0;
80 
81  //- calculate pointFaces addressing
82  # ifdef DEBUG_ZIPUP
83  Info << "Starting pointFaces addressing " << endl;
84  # endif
85 
86  List<direction> nUsage(points.size(), direction(0));
87  forAll(faces, fI)
88  {
89  const face& f = faces[fI];
90  forAll(f, pI)
91  ++nUsage[f[pI]];
92  }
93 
94  VRWGraph pFaces(points.size());
95  forAll(nUsage, pI)
96  pFaces.setRowSize(pI, nUsage[pI]);
97 
98  nUsage = 0;
99 
100  forAll(faces, fI)
101  {
102  const face& f = faces[fI];
103  forAll(f, pI)
104  pFaces(f[pI], nUsage[f[pI]]++) = fI;
105  }
106 
107  nUsage.clear();
108 
109  # ifdef DEBUG_ZIPUP
110  Info << "Starting zipping cells " << endl;
111  # endif
112 
113  forAll (cells, cellI)
114  {
115  const labelList& curFaces = cells[cellI];
116  const edgeList cellEdges = cells[cellI].edges(faces);
117  const labelList cellPoints = cells[cellI].labels(faces);
118 
119  // Find the edges used only once in the cell
120 
121  labelList edgeUsage(cellEdges.size(), 0);
122 
123  forAll (curFaces, faceI)
124  {
125  edgeList curFaceEdges = faces[curFaces[faceI]].edges();
126 
127  forAll (curFaceEdges, faceEdgeI)
128  {
129  const edge& curEdge = curFaceEdges[faceEdgeI];
130 
131  forAll (cellEdges, cellEdgeI)
132  {
133  if (cellEdges[cellEdgeI] == curEdge)
134  {
135  edgeUsage[cellEdgeI]++;
136  break;
137  }
138  }
139  }
140  }
141 
142  edgeList singleEdges(cellEdges.size());
143  label nSingleEdges = 0;
144 
145  forAll (edgeUsage, edgeI)
146  {
147  if (edgeUsage[edgeI] == 1)
148  {
149  singleEdges[nSingleEdges] = cellEdges[edgeI];
150  nSingleEdges++;
151  }
152  else if (edgeUsage[edgeI] != 2)
153  {
154  Warning
155  << "void polyMesh::zipUpCells() : "
156  << "edge " << cellEdges[edgeI] << " in cell " << cellI
157  << " used " << edgeUsage[edgeI] << " times. " << nl
158  << "Should be 1 or 2 - serious error "
159  << "in mesh structure. " << endl;
160 
161 # ifdef DEBUG_ZIPUP
162  forAll (curFaces, faceI)
163  {
164  Info<< "face: " << faces[curFaces[faceI]]
165  << endl;
166  }
167 
168  Info<< "Cell edges: " << cellEdges << nl
169  << "Edge usage: " << edgeUsage << nl
170  << "Cell points: " << cellPoints << endl;
171 
172  forAll (cellPoints, cpI)
173  {
174  Info<< "vertex create \"" << cellPoints[cpI]
175  << "\" coordinates "
176  << points[cellPoints[cpI]] << endl;
177  }
178 # endif
179 
180  // Gather the problem cell
181  problemCells.insert(cellI);
182  }
183  }
184 
185  // Check if the cell is already zipped up
186  if (nSingleEdges == 0) continue;
187 
188  singleEdges.setSize(nSingleEdges);
189 
190 # ifdef DEBUG_ZIPUP
191  Info << "Cell " << cellI << endl;
192 
193  forAll (curFaces, faceI)
194  {
195  Info<< "face: " << faces[curFaces[faceI]] << endl;
196  }
197 
198  Info<< "Cell edges: " << cellEdges << nl
199  << "Edge usage: " << edgeUsage << nl
200  << "Single edges: " << singleEdges << nl
201  << "Cell points: " << cellPoints << endl;
202 
203  forAll (cellPoints, cpI)
204  {
205  Info<< "vertex create \"" << cellPoints[cpI]
206  << "\" coordinates "
207  << points[cellPoints[cpI]] << endl;
208  }
209 # endif
210 
211  // Loop through all single edges and mark the points they use
212  // points marked twice are internal to edge; those marked more than
213  // twice are corners
214 
215  labelList pointUsage(cellPoints.size(), 0);
216 
217  forAll (singleEdges, edgeI)
218  {
219  const edge& curEdge = singleEdges[edgeI];
220 
221  forAll (cellPoints, pointI)
222  {
223  if
224  (
225  cellPoints[pointI] == curEdge.start()
226  || cellPoints[pointI] == curEdge.end()
227  )
228  {
229  pointUsage[pointI]++;
230  }
231  }
232  }
233 
234  boolList singleEdgeUsage(singleEdges.size(), false);
235 
236  // loop through all edges and eliminate the ones that are
237  // blocked out
238  forAll (singleEdges, edgeI)
239  {
240  bool blockedHead = false;
241  bool blockedTail = false;
242 
243  label newEdgeStart = singleEdges[edgeI].start();
244  label newEdgeEnd = singleEdges[edgeI].end();
245 
246  // check that the edge has not got all ends blocked
247  forAll (cellPoints, pointI)
248  {
249  if (cellPoints[pointI] == newEdgeStart)
250  {
251  if (pointUsage[pointI] > 2)
252  {
253  blockedHead = true;
254  }
255  }
256  else if (cellPoints[pointI] == newEdgeEnd)
257  {
258  if (pointUsage[pointI] > 2)
259  {
260  blockedTail = true;
261  }
262  }
263  }
264 
265  if (blockedHead && blockedTail)
266  {
267  // Eliminating edge singleEdges[edgeI] as blocked
268  singleEdgeUsage[edgeI] = true;
269  }
270  }
271 
272  // Go through the points and start from the point used twice
273  // check all the edges to find the edges starting from this point
274  // add the
275 
276  labelListList edgesToInsert(singleEdges.size());
277  label nEdgesToInsert = 0;
278 
279  // Find a good edge
280  forAll (singleEdges, edgeI)
281  {
282  SLList<label> pointChain;
283 
284  bool blockHead = false;
285  bool blockTail = false;
286 
287  if (!singleEdgeUsage[edgeI])
288  {
289  // found a new edge
290  singleEdgeUsage[edgeI] = true;
291 
292  label newEdgeStart = singleEdges[edgeI].start();
293  label newEdgeEnd = singleEdges[edgeI].end();
294 
295  pointChain.insert(newEdgeStart);
296  pointChain.append(newEdgeEnd);
297 
298 # ifdef DEBUG_CHAIN
299  Info<< "found edge to start with: "
300  << singleEdges[edgeI] << endl;
301 # endif
302 
303  // Check if head or tail are blocked
304  forAll (cellPoints, pointI)
305  {
306  if (cellPoints[pointI] == newEdgeStart)
307  {
308  if (pointUsage[pointI] > 2)
309  {
310 # ifdef DEBUG_CHAIN
311  Info << "start head blocked" << endl;
312 # endif
313 
314  blockHead = true;
315  }
316  }
317  else if(cellPoints[pointI] == newEdgeEnd)
318  {
319  if (pointUsage[pointI] > 2)
320  {
321 # ifdef DEBUG_CHAIN
322  Info << "start tail blocked" << endl;
323 # endif
324 
325  blockTail = true;
326  }
327  }
328  }
329 
330  bool stopSearching = false;
331 
332  // Go through the unused edges and try to chain them up
333  do
334  {
335  stopSearching = false;
336 
337  forAll (singleEdges, addEdgeI)
338  {
339  if (!singleEdgeUsage[addEdgeI])
340  {
341  // Grab start and end of the candidate
342  label addStart =
343  singleEdges[addEdgeI].start();
344 
345  label addEnd =
346  singleEdges[addEdgeI].end();
347 
348 # ifdef DEBUG_CHAIN
349  Info<< "Trying candidate "
350  << singleEdges[addEdgeI] << endl;
351 # endif
352 
353  // Try to add the edge onto the head
354  if (!blockHead)
355  {
356  if (pointChain.first() == addStart)
357  {
358  // Added at start mark as used
359  pointChain.insert(addEnd);
360 
361  singleEdgeUsage[addEdgeI] = true;
362  }
363  else if (pointChain.first() == addEnd)
364  {
365  pointChain.insert(addStart);
366 
367  singleEdgeUsage[addEdgeI] = true;
368  }
369  }
370 
371  // Try the other end only if the first end
372  // did not add it
373  if (!blockTail && !singleEdgeUsage[addEdgeI])
374  {
375  if (pointChain.last() == addStart)
376  {
377  // Added at start mark as used
378  pointChain.append(addEnd);
379 
380  singleEdgeUsage[addEdgeI] = true;
381  }
382  else if (pointChain.last() == addEnd)
383  {
384  pointChain.append(addStart);
385 
386  singleEdgeUsage[addEdgeI] = true;
387  }
388  }
389 
390  // check if the new head or tail are blocked
391  label curEdgeStart = pointChain.first();
392  label curEdgeEnd = pointChain.last();
393 
394 # ifdef DEBUG_CHAIN
395  Info<< "curEdgeStart: " << curEdgeStart
396  << " curEdgeEnd: " << curEdgeEnd << endl;
397 # endif
398 
399  forAll (cellPoints, pointI)
400  {
401  if (cellPoints[pointI] == curEdgeStart)
402  {
403  if (pointUsage[pointI] > 2)
404  {
405 # ifdef DEBUG_CHAIN
406  Info << "head blocked" << endl;
407 # endif
408 
409  blockHead = true;
410  }
411  }
412  else if(cellPoints[pointI] == curEdgeEnd)
413  {
414  if (pointUsage[pointI] > 2)
415  {
416 # ifdef DEBUG_CHAIN
417  Info << "tail blocked" << endl;
418 # endif
419 
420  blockTail = true;
421  }
422  }
423  }
424 
425  // Check if the loop is closed
426  if (curEdgeStart == curEdgeEnd)
427  {
428 # ifdef DEBUG_CHAIN
429  Info << "closed loop" << endl;
430 # endif
431 
432  pointChain.removeHead();
433 
434  blockHead = true;
435  blockTail = true;
436 
437  stopSearching = true;
438  }
439 
440 # ifdef DEBUG_CHAIN
441  Info<< "current pointChain: " << pointChain
442  << endl;
443 # endif
444 
445  if (stopSearching) break;
446  }
447  }
448  } while (stopSearching);
449  }
450 
451 # ifdef DEBUG_CHAIN
452  Info << "completed patch chain: " << pointChain << endl;
453 # endif
454 
455  if (pointChain.size() > 2)
456  {
457  edgesToInsert[nEdgesToInsert] = pointChain;
458  nEdgesToInsert++;
459  }
460  }
461 
462  edgesToInsert.setSize(nEdgesToInsert);
463 
464 # ifdef DEBUG_ZIPUP
465  Info << "edgesToInsert: " << edgesToInsert << endl;
466 # endif
467 
468  // Insert the edges into a list of faces
469  forAll (edgesToInsert, edgeToInsertI)
470  {
471  // Order the points of the edge
472  // Warning: the ordering must be parametric, because in
473  // the case of multiple point insertion onto the same edge
474  // it is possible to get non-cyclic loops
475  //
476 
477  const labelList& unorderedEdge = edgesToInsert[edgeToInsertI];
478 
479  scalarField dist(unorderedEdge.size());
480 
481  // Calculate distance
482  point startPoint = points[unorderedEdge[0]];
483  dist[0] = 0;
484 
485  vector dir =
486  points[unorderedEdge[unorderedEdge.size() - 1]]
487  - startPoint;
488 
489  for (label i = 1; i < dist.size(); i++)
490  {
491  dist[i] = (points[unorderedEdge[i]] - startPoint) & dir;
492  }
493 
494  // Sort points
495  labelList orderedEdge(unorderedEdge.size(), -1);
496  boolList used(unorderedEdge.size(), false);
497 
498  forAll (orderedEdge, epI)
499  {
500  label nextPoint = -1;
501  scalar minDist = GREAT;
502 
503  forAll (dist, i)
504  {
505  if (!used[i] && dist[i] < minDist)
506  {
507  minDist = dist[i];
508  nextPoint = i;
509  }
510  }
511 
512  // Insert the next point
513  orderedEdge[epI] = unorderedEdge[nextPoint];
514  used[nextPoint] = true;
515  }
516 
517 # ifdef DEBUG_ORDER
518  Info<< "unorderedEdge: " << unorderedEdge << nl
519  << "orderedEdge: " << orderedEdge << endl;
520 # endif
521 
522  // check for duplicate points in the ordered edge
523  forAll (orderedEdge, checkI)
524  {
525  for
526  (
527  label checkJ = checkI + 1;
528  checkJ < orderedEdge.size();
529  checkJ++
530  )
531  {
532  if (orderedEdge[checkI] == orderedEdge[checkJ])
533  {
534  Warning
535  << "void polyMesh::zipUpCells() : "
536  << "Duplicate point found in edge to insert. "
537  << nl << "Point: " << orderedEdge[checkI]
538  << " edge: " << orderedEdge << endl;
539 
540  problemCells.insert(cellI);
541  }
542  }
543  }
544 
545  edge testEdge
546  (
547  orderedEdge[0],
548  orderedEdge[orderedEdge.size() - 1]
549  );
550 
551  // In order to avoid edge-to-edge comparison, get faces using
552  // point-face addressing in two goes.
553  const label start = testEdge.start();
554  const label end = testEdge.end();
555 
556  labelList facesSharingEdge
557  (
558  pFaces.sizeOfRow(start) +
559  pFaces.sizeOfRow(end)
560  );
561  label nfse = 0;
562 
563  forAllRow(pFaces, start, pfI)
564  facesSharingEdge[nfse++] = pFaces(start, pfI);
565 
566  forAllRow(pFaces, end, pfI)
567  facesSharingEdge[nfse++] = pFaces(end, pfI);
568 
569  forAll(facesSharingEdge, faceI)
570  {
571  bool faceChanges = false;
572 
573  // Label of the face being analysed
574  const label currentFaceIndex = facesSharingEdge[faceI];
575 
576  const edgeList curFaceEdges =
577  faces[currentFaceIndex].edges();
578 
579  forAll (curFaceEdges, cfeI)
580  {
581  if (curFaceEdges[cfeI] == testEdge)
582  {
583  faceChanges = true;
584  break;
585  }
586  }
587 
588  if (faceChanges)
589  {
590  nChangedFacesInMesh++;
591  // In order to avoid loosing point from multiple
592  // insertions into the same face, the new face
593  // will be change incrementally.
594  // 1) Check if all the internal points of the edge
595  // to add already exist in the face. If so, the
596  // edge has already been included 2) Check if the
597  // point insertion occurs on an edge which is
598  // still untouched. If so, simply insert
599  // additional points into the face. 3) If not,
600  // the edge insertion occurs on an already
601  // modified edge. ???
602 
603  face& newFace = faces[currentFaceIndex];
604 
605  bool allPointsPresent = true;
606 
607  forAll (orderedEdge, oeI)
608  {
609  bool curPointFound = false;
610 
611  forAll (newFace, nfI)
612  {
613  if (newFace[nfI] == orderedEdge[oeI])
614  {
615  curPointFound = true;
616  break;
617  }
618  }
619 
620  allPointsPresent =
621  allPointsPresent && curPointFound;
622  }
623 
624 # ifdef DEBUG_ZIPUP
625  if (allPointsPresent)
626  {
627  Info << "All points present" << endl;
628  }
629 # endif
630 
631  if (!allPointsPresent)
632  {
633  // Not all points are already present. The
634  // new edge will need to be inserted into the
635  // face.
636 
637  // Check to see if a new edge fits onto an
638  // untouched edge of the face. Make sure the
639  // edges are grabbed before the face is
640  // resized.
641  edgeList newFaceEdges = newFace.edges();
642 
643 # ifdef DEBUG_ZIPUP
644  Info << "Not all points present." << endl;
645 # endif
646 
647  label nNewFacePoints = 0;
648 
649  bool edgeAdded = false;
650 
651  forAll (newFaceEdges, curFacEdgI)
652  {
653  // Does the current edge change?
654  if (newFaceEdges[curFacEdgI] == testEdge)
655  {
656  // Found an edge match
657  edgeAdded = true;
658 
659  // Resize the face to accept additional
660  // points
661  newFace.setSize
662  (
663  newFace.size()
664  + orderedEdge.size() - 2
665  );
666 
667  if
668  (
669  newFaceEdges[curFacEdgI].start()
670  == testEdge.start()
671  )
672  {
673  // insertion in ascending order
674  for
675  (
676  label i = 0;
677  i < orderedEdge.size() - 1;
678  i++
679  )
680  {
681  newFace[nNewFacePoints] =
682  orderedEdge[i];
683  nNewFacePoints++;
684  }
685  }
686  else
687  {
688  // insertion in reverse order
689  for
690  (
691  label i = orderedEdge.size() - 1;
692  i > 0;
693  i--
694  )
695  {
696  newFace[nNewFacePoints] =
697  orderedEdge[i];
698  nNewFacePoints++;
699  }
700  }
701  }
702  else
703  {
704  // Does not fit onto this edge.
705  // Copy the next point into the face
706  newFace[nNewFacePoints] =
707  newFaceEdges[curFacEdgI].start();
708  nNewFacePoints++;
709  }
710  }
711 
712  forAll(newFace, pI)
713  pFaces.appendIfNotIn
714  (
715  newFace[pI],
716  currentFaceIndex
717  );
718 
719 # ifdef DEBUG_ZIPUP
720  Info<< "oldFace: "
721  << faces[currentFaceIndex] << nl
722  << "newFace: " << newFace << endl;
723 # endif
724 
725  // Check for duplicate points in the new face
726  forAll (newFace, checkI)
727  {
728  for
729  (
730  label checkJ = checkI + 1;
731  checkJ < newFace.size();
732  checkJ++
733  )
734  {
735  if (newFace[checkI] == newFace[checkJ])
736  {
737  Warning
738  << "void polyMesh::zipUpCells()"
739  << "Duplicate point found "
740  << "in the new face. " << nl
741  << "Point: "
742  << orderedEdge[checkI]
743  << " face: "
744  << newFace << endl;
745 
746  problemCells.insert(cellI);
747  }
748  }
749  }
750 
751  // Check if the edge is added.
752  // If not, then it comes on top of an already
753  // modified edge and they need to be
754  // merged in together.
755  if (!edgeAdded)
756  {
757  Info<< "This edge modifies an already modified "
758  << "edge. Point insertions skipped."
759  << endl;
760  }
761  }
762  }
763  }
764  }
765  }
766 
767  if (problemCells.size() > 0)
768  {
769  // This cycle has failed. Print out the problem cells
770  labelList toc(problemCells.toc());
771  sort(toc);
772 
773  FatalErrorIn("void polyMesh::zipUpCells()")
774  << "Found " << problemCells.size() << " problem cells." << nl
775  << "Cells: " << toc
776  << abort(FatalError);
777  }
778 
779  Info<< "Cycle " << ++nCycles
780  << " changed " << nChangedFacesInMesh << " faces." << endl;
781  } while (nChangedFacesInMesh > 0 || nCycles > 100);
782 
783  if (nChangedFacesInMesh > 0)
784  {
785  FatalErrorIn("void polyMesh::zipUpCells()")
786  << "cell zip-up failed after 100 cycles. Probable problem "
787  << "with the original mesh"
788  << abort(FatalError);
789  }
790  Info << "Finished zipping the mesh." << endl;
791 }
792 
793 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
794 
795 } // End namespace Foam
796 
797 // ************************************************************************* //
boolList.H
Foam::LList::append
void append(const T &a)
Add at tail of list.
Definition: LList.H:166
Foam::HashTable::toc
List< Key > toc() const
Return the table of contents.
Definition: HashTable.C:201
Foam::SLList< label >
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::LList::insert
void insert(const T &a)
Add at head of list.
Definition: LList.H:160
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::Warning
messageStream Warning
polyMeshGenModifier.H
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:58
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::polyMeshGenPoints::points
const pointFieldPMG & points() const
access to points
Definition: polyMeshGenPointsI.H:44
Foam::polyMeshGenModifier::mesh_
polyMeshGen & mesh_
reference to the mesh
Definition: polyMeshGenModifier.H:56
Foam::cellListPMG
Definition: cellListPMG.H:49
Foam::HashSet< label, Hash< label > >
pFaces
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
Definition: readKivaGrid.H:235
Foam::edge::end
label end() const
Return end vertex label.
Definition: edgeI.H:92
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::polyMeshGenModifier::clearOut
void clearOut()
clear out unnecessary data (pointFacesPtr_);
Definition: polyMeshGenModifier.H:194
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::polyMeshGenCells::cells
const cellListPMG & cells() const
access to cells
Definition: polyMeshGenCellsI.H:39
forAllRow
#define forAllRow(graph, rowI, index)
Definition: VRWGraph.H:277
HashSet.H
Foam::FatalError
error FatalError
Foam::HashTable::size
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
Foam::face::edges
edgeList edges() const
Return edges in face point ordering,.
Definition: face.C:761
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::List::setSize
void setSize(const label)
Reset size of List.
Foam::edge::start
label start() const
Return start vertex label.
Definition: edgeI.H:81
f
labelList f(nPoints)
Foam::polyMeshGenFaces::faces_
faceListPMG faces_
list of faces
Definition: polyMeshGenFaces.H:57
Foam::Vector< scalar >
Foam::List< direction >
Foam::LList::first
T & first()
Return the first entry added.
Definition: LList.H:133
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::List::clear
void clear()
Clear the list, i.e. set size to zero.
Definition: List.C:379
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:116
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::LList::last
T & last()
Return the last entry added.
Definition: LList.H:145
Foam::polyMeshGenModifier::zipUpCells
void zipUpCells()
zip up topologically open cells
Definition: polyMeshGenModifierZipUpCells.C:42
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::sort
void sort(UList< T > &)
Definition: UList.C:107
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::faceListPMG
Definition: faceListPMG.H:50
Foam::pointFieldPMG
Definition: pointFieldPMG.H:50
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::LList::removeHead
T removeHead()
Remove and return head.
Definition: LList.H:172