44 Foam::blockMesh::strategyNames_
46 { mergeStrategy::MERGE_TOPOLOGY,
"topology" },
47 { mergeStrategy::MERGE_POINTS,
"points" },
97 if ((val > 0) && !
equal(val, 1))
101 scale = vector::uniform(val);
109 bool nonUnity =
false;
110 for (
direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
112 if (scale[cmpt] <= 0)
116 else if (!
equal(scale[cmpt], 1))
124 if (
equal(scale.x(), scale.y()) &&
equal(scale.x(), scale.z()))
146 bool Foam::blockMesh::readPointTransforms(
const dictionary&
dict)
148 transformType_ = transformTypes::NO_TRANSFORM;
151 auto csysPtr = coordinateSystem::NewIfPresent(
dict,
"transform");
155 transform_ = csysPtr();
160 transformType_ |= transformTypes::TRANSLATION;
164 if (!transform_.
R().is_identity(ROOTVSMALL))
166 transformType_ |= transformTypes::ROTATION;
177 prescaling_ = vector::uniform(1);
187 transformType_ |= transformTypes::PRESCALING;
189 else if (scaleType == 3)
191 transformType_ |= transformTypes::PRESCALING3;
198 scaling_ = vector::uniform(1);
206 {{
"convertToMeters", 1012}},
214 transformType_ |= transformTypes::SCALING;
216 else if (scaleType == 3)
218 transformType_ |= transformTypes::SCALING3;
222 return bool(transformType_);
228 Foam::blockMesh::blockMesh
232 mergeStrategy strategy,
238 checkFaceCorrespondence_
240 meshDict_.getOrDefault(
"checkFaceCorrespondence", true)
242 mergeStrategy_(strategy),
243 transformType_(transformTypes::NO_TRANSFORM),
249 meshDict_.time().constant(),
255 meshDict_.
found(
"geometry")
256 ? meshDict_.subDict(
"geometry")
262 meshDict_.
lookup(
"vertices"),
269 topologyPtr_(createTopology(meshDict_,
regionName))
271 if (mergeStrategy_ == mergeStrategy::DEFAULT_MERGE)
273 strategyNames_.
readIfPresent(
"mergeType", meshDict_, mergeStrategy_);
279 mergeStrategy_ == mergeStrategy::DEFAULT_MERGE
284 <<
"Detected collapsed blocks " 285 <<
"- using merge points instead of merge topology" <<
nl 288 mergeStrategy_ = mergeStrategy::MERGE_POINTS;
292 if (mergeStrategy_ == mergeStrategy::MERGE_POINTS)
295 calcGeometricalMerge();
300 calcTopologicalMerge();
309 return bool(topologyPtr_);
336 if (applyTransform && hasPointTransforms())
340 inplacePointTransforms(tpts.ref());
351 const polyPatchList& topoPatches = topology().boundaryMesh();
353 PtrList<dictionary>
patchDicts(topoPatches.size());
355 forAll(topoPatches, patchi)
390 if (patches_.empty())
401 return topology().boundaryMesh().names();
423 for (
const block& blk : blocks)
425 if (blk.zoneName().size())
437 return bool(transformType_);
448 if (transformType_ & transformTypes::PRESCALING)
452 p *= prescaling_.x();
455 else if (transformType_ & transformTypes::PRESCALING3)
463 if (transformType_ & transformTypes::ROTATION)
465 const tensor rot(transform_.R());
467 if (transformType_ & transformTypes::TRANSLATION)
469 const point origin(transform_.origin());
484 else if (transformType_ & transformTypes::TRANSLATION)
486 const point origin(transform_.origin());
494 if (transformType_ & transformTypes::SCALING)
501 else if (transformType_ & transformTypes::SCALING3)
516 if (hasPointTransforms())
520 inplacePointTransforms(tpts.ref());
wordList patchNames() const
Return the patch names.
virtual Ostream & write(const char c)
Write character.
const pointField & vertices() const noexcept
Reference to point field defining the blocks, these points are unscaled and non-transformed.
static bool verboseOutput
The default verbosity (true)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
bool equal(const T &a, const T &b)
Compare two values for equality.
constexpr char nl
The newline '\n' character (0x0a)
defineDebugSwitch(blockMesh, 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
const faceListList & patches() const
Return the patch face lists.
void checkITstream(const ITstream &is) const
Check after reading if the input token stream has unconsumed tokens remaining or if there were no tok...
Lookup type of boundary radiation properties.
tmp< pointField > globalPosition(const pointField &localPoints) const
Apply coordinate transforms and scaling.
static int getVerbosity(const dictionary &dict, int verbosity)
virtual void clear()
Reset origin and rotation to an identity coordinateSystem.
const token & peek() const
Failsafe peek at what the next read would return, including handling of any putback.
virtual const point & origin() const
Return origin.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
virtual const tensor & R() const
Return const reference to the rotation tensor.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
pointField vertices(const blockVertexList &bvl)
Foam::word regionName(Foam::polyMesh::defaultRegion)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
vectorField pointField
pointField is a vectorField.
A class for handling words, derived from Foam::string.
const pointField & points() const
The points for the entire mesh. These points are scaled and transformed.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
int readScaling(const entry *eptr, vector &scale)
dimensioned< Type > cmptMultiply(const dimensioned< Type > &, const dimensioned< Type > &)
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
vector point
Point is a vector.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const cellShapeList & cells() const
Return cell shapes list.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
bool valid() const noexcept
True if the blockMesh topology exists.
bool hasPointTransforms() const noexcept
True if scaling and/or transformations are needed.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
bool inplacePointTransforms(pointField &pts) const
Apply coordinate transforms and scaling.
messageStream Info
Information stream (stdout output on master, null elsewhere)
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
PtrList< dictionary > patchDicts
PtrList< dictionary > patchDicts() const
Patch information from the topology mesh.
A class for managing temporary objects.
virtual ITstream & stream() const =0
Return token stream, if entry is a primitive entry.
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
bool isNumber() const noexcept
Token is LABEL, FLOAT or DOUBLE.
Defines the attributes of an object for which implicit objectRegistry management is supported...
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
An input stream of tokens.
int verbose() const noexcept
Output verbosity level.
A keyword and a list of tokens is an 'entry'.
label numZonedBlocks() const
Number of blocks with specified zones.