mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: 'mag' postOperation returns scalar (#1622)
This commit is contained in:
@ -403,20 +403,6 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
||||
|
||||
switch (postOperation_)
|
||||
{
|
||||
case postOpNone:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case postOpMag:
|
||||
{
|
||||
// mag: component-wise - does not change the type
|
||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||
{
|
||||
setComponent(result, d)
|
||||
= mag(component(result, d));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case postOpSqrt:
|
||||
{
|
||||
// sqrt: component-wise - does not change the type
|
||||
@ -427,6 +413,10 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Write state/results information
|
||||
@ -453,13 +443,30 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
||||
<< " of " << fieldName << " = ";
|
||||
|
||||
|
||||
// Operation tagged that it always returns scalar?
|
||||
const bool alwaysScalar(operation_ & typeScalar);
|
||||
// Operation or post-operation returns scalar?
|
||||
|
||||
scalar sresult{0};
|
||||
|
||||
bool alwaysScalar(operation_ & typeScalar);
|
||||
|
||||
if (alwaysScalar)
|
||||
{
|
||||
const scalar sresult = component(result, 0);
|
||||
sresult = component(result, 0);
|
||||
|
||||
if (postOperation_ == postOpMag)
|
||||
{
|
||||
sresult = mag(sresult);
|
||||
}
|
||||
}
|
||||
else if (postOperation_ == postOpMag)
|
||||
{
|
||||
sresult = mag(result);
|
||||
alwaysScalar = true;
|
||||
}
|
||||
|
||||
|
||||
if (alwaysScalar)
|
||||
{
|
||||
file()<< tab << sresult;
|
||||
|
||||
Log << sresult << endl;
|
||||
|
||||
Reference in New Issue
Block a user