meshSurfaceEngineCalculateBoundaryNodesAndFaces.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 "meshSurfaceEngine.H"
29 #include "demandDrivenData.H"
30 #include "boolList.H"
31 #include "helperFunctions.H"
32 #include "VRWGraphSMPModifier.H"
33 #include "labelledPoint.H"
34 #include "HashSet.H"
35 
36 #include <map>
37 #include <set>
38 
39 # ifdef USE_OMP
40 #include <omp.h>
41 # endif
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
51 {
52  if( mesh_.boundaries().size() != 0 )
53  {
54  const faceListPMG& faces = mesh_.faces();
55  const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
56 
57  label nBoundaryFaces(0);
58  if( activePatch_ < 0 )
59  {
60  //- take all patches
61  forAll(boundaries, patchI)
62  nBoundaryFaces += boundaries[patchI].patchSize();
63 
66  (
67  faces,
68  nBoundaryFaces,
69  boundaries[0].patchStart()
70  );
71  }
72  else if( activePatch_ < boundaries.size() )
73  {
74  nBoundaryFaces = boundaries[activePatch_].patchSize();
75 
78  (
79  faces,
80  nBoundaryFaces,
81  boundaries[activePatch_].patchStart()
82  );
83  }
84  else
85  {
87  (
88  "void meshSurfaceEngine::calculateBoundaryFaces() const"
89  ) << "Cannot select boundary faces. Invalid patch index "
91  }
92 
93  reduce(nBoundaryFaces, sumOp<label>());
94  Info << "Found " << nBoundaryFaces << " boundary faces " << endl;
95  }
96  else
97  {
99  (
100  "void meshSurfaceEngine::calculateBoundaryFaces() const"
101  ) << "Boundary faces are not at the end of the face list!"
102  << exit(FatalError);
103  }
104 }
105 
107 {
108  const labelList& owner = mesh_.owner();
109 
111 
113  boundaryFaceOwnersPtr_ = new labelList(boundaryFaces.size());
114 
116 
117  const label start = mesh_.boundaries()[0].patchStart();
118 
119  # ifdef USE_OMP
120  # pragma omp parallel for schedule(static, 1)
121  # endif
122  forAll(boundaryFaces, fI)
123  owners[fI] = owner[start+fI];
124 }
125 
127 {
128  //- mark boundary points
129  label pointI(0);
130  if( !bppPtr_ )
131  bppPtr_ = new labelList(mesh_.points().size(), -1);
132  labelList& bp = *bppPtr_;
133 
135 
136  boolList isBndPoint(bp.size(), false);
137 
138  # ifdef USE_OMP
139  const label nThreads = 3 * omp_get_num_procs();
140  # pragma omp parallel for num_threads(nThreads) schedule(static, 1)
141  # endif
142  forAll(boundaryFaces, bfI)
143  {
144  const face& bf = boundaryFaces[bfI];
145 
146  forAll(bf, pI)
147  isBndPoint[bf[pI]] = true;
148  }
149 
150  forAll(isBndPoint, pI)
151  {
152  if( isBndPoint[pI] )
153  bp[pI] = pointI++;
154  }
155 
156  if( Pstream::parRun() )
157  {
158  const faceListPMG& faces = mesh_.faces();
159  const PtrList<processorBoundaryPatch>& procBoundaries =
161 
162  //- exchange information with processors
163  //- this is need sometimes to find all nodes at the boundary
164  bool found;
165  do
166  {
167  found = false;
168 
169  //- send bnd nodes to other processor
170  forAll(procBoundaries, patchI)
171  {
172  const label start = procBoundaries[patchI].patchStart();
173  const label end = start + procBoundaries[patchI].patchSize();
174 
175  labelLongList dts;
176  labelHashSet addedPoint;
177  for(label faceI=start;faceI<end;++faceI)
178  {
179  const face& f = faces[faceI];
180  forAll(f, pI)
181  if( (bp[f[pI]] != -1) && !addedPoint.found(f[pI]) )
182  {
183  addedPoint.insert(f[pI]);
184 
185  //- data is sent as follows
186  //- 1. local face label in patch
187  //- 2. local node in face
188  dts.append(faceI-start);
189  dts.append((f.size() - pI) % f.size());
190  }
191  }
192 
193  OPstream toOtherProc
194  (
196  procBoundaries[patchI].neiProcNo(),
197  dts.byteSize()
198  );
199  toOtherProc << dts;
200  }
201 
202  //- receive data and update positions if needed
203  forAll(procBoundaries, patchI)
204  {
205  const label start = procBoundaries[patchI].patchStart();
206  labelList receiveData;
207  IPstream fromOtherProc
208  (
210  procBoundaries[patchI].neiProcNo()
211  );
212  fromOtherProc >> receiveData;
213 
214  label counter(0);
215  while( counter < receiveData.size() )
216  {
217  const label fI = receiveData[counter++];
218  const label pI = receiveData[counter++];
219 
220  if( bp[faces[start+fI][pI]] == -1 )
221  {
222  bp[faces[start+fI][pI]] = pointI++;
223  found = true;
224  }
225  }
226  }
227 
229 
230  } while( found );
231  }
232 
233  if( !boundaryPointsPtr_ )
235 
237  boundaryPoints.setSize(pointI);
238 
239  //- fill the boundaryPoints list
240  # ifdef USE_OMP
241  # pragma omp parallel for num_threads(nThreads) schedule(static, 1)
242  # endif
243  forAll(bp, bpI)
244  {
245  if( bp[bpI] != -1 )
246  boundaryPoints[bp[bpI]] = bpI;
247  }
248 }
249 
251 {
252  const faceList::subList& bFaces = this->boundaryFaces();
253  boundaryFacePatchPtr_ = new labelList(bFaces.size());
254  labelList& facePatch = *boundaryFacePatchPtr_;
255 
256  label faceI(0);
257  const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
258  forAll(boundaries, patchI)
259  {
260  const label nFaces = boundaries[patchI].patchSize();
261  for(label patchFaceI=0;patchFaceI<nFaces;++patchFaceI)
262  {
263  facePatch[faceI] = patchI;
264  ++faceI;
265  }
266  }
267 }
268 
270 {
271  //- fill pointFacesAddr
272  if( !pointFacesPtr_ )
273  pointFacesPtr_ = new VRWGraph();
274  VRWGraph& pointFacesAddr = *pointFacesPtr_;
275 
276  if( !pointInFacePtr_ )
277  pointInFacePtr_ = new VRWGraph();
278  VRWGraph& pointInFaceAddr = *pointInFacePtr_;
279 
280  const labelList& bPoints = this->boundaryPoints();
281  const faceList::subList& bFaces = this->boundaryFaces();
282 
283  //- create boundary points
284  const labelList& bp = this->bp();
285 
286  labelLongList npf;
287 
288  # ifdef USE_OMP
289  label nThreads = 3 * omp_get_num_procs();
290  if( bPoints.size() < 1000 )
291  nThreads = 1;
292  # else
293  const label nThreads(1);
294  # endif
295 
296  label minRow(INT_MAX), maxRow(0);
297  List<List<LongList<labelPair> > > dataForOtherThreads(nThreads);
298 
299  # ifdef USE_OMP
300  # pragma omp parallel num_threads(nThreads)
301  # endif
302  {
303  # ifdef USE_OMP
304  const label threadI = omp_get_thread_num();
305  # else
306  const label threadI(0);
307  # endif
308 
309  List<LongList<labelPair> >& dot = dataForOtherThreads[threadI];
310  dot.setSize(nThreads);
311 
312  //- find min and max entry in the graph
313  //- they are used for assigning ranges of values local for each process
314  label localMinRow(minRow), localMaxRow(0);
315  # ifdef USE_OMP
316  # pragma omp for schedule(static)
317  # endif
318  forAll(bFaces, bfI)
319  {
320  const face& bf = bFaces[bfI];
321  forAll(bf, pI)
322  {
323  const label bpI = bp[bf[pI]];
324  localMaxRow = Foam::max(localMaxRow, bpI);
325  localMinRow = Foam::min(localMinRow, bpI);
326  }
327  }
328 
329  ++localMaxRow;
330 
331  # ifdef USE_OMP
332  # pragma omp critical
333  # endif
334  {
335  minRow = Foam::min(minRow, localMinRow);
336  minRow = Foam::max(minRow, 0);
337  maxRow = Foam::max(maxRow, localMaxRow);
338 
339  npf.setSize(maxRow);
340  }
341 
342  # ifdef USE_OMP
343  # pragma omp barrier
344  # endif
345 
346  //- initialise appearances
347  # ifdef USE_OMP
348  # pragma omp for schedule(static)
349  # endif
350  for(label i=0;i<maxRow;++i)
351  npf[i] = 0;
352 
353  # ifdef USE_OMP
354  # pragma omp barrier
355  # endif
356 
357  const label range = (maxRow - minRow) / nThreads + 1;
358  const label localMin = minRow + threadI * range;
359  const label localMax = Foam::min(localMin + range, maxRow);
360 
361  //- find the number of appearances of each element in the original graph
362  # ifdef USE_OMP
363  # pragma omp for schedule(static)
364  # endif
365  forAll(bFaces, bfI)
366  {
367  const face& bf = bFaces[bfI];
368 
369  forAll(bf, pI)
370  {
371  const label bpI = bp[bf[pI]];
372 
373  const label threadNo = (bpI - minRow) / range;
374 
375  if( threadNo == threadI )
376  {
377  ++npf[bpI];
378  }
379  else
380  {
381  dot[threadNo].append(labelPair(bpI, bfI));
382  }
383  }
384  }
385 
386  # ifdef USE_OMP
387  # pragma omp barrier
388  # endif
389 
390  //- count the appearances which are not local to the processor
391  for(label i=0;i<nThreads;++i)
392  {
393  const LongList<labelPair>& data =
394  dataForOtherThreads[i][threadI];
395 
396  forAll(data, j)
397  ++npf[data[j].first()];
398  }
399 
400  # ifdef USE_OMP
401  # pragma omp barrier
402  # endif
403 
404  //- allocate graph
405  # ifdef USE_OMP
406  # pragma omp master
407  # endif
408  {
409  VRWGraphSMPModifier(pointFacesAddr).setSizeAndRowSize(npf);
410  VRWGraphSMPModifier(pointInFaceAddr).setSizeAndRowSize(npf);
411  }
412 
413  # ifdef USE_OMP
414  # pragma omp barrier
415  # endif
416 
417  for(label i=localMin;i<localMax;++i)
418  npf[i] = 0;
419 
420  //- start filling reverse addressing graph
421  //- update data from processors with smaller labels
422  for(label i=0;i<threadI;++i)
423  {
424  const LongList<labelPair>& data =
425  dataForOtherThreads[i][threadI];
426 
427  forAll(data, j)
428  {
429  const label bpI = data[j].first();
430  const label bfI = data[j].second();
431 
432  pointFacesAddr(bpI, npf[bpI]) = bfI;
433  pointInFaceAddr(bpI, npf[bpI]) =
434  bFaces[bfI].which(bPoints[bpI]);
435 
436  ++npf[bpI];
437  }
438  }
439 
440  //- update data local to the processor
441  # ifdef USE_OMP
442  # pragma omp for schedule(static)
443  # endif
444  forAll(bFaces, bfI)
445  {
446  const face& bf = bFaces[bfI];
447 
448  forAll(bf, pI)
449  {
450  const label bpI = bp[bf[pI]];
451 
452  if( (bpI >= localMin) && (bpI < localMax) )
453  {
454  pointInFaceAddr(bpI, npf[bpI]) = pI;
455  pointFacesAddr(bpI, npf[bpI]++) = bfI;
456  }
457  }
458  }
459 
460  //- update data from the processors with higher labels
461  for(label i=threadI+1;i<nThreads;++i)
462  {
463  const LongList<labelPair>& data =
464  dataForOtherThreads[i][threadI];
465 
466  forAll(data, j)
467  {
468  const label bpI = data[j].first();
469  const label bfI = data[j].second();
470 
471  pointFacesAddr(bpI, npf[bpI]) = bfI;
472  pointInFaceAddr(bpI, npf[bpI]) =
473  bFaces[bfI].which(bPoints[bpI]);
474 
475  ++npf[bpI];
476  }
477  }
478  }
479 
480  pointFacesAddr.setSize(bPoints.size());
481  pointInFaceAddr.setSize(bPoints.size());
482 }
483 
485 {
486  if( !pointPatchesPtr_ )
487  pointPatchesPtr_ = new VRWGraph();
488  VRWGraph& pPatches = *pointPatchesPtr_;
489 
490  const labelList& facePatch = boundaryFacePatches();
491  const VRWGraph& pFaces = pointFaces();
492 
493  # ifdef USE_OMP
494  const label nThreads = 3 * omp_get_num_procs();
495  # endif
496 
497  labelList npPatches(pFaces.size());
498 
499  # ifdef USE_OMP
500  # pragma omp parallel num_threads(nThreads)
501  # endif
502  {
503  # ifdef USE_OMP
504  # pragma omp for schedule(static)
505  # endif
506  forAll(npPatches, i)
507  npPatches[i] = 0;
508 
509  # ifdef USE_OMP
510  # pragma omp for schedule(static)
511  # endif
512  forAll(pFaces, bpI)
513  {
514  DynList<label> pf;
515  forAllRow(pFaces, bpI, pfI)
516  pf.appendIfNotIn(facePatch[pFaces(bpI, pfI)]);
517 
518  npPatches[bpI] = pf.size();
519  }
520 
521  # ifdef USE_OMP
522  # pragma omp barrier
523 
524  # pragma omp master
525  # endif
526  VRWGraphSMPModifier(pPatches).setSizeAndRowSize(npPatches);
527 
528  # ifdef USE_OMP
529  # pragma omp barrier
530 
531  # pragma omp for schedule(static)
532  # endif
533  forAll(pFaces, bpI)
534  {
535  DynList<label> pf;
536  forAllRow(pFaces, bpI, pfI)
537  pf.appendIfNotIn(facePatch[pFaces(bpI, pfI)]);
538 
539  pPatches.setRow(bpI, pf);
540  }
541  }
542 
543  if( Pstream::parRun() )
544  {
545  const labelList& globalPointLabel = globalBoundaryPointLabel();
546  const VRWGraph& bpAtProcs = this->bpAtProcs();
547  const Map<label>& globalToLocal = globalToLocalBndPointAddressing();
548 
549  std::map<label, labelLongList> exchangeData;
550 
551  forAllConstIter(Map<label>, globalToLocal, iter)
552  {
553  const label bpI = iter();
554 
555  forAllRow(bpAtProcs, bpI, procI)
556  {
557  const label neiProc = bpAtProcs(bpI, procI);
558  if( neiProc == Pstream::myProcNo() )
559  continue;
560 
561  if( exchangeData.find(neiProc) == exchangeData.end() )
562  {
563  exchangeData.insert
564  (
565  std::make_pair(neiProc, labelLongList())
566  );
567  }
568 
569  labelLongList& dataToSend = exchangeData[neiProc];
570 
571  //- prepare data which will be sent
572  //- data is sent as follows
573  //- 1. global point label
574  //- 2. number of local patches for point
575  //- 3. patch labels for a given point
576  dataToSend.append(globalPointLabel[bpI]);
577  dataToSend.append(pPatches.sizeOfRow(bpI));
578  forAllRow(pPatches, bpI, patchI)
579  dataToSend.append(pPatches(bpI, patchI));
580  }
581  }
582 
583  //- exchange data with other processors
584  labelLongList receivedData;
585  help::exchangeMap(exchangeData, receivedData);
586 
587  label counter(0);
588  while( counter < receivedData.size() )
589  {
590  const label bpI = globalToLocal[receivedData[counter++]];
591  const label nPatches = receivedData[counter++];
592  for(label i=0;i<nPatches;++i)
593  pPatches.appendIfNotIn(bpI, receivedData[counter++]);
594  }
595  }
596 }
597 
599 {
600  if( !pointPointsPtr_ )
601  pointPointsPtr_ = new VRWGraph();
602 
604 
605  const labelList& boundaryPoints = this->boundaryPoints();
606  const faceList::subList& bFaces = this->boundaryFaces();
607  const VRWGraph& pFaces = this->pointFaces();
608  const labelList& bp = this->bp();
609 
610  # ifdef USE_OMP
611  const label nThreads = 3 * omp_get_num_procs();
612  # endif
613 
615 
616  # ifdef USE_OMP
617  # pragma omp parallel num_threads(nThreads)
618  # endif
619  {
620  # ifdef USE_OMP
621  # pragma omp for schedule(static)
622  # endif
623  forAll(npp, i)
624  npp[i] = 0;
625 
626  # ifdef USE_OMP
627  # pragma omp for schedule(static)
628  # endif
629  forAll(pFaces, bpI)
630  {
631  DynList<label> pPoints;
632 
633  forAllRow(pFaces, bpI, pfI)
634  {
635  const face& bf = bFaces[pFaces(bpI, pfI)];
636 
637  const label pos = bf.which(boundaryPoints[bpI]);
638 
639  pPoints.appendIfNotIn(bp[bf.nextLabel(pos)]);
640  pPoints.appendIfNotIn(bp[bf.prevLabel(pos)]);
641  }
642 
643  npp[bpI] = pPoints.size();
644  }
645 
646  # ifdef USE_OMP
647  # pragma omp barrier
648 
649  # pragma omp master
650  # endif
652 
653  # ifdef USE_OMP
654  # pragma omp barrier
655 
656  # pragma omp for schedule(static)
657  # endif
658  forAll(pFaces, bpI)
659  {
660  DynList<label> pPoints;
661 
662  forAllRow(pFaces, bpI, pfI)
663  {
664  const face& bf = bFaces[pFaces(bpI, pfI)];
665 
666  const label pos = bf.which(boundaryPoints[bpI]);
667 
668  pPoints.appendIfNotIn(bp[bf.nextLabel(pos)]);
669  pPoints.appendIfNotIn(bp[bf.prevLabel(pos)]);
670  }
671 
672  pointPoints.setRow(bpI, pPoints);
673  }
674  }
675 
676  if( Pstream::parRun() )
677  {
678  //- this is needed to make the connection matrix symmetric
679  //- on all processors. In some cases the points on a given processor
680  //- may not be connected because of a single layer of faces on some
681  //- other processor. P0, P0 | P1 | P0 P0
682  const labelList& globalPointLabel = this->globalBoundaryPointLabel();
683  const Map<label>& globalToLocal =
685  const VRWGraph& bpAtProcs = this->bpAtProcs();
686 
687  std::map<label, labelLongList> exchangeData;
688  forAllConstIter(Map<label>, globalToLocal, iter)
689  {
690  const label bpI = iter();
691 
692  DynList<label> neiToSend;
693  forAllRow(pointPoints, bpI, j)
694  {
695  const label bpJ = pointPoints(bpI, j);
696  if( bpAtProcs.sizeOfRow(bpJ) != 0 )
697  neiToSend.append(bpJ);
698  }
699 
700  forAllRow(bpAtProcs, bpI, procI)
701  {
702  const label neiProc = bpAtProcs(bpI, procI);
703  if( neiProc == Pstream::myProcNo() )
704  continue;
705 
706  if( exchangeData.find(neiProc) == exchangeData.end() )
707  exchangeData.insert(std::make_pair(neiProc,labelLongList()));
708 
709  if( neiToSend.size() != 0 )
710  {
711  labelLongList& dts = exchangeData[neiProc];
712  dts.append(globalPointLabel[bpI]);
713  dts.append(neiToSend.size());
714  forAll(neiToSend, i)
715  dts.append(globalPointLabel[neiToSend[i]]);
716  }
717  }
718  }
719 
720  labelLongList receivedData;
721  help::exchangeMap(exchangeData, receivedData);
722 
723  label counter(0);
724  while( counter < receivedData.size() )
725  {
726  const label bpI = globalToLocal[receivedData[counter++]];
727  const label size = receivedData[counter++];
728  for(label i=0;i<size;++i)
729  {
730  const label gpI = receivedData[counter++];
731  if( globalToLocal.found(gpI) )
732  pointPoints.appendIfNotIn(bpI, globalToLocal[gpI]);
733  }
734  }
735  }
736 }
737 
739 {
740  const VRWGraph& pFaces = pointFaces();
741  const vectorField& fNormals = faceNormals();
742 
743  pointNormalsPtr_ = new vectorField(pFaces.size());
744 
745  # ifdef USE_OMP
746  # pragma omp parallel for if( pFaces.size() > 1000 ) schedule(dynamic, 50)
747  # endif
748  forAll(pFaces, pI)
749  {
751 
752  forAllRow(pFaces, pI, pfI)
753  normal += fNormals[pFaces(pI, pfI)];
754 
755  const scalar d = mag(normal);
756  if( d > VSMALL )
757  {
758  normal /= d;
759  }
760  else
761  {
763  }
764 
765  (*pointNormalsPtr_)[pI] = normal;
766  }
767 
769 }
770 
772 {
773  const faceList::subList& bFaces = this->boundaryFaces();
774  const pointFieldPMG& points = mesh_.points();
775 
776  faceNormalsPtr_ = new vectorField(bFaces.size());
777 
778  # ifdef USE_OMP
779  # pragma omp parallel for if( bFaces.size() > 1000 )
780  # endif
781  forAll(bFaces, bfI)
782  {
783  const face& bf = bFaces[bfI];
784 
785  faceNormalsPtr_->operator[](bfI) = bf.normal(points);
786  }
787 }
788 
790 {
791  const faceList::subList& bFaces = this->boundaryFaces();
792  const pointFieldPMG& points = mesh_.points();
793 
794  faceCentresPtr_ = new vectorField(bFaces.size());
795 
796  # ifdef USE_OMP
797  # pragma omp parallel for if( bFaces.size() > 1000 )
798  # endif
799  forAll(bFaces, bfI)
800  faceCentresPtr_->operator[](bfI) = bFaces[bfI].centre(points);
801 }
802 
804 {
805  if( !Pstream::parRun() )
806  return;
807 
808  const VRWGraph& pFaces = pointFaces();
809  const vectorField& fNormals = faceNormals();
810  const labelList& globalPointLabel = this->globalBoundaryPointLabel();
811  const Map<label>& globalToLocal =
813  const VRWGraph& bpAtProcs = this->bpAtProcs();
814 
815  vectorField& pNormals = *pointNormalsPtr_;
816 
817  //- create data which will be sent to other processors
818  std::map<label, LongList<labelledPoint> > exchangeData;
819 
820  forAllConstIter(Map<label>, globalToLocal, iter)
821  {
822  const label bpI = iter();
823 
824  vector& n = pNormals[bpI];
825  n = vector::zero;
826 
827  forAllRow(pFaces, bpI, pfI)
828  n += fNormals[pFaces(bpI, pfI)];
829 
830  forAllRow(bpAtProcs, bpI, procI)
831  {
832  const label neiProc = bpAtProcs(bpI, procI);
833  if( neiProc == Pstream::myProcNo() )
834  continue;
835  if( exchangeData.find(neiProc) == exchangeData.end() )
836  {
837  exchangeData.insert
838  (
839  std::make_pair(neiProc, LongList<labelledPoint>())
840  );
841  }
842 
843  exchangeData[neiProc].append
844  (
845  labelledPoint(globalPointLabel[bpI], n)
846  );
847  }
848  }
849 
850  //- exchange data with other procs
851  LongList<labelledPoint> receivedData;
852  help::exchangeMap(exchangeData, receivedData);
853 
854  forAll(receivedData, i)
855  {
856  const label bpI = globalToLocal[receivedData[i].pointLabel()];
857  pNormals[bpI] += receivedData[i].coordinates();
858  }
859 
860  //- normalize vectors
861  # ifdef USE_OMP
862  # pragma omp parallel for if( bpAtProcs.size() > 1000 ) \
863  schedule(guided)
864  # endif
865  forAll(bpAtProcs, bpI)
866  {
867  if( bpAtProcs.sizeOfRow(bpI) == 0 )
868  continue;
869 
870  vector normal = pNormals[bpI];
871  const scalar d = mag(normal);
872  if( d > VSMALL )
873  {
874  normal /= d;
875  }
876  else
877  {
879  }
880 
881  pNormals[bpI] = normal;
882  }
883 }
884 
886 {
887  const VRWGraph& pFaces = pointFaces();
888  const faceList::subList& bFaces = boundaryFaces();
889  const labelList& bPoints = boundaryPoints();
890  const labelList& bp = this->bp();
891 
892  edgesPtr_ = new edgeList();
894 
895  bpEdgesPtr_ = new VRWGraph();
896  VRWGraph& bpEdges = *bpEdgesPtr_;
897 
898  # ifdef USE_OMP
899  label nThreads = 3 * omp_get_num_procs();
900  if( pFaces.size() < 1000 )
901  nThreads = 1;
902  # else
903  const label nThreads(1);
904  # endif
905 
906  labelList nEdgesForThread(nThreads);
907 
908  label edgeI(0);
909 
910  # ifdef USE_OMP
911  # pragma omp parallel num_threads(nThreads)
912  # endif
913  {
914  edgeLongList edgesHelper;
915 
916  # ifdef USE_OMP
917  # pragma omp for schedule(static)
918  # endif
919  forAll(pFaces, bpI)
920  {
921  std::set<std::pair<label, label> > edgesAtPoint;
922 
923  forAllRow(pFaces, bpI, pfI)
924  {
925  const label bfI = pFaces(bpI, pfI);
926  const face& bf = bFaces[bfI];
927 
928  const label pos = bf.which(bPoints[bpI]);
929 
930  if( bp[bf.nextLabel(pos)] >= bpI )
931  {
932  edgesAtPoint.insert
933  (
934  std::make_pair(bf[pos], bf.nextLabel(pos))
935  );
936  }
937  if( bp[bf.prevLabel(pos)] >= bpI )
938  {
939  edgesAtPoint.insert
940  (
941  std::make_pair(bf[pos], bf.prevLabel(pos))
942  );
943  }
944  }
945 
946  std::set<std::pair<label, label> >::const_iterator it;
947  for(it=edgesAtPoint.begin();it!=edgesAtPoint.end();++it)
948  edgesHelper.append(edge(it->first, it->second));
949  }
950 
951  //- this enables other threads to see the number of edges
952  //- generated by each thread
953  # ifdef USE_OMP
954  const label threadI = omp_get_thread_num();
955  # else
956  const label threadI(0);
957  # endif
958  nEdgesForThread[threadI] = edgesHelper.size();
959 
960  # ifdef USE_OMP
961  # pragma omp critical
962  # endif
963  edgeI += edgesHelper.size();
964 
965  # ifdef USE_OMP
966  # pragma omp barrier
967 
968  # pragma omp master
969  # endif
970  edgesPtr_->setSize(edgeI);
971 
972  # ifdef USE_OMP
973  # pragma omp barrier
974  # endif
975 
976  //- find the starting position of the edges generated by this thread
977  //- in the global list of edges
978  label localStart(0);
979  for(label i=0;i<threadI;++i)
980  localStart += nEdgesForThread[i];
981 
982  //- store edges into the global list
983  forAll(edgesHelper, i)
984  edgesPtr_->operator[](localStart+i) = edgesHelper[i];
985  }
986 
987  //- set the bpEdges
989  bpEdges.setSize(pFaces.size());
990 
991  if( !Pstream::parRun() )
992  return;
993 
994  bool addEdges;
995  do
996  {
997  addEdges = false;
998 
999  //- mark boundary edges for processors which do not contain
1000  //- boundary faces. This procedure is needed to identify boundary
1001  //- edges which are not part of any boundary face on their processor
1002  const faceListPMG& faces = mesh_.faces();
1003  const PtrList<processorBoundaryPatch>& procBoundaries =
1005 
1006  //- send boundary edges to neighbour processors
1007  forAll(procBoundaries, patchI)
1008  {
1009  const label start = procBoundaries[patchI].patchStart();
1010  const label end = start + procBoundaries[patchI].patchSize();
1011 
1012  labelLongList dts;
1013  for(label faceI=start;faceI<end;++faceI)
1014  {
1015  const face& f = faces[faceI];
1016  forAll(f, eI)
1017  {
1018  const edge e = f.faceEdge(eI);
1019  const label s = bp[e.start()];
1020  if( s < 0 )
1021  continue;
1022 
1023  forAllRow(bpEdges, s, peI)
1024  if( edges[bpEdges(s, peI)] == e )
1025  {
1026  dts.append(faceI-start);
1027  dts.append((f.size()-1-eI)%f.size());
1028  break;
1029  }
1030  }
1031  }
1032 
1033  OPstream toOtherProc
1034  (
1036  procBoundaries[patchI].neiProcNo(),
1037  dts.byteSize()
1038  );
1039  toOtherProc << dts;
1040  }
1041 
1042  //- receive data from other processors. Mark edges which are not yet
1043  //- marked as boundary edges
1044  forAll(procBoundaries, patchI)
1045  {
1046  labelList receivedEdges;
1047  IPstream fromOtherProc
1048  (
1050  procBoundaries[patchI].neiProcNo()
1051  );
1052  fromOtherProc >> receivedEdges;
1053 
1054  const label start = procBoundaries[patchI].patchStart();
1055  label nReceivedEdges(0);
1056  while( nReceivedEdges < receivedEdges.size() )
1057  {
1058  const face& f = faces[start+receivedEdges[nReceivedEdges++]];
1059  const label eI = receivedEdges[nReceivedEdges++];
1060 
1061  const edge e = f.faceEdge(eI);
1062  const label s = bp[e.start()];
1063 
1064  bool found(false);
1065  forAllRow(bpEdges, s, peI)
1066  if( edges[bpEdges(s, peI)] == e )
1067  {
1068  found = true;
1069  break;
1070  }
1071 
1072  if( !found )
1073  {
1074  //- create a new edge
1075  addEdges = true;
1076  edges.newElmt(edgeI) = e;
1077 
1078  bpEdges.append(bp[e.start()], edgeI);
1079  bpEdges.append(bp[e.end()], edgeI);
1080  ++edgeI;
1081  }
1082  }
1083  }
1084 
1085  reduce(addEdges, maxOp<bool>());
1086  } while( addEdges );
1087 
1088  edges.setSize(edgeI);
1089 }
1090 
1092 {
1093  const faceList::subList& bFaces = this->boundaryFaces();
1094  const labelList& bp = this->bp();
1095  const edgeList& edges = this->edges();
1096  const VRWGraph& bpEdges = this->boundaryPointEdges();
1097 
1098  faceEdgesPtr_ = new VRWGraph(bFaces.size());
1100 
1101  labelList nfe(bFaces.size());
1102 
1103  # ifdef USE_OMP
1104  const label nThreads = 3 * omp_get_num_procs();
1105 
1106  # pragma omp parallel num_threads(nThreads)
1107  # endif
1108  {
1109  # ifdef USE_OMP
1110  # pragma omp for schedule(static)
1111  # endif
1112  forAll(bFaces, bfI)
1113  nfe[bfI] = bFaces[bfI].size();
1114 
1115  # ifdef USE_OMP
1116  # pragma omp barrier
1117 
1118  # pragma omp master
1119  {
1120  # endif
1121 
1123 
1124  # ifdef USE_OMP
1125  }
1126 
1127  # pragma omp barrier
1128 
1129  # pragma omp for schedule(dynamic, 100)
1130  # endif
1131  forAll(faceEdges, bfI)
1132  {
1133  const face& bf = bFaces[bfI];
1134 
1135  forAll(bf, eI)
1136  {
1137  const edge e = bf.faceEdge(eI);
1138 
1139  const label bps = bp[e.start()];
1140 
1141  forAllRow(bpEdges, bps, peI)
1142  {
1143  const label beI = bpEdges(bps, peI);
1144  const edge& ee = edges[beI];
1145 
1146  if( e == ee )
1147  {
1148  faceEdges(bfI, eI) = beI;
1149  break;
1150  }
1151  }
1152  }
1153  }
1154  }
1155 }
1156 
1158 {
1159  const faceList::subList& bFaces = this->boundaryFaces();
1160  const VRWGraph& pointFaces = this->pointFaces();
1161  const edgeList& edges = this->edges();
1162  const labelList& bp = this->bp();
1163 
1164  edgeFacesPtr_ = new VRWGraph();
1166 
1167  labelList nef(edges.size());
1168 
1169  # ifdef USE_OMP
1170  const label nThreads = 3 * omp_get_num_procs();
1171 
1172  # pragma omp parallel num_threads(nThreads)
1173  # endif
1174  {
1175  # ifdef USE_OMP
1176  # pragma omp for schedule(static)
1177  # endif
1178  forAll(nef, edgeI)
1179  nef[edgeI] = 0;
1180 
1181  # ifdef USE_OMP
1182  # pragma omp for schedule(static)
1183  # endif
1184  forAll(edges, edgeI)
1185  {
1186  const edge& ee = edges[edgeI];
1187  const label bpI = bp[ee.start()];
1188 
1189  forAllRow(pointFaces, bpI, pfI)
1190  {
1191  const label bfI = pointFaces(bpI, pfI);
1192 
1193  const face& bf = bFaces[bfI];
1194 
1195  forAll(bf, eI)
1196  {
1197  if( bf.faceEdge(eI) == ee )
1198  {
1199  ++nef[edgeI];
1200  break;
1201  }
1202  }
1203  }
1204  }
1205 
1206  # ifdef USE_OMP
1207  # pragma omp barrier
1208 
1209  # pragma omp master
1210  # endif
1212 
1213  # ifdef USE_OMP
1214  # pragma omp barrier
1215 
1216  # pragma omp for schedule(static)
1217  # endif
1218  forAll(edges, edgeI)
1219  {
1220  const edge& ee = edges[edgeI];
1221  const label bpI = bp[ee.start()];
1222 
1223  //- find boundary faces attached to this edge
1224  DynList<label> eFaces;
1225  forAllRow(pointFaces, bpI, pfI)
1226  {
1227  const label bfI = pointFaces(bpI, pfI);
1228 
1229  const face& bf = bFaces[bfI];
1230 
1231  forAll(bf, eI)
1232  {
1233  if( bf.faceEdge(eI) == ee )
1234  {
1235  eFaces.append(bfI);
1236  break;
1237  }
1238  }
1239  }
1240 
1241  //- the face that owns the edge shall be the first one in the list
1242  // TODO: find out whether this will be necessary
1243  if( eFaces.size() == 2 )
1244  {
1245  const face& bf = bFaces[eFaces[1]];
1246 
1247  const label pos = bf.which(ee.start());
1248 
1249  if( bf.nextLabel(pos) == ee.end() )
1250  {
1251  //- this face shall be the first one in the list
1252  const label helper = eFaces[0];
1253  eFaces[0] = eFaces[1];
1254  eFaces[1] = helper;
1255  }
1256  }
1257 
1258  edgeFaces.setRow(edgeI, eFaces);
1259  }
1260  }
1261 }
1262 
1264 {
1265  edgePatchesPtr_ = new VRWGraph();
1267 
1268  const VRWGraph& edgeFaces = this->edgeFaces();
1269  const labelList& facePatch = this->boundaryFacePatches();
1270 
1271  edgePatches.setSize(edgeFaces.size());
1272 
1273  forAll(edgeFaces, eI)
1274  {
1275  DynList<label> ePatches;
1276 
1277  forAllRow(edgeFaces, eI, i)
1278  {
1279  const label patchI = facePatch[edgeFaces(eI, i)];
1280 
1281  ePatches.appendIfNotIn(patchI);
1282  }
1283 
1284  edgePatches.setRow(eI, ePatches);
1285  }
1286 
1287  if( Pstream::parRun() )
1288  {
1289  const Map<label>& globalToLocal = globalToLocalBndEdgeAddressing();
1290  const Map<label>& otherPatch = this->otherEdgeFacePatch();
1291 
1292  forAllConstIter(Map<label>, globalToLocal, it)
1293  {
1294  const label beI = it();
1295 
1296  edgePatches.appendIfNotIn(beI, otherPatch[beI]);
1297  }
1298  }
1299 }
1300 
1302 {
1303  const VRWGraph& edgeFaces = this->edgeFaces();
1304 
1305  const faceList::subList& bFaces = boundaryFaces();
1306  faceFacesPtr_ = new VRWGraph(bFaces.size());
1308 
1309  forAll(bFaces, bfI)
1310  faceFaces.setRowSize(bfI, bFaces[bfI].size());
1311 
1312  labelList nAppearances(bFaces.size(), 0);
1313 
1314  forAll(edgeFaces, efI)
1315  {
1316  if( edgeFaces.sizeOfRow(efI) == 2 )
1317  {
1318  const label f0 = edgeFaces(efI, 0);
1319  const label f1 = edgeFaces(efI, 1);
1320 
1321  faceFaces(f0, nAppearances[f0]++) = f1;
1322  faceFaces(f1, nAppearances[f1]++) = f0;
1323  }
1324  else if( Pstream::parRun() && (edgeFaces.sizeOfRow(efI) == 1) )
1325  {
1326  const label f0 = edgeFaces(efI, 0);
1327  faceFaces(f0, nAppearances[f0]++) = -1;
1328  }
1329  else if( Pstream::parRun() && (edgeFaces.sizeOfRow(efI) != 0 ) )
1330  {
1331  FatalErrorIn
1332  (
1333  "void meshSurfaceEngine::calculateFaceFacesAddressing() const"
1334  ) << "The surface of the mesh is invalid!"
1335  << " The number of faces containing edge " << efI
1336  << " is " << edgeFaces.sizeOfRow(efI)
1337  << " Cannot continue" << exit(FatalError);
1338  }
1339  }
1340 }
1341 
1342 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1343 
1344 } // End namespace Foam
1345 
1346 // ************************************************************************* //
Foam::meshSurfaceEngine::boundaryPointsPtr_
labelList * boundaryPointsPtr_
boundary points
Definition: meshSurfaceEngine.H:64
Foam::meshSurfaceEngine::boundaryPointEdges
const VRWGraph & boundaryPointEdges() const
Definition: meshSurfaceEngineI.H:315
Foam::meshSurfaceEngine::pointFacesPtr_
VRWGraph * pointFacesPtr_
point faces addressing
Definition: meshSurfaceEngine.H:76
Foam::meshSurfaceEngine::bpAtProcs
const VRWGraph & bpAtProcs() const
processors which contain the vertex
Definition: meshSurfaceEngineI.H:451
Foam::face::normal
vector normal(const pointField &) const
Vector normal; magnitude is equal to area of face.
Definition: face.C:552
Foam::polyMeshGenFaces::owner
const labelList & owner() const
owner and neighbour cells for faces
Definition: polyMeshGenFacesI.H:67
Foam::maxOp
Definition: ops.H:172
Foam::meshSurfaceEngine::bp
const labelList & bp() const
Definition: meshSurfaceEngineI.H:64
Foam::LongList::append
void append(const T &e)
Append an element at the end of the list.
Definition: LongListI.H:265
Foam::meshSurfaceEngine::updatePointNormalsAtProcBoundaries
void updatePointNormalsAtProcBoundaries() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:803
Foam::Vector< scalar >::zero
static const Vector zero
Definition: Vector.H:80
boolList.H
Foam::edgeList
List< edge > edgeList
Definition: edgeList.H:38
Foam::meshSurfaceEngine::faceEdgesPtr_
VRWGraph * faceEdgesPtr_
face edges addressing
Definition: meshSurfaceEngine.H:98
Foam::meshSurfaceEngine::activePatch_
const label activePatch_
number of active patch
Definition: meshSurfaceEngine.H:61
Foam::meshSurfaceEngine::faceCentresPtr_
vectorField * faceCentresPtr_
face centres
Definition: meshSurfaceEngine.H:113
Foam::meshSurfaceEngine::faceNormalsPtr_
vectorField * faceNormalsPtr_
face normals
Definition: meshSurfaceEngine.H:110
Foam::labelList
List< label > labelList
A List of labels.
Definition: labelList.H:56
Foam::meshSurfaceEngine::globalToLocalBndEdgeAddressing
const Map< label > & globalToLocalBndEdgeAddressing() const
global boundary edge label to local label. Only for processor edges
Definition: meshSurfaceEngineI.H:510
Foam::meshSurfaceEngine::calculateEdgePatchesAddressing
void calculateEdgePatchesAddressing() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:1263
nPatches
label nPatches
Definition: readKivaGrid.H:402
Foam::VRWGraph::setRow
void setRow(const label rowI, const ListType &l)
Set row with the list.
Definition: VRWGraphI.H:354
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::meshSurfaceEngine::globalBoundaryPointLabel
const labelList & globalBoundaryPointLabel() const
global boundary point label
Definition: meshSurfaceEngineI.H:410
Foam::OPstream
Output inter-processor communications stream.
Definition: OPstream.H:50
Foam::meshSurfaceEngine::calculateFaceCentres
void calculateFaceCentres() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:789
Foam::meshSurfaceEngine::calculatePointPatches
void calculatePointPatches() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:484
Foam::meshSurfaceEngine::calculateFaceFacesAddressing
void calculateFaceFacesAddressing() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:1301
Foam::localMin
LocalMin-mean differencing scheme class.
Definition: localMin.H:54
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
Foam::meshSurfaceEngine::boundaryFacesPtr_
faceList::subList * boundaryFacesPtr_
boundary faces
Definition: meshSurfaceEngine.H:67
Foam::SubList
A List obtained as a section of another List.
Definition: SubList.H:53
Foam::face::faceEdge
edge faceEdge(const label n) const
Return n-th face edge.
Definition: faceI.H:110
Foam::Field::operator
friend Ostream & operator(Ostream &, const Field< Type > &)
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
Foam::List::newElmt
T & newElmt(const label)
Return subscript-checked element of UList.
Definition: ListI.H:64
Foam::meshSurfaceEngine::pointFaces
const VRWGraph & pointFaces() const
Definition: meshSurfaceEngineI.H:162
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::dot
void dot(FieldField< Field1, typename innerProduct< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
Definition: FieldFieldFunctions.C:875
Foam::meshSurfaceEngine::boundaryFacePatches
const labelList & boundaryFacePatches() const
patch label for each boundary face
Definition: meshSurfaceEngineI.H:123
Foam::meshSurfaceEngine::faceEdges
const VRWGraph & faceEdges() const
Definition: meshSurfaceEngineI.H:353
Foam::Map< label >
Foam::meshSurfaceEngine::pointPointsPtr_
VRWGraph * pointPointsPtr_
point points addressing
Definition: meshSurfaceEngine.H:86
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::LongList::size
label size() const
Size of the active part of the list.
Definition: LongListI.H:203
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::HashSet< label, Hash< label > >
Foam::VRWGraph::appendIfNotIn
void appendIfNotIn(const label rowI, const label)
Append an element to the given row if it does not exist there.
Definition: VRWGraphI.H:346
Foam::meshSurfaceEngine::faceFaces
const VRWGraph & faceFaces() const
Definition: meshSurfaceEngineI.H:391
Foam::polyMeshGenFaces::faces
const faceListPMG & faces() const
access to faces
Definition: polyMeshGenFacesI.H:43
Foam::face::which
label which(const label globalIndex) const
Navigation through face vertices.
Definition: face.C:630
forAllConstIter
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
Foam::vectorField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Definition: primitiveFieldsFwd.H:49
Foam::LongList::setSize
void setSize(const label)
Reset size of List.
Definition: LongListI.H:223
Foam::meshSurfaceEngine::calculateBoundaryOwners
void calculateBoundaryOwners() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:106
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::LongList< label >
Foam::meshSurfaceEngine::edgePatches
const VRWGraph & edgePatches() const
Definition: meshSurfaceEngineI.H:372
Foam::UPstream::blocking
@ blocking
Definition: UPstream.H:66
n
label n
Definition: TABSMDCalcMethod2.H:31
VRWGraphSMPModifier.H
Foam::meshSurfaceEngine::edgesPtr_
edgeList * edgesPtr_
edges
Definition: meshSurfaceEngine.H:89
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:43
Foam::meshSurfaceEngine::boundaryFaces
const faceList::subList & boundaryFaces() const
Definition: meshSurfaceEngineI.H:103
Foam::localMax
LocalMax-mean differencing scheme class.
Definition: localMax.H:54
Foam::meshSurfaceEngine::calculatePointPoints
void calculatePointPoints() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:598
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::meshSurfaceEngine::boundaryFacePatchPtr_
labelList * boundaryFacePatchPtr_
patches boundary faces are in
Definition: meshSurfaceEngine.H:70
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::meshSurfaceEngine::bpEdgesPtr_
VRWGraph * bpEdgesPtr_
boundary point-edges addressing
Definition: meshSurfaceEngine.H:92
Foam::meshSurfaceEngine::boundaryFaceOwnersPtr_
labelList * boundaryFaceOwnersPtr_
face owners
Definition: meshSurfaceEngine.H:73
Foam::Info
messageStream Info
Foam::meshSurfaceEngine::calculateFaceEdgesAddressing
void calculateFaceEdgesAddressing() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:1091
Foam::VRWGraph::size
label size() const
Returns the number of rows.
Definition: VRWGraphI.H:122
Foam::DynList::appendIfNotIn
void appendIfNotIn(const T &e)
Definition: DynListI.H:324
f1
scalar f1
Definition: createFields.H:28
Foam::VRWGraph::setSize
void setSize(const label)
Reset the number of rows.
Definition: VRWGraphI.H:132
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
forAllRow
#define forAllRow(graph, rowI, index)
Definition: VRWGraph.H:277
Foam::meshSurfaceEngine::points
const pointFieldPMG & points() const
Definition: meshSurfaceEngineI.H:49
Foam::meshSurfaceEngine::calculatePointFaces
void calculatePointFaces() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:269
Foam::pointFieldPMG::size
label size() const
return the number of used elements
Definition: pointFieldPMGI.H:71
HashSet.H
Foam::VRWGraph::sizeOfRow
label sizeOfRow(const label rowI) const
Returns the number of elements in the given row.
Definition: VRWGraphI.H:127
Foam::List::subList
SubList< T > subList
Declare type of subList.
Definition: List.H:153
Foam::FatalError
error FatalError
labelledPoint.H
Foam::meshSurfaceEngine::pointPoints
const VRWGraph & pointPoints() const
Definition: meshSurfaceEngineI.H:220
Foam::HashTable::found
bool found(const Key &) const
Return true if hashedEntry is found in table.
Definition: HashTable.C:109
Foam::meshSurfaceEngine::edgeFaces
const VRWGraph & edgeFaces() const
Definition: meshSurfaceEngineI.H:334
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
meshSurfaceEngine.H
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::DynList< label >
Foam::meshSurfaceEngine::edges
const edgeList & edges() const
Definition: meshSurfaceEngineI.H:296
Foam::meshSurfaceEngine::calculatePointNormals
void calculatePointNormals() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:738
Foam::meshSurfaceEngine::calculateFaceNormals
void calculateFaceNormals() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:771
Foam::VRWGraphSMPModifier::reverseAddressing
void reverseAddressing(const GraphType &origGraph)
Definition: VRWGraphSMPModifierTemplates.C:111
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:405
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
found
bool found
Definition: TABSMDCalcMethod2.H:32
Foam::List::setSize
void setSize(const label)
Reset size of List.
Foam::face::prevLabel
label prevLabel(const label i) const
Previous vertex on face.
Definition: faceI.H:124
Foam::face::nextLabel
label nextLabel(const label i) const
Next vertex on face.
Definition: faceI.H:117
Foam::edge::start
label start() const
Return start vertex label.
Definition: edgeI.H:81
range
scalar range
Definition: LISASMDCalcMethod1.H:12
Foam::sumOp
Definition: ops.H:162
Foam::LongList::byteSize
label byteSize() const
Return the binary size in number of characters of the UList.
Definition: LongListI.H:209
helperFunctions.H
Foam::meshSurfaceEngine::bppPtr_
labelList * bppPtr_
pointBoundaryPoint addressing
Definition: meshSurfaceEngine.H:83
Foam::labelledPoint
Definition: labelledPoint.H:50
f
labelList f(nPoints)
Foam::meshSurfaceEngine::mesh_
polyMeshGen & mesh_
reference to the mesh
Definition: meshSurfaceEngine.H:58
Foam::meshSurfaceEngine::pointPatchesPtr_
VRWGraph * pointPatchesPtr_
point-patches addressing
Definition: meshSurfaceEngine.H:80
Foam::Vector< scalar >
Foam::meshSurfaceEngine::calculateEdgesAndAddressing
void calculateEdgesAndAddressing() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:885
Foam::polyMeshGenFaces::boundaries
const PtrList< boundaryPatch > & boundaries() const
ordinary boundaries
Definition: polyMeshGenFacesI.H:111
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::meshSurfaceEngine::calculateBoundaryFaces
void calculateBoundaryFaces() const
calculate boundary nodes, faces and addressing
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:50
Foam::meshSurfaceEngine::calculateBoundaryFacePatches
void calculateBoundaryFacePatches() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:250
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::help::exchangeMap
void exchangeMap(const std::map< label, ListType > &m, LongList< T > &data, const Pstream::commsTypes commsType)
Definition: helperFunctionsPar.C:129
Foam::meshSurfaceEngine::pointNormalsPtr_
vectorField * pointNormalsPtr_
point normals
Definition: meshSurfaceEngine.H:107
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:116
Foam::meshSurfaceEngine::calculateEdgeFacesAddressing
void calculateEdgeFacesAddressing() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:1157
Foam::VRWGraph::append
void append(const label rowI, const label)
Append an element to the given row.
Definition: VRWGraphI.H:303
Foam::polyMeshGenFaces::procBoundaries
const PtrList< processorBoundaryPatch > & procBoundaries() const
inter-processor boundaries
Definition: polyMeshGenFacesI.H:106
Foam::meshSurfaceEngine::boundaryPoints
const labelList & boundaryPoints() const
Definition: meshSurfaceEngineI.H:84
Foam::IPstream
Input inter-processor communications stream.
Definition: IPstream.H:50
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
Foam::DynList::size
label size() const
Definition: DynListI.H:235
Foam::meshSurfaceEngine::globalToLocalBndPointAddressing
const Map< label > & globalToLocalBndPointAddressing() const
global point label to local label. Only for processors points
Definition: meshSurfaceEngineI.H:431
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::UList::size
label size() const
Return the number of elements in the UList.
Definition: UListI.H:299
Foam::VRWGraphSMPModifier
Definition: VRWGraphSMPModifier.H:50
Foam::meshSurfaceEngine::otherEdgeFacePatch
const Map< label > & otherEdgeFacePatch() const
Definition: meshSurfaceEngineI.H:588
Foam::faceListPMG
Definition: faceListPMG.H:50
Foam::pointFieldPMG
Definition: pointFieldPMG.H:50
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::meshSurfaceEngine::edgeFacesPtr_
VRWGraph * edgeFacesPtr_
edge faces addressing
Definition: meshSurfaceEngine.H:95
Foam::labelLongList
LongList< label > labelLongList
Definition: labelLongList.H:46
Foam::meshSurfaceEngine::faceNormals
const vectorField & faceNormals() const
Definition: meshSurfaceEngineI.H:258
Foam::min
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::VRWGraph::setRowSize
void setRowSize(const label rowI, const label newSize)
Reset the size of the given row.
Definition: VRWGraphI.H:204
Foam::labelPair
Pair< label > labelPair
Label pair.
Definition: labelPair.H:48
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Foam::meshSurfaceEngine::pointInFacePtr_
VRWGraph * pointInFacePtr_
Definition: meshSurfaceEngine.H:77
Foam::meshSurfaceEngine::calculateBoundaryNodes
void calculateBoundaryNodes() const
Definition: meshSurfaceEngineCalculateBoundaryNodesAndFaces.C:126
normal
A normal distribution model.
Foam::meshSurfaceEngine::edgePatchesPtr_
VRWGraph * edgePatchesPtr_
edge-patches addressing
Definition: meshSurfaceEngine.H:101
Foam::meshSurfaceEngine::faceFacesPtr_
VRWGraph * faceFacesPtr_
face-faces addressing
Definition: meshSurfaceEngine.H:104
Foam::DynList::append
void append(const T &e)
Append an element at the end of the list.
Definition: DynListI.H:304
Foam::VRWGraphSMPModifier::setSizeAndRowSize
void setSizeAndRowSize(const ListType &)
set the size and row sizes
Definition: VRWGraphSMPModifierTemplates.C:41
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:190
Foam::meshSurfaceEngine::faces
const faceListPMG & faces() const
Definition: meshSurfaceEngineI.H:54