51bool Foam::hexCellLooper::walkHex
54 const label startFacei,
55 const label startEdgeI,
58 scalarField& loopWeights
61 label facei = startFacei;
63 label edgeI = startEdgeI;
71 Pout<<
" walkHex : inserting cut onto edge:" << edgeI
77 loopWeights[cutI] = 0.5;
87 if (edgeI == startEdgeI)
97 Pout<<
"hexCellLooper::walkHex" <<
"Problem : cell:" << celli
98 <<
" collected loop:";
100 Pout<<
"loopWeights:" << loopWeights <<
endl;
110void Foam::hexCellLooper::makeFace
119 facePoints.setSize(loop.size());
120 faceVerts.setSize(loop.size());
124 label
cut = loop[cutI];
136 loopWeights[cutI]*v1 + (1.0-loopWeights[cutI])*v0;
140 label vertI = getVertex(
cut);
145 faceVerts[cutI] = cutI;
152Foam::hexCellLooper::hexCellLooper(
const polyMesh&
mesh)
190 success = walkHex(celli, face0, edgeI, loop, loopWeights);
212 <<
"could not cut cell " << celli <<
endl;
214 fileName cutsFile(
"hexCellLooper_" +
name(celli) +
".obj");
216 Pout<<
"hexCellLooper : writing cell to " << cutsFile <<
endl;
237 label elem = loop[elemI];
239 if (loopSet.found(elem))
244 loopSet.insert(elem);
251 makeFace(loop, loopWeights, faceVerts, facePoints);
253 if ((faceVerts.mag(facePoints) < SMALL) || (loop.
size() < 3))
256 <<
" on points:" << facePoints <<
endl
268 const plane& cutPlane,
Various functions to operate on Lists.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool found(const Key &key) const
Same as contains().
iterator end() noexcept
iterator to signal the end (for any HashTable)
void setSize(label n)
Alias for resize().
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
A List with indirect addressing. Like IndirectList but does not store addressing.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
iterator end() noexcept
Return an iterator to end traversing the UList.
void size(const label n)
Older name for setAddressableSize.
Abstract base class. Concrete implementations know how to cut a cell (i.e. determine a loop around th...
Maps a geometry to a set of cell primitives.
Ostream & writeCuts(Ostream &os, const labelList &, const scalarField &) const
Write cut descriptions to Ostream.
static label edgeToEVert(const primitiveMesh &mesh, const label edgeI)
Convert edgeI to eVert.
const polyMesh & mesh() const
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A face is a list of labels corresponding to mesh vertices.
scalar mag(const UList< point > &p) const
Magnitude of face area.
A class for handling file names.
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
Create cut along circumference of celli. Gets current mesh cuts.
Implementation of cellLooper.
const cellModel & hex_
Reference to hex cell shape.
virtual bool cut(const vector &refDir, const label celli, const boolList &vertIsCut, const boolList &edgeIsCut, const scalarField &edgeWeight, labelList &loop, scalarField &loopWeights) const
Create cut along circumference of celli. Gets current mesh cuts.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return raw points.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static label getEdge(List< DynamicList< label > > &pe, DynamicList< edge > &es, const label pointi, const label nextPointi)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
vector point
Point is a vector.
List< bool > boolList
A List of bools.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
#define forAll(list, i)
Loop across all elements in list.