45Foam::directions::directionTypeNames_
47 { directionType::TAN1,
"tan1" },
48 { directionType::TAN2,
"tan2" },
49 { directionType::NORMAL,
"normal" },
55void Foam::directions::writeOBJ(Ostream&
os,
const point& pt)
57 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
endl;
61void Foam::directions::writeOBJ
72 os <<
"l " << vertI + 1 <<
' ' << vertI + 2 <<
endl;
78void Foam::directions::writeOBJ
80 const fileName& fName,
81 const primitiveMesh&
mesh,
85 Pout<<
"Writing cell info to " << fName <<
" as vectors at the cellCentres"
88 OFstream xDirStream(fName);
97 scalar minDist = GREAT;
106 scalar scale = 0.5*minDist;
108 writeOBJ(xDirStream, ctr, ctr + scale*dirs[celli], vertI);
113void Foam::directions::check2D
115 const twoDPointCorrector* correct2DPtr,
121 if (
mag(correct2DPtr->planeNormal() & vec) > 1
e-6)
124 <<
"is not normal to plane defined in dynamicMeshDict."
126 <<
"Either make case 3D or adjust vector."
135 const polyMesh&
mesh,
144 List<directionInfo> changedFacesInfo(pp.size());
150 label meshFacei = pp.start() + patchFacei;
157 <<
"useHexTopology specified but cell " << celli
158 <<
" on face " << patchFacei <<
" of patch " << pp.name()
162 const vector& cutDir = ppField[patchFacei];
178 changedFaces[patchFacei] = meshFacei;
179 changedFacesInfo[patchFacei] =
191 changedFaces[patchFacei] = pp.start() + patchFacei;
192 changedFacesInfo[patchFacei] =
201 MeshWave<directionInfo> directionCalc
209 const List<directionInfo>& cellInfo = directionCalc.allCellInfo();
219 label index = cellInfo[celli].index();
225 <<
"Cell " << celli <<
" never visited to determine "
226 <<
"local coordinate system" <<
endl
227 <<
"Using direction " << defaultDir <<
" instead" <<
endl;
229 dirField[celli] = defaultDir;
233 else if (index == -2)
236 dirField[celli] = cellInfo[celli].n();
240 else if (index == -1)
243 <<
"Illegal index " << index <<
endl
255 reduce(nGeom, sumOp<label>());
256 reduce(nTopo, sumOp<label>());
257 reduce(nUnset, sumOp<label>());
259 Info<<
"Calculated local coords for " << defaultDir
261 <<
" Geometric cut cells : " << nGeom <<
endl
262 <<
" Topological cut cells : " << nTopo <<
endl
263 <<
" Unset cells : " << nUnset <<
endl
286 bool wantNormal =
false;
287 bool wantTan1 =
false;
288 bool wantTan2 =
false;
291 if (coordSystem !=
"fieldBased")
293 for (
const word& wantedName : wantedDirs)
301 else if (wantedDir ==
TAN1)
305 else if (wantedDir ==
TAN2)
313 if (coordSystem ==
"global")
318 check2D(correct2DPtr, tan1);
321 check2D(correct2DPtr, tan2);
325 Info<<
"Global Coordinate system:" <<
endl
326 <<
" normal : " << normal <<
endl
327 <<
" tan1 : " << tan1 <<
endl
328 <<
" tan2 : " << tan2
344 else if (coordSystem ==
"patchLocal")
348 const word patchName(patchDict.
get<
word>(
"patch"));
355 <<
"Cannot find patch "
372 <<
"Discarding user specified tan1 since 2D case." <<
endl
373 <<
"Recalculated tan1 from face normal and planeNormal as "
377 const bool useTopo(
dict.
get<
bool>(
"useHexTopology"));
382 if (wantNormal || wantTan2)
400 if (wantTan1 || wantTan2)
425 else if (coordSystem ==
"fieldBased")
445 <<
"Unknown coordinate system "
446 << coordSystem <<
endl
447 <<
"Known types are global, patchLocal and fieldBased"
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
virtual bool resize()
Resize the ODE solver.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const fileName & instance() const noexcept
Read access to instance path component.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const Field< point_type > & faceNormals() const
Return face unit normals for patch.
void size(const label n)
Older name for setAddressableSize.
T & operator[](const label i)
Return element of UList.
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
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
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.
Set of directions for each cell in the mesh. Either uniform and size=1 or one set of directions per c...
directionType
Enumeration listing the possible coordinate directions.
label nTotalCells() const noexcept
Return total number of cells in decomposed mesh.
static bool test(const UList< face > &faces)
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
Mesh consisting of general polyhedral cells.
virtual const labelList & faceOwner() const
Return face owner.
const globalMeshData & globalData() const
Return parallel info.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
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.
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)
vector point
Point is a vector.
IOField< vector > vectorIOField
vectorField with IO.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
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.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.