From 81d24f2664cf3a383e652756c687e2905e66811d Mon Sep 17 00:00:00 2001 From: Andrew E Slaughter Date: Mon, 10 Feb 2020 14:53:20 -0700 Subject: [PATCH] Use ParallelObject instead of MooseObject --- framework/include/utils/BootstrapStatistics.h | 8 ++++--- framework/include/utils/Statistics.h | 22 ++++++++++--------- framework/src/utils/BootstrapStatistics.C | 6 ++--- framework/src/utils/Statistics.C | 20 ++++++++--------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/framework/include/utils/BootstrapStatistics.h b/framework/include/utils/BootstrapStatistics.h index 4d9e81cdfcca..71932746b9bf 100644 --- a/framework/include/utils/BootstrapStatistics.h +++ b/framework/include/utils/BootstrapStatistics.h @@ -7,6 +7,8 @@ //* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html +#pragma once + #include "MooseTypes.h" #include "MooseObject.h" #include @@ -30,7 +32,7 @@ MooseEnum makeBootstrapCalculatorEnum(); * objects. */ std::unique_ptr makeBootstrapCalculator( - const MooseEnum &, const MooseObject &, const std::vector &, unsigned int, unsigned int); + const MooseEnum &, const libMesh::ParallelObject &, const std::vector &, unsigned int, unsigned int); /* * Base class for computing bootstrap confidence level intervals. These classes follow the same @@ -39,7 +41,7 @@ std::unique_ptr makeBootstrapCalculator( class BootstrapCalculator : public libMesh::ParallelObject { public: - BootstrapCalculator(const MooseObject &); + BootstrapCalculator(const libMesh::ParallelObject &); virtual ~BootstrapCalculator() = default; void setSeed(unsigned int); void setReplicates(unsigned int); @@ -58,7 +60,7 @@ class BootstrapCalculator : public libMesh::ParallelObject class Percentile : public BootstrapCalculator { public: - Percentile(const MooseObject &); + Percentile(const libMesh::ParallelObject &); virtual std::vector compute(const std::vector &, const Calculator &, const bool) const override; }; diff --git a/framework/include/utils/Statistics.h b/framework/include/utils/Statistics.h index 12eda582872e..a989a6b9411f 100644 --- a/framework/include/utils/Statistics.h +++ b/framework/include/utils/Statistics.h @@ -7,6 +7,8 @@ //* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html +#pragma once + #include "MooseTypes.h" #include "MooseObject.h" #include @@ -21,7 +23,7 @@ class Calculator; * Free function for building a const Calculator object for use by StatisticsVectorPostprocessor. */ std::unique_ptr makeCalculator(const MooseEnumItem & item, - const MooseObject & other); + const libMesh::ParallelObject & other); /* * Free function that returns the available statistics available to the @@ -45,7 +47,7 @@ MultiMooseEnum makeCalculatorEnum(); class Calculator : public libMesh::ParallelObject { public: - Calculator(const MooseObject &); + Calculator(const libMesh::ParallelObject &); virtual ~Calculator() = default; virtual Real compute(const std::vector &, bool) const = 0; }; @@ -53,56 +55,56 @@ class Calculator : public libMesh::ParallelObject class Mean : public Calculator { public: - Mean(const MooseObject &); + Mean(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; class Min : public Calculator { public: - Min(const MooseObject &); + Min(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; class Max : public Calculator { public: - Max(const MooseObject &); + Max(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; class Sum : public Calculator { public: - Sum(const MooseObject &); + Sum(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; class StdDev : public Calculator { public: - StdDev(const MooseObject &); + StdDev(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; class StdErr : public StdDev { public: - StdErr(const MooseObject &); + StdErr(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; class Ratio : public Calculator { public: - Ratio(const MooseObject &); + Ratio(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; class L2Norm : public Calculator { public: - L2Norm(const MooseObject &); + L2Norm(const libMesh::ParallelObject &); virtual Real compute(const std::vector &, bool) const override; }; diff --git a/framework/src/utils/BootstrapStatistics.C b/framework/src/utils/BootstrapStatistics.C index 7d02e62e827e..5e2483e73eb7 100644 --- a/framework/src/utils/BootstrapStatistics.C +++ b/framework/src/utils/BootstrapStatistics.C @@ -31,7 +31,7 @@ makeBootstrapCalculatorEnum() std::unique_ptr makeBootstrapCalculator(const MooseEnum & item, - const MooseObject & other, + const libMesh::ParallelObject & other, const std::vector & levels, unsigned int replicates, unsigned int seed) @@ -51,7 +51,7 @@ makeBootstrapCalculator(const MooseEnum & item, return std::unique_ptr(ptr); } -BootstrapCalculator::BootstrapCalculator(const MooseObject & other) : libMesh::ParallelObject(other) +BootstrapCalculator::BootstrapCalculator(const libMesh::ParallelObject & other) : libMesh::ParallelObject(other) { } @@ -158,7 +158,7 @@ BootstrapCalculator::shuffle(const std::vector & data, } // PERCENTILE ////////////////////////////////////////////////////////////////////////////////////// -Percentile::Percentile(const MooseObject & other) : BootstrapCalculator(other) {} +Percentile::Percentile(const libMesh::ParallelObject & other) : BootstrapCalculator(other) {} std::vector Percentile::compute(const std::vector & data, diff --git a/framework/src/utils/Statistics.C b/framework/src/utils/Statistics.C index 552957a86232..1b145ded0d38 100644 --- a/framework/src/utils/Statistics.C +++ b/framework/src/utils/Statistics.C @@ -26,7 +26,7 @@ makeCalculatorEnum() } std::unique_ptr -makeCalculator(const MooseEnumItem & item, const MooseObject & other) +makeCalculator(const MooseEnumItem & item, const libMesh::ParallelObject & other) { if (item == "min") return libmesh_make_unique(other); @@ -57,10 +57,10 @@ makeCalculator(const MooseEnumItem & item, const MooseObject & other) } // CALCULATOR ////////////////////////////////////////////////////////////////////////////////////// -Calculator::Calculator(const MooseObject & other) : libMesh::ParallelObject(other) {} +Calculator::Calculator(const libMesh::ParallelObject & other) : libMesh::ParallelObject(other) {} // MEAN //////////////////////////////////////////////////////////////////////////////////////////// -Mean::Mean(const MooseObject & other) : Calculator(other) {} +Mean::Mean(const libMesh::ParallelObject & other) : Calculator(other) {} Real Mean::compute(const std::vector & data, bool is_distributed) const @@ -79,7 +79,7 @@ Mean::compute(const std::vector & data, bool is_distributed) const } // MIN ///////////////////////////////////////////////////////////////////////////////////////////// -Min::Min(const MooseObject & other) : Calculator(other) {} +Min::Min(const libMesh::ParallelObject & other) : Calculator(other) {} Real Min::compute(const std::vector & data, bool is_distributed) const @@ -92,7 +92,7 @@ Min::compute(const std::vector & data, bool is_distributed) const } // MAX ///////////////////////////////////////////////////////////////////////////////////////////// -Max::Max(const MooseObject & other) : Calculator(other) {} +Max::Max(const libMesh::ParallelObject & other) : Calculator(other) {} Real Max::compute(const std::vector & data, bool is_distributed) const @@ -105,7 +105,7 @@ Max::compute(const std::vector & data, bool is_distributed) const } // SUM ///////////////////////////////////////////////////////////////////////////////////////////// -Sum::Sum(const MooseObject & other) : Calculator(other) {} +Sum::Sum(const libMesh::ParallelObject & other) : Calculator(other) {} Real Sum::compute(const std::vector & data, bool is_distributed) const @@ -118,7 +118,7 @@ Sum::compute(const std::vector & data, bool is_distributed) const } // STDDEV ////////////////////////////////////////////////////////////////////////////////////////// -StdDev::StdDev(const MooseObject & other) : Calculator(other) {} +StdDev::StdDev(const libMesh::ParallelObject & other) : Calculator(other) {} Real StdDev::compute(const std::vector & data, bool is_distributed) const @@ -144,7 +144,7 @@ StdDev::compute(const std::vector & data, bool is_distributed) const } // STDERR ////////////////////////////////////////////////////////////////////////////////////////// -StdErr::StdErr(const MooseObject & other) : StdDev(other) {} +StdErr::StdErr(const libMesh::ParallelObject & other) : StdDev(other) {} Real StdErr::compute(const std::vector & data, bool is_distributed) const @@ -156,7 +156,7 @@ StdErr::compute(const std::vector & data, bool is_distributed) const } // RATIO /////////////////////////////////////////////////////////////////////////////////////////// -Ratio::Ratio(const MooseObject & other) : Calculator(other) {} +Ratio::Ratio(const libMesh::ParallelObject & other) : Calculator(other) {} Real Ratio::compute(const std::vector & data, bool is_distributed) const @@ -176,7 +176,7 @@ Ratio::compute(const std::vector & data, bool is_distributed) const } // L2NORM ////////////////////////////////////////////////////////////////////////////////////////// -L2Norm::L2Norm(const MooseObject & other) : Calculator(other) {} +L2Norm::L2Norm(const libMesh::ParallelObject & other) : Calculator(other) {} Real L2Norm::compute(const std::vector & data, bool is_distributed) const