Skip to content
Commits on Source (1)
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -105,7 +105,7 @@ queryFieldSummary
{
queried.nComponents_ = array->GetNumberOfComponents();
queried.association_ |= FieldAssociation::CELL_DATA;
queried.range_ += vtk::Tools::rangeOf(array);
queried.bounds_ += vtk::Tools::rangeOf(array);
}
array = vtkDataArray::SafeDownCast
......@@ -117,7 +117,7 @@ queryFieldSummary
{
queried.nComponents_ = array->GetNumberOfComponents();
queried.association_ |= FieldAssociation::POINT_DATA;
queried.range_ += vtk::Tools::rangeOf(array);
queried.bounds_ += vtk::Tools::rangeOf(array);
}
}
......@@ -163,7 +163,7 @@ queryFieldSummary
}
queried.association_ |= local.association_;
queried.range_ += local.range_;
queried.bounds_ += local.bounds_;
}
}
......@@ -360,11 +360,11 @@ void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::addMagField
void Foam::functionObjects::runTimePostPro::fieldVisualisationBase::
fieldSummary::reduce()
{
if (Pstream::parRun())
if (UPstream::parRun())
{
Foam::reduce(nComponents_, maxOp<int>());
Foam::reduce(association_, bitOrOp<unsigned>());
Foam::reduce(range_, minMaxOp<scalar>());
Foam::reduce(bounds_, sumOp<scalarMinMax>());
}
}
......@@ -378,9 +378,10 @@ Foam::Ostream& Foam::operator<<
>& proxy
)
{
os << "nComponents:" << proxy.t_.nComponents_
<< " association:" << label(proxy.t_.association_)
<< " min/max:" << proxy.t_.range_;
const auto& summary = *proxy;
os << "nComponents:" << summary.nComponents_
<< " association:" << int(summary.association_)
<< " min/max:" << summary.bounds_;
return os;
}
......@@ -633,11 +634,7 @@ addGlyphs
if (maxGlyphLength > 0)
{
// Using range from the data:
// glyph->SetRange
// (
// scaleFieldInfo.range_.first(),
// scaleFieldInfo.range_.second()
// );
// glyph->SetRange(scaleFieldInfo.min(), scaleFieldInfo.max());
// Set range according to user-supplied limits
glyph->ClampingOn();
......@@ -678,11 +675,7 @@ addGlyphs
{
// Set range according data limits
glyph->ClampingOn();
glyph->SetRange
(
scaleFieldInfo.range_.first(),
scaleFieldInfo.range_.second()
);
glyph->SetRange(scaleFieldInfo.min(), scaleFieldInfo.max());
glyph->SetScaleFactor(maxGlyphLength);
}
else
......
......@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -145,43 +145,40 @@ public:
{
int nComponents_;
unsigned association_;
scalarMinMax range_;
scalarMinMax bounds_;
//- Default construct
fieldSummary()
:
nComponents_(0),
association_(0u),
range_()
bounds_()
{}
//- Parallel reduction. A no-op if Pstream::parRun() is false
void reduce();
//- True if nComponents_ == 1
bool isScalar() const
{
return nComponents_ == 1;
}
bool isScalar() const noexcept { return nComponents_ == 1; }
//- True if nComponents_ == 3
bool isVector() const
{
return nComponents_ == 3;
}
bool isVector() const noexcept { return nComponents_ == 3; }
//- True if association_ is non-zero
bool exists() const
{
return association_;
}
bool exists() const noexcept { return association_; }
//- True if there is a POINT_DATA association
bool hasPointData() const
bool hasPointData() const noexcept
{
return (association_ & FieldAssociation::POINT_DATA);
}
//- The minimum value in the field summary
scalar min() const noexcept { return bounds_.min(); }
//- The maximum value in the field summary
scalar max() const noexcept { return bounds_.max(); }
InfoProxy<fieldSummary> info() const
{
return InfoProxy<fieldSummary>(*this);
......