10 #ifndef MUELU_ZEROSUBBLOCKAFACTORY_DEF_HPP_
11 #define MUELU_ZEROSUBBLOCKAFACTORY_DEF_HPP_
26 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
32 validParamList->
set<
int>(
"block row", 0,
"Block row of subblock in block matrix A");
33 validParamList->
set<
int>(
"block col", 0,
"Block column of subblock in block matrix A");
35 return validParamList;
38 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
40 Input(currentLevel,
"A");
43 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
48 const size_t row = Teuchos::as<size_t>(pL.
get<
int>(
"block row"));
49 const size_t col = Teuchos::as<size_t>(pL.
get<
int>(
"block col"));
71 if (stridedRangeMap.is_null()) {
73 "Range map extractor contains non-strided maps in block row " << row <<
". This should not be.");
74 stridedRangeMap = rcp_dynamic_cast<
const StridedMap>(rangeMapExtractor->getMap(row));
77 if (stridedDomainMap.
is_null()) {
79 "Domain map extractor contains non-strided maps in block row " << row <<
". This should not be.");
80 stridedDomainMap = rcp_dynamic_cast<
const StridedMap>(domainMapExtractor->getMap(col));
86 RCP<Matrix> Op = MatrixFactory::Build(stridedRangeMap, stridedDomainMap, static_cast<size_t>(0));
89 Op->fillComplete(stridedDomainMap, stridedRangeMap);
92 GetOStream(
Statistics1) <<
"A(" << row <<
"," << col <<
") is a single block and has strided maps:"
93 <<
"\n range map fixed block size = " << stridedRangeMap->getFixedBlockSize() <<
", strided block id = " << stridedRangeMap->getStridedBlockId()
94 <<
"\n domain map fixed block size = " << stridedDomainMap->getFixedBlockSize() <<
", strided block id = " << stridedDomainMap->getStridedBlockId() << std::endl;
95 GetOStream(
Statistics2) <<
"A(" << row <<
"," << col <<
") has " << Op->getGlobalNumRows() <<
"x" << Op->getGlobalNumCols() <<
" rows and columns." << std::endl;
97 if (Op->IsView(
"stridedMaps") ==
true)
98 Op->RemoveView(
"stridedMaps");
99 Op->CreateView(
"stridedMaps", stridedRangeMap, stridedDomainMap);
101 currentLevel.
Set(
"A", Op,
this);
Exception indicating invalid cast attempted.
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access). Usage: Level->Get< RCP<Matrix> >("A", factory) if factory == NULL => use default factory.
void DeclareInput(Level ¤tLevel) const override
Specifies the data that this class needs, and the factories that generate that data.
void Build(Level ¤tLevel) const override
Build a zero sub-block object with this factory.
T & get(const std::string &name, T def_value)
Timer to be used in factories. Similar to Monitor but with additional timers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Print even more statistics.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Class that holds all level-specific information.
RCP< const ParameterList > GetValidParameterList() const override
Input.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
void Set(const std::string &ename, const T &entry, const FactoryBase *factory=NoFactory::get())
Exception throws to report errors in the internal logical of the program.
#define TEUCHOS_ASSERT(assertion_test)