extrudeMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
7  -------------------------------------------------------------------------------
8  License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24  Application
25  extrudeMesh
26 
27  Description
28  Extrude mesh from existing patch (by default outwards facing normals;
29  optional flips faces) or from patch read from file.
30 
31 Note: Merges close points so be careful.
32 
33 Type of extrusion prescribed by run-time selectable model.
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #include "argList.H"
38 #include "Time.H"
39 #include "polyTopoChange.H"
40 #include "polyTopoChanger.H"
41 #include "edgeCollapser.H"
42 #include "perfectInterface.H"
43 #include "addPatchCellLayer.H"
44 #include "fvMesh.H"
45 #include "MeshedSurfaces.H"
46 #include "globalIndex.H"
47 #include "cellSet.H"
48 #include "extrudedMesh.H"
49 #include "extrudeModel.H"
50 #include "doubleScalar.H"
51 #include "wedge.H"
52 #include "wedgePolyPatch.H"
53 #include "planeExtrusion.H"
54 #include "emptyPolyPatch.H"
55 #include "VectorSpace.H"
56 #include "IOstreams.H"
57 #include <sstream>
58 #include <vector>
59 using namespace Foam;
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
63 {
67 };
68 
69 namespace Foam
70 {
71  template<>
73  {
74  "mesh",
75  "patch",
76  "surface"
77  };
78 }
79 
81 
82 
84 {
85  // Create dummy system/fv*
86  {
87  IOobject io
88  (
89  "fvSchemes",
90  mesh.time().system(),
91  regionName,
92  mesh,
95  false
96  );
97 
98  Info<< "Testing:" << io.objectPath() << endl;
99 
100  if (!io.headerOk())
101  {
102  Info<< "Writing dummy " << regionName/io.name() << endl;
103  dictionary dummyDict;
104  dictionary divDict;
105  dummyDict.add("divSchemes", divDict);
106  dictionary gradDict;
107  dummyDict.add("gradSchemes", gradDict);
108  dictionary laplDict;
109  dummyDict.add("laplacianSchemes", laplDict);
110 
111  IOdictionary(io, dummyDict).regIOobject::write();
112  }
113  }
114  {
115  IOobject io
116  (
117  "fvSolution",
118  mesh.time().system(),
119  regionName,
120  mesh,
123  false
124  );
125 
126  if (!io.headerOk())
127  {
128  Info<< "Writing dummy " << regionName/io.name() << endl;
129  dictionary dummyDict;
130  IOdictionary(io, dummyDict).regIOobject::write();
131  }
132  }
133 }
134 
135 
137 {
138  const label patchID = patches.findPatchID(name);
139 
140  if (patchID == -1)
141  {
143  << "Cannot find patch " << name
144  << " in the source mesh.\n"
145  << "Valid patch names are " << patches.names()
146  << exit(FatalError);
147  }
148  return patchID;
149 }
150 
151 
153 {
154  label n = 0;
155 
156  forAll(names, i)
157  {
158  const polyPatch& pp = patches[findPatchID(patches, names[i])];
159 
160  n += pp.size();
161  }
162  labelList faceLabels(n);
163  n = 0;
164  forAll(names, i)
165  {
166  const polyPatch& pp = patches[findPatchID(patches, names[i])];
167 
168  forAll(pp, j)
169  {
170  faceLabels[n++] = pp.start()+j;
171  }
172  }
173 
174  return faceLabels;
175 }
176 
177 
178 void updateFaceLabels(const mapPolyMesh& map, labelList& faceLabels)
179 {
180  const labelList& reverseMap = map.reverseFaceMap();
181 
182  labelList newFaceLabels(faceLabels.size());
183  label newI = 0;
184 
185  forAll(faceLabels, i)
186  {
187  label oldFaceI = faceLabels[i];
188 
189  if (reverseMap[oldFaceI] >= 0)
190  {
191  newFaceLabels[newI++] = reverseMap[oldFaceI];
192  }
193  }
194  newFaceLabels.setSize(newI);
195  faceLabels.transfer(newFaceLabels);
196 }
197 
198 
199 void updateCellSet(const mapPolyMesh& map, labelHashSet& cellLabels)
200 {
201  const labelList& reverseMap = map.reverseCellMap();
202 
203  labelHashSet newCellLabels(2*cellLabels.size());
204 
205  forAll(cellLabels, i)
206  {
207  label oldCellI = cellLabels[i];
208 
209  if (reverseMap[oldCellI] >= 0)
210  {
211  newCellLabels.insert(reverseMap[oldCellI]);
212  }
213  }
214  cellLabels.transfer(newCellLabels);
215 }
216 
217 
218 template<class PatchType>
220 (
221  polyMesh& mesh,
222  const word& frontPatchName,
223  const word& backPatchName
224  )
225 {
227 
228  label frontPatchI = findPatchID(patches, frontPatchName);
229  label backPatchI = findPatchID(patches, backPatchName);
230 
231  DynamicList<polyPatch*> newPatches(patches.size());
232 
233  forAll(patches, patchI)
234  {
235  const polyPatch& pp(patches[patchI]);
236 
237  if (patchI == frontPatchI || patchI == backPatchI)
238  {
239  newPatches.append
240  (
241  new PatchType
242  (
243  pp.name(),
244  pp.size(),
245  pp.start(),
246  pp.index(),
247  mesh.boundaryMesh(),
248  PatchType::typeName
249  )
250  );
251  }
252  else
253  {
254  newPatches.append(pp.clone(mesh.boundaryMesh()).ptr());
255  }
256  }
257 
258  // Edit patches
260  mesh.addPatches(newPatches, true);
261 }
262 
263 
265 (
266  const dictionary& dict
267  )
268 {
269  const word modelType("linearDirection");
270 
271  Info<< "Selecting extrudeModel " << modelType << endl;
272 
273  dictionaryConstructorTable::iterator cstrIter =
274  dictionaryConstructorTablePtr_->find(modelType);
275 
276  if (cstrIter == dictionaryConstructorTablePtr_->end())
277  {
279  << "Unknown extrudeModel type "
280  << modelType << nl << nl
281  << "Valid extrudeModel types are :" << nl
282  << dictionaryConstructorTablePtr_->sortedToc() << nl
283  << exit(FatalError);
284  }
285 
286  return autoPtr<extrudeModel>(cstrIter()(dict));
287 }
288 
289 std::string replaceChar(std::string & SourceString, const std::string & strsrc, const std::string & strdst)
290 {
291 
293  std::string::size_type srclen = strsrc.size();
294  std::string::size_type dstlen = strdst.size();
295  std::string stringsource_new = SourceString;
296 
297  while ((pos = stringsource_new.find(strsrc, pos)) != std::string::npos)
298  {
299  stringsource_new.replace(pos, srclen, strdst);
300  pos += dstlen;
301  }
302  return stringsource_new;
303 }
304 
305 
306 
307 
308 std::string trim(std::string s)
309 {
310 
311 
312  if (s.empty())
313  {
314  return s;
315  }
316  s.erase(0, s.find_first_not_of(" "));
317  s.erase(s.find_last_not_of(" ") + 1);
318  s.erase(0, s.find_first_not_of("\t"));
319  s.erase(s.find_last_not_of("\t") + 1);
320  return s;
321 
322 }
323 std::vector<std::string> splitstring (std::string SourceString, std::string strSplit = " ", int nSkip = 0 )
324 {
325  std::vector<std::string> vecStr;
327 
328  char aa = '(';
329  char bb = ')';
330  char cc = '"';
331  char dd = '\'';
332  std::string stringsource_new;
333  for (int i = 0; i < (int)SourceString.length(); i++)
334  {
335  if (SourceString[i] == aa || SourceString[i] == bb || SourceString[i] == cc || SourceString[i] == dd)// || SourceString[i] == ee || SourceString[i] == ff)
336  {
337  }//std::cout << "add nothing" << std::endl;
338  else
339  stringsource_new.push_back(SourceString[i]);
340  }
341 
342  std::vector<std::string>::size_type ePos = stringsource_new.find(strSplit, sPos);
343 
344  while (ePos != std::string::npos)
345  {
346  if (sPos != ePos) vecStr.push_back(stringsource_new.substr(sPos, ePos - sPos).c_str());
347  sPos = ePos + strSplit.size();
348  ePos = stringsource_new.find(strSplit, sPos);
349  }
350  if (sPos < stringsource_new.size()) vecStr.push_back(trim(stringsource_new.substr(sPos, stringsource_new.size() - sPos)).c_str());
351 
352  return vecStr;
353 }
354 
355 
356 
357 
358 
359 
360 
361 int main(int argc, char *argv[])
362 {
363 #include "addRegionOption.H"
364 #include "addDictOption.H"
365 #include "setRootCase.H"
366 #include "createTimeExtruded.H"
367 #include "createTime.H"
368  // Get optional regionName
370  word regionDir;
371  if (args.optionReadIfPresent("region", regionName))
372  {
373  regionDir = regionName;
374  Info<< "Create mesh " << regionName << " for time = "
375  << runTimeExtruded.timeName() << nl << endl;
376  }
377  else
378  {
380  Info<< "Create mesh for time = "
381  << runTimeExtruded.timeName() << nl << endl;
382  }
383 
384 
385  const word dictName("extrudeMeshDict");
386  // #include "setSystemMeshDictionaryIO.H"
387 
388  fileName dictPath = "";
389  std::string dictPara = "";
390  dictionary dict,subDict,subsubDict;
391  if (args.optionFound("dict"))
392  {
393  dictPara = args["dict"];
394  std::vector<std::string> paraList = splitstring(dictPara," ");
395  if (paraList[0]=="pkpmchenjia1008")
396  {
397 
398  // constructFrom mesh;
399  // sourceCase "D:/Projects/OFTest/tmp"; // para 1
400  // sourcePatches ( ground green_grass parking road water ); //para2
401  // flipNormals false;
402  // extrudeModel linearDirection;
403  // nLayers 6;
404  // expansionRatio 0.831398;
405  // linearDirectionCoeffs
406  // {
407  // axisPt ( 0 0 0 );
408  // direction ( 0 0 -1 );
409  // thickness 2;
410  // }
411  // mergeFaces false;
412  // mergeTol 0;
413  dict.add("constructFrom", (word)"mesh");
414  dict.add("sourceCase", replaceChar(paraList[1],"\\","/"));
415  std::vector<std::string> nameList = splitstring(paraList[2]," ");
416  List<std::string> patchestmp;
417  for (int i=0;i<nameList.size();i++)
418  {
419  patchestmp.append(nameList[i]);
420  }
421  dict.add("sourcePatches", patchestmp);
422  dict.add("flipNormals", (word)"false");
423  dict.add("extrudeModel", (word)"linearDirection");
424  dict.add("nLayers", std::atoi(paraList[3].c_str()));
425  dict.add("expansionRatio", std::atof(paraList[4].c_str()));
426  //doubleScalar a1=0,a2=0,a3=0;
427  // vector axisPt(0,0,0);
428  Vector<doubleScalar> axisPt(0,0,0);
429  //VectorSpace<Vector<scalar>,scalar,1> aadd;
430  subDict.add("axisPt",axisPt);
431  float v1,v2,v3;
432  std::vector<std::string> vectorlist = splitstring(paraList[5]," ");
433  v1=std::atof(vectorlist[0].c_str());
434  v2=std::atof(vectorlist[1].c_str());
435  v3=std::atof(vectorlist[2].c_str());
436  Vector<doubleScalar> directionCom(v1,v2,v3);
437  subDict.add("direction",directionCom);
438  subDict.add("thickness",std::atoi(paraList[6].c_str()));
439  dict.add("linearDirectionCoeffs",subDict);
440  dict.add("mergeFaces",(word) "false");
441  doubleScalar tol=0.0;
442  dict.add("mergeTol", tol);
443  //Info << "my dict is == "<< dict << endl;
444  }
445  else
446  {
447  return 0;
448  }
449 
450  }
451 
452 
453 
454 
455 
456 
457 
458 
459 
460 
461 
462 
463  // Point generator
465  //Info << "dict=== " << dict << endl;
466  // Whether to flip normals
467  const Switch flipNormals(dict.lookup("flipNormals"));
468 
469  // What to extrude
470  const ExtrudeMode mode = ExtrudeModeNames.read
471  (
472  dict.lookup("constructFrom")
473  );
474 
475  // Any merging of small edges
476  const scalar mergeTol(dict.lookupOrDefault<scalar>("mergeTol", 1e-4));
477 
478  // Info<< "Extruding from " << ExtrudeModeNames[mode]
479  // << " using model " << model().type() << endl;
480  if (flipNormals)
481  {
482  Info<< "Flipping normals before extruding" << endl;
483  }
484  if (mergeTol > 0)
485  {
486  Info<< "Collapsing edges < " << mergeTol << " of bounding box" << endl;
487  }
488  else
489  {
490  Info<< "Not collapsing any edges after extrusion" << endl;
491  }
492  Info<< endl;
493 
494 
495  // Generated mesh (one of either)
496  autoPtr<fvMesh> meshFromMesh;
497  autoPtr<polyMesh> meshFromSurface;
498 
499  // Faces on front and back for stitching (in case of mergeFaces)
500  word frontPatchName;
501  labelList frontPatchFaces;
502  word backPatchName;
503  labelList backPatchFaces;
504 
505  // Optional added cells (get written to cellSet)
506  labelHashSet addedCellsSet;
507 
508  if (mode == PATCH || mode == MESH)
509  {
510  if (flipNormals && mode == MESH)
511  {
513  << "Flipping normals not supported for extrusions from mesh."
514  << exit(FatalError);
515  }
516 
517  fileName sourceCasePath(dict.lookup("sourceCase"));
518  sourceCasePath.expand();
519  fileName sourceRootDir = sourceCasePath.path();
520  // Info << sourceRootDir<< endl;
521 
522  fileName sourceCaseDir = sourceCasePath.name();
523  // Info << sourceCaseDir << endl;
524  if (Pstream::parRun())
525  {
526  sourceCaseDir =
527  sourceCaseDir
528  /"processor" + Foam::name(Pstream::myProcNo());
529 
530  }
531  wordList sourcePatches;
532  dict.lookup("sourcePatches") >> sourcePatches;
533 
534  if (sourcePatches.size() == 1)
535  {
536  frontPatchName = sourcePatches[0];
537  }
538 
539  // Info<< "Extruding patches " << sourcePatches
540  // << " on mesh " << sourceCasePath << nl
541  // << endl;
542 
543  Time runTime
544  (
546  sourceRootDir,
547  sourceCaseDir
548  );
549 
550 #include "createMesh.H"
551 
553 
554 
555  // Extrusion engine. Either adding to existing mesh or
556  // creating separate mesh.
557  addPatchCellLayer layerExtrude(mesh, (mode == MESH));
558 
559  const labelList meshFaces(patchFaces(patches, sourcePatches));
560 
561  if (mode == PATCH && flipNormals)
562  {
563  // Cheat. Flip patch faces in mesh. This invalidates the
564  // mesh (open cells) but does produce the correct extrusion.
565  polyTopoChange meshMod(mesh);
566  forAll(meshFaces, i)
567  {
568  label meshFaceI = meshFaces[i];
569 
570  label patchI = patches.whichPatch(meshFaceI);
571  label own = mesh.faceOwner()[meshFaceI];
572  label nei = -1;
573  if (patchI == -1)
574  {
575  nei = mesh.faceNeighbour()[meshFaceI];
576  }
577 
578  label zoneI = mesh.faceZones().whichZone(meshFaceI);
579  bool zoneFlip = false;
580  if (zoneI != -1)
581  {
582  label index = mesh.faceZones()[zoneI].whichFace(meshFaceI);
583  zoneFlip = mesh.faceZones()[zoneI].flipMap()[index];
584  }
585 
586  meshMod.modifyFace
587  (
588  mesh.faces()[meshFaceI].reverseFace(), // modified face
589  meshFaceI, // label of face
590  own, // owner
591  nei, // neighbour
592  true, // face flip
593  patchI, // patch for face
594  zoneI, // zone for face
595  zoneFlip // face flip in zone
596  );
597  }
598 
599  // Change the mesh. No inflation.
600  autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
601 
602  // Update fields
603  mesh.updateMesh(map);
604 
605  // Move mesh (since morphing does not do this)
606  if (map().hasMotionPoints())
607  {
608  mesh.movePoints(map().preMotionPoints());
609  }
610  }
611 
612 
613 
614  indirectPrimitivePatch extrudePatch
615  (
617  (
618  mesh.faces(),
619  meshFaces
620  ),
621  mesh.points()
622  );
623 
624  // Determine extrudePatch normal
625  pointField extrudePatchPointNormals
626  (
627  PatchTools::pointNormals(mesh, extrudePatch)
628  );
629 
630 
631  // Precalculate mesh edges for pp.edges.
632  const labelList meshEdges
633  (
634  extrudePatch.meshEdges
635  (
636  mesh.edges(),
637  mesh.pointEdges()
638  )
639  );
640 
641  // Global face indices engine
642  const globalIndex globalFaces(mesh.nFaces());
643 
644  // Determine extrudePatch.edgeFaces in global numbering (so across
645  // coupled patches)
646  labelListList edgeGlobalFaces
647  (
649  (
650  mesh,
651  globalFaces,
652  extrudePatch
653  )
654  );
655 
656 
657  // Determine what patches boundary edges need to get extruded into.
658  // This might actually cause edge-connected processors to become
659  // face-connected so might need to introduce new processor boundaries.
660  // Calculates:
661  // - per pp.edge the patch to extrude into
662  // - any additional processor boundaries (patchToNbrProc = map from
663  // new patchID to neighbour processor)
664  // - number of new patches (nPatches)
665 
666  labelList edgePatchID;
667  labelList edgeZoneID;
668  boolList edgeFlip;
669  labelList inflateFaceID;
670  label nPatches;
671  Map<label> nbrProcToPatch;
672  Map<label> patchToNbrProc;
674  (
675  true, // for internal edges get zone info from any face
676 
677  mesh,
678  globalFaces,
679  edgeGlobalFaces,
680  extrudePatch,
681 
682  edgePatchID,
683  nPatches,
684  nbrProcToPatch,
685  patchToNbrProc,
686 
687  edgeZoneID,
688  edgeFlip,
689  inflateFaceID
690  );
691 
692 
693  // Add any patches.
694 
695  label nAdded = nPatches - mesh.boundaryMesh().size();
696  reduce(nAdded, sumOp<label>());
697 
698  Info<< "Adding overall " << nAdded << " processor patches." << endl;
699 
700  if (nAdded > 0)
701  {
702  DynamicList<polyPatch*> newPatches(nPatches);
703  forAll(mesh.boundaryMesh(), patchI)
704  {
705  newPatches.append
706  (
707  mesh.boundaryMesh()[patchI].clone
708  (
710  ).ptr()
711  );
712  }
713  for
714  (
715  label patchI = mesh.boundaryMesh().size();
716  patchI < nPatches;
717  patchI++
718  )
719  {
720  label nbrProcI = patchToNbrProc[patchI];
721 
722  word name =
723  "procBoundary"
725  + "to"
726  + Foam::name(nbrProcI);
727 
728  Pout<< "Adding patch " << patchI
729  << " name:" << name
730  << " between " << Pstream::myProcNo()
731  << " and " << nbrProcI
732  << endl;
733 
734 
735  newPatches.append
736  (
738  (
739  name,
740  0, // size
741  mesh.nFaces(), // start
742  patchI, // index
743  mesh.boundaryMesh(),// polyBoundaryMesh
744  Pstream::myProcNo(),// myProcNo
745  nbrProcI // neighbProcNo
746  )
747  );
748  }
749 
750  // Add patches. Do no parallel updates.
752  mesh.addFvPatches(newPatches, true);
753  }
754 
755 
756 
757  // Only used for addPatchCellLayer into new mesh
758  labelList exposedPatchID;
759  if (mode == PATCH)
760  {
761  dict.lookup("exposedPatchName") >> backPatchName;
762  exposedPatchID.setSize
763  (
764  extrudePatch.size(),
765  findPatchID(patches, backPatchName)
766  );
767  }
768 
769  // Determine points and extrusion
770  pointField layer0Points(extrudePatch.nPoints());
771  pointField displacement(extrudePatch.nPoints());
772  forAll(displacement, pointI)
773  {
774  const vector& patchNormal = extrudePatchPointNormals[pointI];
775 
776  // layer0 point
777  layer0Points[pointI] = model()
778  (
779  extrudePatch.localPoints()[pointI],
780  patchNormal,
781  0
782  );
783  // layerN point
784  point extrudePt = model()
785  (
786  extrudePatch.localPoints()[pointI],
787  patchNormal,
788  model().nLayers()
789  );
790  displacement[pointI] = extrudePt - layer0Points[pointI];
791  }
792 
793 
794  // Check if wedge (has layer0 different from original patch points)
795  // If so move the mesh to starting position.
796  if (gMax(mag(layer0Points-extrudePatch.localPoints())) > SMALL)
797  {
798  Info<< "Moving mesh to layer0 points since differ from original"
799  << " points - this can happen for wedge extrusions." << nl
800  << endl;
801 
802  pointField newPoints(mesh.points());
803  forAll(extrudePatch.meshPoints(), i)
804  {
805  newPoints[extrudePatch.meshPoints()[i]] = layer0Points[i];
806  }
807  mesh.movePoints(newPoints);
808  }
809 
810 
811  // Layers per face
812  labelList nFaceLayers(extrudePatch.size(), model().nLayers());
813 
814  // Layers per point
815  labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
816 
817  // Displacement for first layer
818  vectorField firstLayerDisp(displacement*model().sumThickness(1));
819 
820  // Expansion ratio not used.
821  scalarField ratio(extrudePatch.nPoints(), 1.0);
822 
823  // Topo change container. Either copy an existing mesh or start
824  // with empty storage (number of patches only needed for checking)
826  (
827  (
828  mode == MESH
829  ? new polyTopoChange(mesh)
830  : new polyTopoChange(patches.size())
831  )
832  );
833 
834  layerExtrude.setRefinement
835  (
836  globalFaces,
837  edgeGlobalFaces,
838 
839  ratio, // expansion ratio
840  extrudePatch, // patch faces to extrude
841 
842  edgePatchID, // if boundary edge: patch for extruded face
843  edgeZoneID, // optional zone for extruded face
844  edgeFlip,
845  inflateFaceID, // mesh face that zone/patch info is from
846 
847  exposedPatchID, // if new mesh: patches for exposed faces
848  nFaceLayers,
849  nPointLayers,
850  firstLayerDisp,
851  meshMod()
852  );
853 
854  // Reset points according to extrusion model
855  forAll(layerExtrude.addedPoints(), pointI)
856  {
857  const labelList& pPoints = layerExtrude.addedPoints()[pointI];
858  forAll(pPoints, pPointI)
859  {
860  label meshPointI = pPoints[pPointI];
861 
862  point modelPt
863  (
864  model()
865  (
866  extrudePatch.localPoints()[pointI],
867  extrudePatchPointNormals[pointI],
868  pPointI+1 // layer
869  )
870  );
871 
872  const_cast<DynamicList<point>&>
873  (
874  meshMod().points()
875  )[meshPointI] = modelPt;
876  }
877  }
878 
879  // Store faces on front and exposed patch (if mode=patch there are
880  // only added faces so cannot used map to old faces)
881  const labelListList& layerFaces = layerExtrude.layerFaces();
882  backPatchFaces.setSize(layerFaces.size());
883  frontPatchFaces.setSize(layerFaces.size());
884  forAll(backPatchFaces, patchFaceI)
885  {
886  backPatchFaces[patchFaceI] = layerFaces[patchFaceI].first();
887  frontPatchFaces[patchFaceI] = layerFaces[patchFaceI].last();
888  }
889 
890 
891  // Create dummy fvSchemes, fvSolution
892  createDummyFvMeshFiles(mesh, regionDir);
893 
894  // Create actual mesh from polyTopoChange container
895  autoPtr<mapPolyMesh> map = meshMod().makeMesh
896  (
897  meshFromMesh,
898  IOobject
899  (
900  regionName,
901  runTimeExtruded.constant(),
902  runTimeExtruded,
905  false
906  ),
907  mesh
908  );
909 
910  layerExtrude.updateMesh
911  (
912  map(),
913  identity(extrudePatch.size()),
914  identity(extrudePatch.nPoints())
915  );
916 
917  // Calculate face labels for front and back.
918  frontPatchFaces = renumber
919  (
920  map().reverseFaceMap(),
921  frontPatchFaces
922  );
923  backPatchFaces = renumber
924  (
925  map().reverseFaceMap(),
926  backPatchFaces
927  );
928 
929  // Store added cells
930  if (mode == MESH)
931  {
932  const labelListList addedCells
933  (
934  layerExtrude.addedCells
935  (
936  meshFromMesh,
937  layerExtrude.layerFaces()
938  )
939  );
940  forAll(addedCells, faceI)
941  {
942  const labelList& aCells = addedCells[faceI];
943  forAll(aCells, i)
944  {
945  addedCellsSet.insert(aCells[i]);
946  }
947  }
948  }
949  }
950  else
951  {
952  // Read from surface
953  fileName surfName(dict.lookup("surface"));
954  surfName.expand();
955 
956  Info<< "Extruding surfaceMesh read from file " << surfName << nl
957  << endl;
958 
959  MeshedSurface<face> fMesh(surfName);
960 
961  if (flipNormals)
962  {
963  Info<< "Flipping faces." << nl << endl;
964  faceList& faces = const_cast<faceList&>(fMesh.faces());
965  forAll(faces, i)
966  {
967  faces[i] = fMesh[i].reverseFace();
968  }
969  }
970 
971  Info<< "Extruding surface with :" << nl
972  << " points : " << fMesh.points().size() << nl
973  << " faces : " << fMesh.size() << nl
974  << " normals[0] : " << fMesh.faceNormals()[0]
975  << nl
976  << endl;
977 
978  meshFromSurface.reset
979  (
980  new extrudedMesh
981  (
982  IOobject
983  (
985  runTimeExtruded.constant(),
986  runTimeExtruded
987  ),
988  fMesh,
989  model()
990  )
991  );
992 
993 
994  // Get the faces on front and back
995  frontPatchName = "originalPatch";
996  frontPatchFaces = patchFaces
997  (
998  meshFromSurface().boundaryMesh(),
999  wordList(1, frontPatchName)
1000  );
1001  backPatchName = "otherSide";
1002  backPatchFaces = patchFaces
1003  (
1004  meshFromSurface().boundaryMesh(),
1005  wordList(1, backPatchName)
1006  );
1007  }
1008 
1009 
1010  polyMesh& mesh =
1011  (
1012  meshFromMesh.valid()
1013  ? meshFromMesh()
1014  : meshFromSurface()
1015  );
1016 
1017 
1018  const boundBox& bb = mesh.bounds();
1019  const vector span = bb.span();
1020  const scalar mergeDim = mergeTol * bb.minDim();
1021 
1022  Info<< "Mesh bounding box : " << bb << nl
1023  << " with span : " << span << nl
1024  << "Merge distance : " << mergeDim << nl
1025  << endl;
1026 
1027 
1028  // Collapse edges
1029  // ~~~~~~~~~~~~~~
1030 
1031  if (mergeDim > 0)
1032  {
1033  Info<< "Collapsing edges < " << mergeDim << " ..." << nl << endl;
1034 
1035  // Edge collapsing engine
1036  edgeCollapser collapser(mesh);
1037 
1038  const edgeList& edges = mesh.edges();
1039  const pointField& points = mesh.points();
1040 
1042  Map<point> collapsePointToLocation(mesh.nPoints());
1043 
1044  forAll(edges, edgeI)
1045  {
1046  const edge& e = edges[edgeI];
1047 
1048  scalar d = e.mag(points);
1049 
1050  if (d < mergeDim)
1051  {
1052  Info<< "Merging edge " << e << " since length " << d
1053  << " << " << mergeDim << nl;
1054 
1055  collapseEdge[edgeI] = true;
1056  collapsePointToLocation.set(e[1], points[e[0]]);
1057  }
1058  }
1059 
1060  List<pointEdgeCollapse> allPointInfo;
1062  labelList pointPriority(mesh.nPoints(), 0);
1063 
1064  collapser.consistentCollapse
1065  (
1066  globalPoints,
1067  pointPriority,
1068  collapsePointToLocation,
1069  collapseEdge,
1070  allPointInfo
1071  );
1072 
1073  // Topo change container
1074  polyTopoChange meshMod(mesh);
1075 
1076  // Put all modifications into meshMod
1077  bool anyChange = collapser.setRefinement(allPointInfo, meshMod);
1078 
1079  if (anyChange)
1080  {
1081  // Construct new mesh from polyTopoChange.
1082  autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
1083 
1084  // Update fields
1085  mesh.updateMesh(map);
1086 
1087  // Update stored data
1088  updateFaceLabels(map(), frontPatchFaces);
1089  updateFaceLabels(map(), backPatchFaces);
1090  updateCellSet(map(), addedCellsSet);
1091 
1092  // Move mesh (if inflation used)
1093  if (map().hasMotionPoints())
1094  {
1095  mesh.movePoints(map().preMotionPoints());
1096  }
1097  }
1098  }
1099 
1100 
1101  // Change the front and back patch types as required
1102  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1103 
1104  word frontBackType(word::null);
1105 
1106  if (isType<extrudeModels::wedge>(model()))
1107  {
1108  changeFrontBackPatches<wedgePolyPatch>
1109  (
1110  mesh,
1111  frontPatchName,
1112  backPatchName
1113  );
1114  }
1115  else if (isType<extrudeModels::plane>(model()))
1116  {
1117  changeFrontBackPatches<emptyPolyPatch>
1118  (
1119  mesh,
1120  frontPatchName,
1121  backPatchName
1122  );
1123  }
1124 
1125 
1126  // Merging front and back patch faces
1127  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1128 
1129  Switch mergeFaces(dict.lookup("mergeFaces"));
1130  if (mergeFaces)
1131  {
1132  if (mode == MESH)
1133  {
1135  << "Cannot stitch front and back of extrusion since"
1136  << " in 'mesh' mode (extrusion appended to mesh)."
1137  << exit(FatalError);
1138  }
1139 
1140  Info<< "Assuming full 360 degree axisymmetric case;"
1141  << " stitching faces on patches "
1142  << frontPatchName << " and "
1143  << backPatchName << " together ..." << nl << endl;
1144 
1145  if (frontPatchFaces.size() != backPatchFaces.size())
1146  {
1148  << "Differing number of faces on front ("
1149  << frontPatchFaces.size() << ") and back ("
1150  << backPatchFaces.size() << ")"
1151  << exit(FatalError);
1152  }
1153 
1154 
1155 
1156  polyTopoChanger stitcher(mesh);
1157  stitcher.setSize(1);
1158 
1159  const word cutZoneName("originalCutFaceZone");
1160 
1161  List<faceZone*> fz
1162  (
1163  1,
1164  new faceZone
1165  (
1166  cutZoneName,
1167  frontPatchFaces,
1168  boolList(frontPatchFaces.size(), false),
1169  0,
1170  mesh.faceZones()
1171  )
1172  );
1173 
1175 
1176  // Add the perfect interface mesh modifier
1177  perfectInterface perfectStitcher
1178  (
1179  "couple",
1180  0,
1181  stitcher,
1182  cutZoneName,
1183  word::null, // dummy patch name
1184  word::null // dummy patch name
1185  );
1186 
1187  // Topo change container
1188  polyTopoChange meshMod(mesh);
1189 
1190  perfectStitcher.setRefinement
1191  (
1193  (
1195  (
1196  mesh.faces(),
1197  frontPatchFaces
1198  ),
1199  mesh.points()
1200  ),
1202  (
1204  (
1205  mesh.faces(),
1206  backPatchFaces
1207  ),
1208  mesh.points()
1209  ),
1210  meshMod
1211  );
1212 
1213  // Construct new mesh from polyTopoChange.
1214  autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
1215 
1216  // Update fields
1217  mesh.updateMesh(map);
1218 
1219  // Update local data
1220  updateCellSet(map(), addedCellsSet);
1221 
1222  // Move mesh (if inflation used)
1223  if (map().hasMotionPoints())
1224  {
1225  mesh.movePoints(map().preMotionPoints());
1226  }
1227  }
1228 
1229  mesh.setInstance(runTimeExtruded.constant());
1230  Info<< "Writing mesh to " << mesh.objectPath() << nl << endl;
1231 
1232  if (!mesh.write())
1233  {
1235  << exit(FatalError);
1236  }
1237 
1238  // Need writing cellSet
1239  label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>());
1240  if (nAdded > 0)
1241  {
1242  cellSet addedCells(mesh, "addedCells", addedCellsSet);
1243  Info<< "Writing added cells to cellSet " << addedCells.name()
1244  << nl << endl;
1245  if (!addedCells.write())
1246  {
1248  << addedCells.name()
1249  << exit(FatalError);
1250  }
1251  }
1252 
1253  Info<< "End\n" << endl;
1254 
1255  return 0;
1256 }
1257 
1258 
1259 // ************************************************************************* //
planeExtrusion.H
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
addPatchCellLayer.H
Foam::polyMesh::points
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:979
VectorSpace.H
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::doubleScalar
double doubleScalar
Double precision floating point scalar type.
Definition: doubleScalar.H:49
Foam::PackedBoolList
A bit-packed bool list.
Definition: PackedBoolList.H:63
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
main
int main(int argc, char *argv[])
Definition: extrudeMesh.C:260
IOstreams.H
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::globalPoints
Calculates points shared by more than two processor patches or cyclic patches.
Definition: globalPoints.H:100
createDummyFvMeshFiles
void createDummyFvMeshFiles(const polyMesh &mesh, const word &regionName)
Definition: extrudeMesh.C:79
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:86
Foam::polyBoundaryMesh
Foam::polyBoundaryMesh.
Definition: polyBoundaryMesh.H:60
Foam::IOobject::AUTO_WRITE
@ AUTO_WRITE
Definition: IOobject.H:117
nPatches
label nPatches
Definition: readKivaGrid.H:402
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:306
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::HashTable::transfer
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
Definition: HashTable.C:518
splitstring
std::vector< std::string > splitstring(std::string SourceString, std::string strSplit=" ", int nSkip=0)
Definition: extrudeMesh.C:323
Foam::addPatchCellLayer::globalEdgeFaces
static labelListList globalEdgeFaces(const polyMesh &, const globalIndex &globalFaces, const indirectPrimitivePatch &pp)
Per patch edge the pp faces (in global indices) using it. Uses.
Definition: addPatchCellLayer.C:618
Foam::polyTopoChange::changeMesh
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
Definition: polyTopoChange.C:3039
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:56
Foam::fvMesh::addFvPatches
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
Definition: fvMesh.C:462
wedgePolyPatch.H
Foam::PrimitivePatch::localPoints
const Field< PointType > & localPoints() const
Return pointField of points in patch.
Definition: PrimitivePatchTemplate.C:432
globalIndex.H
Foam::polyTopoChanger
List of mesh modifiers defining the mesh dynamics.
Definition: polyTopoChanger.H:56
polyTopoChanger.H
Foam::polyTopoChange::modifyFace
void modifyFace(const face &f, const label faceI, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Modify vertices or cell of face.
Definition: polyTopoChange.C:2869
polyTopoChange.H
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
Foam::PrimitivePatch::meshEdges
labelList meshEdges(const edgeList &allEdges, const labelListList &cellEdges, const labelList &faceCells) const
Return labels of patch edges in the global edge list using.
Definition: PrimitivePatchMeshEdges.C:41
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:97
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::fileName::path
fileName path() const
Return directory path name (part before last /)
Definition: fileName.C:293
Foam::List::transfer
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Foam::dictionary::lookupOrDefault
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Definition: dictionaryTemplates.C:33
Foam::Map< label >
Foam::regIOobject::write
virtual bool write() const
Write using setting from DB.
Definition: regIOobjectWrite.C:126
Foam::fvMesh::removeFvBoundary
void removeFvBoundary()
Remove boundary patches. Warning: fvPatchFields hold ref to.
Definition: fvMesh.C:480
Foam::fvMesh::movePoints
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Definition: fvMesh.C:726
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:421
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::primitiveMesh::edges
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Definition: primitiveMeshEdges.C:353
Foam::mag
dimensioned< scalar > mag(const dimensioned< Type > &)
Foam::primitiveMesh::pointEdges
const labelListList & pointEdges() const
Definition: primitiveMeshPointEdges.C:96
Foam::perfectInterface::setRefinement
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
Definition: perfectInterface.C:435
Foam::addPatchCellLayer::addedPoints
const labelListList & addedPoints() const
Added points per patch point.
Definition: addPatchCellLayer.H:306
Foam::HashSet< label, Hash< label > >
patchFaces
labelList patchFaces(const polyBoundaryMesh &patches, const wordList &names)
Definition: extrudeMesh.C:148
Foam::primitiveMesh::nEdges
label nEdges() const
Definition: primitiveMeshI.H:41
Foam::extrudeModel::New
static autoPtr< extrudeModel > New(const dictionary &)
Select null constructed.
Definition: extrudeModelNew.C:31
wedge.H
Foam::MeshedSurface::faces
const List< Face > & faces() const
Return const access to the faces.
Definition: MeshedSurface.H:301
Foam::mode
mode_t mode(const fileName &)
Return the file mode.
Definition: POSIX.C:573
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::IOobject::NO_WRITE
@ NO_WRITE
Definition: IOobject.H:118
Foam::fileName::name
word name() const
Return file name (part beyond last /)
Definition: fileName.C:212
changeFrontBackPatches
void changeFrontBackPatches(polyMesh &mesh, const word &frontPatchName, const word &backPatchName)
Definition: extrudeMesh.C:216
Foam::polyMesh::faceZones
const faceZoneMesh & faceZones() const
Return face zone mesh.
Definition: polyMesh.H:463
addDictOption.H
Foam::wordList
List< word > wordList
A List of words.
Definition: fileName.H:54
Foam::renumber
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
Definition: ListOpsTemplates.C:32
Foam::edgeCollapser
Does polyTopoChanges to remove edges. Can remove faces due to edge collapse but can not remove cells ...
Definition: edgeCollapser.H:66
Foam::IOobject::objectPath
fileName objectPath() const
Return complete path + object name.
Definition: IOobject.H:376
Foam::boundBox::span
vector span() const
The bounding box span (from minimum to maximum)
Definition: boundBoxI.H:84
Foam::fvMesh::write
virtual bool write() const
Write mesh using IO settings from time.
Definition: fvMesh.C:873
PATCH
@ PATCH
Definition: extrudeMesh.C:61
Foam::IOobject::headerOk
bool headerOk()
Read and check header info.
Definition: IOobject.C:439
dictName
const word dictName("particleTrackDict")
n
label n
Definition: TABSMDCalcMethod2.H:31
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::primitiveMesh::nPoints
label nPoints() const
Definition: primitiveMeshI.H:35
doubleScalar.H
Foam::reduce
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Definition: PstreamReduceOps.H:43
updateFaceLabels
void updateFaceLabels(const mapPolyMesh &map, labelList &faceLabels)
Definition: extrudeMesh.C:174
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::TimePaths::system
const word & system() const
Return system name.
Definition: TimePaths.H:120
Foam::extrudedMesh
Definition: extrudedMesh.H:49
Foam::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:64
Foam::List::append
void append(const T &)
Append an element at the end of the list.
edgeCollapser.H
Foam::IOobject::NO_READ
@ NO_READ
Definition: IOobject.H:111
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
MESH
@ MESH
Definition: extrudeMesh.C:60
extrudeModel.H
argList.H
Foam::polyMesh::faceOwner
virtual const labelList & faceOwner() const
Return face owner.
Definition: polyMesh.C:1017
Foam::IndirectList
A List with indirect addressing.
Definition: IndirectList.H:102
addRegionOption.H
Foam::fvMesh::updateMesh
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
Definition: fvMesh.C:802
Foam::boundBox::minDim
scalar minDim() const
Smallest length/height/width dimension.
Definition: boundBoxI.H:102
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobject.H:273
Foam::processorPolyPatch
Neighbour processor patch.
Definition: processorPolyPatch.H:55
size_type
graph_traits< Graph >::vertices_size_type size_type
Definition: SloanRenumber.C:73
findPatchID
label findPatchID(const polyBoundaryMesh &patches, const word &name)
Definition: extrudeMesh.C:132
Foam::edgeCollapser::consistentCollapse
void consistentCollapse(const globalIndex &globalPoints, const labelList &pointPriority, const Map< point > &collapsePointToLocation, PackedBoolList &collapseEdge, List< pointEdgeCollapse > &allPointInfo, const bool allowCellCollapse=false) const
Ensure that the collapse is parallel consistent and update.
Definition: edgeCollapser.C:1637
Foam::ZoneMesh::whichZone
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Definition: ZoneMesh.C:226
Foam::identity
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::PrimitivePatch::nPoints
label nPoints() const
Return number of points supporting patch faces.
Definition: PrimitivePatchTemplate.H:293
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::HashTable::size
label size() const
Return number of elements in table.
Definition: HashTableI.H:65
Foam::perfectInterface
Hack of attachDetach to couple patches when they perfectly align. Does not decouple....
Definition: perfectInterface.H:55
Foam::addPatchCellLayer
Adds layers of cells to outside of polyPatch. Can optionally create stand-alone extruded mesh (addToM...
Definition: addPatchCellLayer.H:125
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
fvMesh.H
Foam::edgeCollapser::setRefinement
bool setRefinement(const List< pointEdgeCollapse > &allPointInfo, polyTopoChange &meshMod) const
Play commands into polyTopoChange to create mesh.
Definition: edgeCollapser.C:1265
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::cellSet
A collection of cell labels.
Definition: cellSet.H:48
Foam::globalIndex
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Definition: globalIndex.H:63
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
Foam::boolList
List< bool > boolList
Bool container classes.
Definition: boolList.H:50
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::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:312
Foam::addPatchCellLayer::updateMesh
void updateMesh(const mapPolyMesh &, const labelList &faceMap, const labelList &pointMap)
Update any locally stored mesh information. Gets additional.
Definition: addPatchCellLayer.C:1972
emptyPolyPatch.H
Foam::DynamicList::append
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Foam::polyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: polyPatch.H:231
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::polyMesh::removeBoundary
void removeBoundary()
Remove boundary patches.
Definition: polyMeshClear.C:36
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:405
Foam::addPatchCellLayer::layerFaces
const labelListList & layerFaces() const
Layer faces per patch face. See above.
Definition: addPatchCellLayer.H:312
Foam::mapPolyMesh::reverseFaceMap
const labelList & reverseFaceMap() const
Reverse face map.
Definition: mapPolyMesh.H:497
Foam::polyMesh::setInstance
void setInstance(const fileName &)
Set the instance for mesh files.
Definition: polyMeshIO.C:32
Foam::polyMesh::bounds
const boundBox & bounds() const
Return mesh bounding box.
Definition: polyMesh.H:427
Foam::List::setSize
void setSize(const label)
Reset size of List.
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
setRootCase.H
Foam::mapPolyMesh::reverseCellMap
const labelList & reverseCellMap() const
Reverse cell map.
Definition: mapPolyMesh.H:528
SURFACE
@ SURFACE
Definition: extrudeMesh.C:62
Foam::polyMesh::faces
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1004
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::primitiveMesh::nFaces
label nFaces() const
Definition: primitiveMeshI.H:58
Foam::sumOp
Definition: ops.H:162
Foam::Pout
prefixOSstream Pout(cout, "Pout")
Definition: IOstreams.H:53
Foam::PatchTools::pointNormals
static tmp< pointField > pointNormals(const polyMesh &, const PrimitivePatch< Face, FaceList, PointField, PointType > &)
Return parallel consistent point normals for patches using mesh points.
Foam::Vector
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition: Vector.H:57
Foam::polyMesh::addPatches
void addPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches.
Definition: polyMesh.C:878
updateCellSet
void updateCellSet(const mapPolyMesh &map, labelHashSet &cellLabels)
Definition: extrudeMesh.C:195
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::addPatchCellLayer::calcExtrudeInfo
static void calcExtrudeInfo(const bool zoneFromAnyFace, const polyMesh &, const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const indirectPrimitivePatch &pp, labelList &edgePatchID, label &nPatches, Map< label > &nbrProcToPatch, Map< label > &patchToNbrProc, labelList &edgeZoneID, boolList &edgeFlip, labelList &inflateFaceID)
Determine extrude information per patch edge:
Definition: addPatchCellLayer.C:663
Foam::IOobject::clone
Foam::autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:252
Foam::string::expand
string & expand(const bool allowEmpty=false)
Expand initial tildes and all occurences of environment variables.
Definition: string.C:98
Foam::autoPtr::valid
bool valid() const
Return true if the autoPtr valid (ie, the pointer is set).
Definition: autoPtrI.H:83
createMesh.H
MeshedSurfaces.H
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::HashSet::insert
bool insert(const Key &key)
Insert a new entry.
Definition: HashSet.H:116
Foam::PtrList::setSize
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Definition: PtrList.C:142
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
createTime.H
Foam::argList::optionFound
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:108
ExtrudeMode
ExtrudeMode
Definition: extrudeMesh.C:58
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::autoPtr::reset
void reset(T *=0)
If object pointer already set, delete object and set to given.
Definition: autoPtrI.H:114
perfectInterface.H
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
Foam::boundaryMesh
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:59
patches
patches[0]
Definition: createSingleCellMesh.H:36
cellSet.H
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
collapseEdge
label collapseEdge(triSurface &surf, const scalar minLen)
Keep collapsing all edges < minLen.
Foam::PrimitivePatch::meshPoints
const labelList & meshPoints() const
Return labelList of mesh points in patch.
Definition: PrimitivePatchTemplate.C:392
Foam::MeshedSurface< face >
args
Foam::argList args(argc, argv)
Foam::Time::controlDictName
static word controlDictName
The default control dictionary name (normally "controlDict")
Definition: Time.H:213
Foam::MeshedSurface::size
label size() const
The surface size is the number of faces.
Definition: MeshedSurface.H:295
dictPath
fileName dictPath
Definition: setConstantMeshDictionaryIO.H:5
Foam::argList::optionReadIfPresent
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Definition: argListI.H:198
Foam::patchIdentifier::name
const word & name() const
Return name.
Definition: patchIdentifier.H:109
Foam::patchIdentifier::index
label index() const
Return the index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:133
Foam::polyMesh::addZones
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
Definition: polyMesh.C:922
trim
std::string trim(std::string s)
Definition: extrudeMesh.C:308
ExtrudeModeNames
static const NamedEnum< ExtrudeMode, 3 > ExtrudeModeNames
Definition: extrudeMesh.C:80
Foam::gMax
Type gMax(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:562
replaceChar
std::string replaceChar(std::string &SourceString, const std::string &strsrc, const std::string &strdst)
Definition: extrudeMesh.C:289
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::polyMesh::faceNeighbour
virtual const labelList & faceNeighbour() const
Return face neighbour.
Definition: polyMesh.C:1023
Foam::dictionary::add
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:729
Foam::addPatchCellLayer::addedCells
static labelListList addedCells(const polyMesh &, const labelListList &layerFaces)
Helper: get added cells per patch face.
Definition: addPatchCellLayer.C:584
Foam::NamedEnum
Initialise the NamedEnum HashTable from the static list of names.
Definition: NamedEnum.H:52
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88
createTimeExtruded.H
Foam::addPatchCellLayer::setRefinement
void setRefinement(const globalIndex &globalFaces, const labelListList &globalEdgeFaces, const scalarField &expansionRatio, const indirectPrimitivePatch &pp, const labelList &sidePatchID, const labelList &sideZoneID, const boolList &sideFlip, const labelList &inflateFaceID, const labelList &exposedPatchID, const labelList &nFaceLayers, const labelList &nPointLayers, const vectorField &firstLayerDisp, polyTopoChange &meshMod)
Play commands into polyTopoChange to create layers on top.
Definition: addPatchCellLayer.C:1008
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:190