46 #ifndef MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP 47 #define MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP 49 #include <Xpetra_Matrix.hpp> 53 #include "MueLu_FactoryManager.hpp" 59 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
61 RCP<ParameterList> validParamList = rcp(
new ParameterList());
63 validParamList->set< RCP<const FactoryBase> >(
"A", Teuchos::null,
"Generating factory of the matrix A");
64 validParamList->set< RCP<const FactoryBase> >(
"Coordinates", Teuchos::null,
"Generating factory for coorindates");
65 validParamList->set< std::string > (
"orientation",
"Z",
"Lines orientation");
66 validParamList->set< RCP<const FactoryBase> >(
"lNodesPerDim", Teuchos::null,
"Number of nodes per spatial dimension provided by CoordinatesTransferFactory.");
68 return validParamList;
71 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
73 Input(currentLevel,
"A");
74 Input(currentLevel,
"Coordinates");
82 "lNodesPerDim was not provided by the user on level0!");
85 Input(currentLevel,
"lNodesPerDim");
89 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
92 using xdMV = Xpetra::MultiVector<double, LO, GO, NO>;
96 Teuchos::ArrayRCP<LO> VertLineId = Teuchos::arcp<LO>(0);
99 const ParameterList& pL = GetParameterList();
100 const std::string lineOrientation = pL.get<std::string>(
"orientation");
103 RCP<Matrix> A = Get< RCP<Matrix> >(currentLevel,
"A");
104 RCP<xdMV> Coordinates = Get< RCP<xdMV> > (currentLevel,
"Coordinates");
105 Array<LO> lNodesPerDir = Get<Array<LO> > (currentLevel,
"lNodesPerDim");
106 LO numNodes = Coordinates->getLocalLength();
107 VertLineId.resize(numNodes);
108 if(lineOrientation ==
"X") {
109 NumZDir = lNodesPerDir[0];
110 }
else if(lineOrientation ==
"Y") {
111 NumZDir = lNodesPerDir[1];
112 }
else if(lineOrientation ==
"Z") {
113 NumZDir = lNodesPerDir[2];
116 for(LO k = 0; k < lNodesPerDir[2]; ++k) {
117 for(LO j = 0; j < lNodesPerDir[1]; ++j) {
118 for(LO i = 0; i < lNodesPerDir[0]; ++i) {
119 if(lineOrientation ==
"X") {
120 VertLineId[k*lNodesPerDir[1]*lNodesPerDir[0] + j*lNodesPerDir[0] + i] = k*lNodesPerDir[1] + j;
121 }
else if(lineOrientation ==
"Y") {
122 VertLineId[k*lNodesPerDir[1]*lNodesPerDir[0] + j*lNodesPerDir[0] + i] = k*lNodesPerDir[0] + i;
123 }
else if(lineOrientation ==
"Z") {
124 VertLineId[k*lNodesPerDir[1]*lNodesPerDir[0] + j*lNodesPerDir[0] + i] = j*lNodesPerDir[0] + i;
130 Set(currentLevel,
"CoarseNumZLayers", NumZDir);
131 Set(currentLevel,
"LineDetection_VertLineIds", VertLineId);
136 #endif // MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
Namespace for MueLu classes and methods.
static const NoFactory * get()
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
int GetLevelID() const
Return level number.
Class that holds all level-specific information.
void Build(Level ¤tLevel) const
Build method.
void DeclareInput(Level ¤tLevel) const
Input.
bool IsAvailable(const std::string &ename, const FactoryBase *factory=NoFactory::get()) const
Test whether a need's value has been saved.
Exception throws to report errors in the internal logical of the program.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()