35 sizeof(wallBoundedParticle) -
sizeof(particle)
48 <<
"cannot both be on a mesh edge and a face-diagonal edge."
63 if (faceBasePti == -1)
77 return edge(
f[faceBasePti],
f[diagPti]);
97 for (
const label facei : thisCell)
102 if (tetFacei == facei)
109 label edDir = otherFace.edgeDirection(
e);
135 eIndex = otherFace.find(
e.start());
142 eIndex = otherFace.find(
e.
end());
147 if (tetBasePtI == -1)
160 eIndex -= tetBasePtI;
164 eIndex = (eIndex + otherFace.size()) % otherFace.size();
173 else if (eIndex == otherFace.size() - 1)
177 tetPti = otherFace.size() - 2;
193 crossEdgeConnectedFace(
cell(), tetFace(), tetPt(), meshEdge);
200 label fp =
f.
find(meshEdge[0]);
202 if (
f.nextLabel(fp) == meshEdge[1])
210 if (
f[fpMin1] == meshEdge[1])
212 meshEdgeStart_ = fpMin1;
220 <<
"face:" << tetFace()
222 <<
" meshEdge:" << meshEdge
230 const edge eNew(
f[meshEdgeStart_],
f.nextLabel(meshEdgeStart_));
231 if (eNew != meshEdge)
248 if (meshEdgeStart_ != -1)
260 if (tetPt() == diagEdge_)
266 label nextTetPt =
f.
fcIndex(tetPt());
267 if (diagEdge_ == nextTetPt)
276 <<
"tetPt:" << tetPt()
288 const vector& endPosition,
293 const triFace tri(currentTetIndices().faceTriIs(
mesh(),
false));
300 edge currentE(-1, -1);
301 if (meshEdgeStart_ != -1 || diagEdge_ != -1)
303 currentE = currentEdge();
314 if (
edge(tri[i], tri[j]) == currentE)
321 vector edgeNormal = (pt1 - pt0)^
n;
325 scalar sEnd = (endPosition - pt0)&edgeNormal;
330 scalar sStart = (localPosition_ - pt0)&edgeNormal;
331 if (
mag(sEnd - sStart) > VSMALL)
333 scalar
s = sStart/(sStart - sEnd);
335 if (
s >= 0 &&
s < minS)
346 localPosition_ += minS*(endPosition - localPosition_);
352 localPosition_ = endPosition;
358 localPosition_ -= ((localPosition_ - triPt)&
n)*
n;
367 const point& endPosition
370 const triFace triVerts(currentTetIndices().faceTriIs(
mesh(),
false));
371 const edge currentE = currentEdge();
375 currentE[0] == currentE[1]
376 || !triVerts.
found(currentE[0])
377 || !triVerts.
found(currentE[1])
381 <<
"Edge " << currentE <<
" not on triangle " << triVerts
387 const vector dir = endPosition - localPosition_;
395 if (
edge(triVerts[i], triVerts[j]) == currentE)
397 vector edgeNormal = (pt1-pt0)^
n;
398 return (dir&edgeNormal) < 0;
414 const point& position,
416 const label tetFacei,
418 const label meshEdgeStart,
422 particle(
mesh, position, celli, tetFacei, tetPti, false),
423 localPosition_(position),
424 meshEdgeStart_(meshEdgeStart),
473 localPosition_(
p.localPosition_),
474 meshEdgeStart_(
p.meshEdgeStart_),
475 diagEdge_(
p.diagEdge_)
489 os << static_cast<const particle&>(
p)
496 os << static_cast<const particle&>(
p);
499 reinterpret_cast<const char*
>(&
p.localPosition_),
const Mesh & mesh() const
Return mesh.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
label fcIndex(const label i) const
streamFormat format() const noexcept
Get the current stream format.
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const noexcept
virtual bool check(const char *operation) const
Check IOstream status for given operation.
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const noexcept
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual bool endRawRead()=0
End of low-level raw binary read.
virtual bool beginRawRead()=0
Start of low-level raw binary read.
virtual Istream & read(token &)=0
Return next token from stream.
virtual Ostream & write(const char c)
Write character.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
iterator end() noexcept
Return an iterator to end traversing the UList.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
label rcIndex(const label i) const noexcept
void size(const label n)
Older name for setAddressableSize.
label fcIndex(const label i) const noexcept
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
A cell is defined as a list of faces with extra functionality.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
static constexpr direction nComponents
Number of components in bool is 1.
const polyMesh & mesh() const noexcept
Return the mesh database.
label tetFace() const noexcept
Return current tet face particle is in.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
virtual const pointField & points() const
Return raw points.
const cellList & cells() const
const Point & a() const
Return vertices.
A triangular face using a FixedList of labels corresponding to mesh vertices.
Particle class that tracks on triangles of boundary faces. Use trackToEdge similar to trackToFace on ...
label meshEdgeStart_
Particle is on mesh edge:
bool isTriAlongTrack(const vector &n, const point &endPosition) const
Is current triangle in the track direction.
edge currentEdge() const
Construct current edge.
InfoProxy< wallBoundedParticle > info() const
Return info proxy.
static const std::size_t sizeofFields_
Size in bytes of the fields.
label diagEdge_
Particle is on diagonal edge:
scalar trackFaceTri(const vector &n, const vector &endPosition, label &)
Track through single triangle.
void crossEdgeConnectedFace(const label &celli, label &tetFacei, label &tetPti, const edge &e)
Replacement for particle::crossEdgeConnectedFace that avoids bombing.
point localPosition_
Particle position is updated locally as opposed to via track.
void crossDiagonalEdge()
Cross diagonal edge into different triangle on same face,cell.
static void readFields(CloudType &)
Read.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label readRawLabel(Istream &is)
Read raw label from binary stream.
errorManip< error > abort(error &err)
dimensionedScalar neg(const dimensionedScalar &ds)
constexpr char nl
The newline '\n' character (0x0a)
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::HEX);labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells].reset(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.