| 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_NOFACTORY_HPP |
| 11 |
#define MUELU_NOFACTORY_HPP |
| 12 |
|
| 13 |
#include <algorithm> // for swap |
| 14 |
#include "Teuchos_RCPDecl.hpp" // for RCP |
| 15 |
#include "Teuchos_RCP.hpp" // for RCP::RCP<T>, RCP::operator=, etc |
| 16 |
#include "MueLu_config.hpp" // for HAVE_MUELU_DEBUG |
| 17 |
#include "MueLu_Exceptions.hpp" |
| 18 |
#include "MueLu_FactoryBase.hpp" |
| 19 |
#include "MueLu_Level_fwd.hpp" |
| 20 |
|
| 21 |
namespace MueLu { |
| 22 |
|
| 23 |
/*! |
| 24 |
@class NoFactory class. |
| 25 |
@brief NoFactory that is used for data stored in level class for that no generating factory is available/necessary. |
| 26 |
|
| 27 |
This should be used as the "generating" factory for user-data. Uses Singleton pattern. |
| 28 |
*/ |
| 29 |
class NoFactory : public FactoryBase { |
| 30 |
//! Constructor. |
| 31 |
NoFactory(); |
| 32 |
|
| 33 |
public: |
| 34 |
//! Destructor. |
| 35 |
virtual ~NoFactory(); |
| 36 |
|
| 37 |
//! Implementation of FactoryBase interface |
| 38 |
//@{ |
| 39 |
|
| 40 |
//! |
| 41 |
void CallBuild(Level& requestedLevel) const; |
| 42 |
|
| 43 |
//! |
| 44 |
void CallDeclareInput(Level& /* requestedLevel */) const; |
| 45 |
|
| 46 |
//@} |
| 47 |
|
| 48 |
//! Static Get() functions |
| 49 |
//@{ |
| 50 |
|
| 51 |
//! |
| 52 |
static const RCP<const NoFactory> getRCP(); |
| 53 |
|
| 54 |
//! |
| 55 |
static const NoFactory* get(); |
| 56 |
|
| 57 |
//@} |
| 58 |
#ifdef HAVE_MUELU_DEBUG |
| 59 |
void ResetDebugData() const {} |
| 60 |
#endif |
| 61 |
|
| 62 |
private: |
| 63 |
static RCP<const NoFactory> noFactory_; // static NoFactory instance for user defined "factories" |
| 64 |
|
| 65 |
}; // class NoFactory |
| 66 |
|
| 67 |
} // namespace MueLu |
| 68 |
|
| 69 |
#endif // MUELU_NOFACTORY_HPP |