Go to the documentation of this file.
35 sizeof(wallBoundedParticle) -
sizeof(particle)
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])
208 label fpMin1 =
f.rcIndex(fp);
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_)
262 tetPt() =
f.rcIndex(tetPt());
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),
443 is >> localPosition_ >> meshEdgeStart_ >> diagEdge_;
459 is.
read(
reinterpret_cast<char*
>(&localPosition_), sizeofFields_);
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_),
virtual const pointField & points() const
Return raw points.
static const std::size_t sizeofFields_
Size in bytes of the fields.
A helper class for outputting values to Ostream.
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))
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.
label tetFace() const
Return current tet face particle is in.
const cellList & cells() const
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
label meshEdgeStart_
Particle is on mesh edge:
void crossDiagonalEdge()
Cross diagonal edge into different triangle on same face,cell.
streamFormat format() const noexcept
Get the current stream format.
InfoProxy< wallBoundedParticle > info() const
Return info proxy.
Vector< Cmpt > & normalise()
Normalise the vector by its magnitude.
virtual Ostream & write(const char c)
Write character.
label fcIndex(const label i) const
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
std::enable_if< std::is_integral< T >::value, bool >::type checkLabelSize() const noexcept
virtual bool endRawRead()=0
End of low-level raw binary read.
void crossEdgeConnectedFace(const label &celli, label &tetFacei, label &tetPti, const edge &e)
Replacement for particle::crossEdgeConnectedFace that avoids bombing.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Particle class that tracks on triangles of boundary faces. Use trackToEdge similar to trackToFace on ...
const polyMesh & mesh() const
Return the mesh database.
std::enable_if< std::is_floating_point< T >::value, bool >::type checkScalarSize() const noexcept
virtual bool check(const char *operation) const
Check IOstream status for given operation.
OBJstream os(runTime.globalPath()/outputName)
bool isTriAlongTrack(const vector &n, const point &endPosition) const
Is current triangle in the track direction.
errorManip< error > abort(error &err)
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type.
const Point & a() const
Return vertices.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual bool beginRawRead()=0
Start of low-level raw binary read.
A triangular face using a FixedList of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const dimensionedScalar e
Elementary charge.
edge currentEdge() const
Construct current edge.
A face is a list of labels corresponding to mesh vertices.
label readRawLabel(Istream &is)
Read raw label from binary stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool found(const T &val, label pos=0) const
True if the value if found in the list.
scalar trackFaceTri(const vector &n, const vector &endPosition, label &)
Track through single triangle.
dimensionedScalar neg(const dimensionedScalar &ds)
A cell is defined as a list of faces with extra functionality.
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]
static constexpr direction nComponents
Number of components in this vector space.
label diagEdge_
Particle is on diagonal edge:
virtual Istream & read(token &)=0
Return next token from stream.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.