37 namespace zoneGenerators
69 include_(includeNames.lookupOrDefault(
"include",
dict,
include::
all))
84 boolList cellIsAbovePlane(mesh_.nCells());
85 forAll(mesh_.cells(), celli)
87 cellIsAbovePlane[celli] =
88 ((mesh_.cellCentres()[celli] - point_) & normal_) > 0;
92 boolList bFaceNbrCellIsAbovePlane(mesh_.nFaces() - mesh_.nInternalFaces());
101 forAll(bFaceNbrCellIsAbovePlane, bFacei)
103 bFaceNbrCellIsAbovePlane[bFacei] =
104 ((bFaceNbrCellCentres[bFacei] - point_) & normal_) > 0;
109 boolList faceIsOnPlane(mesh_.nFaces(),
false);
110 forAll(mesh_.faceNeighbour(), facei)
112 faceIsOnPlane[facei] =
113 cellIsAbovePlane[mesh_.faceOwner()[facei]]
114 != cellIsAbovePlane[mesh_.faceNeighbour()[facei]];
120 if (!
patch.coupled())
continue;
124 const label facei =
patch.start() + patchFacei;
125 faceIsOnPlane[facei] =
126 cellIsAbovePlane[mesh_.faceOwner()[facei]]
127 != bFaceNbrCellIsAbovePlane[facei - mesh_.nInternalFaces()];
139 if (include_ == include::closest)
171 procRegionOffset[proci] +=
172 procRegionOffset[proci - 1]
173 + procNRegions[proci - 1];
179 newSetFaceRegions[fi] +=
184 nRegions = procRegionOffset.
last() + procNRegions.
last();
196 const label facei = faceIndices[fi];
197 const label regioni = newSetFaceRegions[fi];
198 forAll(mesh_.faceEdges()[facei], faceEdgei)
200 const label edgei = mesh_.faceEdges()[facei][faceEdgei];
201 meshEdgeRegions[edgei] =
labelList(1, regioni);
217 const label facei = faceIndices[fi];
218 const label regioni = newSetFaceRegions[fi];
219 forAll(mesh_.faceEdges()[facei], faceEdgei)
221 const label edgei = mesh_.faceEdges()[facei][faceEdgei];
222 forAll(meshEdgeRegions[edgei], edgeRegioni)
224 if (meshEdgeRegions[edgei][edgeRegioni] != regioni)
226 regionRegions[regioni].insert
228 meshEdgeRegions[edgei][edgeRegioni]
239 forAll(regionRegions, regioni)
243 regionMap[iter.key()] =
244 min(regionMap[iter.key()], regionMap[regioni]);
254 forAll(regionMap, regioni)
256 if (regionMap[regioni] > regioni0)
259 regionMap[regioni] = regioni0;
264 nRegions = regioni0 + 1;
274 regionNFaces[newSetFaceRegions[fi]] ++;
278 Info<<
" Found " << nRegions <<
" contiguous regions with "
279 << regionNFaces <<
" faces" <<
endl;
283 label selectedRegioni = -1;
290 const label facei = faceIndices[fi];
291 const label regioni = newSetFaceRegions[fi];
293 const vector& a = mesh_.faceAreas()[facei];
294 const point&
c = mesh_.faceCentres()[facei];
296 regionMagAreas[regioni] +=
mag(a);
297 regionCentres[regioni] +=
mag(a)*
c;
303 regionCentres /= regionMagAreas;
313 Info<<
" Selecting region " << selectedRegioni <<
" with "
314 << regionNFaces[selectedRegioni]
315 <<
" faces as the closest to point " << point_ <<
endl;
324 faceIndices[fi0] = faceIndices[fi];
326 if (newSetFaceRegions[fi] == selectedRegioni)
340 flipMap[fi] = cellIsAbovePlane[mesh_.faceOwner()[faceIndices[fi]]];
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Macros for easy insertion into run-time selection tables.
A List with indirect addressing.
void resize(const label)
Alias for setSize(const label)
void size(const label)
Override size to be inconsistent with allocated storage.
Initialise the NamedEnum HashTable from the static list of names.
A list of faces which address into the list of points.
label nEdges() const
Return number of edges in patch.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
A List with indirect addressing.
T & last()
Return the last element of the list.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Named list of face indices representing a sub-set of the mesh faces.
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
A class for handling words, derived from string.
Abstract base class for all zoneGenerators, providing runtime selection.
A zoneGenerator which looks-up and returns a zoneSet containing point, and/or cell and/or faces zones...
A zoneGenerator which constructs a faceZone from a set of patches.
A zoneGenerator which selects faces based on the adjacent cell centres spanning a given plane....
virtual zoneSet generate() const
Generate and return the zoneSet.
virtual ~plane()
Destructor.
static const NamedEnum< include, 2 > includeNames
Include option names.
include
Enumeration for what to include.
plane(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
A zoneGenerator which converts the point, cell and face zones from a list of zoneGenerators into a po...
Zone container returned by zoneGenerator::generate.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
const dimensionedScalar c
Speed of light in a vacuum.
defineTypeNameAndDebug(cylinderHeadPoints, 0)
addToRunTimeSelectionTable(zoneGenerator, cylinderHeadPoints, dictionary)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
const dimensionSet dimless
const dimensionSet dimLength
List< bool > boolList
Bool container classes.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
label findMin(const ListType &, const label start=0)
Find index of min element (and less than given element).
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.