43 searchableSurfaceToFaceZone,
51 searchableSurfaceToFaceZone::typeName,
52 "\n Usage: searchableSurfaceToFaceZone surface\n\n" 53 " Select all faces whose cell-cell centre vector intersects the surface " 60 void Foam::searchableSurfaceToFaceZone::combine
67 labelList interiorFaceFaces(mesh_.nFaces());
69 forAll(mesh_.faceNeighbour(), facei)
71 interiorFaceFaces[facei] = facei;
73 label nInteriorFaces = mesh_.nInternalFaces();
76 const polyPatch& patch = mesh_.boundaryMesh()[
patchi];
81 const label facei = patch.start() + patchFacei;
82 interiorFaceFaces[nInteriorFaces] = facei;
87 interiorFaceFaces.resize(nInteriorFaces);
99 forAll(ownCc, interiorFacei)
101 const label facei = interiorFaceFaces[interiorFacei];
103 ownCc[interiorFacei] = cc[mesh_.faceOwner()[facei]];
104 nbrCc[interiorFacei] =
105 mesh_.isInternalFace(facei)
106 ? cc[mesh_.faceNeighbour()[facei]]
107 : boundaryNbrCc[facei - mesh_.nInternalFaces()];
113 List<pointIndexHit> hits;
115 surfacePtr_().findLine
117 ownCc + tol_*(ownCc - nbrCc),
118 nbrCc - tol_*(ownCc - nbrCc),
121 surfacePtr_().getNormal(hits, normals);
127 forAll(hits, interiorFacei)
129 if (hits[interiorFacei].hit())
131 const label facei = interiorFaceFaces[interiorFacei];
133 const vector d = nbrCc[interiorFacei] - ownCc[interiorFacei];
134 const bool sign = (normals[interiorFacei] & d) < 0;
136 side[mesh_.faceOwner()[facei]] = sign ? -1 : +1;
138 if (mesh_.isInternalFace(facei))
140 side[mesh_.faceNeighbour()[facei]] = sign ? +1 : -1;
151 forAll(interiorFaceFaces, interiorFacei)
153 const label facei = interiorFaceFaces[interiorFacei];
155 const label ownSide = side[mesh_.faceOwner()[facei]];
156 const label nbrSide =
157 mesh_.isInternalFace(facei)
158 ? side[mesh_.faceNeighbour()[facei]]
159 : boundaryNbrSide[facei - mesh_.nInternalFaces()];
161 direction[facei] = ownSide*nbrSide < 0 ? ownSide - nbrSide : 0;
165 DynamicList<label> newAddressing;
166 DynamicList<bool> newFlipMap;
170 newAddressing = DynamicList<label>(fzSet.addressing());
171 newFlipMap = DynamicList<bool>(fzSet.flipMap());
176 if (
direction[facei] != 0 && !fzSet.found(facei))
178 newAddressing.append(facei);
186 newAddressing = DynamicList<label>(fzSet.addressing().size());
187 newFlipMap = DynamicList<bool>(fzSet.flipMap().size());
190 forAll(fzSet.addressing(), i)
192 if (
direction[fzSet.addressing()[i]] == 0)
194 newAddressing.append(fzSet.addressing()[i]);
195 newFlipMap.append(fzSet.flipMap()[i]);
199 fzSet.addressing().transfer(newAddressing);
200 fzSet.flipMap().transfer(newFlipMap);
224 mesh.objectRegistry::db(),
249 if (!isA<faceZoneSet>(
set))
252 <<
"Operation only allowed on a faceZoneSet." <<
endl;
260 Info<<
" Adding all faces from surface " 261 << surfacePtr_().name() <<
" ..." <<
endl;
267 Info<<
" Removing all faces from surface " 268 << surfacePtr_().name() <<
" ..." <<
endl;
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
searchableSurfaceToFaceZone(const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< scalar > vector
A scalar version of the templated Vector.
AccessType combine(const List< T > &, AccessOp aop=accessOp< T >())
Combines sublists into one big list.
Macros for easy insertion into run-time selection tables.
Base class of a source for a topoSet.
vectorField pointField
pointField is a vectorField.
static const word & geometryDir()
Return the geometry directory name.
A class for handling words, derived from string.
const word & constant() const
Return constant name.
setAction
Enumeration defining the valid actions.
List< label > labelList
A List of labels.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
virtual ~searchableSurfaceToFaceZone()
Destructor.
const Time & time() const
Return time.
defineTypeNameAndDebug(combustionModel, 0)
Like faceSet but -reads data from faceZone -updates faceZone when writing.
General set of labels of mesh quantity (points, cells, faces).
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
#define WarningInFunction
Report a warning using Foam::Warning.
Class with constructor to add usage string to table.
static autoPtr< searchableSurface > New(const word &surfaceType, const IOobject &io, const dictionary &dict)
Return a reference to the selected searchableSurface.
Field< vector > vectorField
Specialisation of Field<T> for vector.
Mesh consisting of general polyhedral cells.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.