10#ifndef MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
11#define MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
13#include <Xpetra_Matrix.hpp>
21template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
23 RCP<ParameterList> validParamList = rcp(
new ParameterList());
25 validParamList->set<RCP<const FactoryBase> >(
"A", Teuchos::null,
"Generating factory of the matrix A");
26 validParamList->set<std::string>(
"orientation",
"Z",
"Lines orientation");
27 validParamList->set<RCP<const FactoryBase> >(
"lNodesPerDim", Teuchos::null,
"Number of nodes per spatial dimension provided by CoordinatesTransferFactory.");
29 return validParamList;
32template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
34 Input(currentLevel,
"A");
42 "lNodesPerDim was not provided by the user on level0!");
45 Input(currentLevel,
"lNodesPerDim");
49template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
53 Teuchos::ArrayRCP<LO> VertLineId = Teuchos::arcp<LO>(0);
57 const std::string lineOrientation = pL.get<std::string>(
"orientation");
61 Array<LO> lNodesPerDir =
Get<Array<LO> >(currentLevel,
"lNodesPerDim");
62 LO numNodes = lNodesPerDir[0] * lNodesPerDir[1] * lNodesPerDir[2];
63 VertLineId.resize(numNodes);
64 if (lineOrientation ==
"X") {
65 NumZDir = lNodesPerDir[0];
66 }
else if (lineOrientation ==
"Y") {
67 NumZDir = lNodesPerDir[1];
68 }
else if (lineOrientation ==
"Z") {
69 NumZDir = lNodesPerDir[2];
72 for (LO k = 0; k < lNodesPerDir[2]; ++k) {
73 for (LO j = 0; j < lNodesPerDir[1]; ++j) {
74 for (LO i = 0; i < lNodesPerDir[0]; ++i) {
75 if (lineOrientation ==
"X") {
76 VertLineId[k * lNodesPerDir[1] * lNodesPerDir[0] + j * lNodesPerDir[0] + i] = k * lNodesPerDir[1] + j;
77 }
else if (lineOrientation ==
"Y") {
78 VertLineId[k * lNodesPerDir[1] * lNodesPerDir[0] + j * lNodesPerDir[0] + i] = k * lNodesPerDir[0] + i;
79 }
else if (lineOrientation ==
"Z") {
80 VertLineId[k * lNodesPerDir[1] * lNodesPerDir[0] + j * lNodesPerDir[0] + i] = j * lNodesPerDir[0] + i;
86 Set(currentLevel,
"CoarseNumZLayers", NumZDir);
87 Set(currentLevel,
"LineDetection_VertLineIds", VertLineId);
Exception throws to report errors in the internal logical of the program.
void Input(Level &level, const std::string &varName) const
T Get(Level &level, const std::string &varName) const
void Set(Level &level, const std::string &varName, const T &data) const
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.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput().
int GetLevelID() const
Return level number.
static const NoFactory * get()
virtual const Teuchos::ParameterList & GetParameterList() const
void DeclareInput(Level ¤tLevel) const
Input.
RCP< const ParameterList > GetValidParameterList() const
Return a const parameter list of valid parameters that setParameterList() will accept.
void Build(Level ¤tLevel) const
Build method.
Namespace for MueLu classes and methods.