109 const label nActiveCuts,
162 const label nActiveCuts,
168 faceCuts_(nActiveCuts),
169 faceCutAreas_(nActiveCuts)
198 for (
label sidei = 0; sidei <= 1; ++ sidei)
200 faceCutAreas_[
activeCuti(cuti)][sidei][facei] =
249 const label nActiveCuts,
256 pointFs_(nActiveCuts),
257 faceFs_(nActiveCuts),
258 faceCutFs_(nActiveCuts)
301 label fi = (cuti > 0 ? 0 : 1);
317 label fi = (cuti > 0 ? 0 : 1);
322 for (
label sidei = 0; sidei <= 1; ++ sidei)
325 fi == 0 && sidei == 0 ? cuti - 1
326 : fi == 1 && sidei == 1 ? cuti + 1
329 if (cutj < 0 || cutj >
cutXs_.
size() - 1)
continue;
345 const scalar magSqrArea =
magSqr(integral.
first());
347 faceCutFs_[
activeCuti(cuti)][fi][sidei][facei] =
395 label nActiveCuts = 0;
398 forAll(zoneCellMinOrder, zoneCellMinOrderi)
400 const label zoneCelli = zoneCellMinOrder[zoneCellMinOrderi];
403 while (zoneCellMinXs[zoneCelli] > cutXs[cuti + 1]) cuti ++;
407 while (zoneCellMaxXs[zoneCelli] > cutXs[cutj]) cutj ++;
409 nActiveCuts =
max(nActiveCuts, cutj - cuti);
419 forAll(zoneCellMinOrder, zoneCellMinOrderi)
421 const label zoneCelli = zoneCellMinOrder[zoneCellMinOrderi];
428 cuti < cutXs.
size() - 1
429 && zoneCellMinXs[zoneCelli] > cutXs[cuti + 1]
440 cutj < cutXs.
size() - 1
441 && zoneCellMaxXs[zoneCelli] > cutXs[cutj]
445 fcd.
cache(celli, cutj);
446 fcd.
cache(celli, cutj + 1);
449 dynWeights.
append({celli, cutj, cellVolumes[celli]});
452 if (zoneCellMinXs[zoneCelli] < cutXs[cutj])
454 dynWeights.
last().value -=
481 if (zoneCellMaxXs[zoneCelli] > cutXs[cutj + 1])
483 dynWeights.
last().value -=
523 cutWeightSums[weights[weighti].cuti] += weights[weighti].value;
531 weights[weighti].value /=
532 (cutWeightSums[weights[weighti].cuti] + vSmall);
562 label nActiveCuts = 0;
565 forAll(zoneCellMinOrder, zoneCellMinOrderi)
567 const label zoneCelli = zoneCellMinOrder[zoneCellMinOrderi];
570 while (zoneCellMinXs[zoneCelli] > cutXs[cuti + 1])
577 while (zoneCellMaxXs[zoneCelli] > cutXs[
max(cutj - 1, 0)])
582 nActiveCuts =
max(nActiveCuts, cutj - cuti + 1);
593 forAll(zoneCellMinOrder, zoneCellMinOrderi)
595 const label zoneCelli = zoneCellMinOrder[zoneCellMinOrderi];
603 && zoneCellMinXs[zoneCelli] > cutXs[cuti + 1]
606 if (cuti != 0) fcd.
clear(cuti - 1);
616 && zoneCellMaxXs[zoneCelli] > cutXs[
max(cutj - 1, 0)]
620 if (cutj != 0) fcd.
cache(celli, cutj - 1);
621 fcd.
cache(celli, cutj);
622 if (cutj != cutXs.
size() - 1) fcd.
cache(celli, cutj + 1);
623 ffs.
cache(celli, cutj);
626 dynWeights.
append({celli, cutj, 0});
646 && zoneCellMinXs[zoneCelli] < cutXs[cutj]
649 const scalar cellVF =
660 dynWeights.
last().value += cellVF;
663 if (zoneCellMinXs[zoneCelli] < cutXs[cutj - 1])
665 dynWeights.
last().value -=
671 cellVF/cellVolumes[celli],
696 if (zoneCellMaxXs[zoneCelli] > cutXs[cutj])
698 dynWeights.
last().value -=
704 cellVF/cellVolumes[celli],
724 cutj < cutXs.
size() - 1
725 && zoneCellMaxXs[zoneCelli] > cutXs[cutj]
728 const scalar cellVF =
739 dynWeights.
last().value += cellVF;
742 if (zoneCellMinXs[zoneCelli] < cutXs[cutj])
744 dynWeights.
last().value -=
750 cellVF/cellVolumes[celli],
767 if (zoneCellMaxXs[zoneCelli] > cutXs[cutj + 1])
769 dynWeights.
last().value -=
775 cellVF/cellVolumes[celli],
816 cutWeightSums[weights[weighti].cuti] += weights[weighti].value;
824 weights[weighti].value /=
825 (cutWeightSums[weights[weighti].cuti] + vSmall);
834 weights[weighti].cuti == 0
835 || weights[weighti].cuti == cutXs.
size() - 1
838 weights[weighti].value *= 2;
902 forAll(zoneCellMinXs, zoneCelli)
908 forAll(faces[facei], facePointi)
910 const label pointi = faces[facei][facePointi];
911 zoneCellMinXs[zoneCelli] =
912 min(zoneCellMinXs[zoneCelli], pointXs[pointi]);
913 zoneCellMaxXs[zoneCelli] =
914 max(zoneCellMaxXs[zoneCelli], pointXs[pointi]);
961 forAll(zoneCellMinXs, zoneCelli)
967 forAll(faces[facei], facePointi)
969 const label pointi = faces[facei][facePointi];
970 zoneCellMinXs[zoneCelli] =
971 min(zoneCellMinXs[zoneCelli], pointXs[pointi]);
972 zoneCellMaxXs[zoneCelli] =
973 max(zoneCellMaxXs[zoneCelli], pointXs[pointi]);
988 cutXs.first() =
xMin;
994 #define DeclareTypeFieldValues(Type, nullArg) \
995 PtrList<Field<Type>> Type##FieldValues;
997 #undef DeclareTypeFieldValues
1001 for (
label iteri = 0; iteri < nIter + debug; ++ iteri)
1028 #define ResizeTypeFieldValues(Type, nullArg) \
1029 Type##FieldValues.resize(nFields);
1031 #undef ResizeTypeFieldValues
1039 scalarFieldValues.set(nFields0, (distance0s + distance1s)/2);
1042 scalarFieldValues.set(nFields0 + 1, distance1s - distance0s);
1047 scalarFieldValues.set(nFields0,
new scalarField(cutXs));
1051 scalarFieldValues.set(nFields - 1,
new scalarField(intervalCounts));
1053 if (iteri == nIter)
break;
1058 for (
label cuti = 0; cuti < nCuts - 1; ++ cuti)
1060 cutSumCounts[cuti + 1] =
1064 ? (intervalCounts[cuti + 1] + intervalCounts[cuti])/2
1065 : intervalCounts[cuti]
1070 const scalar intervalCount = cutSumCounts.
last()/(nCuts - 1);
1075 cutXs.first() =
xMin;
1077 for (
label cuti0 = 0; cuti0 < nCuts - 1; ++ cuti0)
1082 && cutSumCounts[cuti0 + 1] > cuti*intervalCount
1086 (cuti*intervalCount - cutSumCounts[cuti0])
1087 /(cutSumCounts[cuti0 + 1] - cutSumCounts[cuti0]);
1089 cutXs[cuti] = (1 -
f)*cut0Xs[cuti0] +
f*cut0Xs[cuti0 + 1];
1101 /functionObjects::writeFile::outputPrefix
1103 mesh.
name() != polyMesh::defaultRegion
1112 functionFormatter.
write
1150 const weight& w = weights[weighti];
1157 const weight& w = weights[weighti];
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
#define TypeFieldValuesParameter(Type, nullArg)
#define DeclareTypeFieldValues(Type, nullArg)
#define ResizeTypeFieldValues(Type, nullArg)
static cellEdgeAddressingList & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Pre-declare SubField and related Field type.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const word & name() const
Return name.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void resize(const label)
Alias for setSize(const label)
void size(const label)
Override size to be inconsistent with allocated storage.
An ordered pair of two objects of type <Type> with first() and second() elements.
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.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
Pre-declare related SubField type.
fileName globalPath() const
Return the global path.
A 2-tuple for storing two objects of different types.
const Type2 & second() const
Return second.
const Type1 & first() const
Return first.
A List with indirect addressing.
T & last()
Return the last element of the list.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Class to manage face cut data.
const List< List< labelPair > > & faceCuts(const label cuti) const
void cache(const label celli, const label cuti)
const Pair< vectorField > & faceCutAreas(const label cuti) const
faceCutData(const polyMesh &mesh, const label nActiveCuts, const scalarField &pointXs, const scalarField &cutXs)
Base class for classes which manage incomplete sets of face data.
const scalarField & pointXs_
const pointField & points_
label activeCuti(const label cuti) const
PtrList< DynamicList< label > > faceis_
faceData(const polyMesh &mesh, const label nActiveCuts, const scalarField &pointXs, const scalarField &cutXs)
void clear(const label cuti)
const pointField & faceCentres_
const cellEdgeAddressingList & cAddrs_
PtrList< boolList > haveFaces_
const scalarField & cellVolumes_
const vectorField & faceAreas_
const scalarField & cutXs_
Class to manage face basis function data.
const Pair< Pair< scalarField > > & faceCutFs(const label cuti) const
const Pair< scalarField > & faceFs(const label cuti) const
const Pair< scalarField > & pointFs(const label cuti) const
void cache(const label celli, const label cuti)
faceFsData(const faceCutData &fcd, const polyMesh &mesh, const label nActiveCuts, const scalarField &pointXs, const scalarField &cutXs)
Holds list of sampling positions.
Generic dimensioned Type class.
const word & name() const
Return const reference to name.
A class for handling file names.
A functionName is a word starting with '#'.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const word & name() const
Return reference to name.
cellZone selection or generation class
label celli(const label i) const
Return the cell index corresponding to the cell set index.
label nCells() const
Return the number of cells in the set.
Mesh consisting of general polyhedral cells.
virtual const faceList & faces() const
Return raw faces.
virtual const pointField & points() const
Return raw points.
const vectorField & faceCentres() const
const scalarField & cellVolumes() const
const vectorField & faceAreas() const
const cellList & cells() const
virtual bool write(const bool write=true) const
Write using setting from DB.
Base class for writing coordinate sets with data.
virtual void write(const fileName &outputDir, const fileName &setName, const coordSet &set, const wordList &valueSetNames #define TypeValueSetsConstArg(Type, nullArg)) const =0
Write a coordSet and associated data.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FOR_ALL_FIELD_TYPES(Macro,...)
volScalarField scalarField(fieldObject, mesh)
static List< word > fieldNames
autoPtr< Pair< Field< Type > > > fieldPairPtr(const label size)
Allocate and return a pair of fields.
List< weight > calcWeights(const polyMesh &mesh, const generatedCellZone &zone, const scalarField &pointXs, const scalarField &cellMinXs, const scalarField &cellMaxXs, const labelList &cellMinOrder, const scalarField &cutXs, const bool interpolate, const bool normalise)
void writeLayers(const fvMesh &mesh, const List< cellCutPlot::weight > &weights, const word &functionName)
Write the layers as components of a tensor field for debugging.
tmp< scalarField > calcCutXs(const polyMesh &mesh, const generatedCellZone &zone, const scalarField &pointXs, const bool interpolate, const label nCuts, const label nIter, const bool debug=false, const word &functionName=word::null, const setWriter &functionFormatter=NullObjectRef< setWriter >())
Compute and return evenly-spaced cut coordinates.
List< weight > calcInterpolatingWeights(const polyMesh &mesh, const generatedCellZone &zone, const scalarField &pointXs, const scalarField &zoneCellMinXs, const scalarField &zoneCellMaxXs, const labelList &zoneCellMinOrder, const scalarField &cutXs, const bool normalise)
List< weight > calcNonInterpolatingWeights(const polyMesh &mesh, const generatedCellZone &zone, const scalarField &pointXs, const scalarField &zoneCellMinXs, const scalarField &zoneCellMaxXs, const labelList &zoneCellMinOrder, const scalarField &cutXs, const bool normalise)
autoPtr< Pair< Pair< Field< Type > > > > fieldPairPairPtr(const label size)
Allocate and return a pair of a pair of fields.
tmp< Field< Type > > applyWeights(const label n, const List< cellCutPlot::weight > &weights, const Field< Type > &cellValues)
Construct plot values from cell values given a set of weights.
Tuple2< vector, std::tuple< AreaIntegralType< Types > ... > > faceCutAreaIntegral(const face &f, const vector &fArea, const std::tuple< Types ... > &fPsis, const List< labelPair > &fCuts, const pointField &ps, const std::tuple< const Field< Types > &... > &pPsis, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the face-cut-area and face-cut-area-integral of the given properties.
vector faceCutArea(const face &f, const vector &fArea, const List< labelPair > &fCuts, const pointField &ps, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the face-cut-area.
Tuple2< scalar, std::tuple< Types ... > > cellCutVolumeIntegral(const cell &c, const cellEdgeAddressing &cAddr, const scalar cVolume, const std::tuple< Types ... > &cPsis, const labelListList &cCuts, const faceUList &fs, const vectorField &fAreas, const pointField &fCentres, const std::tuple< const Field< Types > &... > &fPsis, const vectorField &fCutAreas, const std::tuple< const Field< Types > &... > &fCutPsis, const pointField &ps, const std::tuple< const Field< Types > &... > &pPsis, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the cell-cut-volume and cell-cut-volume-integral.
Tuple2< scalar, std::tuple< Types ... > > cellVolumeIntegral(const cell &c, const cellEdgeAddressing &cAddr, const point &cPAvg, const std::tuple< Types ... > &cPsiAvgs, const vectorField &fAreas, const pointField &fCentres, const std::tuple< const Field< Types > &... > &fPsis)
Compute the cell-volume and cell-volume-integrals of the given properties.
Tuple2< vector, std::tuple< Types ... > > faceAreaAverage(const FaceValues< point > &fPs, const point &fPAvg, const std::tuple< FaceValues< Types > ... > &fPsis, const std::tuple< Types ... > &fPsiAvgs)
Compute the face-area and face-area-averages of the given properties.
List< labelPair > faceCuts(const face &f, const scalarField &pAlphas, const scalar isoAlpha)
Return the cuts for a given face. This returns a list of pairs of.
labelListList cellCuts(const cell &c, const cellEdgeAddressing &cAddr, const faceUList &fs, const List< List< labelPair >> &fCuts, const scalarField &pAlphas, const scalar isoAlpha)
Return the cuts for a given cell. This returns a list of lists of cell-edge.
scalar cellCutVolume(const cell &c, const cellEdgeAddressing &cAddr, const scalar cVolume, const labelListList &cCuts, const faceUList &fs, const vectorField &fAreas, const pointField &fCentres, const vectorField &fCutAreas, const pointField &ps, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the cell-cut-volume.
const dimensionSet dimless
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Type gMin(const UList< Type > &f, const label comm)
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.
List< bool > boolList
Bool container classes.
tmp< scalarField > linearSequence01(const label n)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Type gMax(const UList< Type > &f, const label comm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
quaternion normalise(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Structure containing the weight for a given mesh element and cut index.
const label nIntervals(pdfDictionary.lookup< label >("nIntervals"))