40 Foam::directions::directionTypeNames_
50 void Foam::directions::writeOBJ(Ostream& os,
const point& pt)
52 os <<
"v " << pt.x() <<
' ' << pt.y() <<
' ' << pt.z() <<
endl;
56 void Foam::directions::writeOBJ
67 os <<
"l " << vertI + 1 <<
' ' << vertI + 2 <<
endl;
73 void Foam::directions::writeOBJ
75 const fileName& fName,
76 const primitiveMesh&
mesh,
80 Pout<<
"Writing cell info to " << fName <<
" as vectors at the cellCentres"
83 OFstream xDirStream(fName);
103 writeOBJ(xDirStream, ctr, ctr + scale*dirs[celli], vertI);
108 void Foam::directions::check2D
110 const twoDPointCorrector* correct2DPtr,
116 if (
mag(correct2DPtr->planeNormal() & vec) > 1
e-6)
119 <<
"is not normal to plane defined in dynamicMeshDict."
121 <<
"Either make case 3D or adjust vector."
130 const polyMesh&
mesh,
139 List<directionInfo> changedFacesInfo(pp.size());
145 label meshFacei = pp.start() + patchFacei;
149 if (!hexMatcher().
isA(
mesh, celli))
152 <<
"useHexTopology specified but cell " << celli
153 <<
" on face " << patchFacei <<
" of patch " << pp.name()
157 const vector& cutDir = ppField[patchFacei];
173 changedFaces[patchFacei] = meshFacei;
174 changedFacesInfo[patchFacei] =
186 changedFaces[patchFacei] = pp.start() + patchFacei;
187 changedFacesInfo[patchFacei] =
197 FaceCellWave<directionInfo> directionCalc
215 label index = cellInfo[celli].index();
221 <<
"Cell " << celli <<
" never visited to determine "
222 <<
"local coordinate system" <<
endl
223 <<
"Using direction " << defaultDir <<
" instead" <<
endl;
225 dirField[celli] = defaultDir;
229 else if (index == -2)
232 dirField[celli] = cellInfo[celli].n();
236 else if (index == -1)
239 <<
"Illegal index " << index <<
endl
251 reduce(nGeom, sumOp<label>());
252 reduce(nTopo, sumOp<label>());
253 reduce(nUnset, sumOp<label>());
255 Info<<
"Calculated local coords for " << defaultDir
257 <<
" Geometric cut cells : " << nGeom <<
endl
258 <<
" Topological cut cells : " << nTopo <<
endl
259 <<
" Unset cells : " << nUnset <<
endl
296 if (coordSystem !=
"fieldBased")
300 directionType wantedDir = directionTypeNames_[wantedDirs[i]];
306 else if (wantedDir == e1)
310 else if (wantedDir == e2)
318 if (coordSystem ==
"global")
323 check2D(correct2DPtr, e1);
326 check2D(correct2DPtr, e2);
331 Info<<
"Global Coordinate system:" <<
endl
332 <<
" e1 : " << e1 <<
nl
333 <<
" e2 : " << e2 <<
nl
334 <<
" e3 : " << e3 <<
nl
350 else if (coordSystem ==
"patchLocal")
354 const word patchName(patchDict.
lookup(
"patch"));
361 <<
"Cannot find patch "
378 <<
"Discarding user specified e1 since 2D case." <<
endl
379 <<
"Recalculated e1 from face normal and planeNormal as "
388 if (wantE3 || wantE2)
402 this->operator[](nDirs++) = e3Dirs;
406 if (wantE1 || wantE2)
421 this->operator[](nDirs++) = e1Dirs;
428 this->operator[](nDirs++) = e2Dirs;
431 else if (coordSystem ==
"fieldBased")
435 operator[](nDirs++) =
451 <<
"Unknown coordinate system "
452 << coordSystem <<
endl
453 <<
"Known types are global, patchLocal and fieldBased"
#define forAll(list, i)
Loop across all elements in list.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
void size(const label)
Override size to be inconsistent with allocated storage.
Initialise the NamedEnum HashTable from the static list of names.
const Field< PointType > & faceNormals() const
Return face normals for patch.
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
label size() const
Return the number of elements in the UList.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
T lookupOrDefault(const word &, const T &, const bool writeDefault=writeOptionalEntries > 0) const
Find and return a T, if not found return the given default.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
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.
directions(const polyMesh &mesh, const dictionary &dict, const twoDPointCorrector *correct2DPtr=nullptr)
Construct from mesh and dictionary and optional 2D corrector.
directionType
Enumeration listing the possible coordinate directions.
label nTotalCells() const
Return total number of cells in decomposed mesh.
label findIndex(const word &patchName) const
Find patch index given a name.
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 class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
scalar minDist(const List< pointIndexHit > &hitList)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
vector point
Point is a vector.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
IOField< vector > vectorIOField
vectorField with IO.
Vector< scalar > vector
A scalar version of the templated Vector.
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Field< vector > vectorField
Specialisation of Field<T> for vector.
prefixOSstream Pout(cout, "Pout")
points setSize(newPointi)