46Foam::directions::directionTypeNames_
48 { directionType::TAN1,
"tan1" },
49 { directionType::TAN2,
"tan2" },
50 { directionType::NORMAL,
"normal" },
56void Foam::directions::writeOBJ(Ostream&
os,
const point& pt)
58 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
endl;
62void Foam::directions::writeOBJ
73 os <<
"l " << vertI + 1 <<
' ' << vertI + 2 <<
endl;
79void Foam::directions::writeOBJ
86 Pout<<
"Writing cell info to " << fName <<
" as vectors at the cellCentres"
98 scalar minDist = GREAT;
107 scalar scale = 0.5*minDist;
109 writeOBJ(xDirStream, ctr, ctr + scale*dirs[celli], vertI);
114void Foam::directions::check2D
122 if (
mag(correct2DPtr->planeNormal() & vec) > 1
e-6)
125 <<
"is not normal to plane defined in dynamicMeshDict."
127 <<
"Either make case 3D or adjust vector."
151 label meshFacei =
pp.start() + patchFacei;
158 <<
"useHexTopology specified but cell " << celli
159 <<
" on face " << patchFacei <<
" of patch " <<
pp.name()
163 const vector& cutDir = ppField[patchFacei];
179 changedFaces[patchFacei] = meshFacei;
180 changedFacesInfo[patchFacei] =
192 changedFaces[patchFacei] =
pp.start() + patchFacei;
193 changedFacesInfo[patchFacei] =
220 label index =
cellInfo[celli].index();
226 <<
"Cell " << celli <<
" never visited to determine "
227 <<
"local coordinate system" <<
endl
228 <<
"Using direction " << defaultDir <<
" instead" <<
endl;
230 dirField[celli] = defaultDir;
234 else if (index == -2)
237 dirField[celli] =
cellInfo[celli].n();
241 else if (index == -1)
244 <<
"Illegal index " << index <<
endl
260 Info<<
"Calculated local coords for " << defaultDir
262 <<
" Geometric cut cells : " << nGeom <<
endl
263 <<
" Topological cut cells : " << nTopo <<
endl
264 <<
" Unset cells : " << nUnset <<
endl
273Foam::directions::directions
287 bool wantNormal =
false;
288 bool wantTan1 =
false;
289 bool wantTan2 =
false;
294 for (
const word& wantedName : wantedDirs)
302 else if (wantedDir ==
TAN1)
306 else if (wantedDir ==
TAN2)
314 if (coordSystem ==
"global")
319 check2D(correct2DPtr, tan1);
322 check2D(correct2DPtr, tan2);
326 Info<<
"Global Coordinate system:" <<
endl
327 <<
" normal : " << normal <<
endl
328 <<
" tan1 : " << tan1 <<
endl
329 <<
" tan2 : " << tan2
345 else if (coordSystem ==
"user")
349 auto csysPtr(coordinateSystem::New(
mesh.thisDb(), globalDict));
350 const auto& cs = csysPtr();
356 result = cs.transform(
mesh.cellCentres(),
vector(0, 0, 1));
361 result = cs.transform(
mesh.cellCentres(),
vector(1, 0, 0));
366 result = cs.transform(
mesh.cellCentres(),
vector(0, 1, 0));
369 else if (coordSystem ==
"patchLocal")
373 const word patchName(patchDict.get<word>(
"patch"));
375 const label patchi =
mesh.boundaryMesh().findPatchID(patchName);
380 <<
"Cannot find patch "
386 const polyPatch&
pp =
mesh.boundaryMesh()[patchi];
390 const vector& n0 =
pp.faceNormals()[0];
397 <<
"Discarding user specified tan1 since 2D case." <<
endl
398 <<
"Recalculated tan1 from face normal and planeNormal as "
402 const bool useTopo(
dict.get<
bool>(
"useHexTopology"));
407 if (wantNormal || wantTan2)
425 if (wantTan1 || wantTan2)
445 tmp<vectorField> tan2Dirs = normalDirs ^ tan1Dirs;
450 else if (coordSystem ==
"fieldBased")
459 mesh.instance()/wantedDirs[i],
470 <<
"Unknown coordinate system "
471 << coordSystem <<
endl
472 <<
"Known types are global, user, patchLocal and fieldBased"
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
label size() const noexcept
The number of elements in the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize(const label len)
Adjust allocated size of list.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void size(const label n)
Older name for setAddressableSize.
vectorField & operator[](const label i)
Holds information regarding type of cell. Used in inside/outside determination in cellClassification.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
Holds direction in which to split cell (in fact a local coordinate axes). Information is a label and ...
static label edgeToFaceIndex(const primitiveMesh &mesh, const label celli, const label facei, const label edgeI)
Given edge on hex cell find corresponding edge on face. Is either.
directionType
Enumeration listing the possible coordinate directions.
A class for handling file names.
label nTotalCells() const noexcept
Total global number of mesh cells.
static bool test(const UList< face > &faces)
Test if given list of faces satisfies criteria for HEX. (6 quad).
Mesh consisting of general polyhedral cells.
virtual const labelList & faceOwner() const
Return face owner.
const globalMeshData & globalData() const
Return parallel info (demand-driven).
A patch is a list of labels that address the faces in the global face list.
Cell-face mesh analysis engine.
const vectorField & cellCentres() const
const labelListList & cellCells() const
A class for managing temporary objects.
Class applies a two-dimensional correction to mesh motion point field.
const vector & planeNormal() const
Return plane normal.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for coordinate systems.
List< word > wordList
List of word.
List< label > labelList
A List of labels.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
IOField< vector > vectorIOField
IO for a Field of vector.
#define forAll(list, i)
Loop across all elements in list.