MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MueLu_NoFactory.cpp
Go to the documentation of this file.
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 /*
11  * MueLu_NoFactory.cpp
12  *
13  * Created on: Sep 13, 2011
14  * Author: wiesner
15  */
16 
17 #include "MueLu_Level.hpp"
18 
19 #include "MueLu_NoFactory.hpp"
20 
21 namespace MueLu {
22 
23 NoFactory::NoFactory() = default;
24 
25 NoFactory::~NoFactory() = default;
26 
28  if (noFactory_.is_null())
29  noFactory_ = rcp(new NoFactory());
30 
31  return noFactory_;
32 }
33 
35  return getRCP().get();
36 }
37 
38 void NoFactory::CallDeclareInput(Level& /* requestedLevel */) const {}
39 
41 
42 void NoFactory::CallBuild(Level& requestedLevel) const {
43  GetOStream(Errors) << "MueLu::NoFactory::Build(): this method cannot be called." << std::endl
44  << std::endl;
45  GetOStream(Errors) << "Maybe, the required variable has been generated by another factory?" << std::endl;
46  GetOStream(Errors) << "Here is a list of all available data on the current level:" << std::endl;
47  requestedLevel.print(GetOStream(Errors), MueLu::Debug);
48  throw Exceptions::RuntimeError("MueLu::NoFactory::Build(): this method cannot be called.");
49 }
50 
51 } // namespace MueLu
Teuchos::FancyOStream & GetOStream(MsgType type, int thisProcRankOnly=0) const
Get an output stream for outputting the input message type.
void CallBuild(Level &requestedLevel) const
Implementation of FactoryBase interface.
void CallDeclareInput(Level &) const
Print additional debugging information.
static const NoFactory * get()
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:63
virtual ~NoFactory()
Destructor.
NoFactory()
Constructor.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
static RCP< const NoFactory > noFactory_
NoFactory that is used for data stored in level class for that no generating factory is available/nec...
void print(std::ostream &out, const VerbLevel verbLevel=Default) const
Printing method.
Exception throws to report errors in the internal logical of the program.