10#ifndef MUELU_INITIALBLOCKNUMBER_FACTORY_DEF_HPP
11#define MUELU_INITIALBLOCKNUMBER_FACTORY_DEF_HPP
13#include "Xpetra_VectorFactory.hpp"
14#include "Xpetra_Map.hpp"
15#include "Xpetra_Matrix.hpp"
16#include "Xpetra_IO.hpp"
26template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
28 RCP<ParameterList> validParamList = rcp(
new ParameterList());
30#define SET_VALID_ENTRY(name) validParamList->setEntry(name, MasterList::getEntry(name))
34 validParamList->set<RCP<const FactoryBase>>(
"A", Teuchos::null,
"Generating factory of the matrix A");
35 validParamList->set<RCP<const FactoryBase>>(
"BlockNumber", Teuchos::null,
"Generating factory of the BlockNumber vector");
37 return validParamList;
40template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
42 Input(currentLevel,
"A");
45 Input(currentLevel,
"BlockNumber");
48template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
51 const ParameterList& pL = GetParameterList();
53 RCP<LocalOrdinalVector> BlockNumber;
57 BlockNumber = Get<RCP<LocalOrdinalVector>>(currentLevel,
"BlockNumber");
58 GetOStream(
Statistics1) <<
"Use user-given blocknumber with length=" << BlockNumber->getGlobalLength() << std::endl;
61 RCP<Matrix> A = Get<RCP<Matrix>>(currentLevel,
"A");
62 LO blocksize = as<LO>(pL.get<
int>(
"aggregation: block diagonal: interleaved blocksize"));
64 GetOStream(
Statistics1) <<
"Generating new interleaved blocking with " << blocksize <<
" equations" << std::endl;
65 BlockNumber = LocalOrdinalVectorFactory::Build(A->getRowMap(),
false);
66 Teuchos::ArrayRCP<LO> bn_data = BlockNumber->getDataNonConst(0);
67 for (LO i = 0; i < (LO)A->getRowMap()->getLocalNumElements(); i++)
68 bn_data[i] = i % blocksize;
71 Set(currentLevel,
"BlockNumber", BlockNumber);
#define SET_VALID_ENTRY(name)
Timer to be used in factories. Similar to Monitor but with additional timers.
void Build(Level ¤tLevel) const
Build an object with this factory.
void DeclareInput(Level ¤tLevel) const
Specifies the data that this class needs, and the factories that generate that data.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
Class that holds all level-specific information.
bool IsAvailable(const std::string &ename, const FactoryBase *factory=NoFactory::get()) const
Test whether a need's value has been saved.
int GetLevelID() const
Return level number.
static const NoFactory * get()
Namespace for MueLu classes and methods.
@ Statistics1
Print more statistics.