diff --git a/src/SIM/SIMbase.C b/src/SIM/SIMbase.C index 6e7449c64..f9f0a0ed5 100644 --- a/src/SIM/SIMbase.C +++ b/src/SIM/SIMbase.C @@ -2136,6 +2136,7 @@ bool SIMbase::project (RealArray& values, const FunctionBase* f, for (size_t j = 0; j < myModel.size() && ok; j++) { if (myModel[j]->empty()) continue; // skip empty patches + f->initPatch(j); Vector loc_values; switch (pMethod) { diff --git a/src/Utility/FieldFunctions.C b/src/Utility/FieldFunctions.C index bd61fc17c..eaa337eca 100644 --- a/src/Utility/FieldFunctions.C +++ b/src/Utility/FieldFunctions.C @@ -36,7 +36,7 @@ FieldFuncBase::~FieldFuncBase () } -bool FieldFuncBase::setPatch (size_t pIdx) +bool FieldFuncBase::setPatch (size_t pIdx) const { if (pIdx >= npch) return false; diff --git a/src/Utility/FieldFunctions.h b/src/Utility/FieldFunctions.h index ccd519d77..37c2070da 100644 --- a/src/Utility/FieldFunctions.h +++ b/src/Utility/FieldFunctions.h @@ -42,12 +42,12 @@ class FieldFuncBase virtual ~FieldFuncBase(); //! \brief Sets the active patch. - bool setPatch(size_t pIdx); + bool setPatch(size_t pIdx) const; protected: std::vector patch; //!< The patches on which the field is defined - size_t pidx; //!< Current patch index + mutable size_t pidx; //!< Current patch index size_t npch; //!< Number of patches in the field }; @@ -170,7 +170,7 @@ class FieldFunction : public RealFunc, public FieldFuncScalarBase virtual ~FieldFunction() {} //! \brief Sets the active patch. - virtual bool initPatch(size_t pIdx) { return this->setPatch(pIdx); } + virtual bool initPatch(size_t pIdx) const { return this->setPatch(pIdx); } protected: //! \brief Evaluates the scalar field function. diff --git a/src/Utility/Function.h b/src/Utility/Function.h index 5e9e49d55..81bfe9e58 100644 --- a/src/Utility/Function.h +++ b/src/Utility/Function.h @@ -160,7 +160,7 @@ class FunctionBase size_t dim() const { return ncmp; } //! \brief Sets the active patch. - virtual bool initPatch(size_t) { return true; } + virtual bool initPatch(size_t) const { return true; } //! \brief Checks if a specified point is within the function domain. virtual bool inDomain(const Vec3&) const { return true; }