48 <<
"cannot both be on a mesh edge and a face-diagonal edge." 63 if (faceBasePti == -1)
75 label diagPti = (faceBasePti +
diagEdge_)%
f.size();
77 return edge(
f[faceBasePti],
f[diagPti]);
97 for (
const label facei : thisCell)
102 if (tetFacei == facei)
147 if (tetBasePtI == -1)
160 eIndex -= tetBasePtI;
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();
309 label j = tri.fcIndex(i);
314 if (edge(tri[i], tri[j]) == currentE)
321 vector edgeNormal = (pt1 - pt0)^
n;
322 edgeNormal.normalise();
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),
469 const wallBoundedParticle&
p 473 localPosition_(
p.localPosition_),
474 meshEdgeStart_(
p.meshEdgeStart_),
475 diagEdge_(
p.diagEdge_)
484 const wallBoundedParticle&
p 489 os << static_cast<const particle&>(
p)
496 os << static_cast<const particle&>(
p);
499 reinterpret_cast<const char*>(&
p.localPosition_),
511 const InfoProxy<wallBoundedParticle>& ip
514 const wallBoundedParticle&
p = ip.t_;
518 os <<
" " <<
static_cast<const particle&
>(
p) <<
nl label meshEdgeStart_
Particle is on mesh edge:
bool found(const T &val, label pos=0) const
True if the value if found in the list.
virtual Ostream & write(const char c)
Write character.
label tetFace() const noexcept
Return current tet face particle is in.
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const noexcept
Check if the scalar byte-size associated with the stream is the same as the given type...
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
InfoProxy< wallBoundedParticle > info() const
Return info proxy.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
tetrahedron< point, const point & > tetPointRef
A tetrahedron using referred points.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
List< face > faceList
A List of faces.
virtual bool endRawRead()=0
End of low-level raw binary read.
const cellList & cells() const
static const std::size_t sizeofFields_
Size in bytes of the fields.
static void readFields(CloudType &)
Read.
dimensionedScalar neg(const dimensionedScalar &ds)
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
const dimensionedScalar e
Elementary charge.
virtual Istream & read(token &)=0
Return next token from stream.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool isTriAlongTrack(const vector &n, const point &endPosition) const
Is current triangle in the track direction.
A triangular face using a FixedList of labels corresponding to mesh vertices.
point localPosition_
Particle position is updated locally as opposed to via track.
virtual const faceList & faces() const
Return raw faces.
label diagEdge_
Particle is on diagonal edge:
errorManip< error > abort(error &err)
label fcIndex(const label i) const
Return the forward circular index, i.e. next index which returns to the first at the end of the list...
Particle class that tracks on triangles of boundary faces. Use trackToEdge similar to trackToFace on ...
const Mesh & mesh() const noexcept
Return mesh.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
OBJstream os(runTime.globalPath()/outputName)
wallBoundedParticle(const polyMesh &c, const point &position, const label celli, const label tetFacei, const label tetPti, const label meshEdgeStart, const label diagEdge)
Construct from components.
void crossDiagonalEdge()
Cross diagonal edge into different triangle on same face,cell.
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]
label readRawLabel(Istream &is)
Read raw label from binary stream.
const polyMesh & mesh() const noexcept
Return the mesh database.
scalar trackFaceTri(const vector &n, const vector &endPosition, label &)
Track through single triangle.
vector point
Point is a vector.
A cell is defined as a list of faces with extra functionality.
virtual bool beginRawRead()=0
Start of low-level raw binary read.
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const noexcept
Check if the label byte-size associated with the stream is the same as the given type.
Mesh consisting of general polyhedral cells.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type.
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
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))
edge currentEdge() const
Construct current edge.
streamFormat format() const noexcept
Get the current stream format.
List< cell > cellList
A List of cells.
void crossEdgeConnectedFace(const label &celli, label &tetFacei, label &tetPti, const edge &e)
Replacement for particle::crossEdgeConnectedFace that avoids bombing.