bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) { const bool ok = validField<Type>(fieldName); if (ok) { // Get (correctly oriented) field Field<Type> values = combineFields(setFieldValues<Type>(fieldName)()); // Get unoriented magSf scalarField magSf; if (surfacePtr_.valid()) { magSf = combineFields(surfacePtr_().magSf()); } else { magSf = combineFields(filterField(mesh().magSf(), false)()); } // Get (correctly oriented) weighting field scalarField weightField = combineFields(setFieldValues<scalar>(weightFieldName_)()); if (Pstream::master()) { Type result = processValues(values, magSf, weightField); if (valueOutput_) { IOList<Type> ( IOobject ( fieldName + "_" + sourceTypeNames_[source_] + "-" + sourceName_, obr_.time().timeName(), obr_, IOobject::NO_READ, IOobject::NO_WRITE ), values ).write(); } outputFilePtr_()<< tab << result; if (log_) { Info<< " " << operationTypeNames_[operation_] << "(" << sourceName_ << ") for " << fieldName << " = " << result << endl; } } } return ok; }
bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) { const bool ok = validField<Type>(fieldName); if (ok) { Field<Type> values(setFieldValues<Type>(fieldName)); scalarField V(filterField(mesh().V())); scalarField weightField(values.size(), 1.0); if (weightFieldName_ != "none") { weightField = setFieldValues<scalar>(weightFieldName_, true); } // Combine onto master combineFields(values); combineFields(V); combineFields(weightField); // apply weight field values *= weightField; if (Pstream::master()) { Type result = processValues(values, V, weightField); // add to result dictionary, over-writing any previous entry resultDict_.add(fieldName, result, true); if (valueOutput_) { IOField<Type> ( IOobject ( fieldName + "_" + sourceTypeNames_[source_] + "-" + sourceName_, obr_.time().timeName(), obr_, IOobject::NO_READ, IOobject::NO_WRITE ), values ).write(); } file()<< tab << result; Info(log_)<< " " << operationTypeNames_[operation_] << "(" << sourceName_ << ") for " << fieldName << " = " << result << endl; } } return ok; }
bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) { const bool ok = validField<Type>(fieldName); if (ok) { Field<Type> values = combineFields(setFieldValues<Type>(fieldName)); scalarField V = combineFields(filterField(mesh().V())); scalarField weightField = combineFields(setFieldValues<scalar>(weightFieldName_)); if (Pstream::master()) { Type result = processValues(values, V, weightField); if (valueOutput_) { IOList<Type> ( IOobject ( fieldName + "_" + sourceTypeNames_[source_] + "-" + sourceName_, obr_.time().timeName(), obr_, IOobject::NO_READ, IOobject::NO_WRITE ), values ).write(); } outputFilePtr_()<< tab << result; if (log_) { Info<< " " << operationTypeNames_[operation_] << "(" << sourceName_ << ") for " << fieldName << " = " << result << endl; } } } return ok; }
void Foam::fieldValue::combineFields(tmp<Field<Type> >& field) { combineFields(field()); }
void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field) { combineFields(field()); }