| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// MueLu: A package for multigrid based preconditioning |
| 4 |
// |
| 5 |
// Copyright 2012 NTESS and the MueLu contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef MUELU_FACTORYMANAGERBASE_HPP |
| 11 |
#define MUELU_FACTORYMANAGERBASE_HPP |
| 12 |
|
| 13 |
#include <string> |
| 14 |
|
| 15 |
#include "MueLu_ConfigDefs.hpp" |
| 16 |
#include "MueLu_BaseClass.hpp" |
| 17 |
|
| 18 |
#include "MueLu_FactoryBase_fwd.hpp" |
| 19 |
|
| 20 |
namespace MueLu { |
| 21 |
|
| 22 |
/*! |
| 23 |
@class FactoryManagerBase |
| 24 |
@brief Class that provides default factories within Needs class. |
| 25 |
@ingroup MueLuBaseClasses |
| 26 |
*/ |
| 27 |
class FactoryManagerBase : public BaseClass { |
| 28 |
public: |
| 29 |
//@{ Constructors/Destructors. |
| 30 |
FactoryManagerBase() |
| 31 |
: bIgnoreUserData_(false) {} |
| 32 |
|
| 33 |
//! Destructor. |
| 34 |
virtual ~FactoryManagerBase() {} |
| 35 |
|
| 36 |
//@} |
| 37 |
|
| 38 |
//@{ Get/Set functions. |
| 39 |
|
| 40 |
//! Get |
| 41 |
// Return ref because user also give ref to the Hierarchy. |
| 42 |
const virtual RCP<const FactoryBase> GetFactory(const std::string& varName) const = 0; |
| 43 |
//@} |
| 44 |
|
| 45 |
//! Check |
| 46 |
// Return true if Factory associated with varName is registered |
| 47 |
virtual bool hasFactory(const std::string& varName) const = 0; |
| 48 |
|
| 49 |
// Free temporarily hold data at the end of Hierarchy::Setup() |
| 50 |
// This method is const because the clean concerns only mutable data. |
| 51 |
virtual void Clean() const {} // TODO: should be used inside of MueLu::Hierarchy |
| 52 |
|
| 53 |
#ifdef HAVE_MUELU_DEBUG |
| 54 |
virtual void ResetDebugData() const = 0; |
| 55 |
#endif |
| 56 |
|
| 57 |
//! get IgnoreUserData flag |
| 58 |
bool IgnoreUserData() const { return bIgnoreUserData_; } |
| 59 |
|
| 60 |
//! set IgnoreUserData flag |
| 61 |
void SetIgnoreUserData(bool bIgnoreUserData = false) { bIgnoreUserData_ = bIgnoreUserData; } |
| 62 |
|
| 63 |
private: |
| 64 |
//! boolean flag that controls behaviour of Level::GetFactory |
| 65 |
//! if bIgnoreUserData == true, the Level::GetFactory function always asks the Factory manager for a valid factory given a variable name |
| 66 |
//! if bIgnoreUserData == false, the Level::GetFactory prefers user-provided data for a variable name if available. Otherwise the factory manager is asked for a valid factory |
| 67 |
//! default: bIgnoreUserData = false; |
| 68 |
bool bIgnoreUserData_; |
| 69 |
|
| 70 |
}; // class FactoryManagerBase |
| 71 |
|
| 72 |
} // namespace MueLu |
| 73 |
|
| 74 |
#define MUELU_FACTORYMANAGERBASE_SHORT |
| 75 |
#endif // ifndef MUELU_FACTORYMANAGERBASE_HPP |