ENH: refactor Function1 to enable fields

This commit is contained in:
Andrew Heather
2021-03-25 11:09:00 +00:00
committed by Andrew Heather
parent 7cd3b270d8
commit 7ff603d496
6 changed files with 19 additions and 48 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -285,7 +285,7 @@ Type Foam::Function1Types::TableBase<Type>::value(const scalar x) const
// Use interpolator
interpolator().valueWeights(xDash, currentIndices_, currentWeights_);
Type t = currentWeights_[0]*table_[currentIndices_[0]].second();
Type t(currentWeights_[0]*table_[currentIndices_[0]].second());
for (label i = 1; i < currentIndices_.size(); i++)
{
t += currentWeights_[i]*table_[currentIndices_[i]].second();
@ -305,7 +305,7 @@ Type Foam::Function1Types::TableBase<Type>::integrate
// Use interpolator
interpolator().integrationWeights(x1, x2, currentIndices_, currentWeights_);
Type sum = currentWeights_[0]*table_[currentIndices_[0]].second();
Type sum(currentWeights_[0]*table_[currentIndices_[0]].second());
for (label i = 1; i < currentIndices_.size(); i++)
{
sum += currentWeights_[i]*table_[currentIndices_[i]].second();