blockMeshConfigurationBase.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
6  \\/ M anipulation |
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 \*---------------------------------------------------------------------------*/
25 
27 #include "polyPatch.H"
28 #include "wallPolyPatch.H"
29 #include "blockMeshFunctions.H"
30 
31 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
32 
34 (
35  boundBox& bb,
36  const scalar s
37 )
38 {
39  Info<< "Rounding bounding box to multiples of " << s << endl;
40 
41  bb.min() = roundDown(bb.min(), s);
42  bb.max() = roundUp(bb.max(), s);
43 }
44 
45 
47 (
48  const word& option
49 ) const
50 {
51  const Pair<word> patchOpt(patchOpts_.find(option)());
52 
53  if
54  (
55  !(
56  polyPatch::constraintType(patchOpt.second())
57  || patchOpt.second() == wallPolyPatch::typeName
58  || patchOpt.second() == polyPatch::typeName
59  )
60  )
61  {
62  FatalErrorInFunction<< "Argument to '-"
63  << option << " should be of the form "
64  << "'(<name> <type>)'" << nl
65  << "where <type> must be a generic \"patch\", \"wall\" "
66  << "or a constraint condition:" << nl << nl
68  << exit(FatalError);
69  }
70 
71  return patchOpt;
72 }
73 
74 
76 (
77  const word& x,
78  const word& y,
79  const word& z
80 )
81 {
82  const word bgm("$!backgroundMesh/");
83  os_ << indent << "("
84  << bgm << x << " "
85  << bgm << y << " "
86  << bgm << z << ")"
87  << endl;
88 }
89 
90 
91 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92 
94 (
95  const fileName& name,
96  const fileName& dir,
97  const Time& time,
98  const meshingSurfaceList& surfaces,
99  const HashTable<Pair<word>>& patchOpts
100 )
101 :
102  caseFileConfiguration(name, dir, time),
103  bb_(surfaces.bb()),
104  patchOpts_(patchOpts)
105 {}
106 
107 
108 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
109 
111 {}
112 
113 
114 // ************************************************************************* //
scalar y
Functions for calculating the bounds and number of cells of a background mesh configured within a blo...
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: Pair.H:65
void writeVertex(const word &x, const word &y, const word &z)
Write a vertex entry in the vertices list.
void roundBoundingBox(boundBox &bb, const scalar s)
Round a bounding box by the rounding scale.
Pair< word > readPatchOption(const word &option) const
Parse the patch commandline options.
blockMeshConfigurationBase(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces, const HashTable< Pair< word >> &patchOpts)
Construct from components.
static wordList constraintTypes()
Return a list of all the constraint patch types.
Definition: polyPatch.C:244
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
Definition: polyPatch.C:238
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
scalar roundDown(const scalar x, const scalar s)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
messageStream Info
scalar roundUp(const scalar x, const scalar s)
error FatalError
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221
static const char nl
Definition: Ostream.H:260