35bool Foam::functionObjects::columnAverage::columnAverageField
40 typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
42 const fieldType* fldPtr = cfindObject<fieldType>(fieldName);
46 const fieldType&
fld = *fldPtr;
48 const word resultName(averageName(fieldName));
54 resPtr =
new fieldType
59 fld.mesh().time().timeName(),
66 obr_.objectRegistry::store(resPtr);
68 fieldType& res = *resPtr;
70 const meshStructure& ms = meshAddressing(
fld.mesh());
71 if (globalFaces_().empty())
76 const labelList& cellToPatchFace = ms.cellToPatchFaceAddressing();
79 Field<Type> regionField(globalFaces_().totalSize(),
Zero);
82 forAll(cellToPatchFace, celli)
84 const label regioni = cellToPatchFace[celli];
85 regionField[regioni] +=
fld[celli];
86 regionCount[regioni]++;
93 forAll(regionField, regioni)
95 regionField[regioni] /= regionCount[regioni];
99 forAll(cellToPatchFace, celli)
101 const label regioni = cellToPatchFace[celli];
102 res[celli] = regionField[regioni];
104 res.correctBoundaryConditions();
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
static void listCombineAllGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
const objectRegistry & obr_
Reference to the region objectRegistry.
Type * getObjectPtr(const word &name, const bool recursive=false) const
List< label > labelList
A List of labels.
static constexpr const zero Zero
Global zero (0)
#define forAll(list, i)
Loop across all elements in list.