46 #ifndef MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
47 #define MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
57 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
62 validParamList->
set<std::string>(
"orientation",
"Z",
"Lines orientation");
63 validParamList->
set<
RCP<const FactoryBase> >(
"lNodesPerDim", Teuchos::null,
"Number of nodes per spatial dimension provided by CoordinatesTransferFactory.");
65 return validParamList;
68 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
70 Input(currentLevel,
"A");
78 "lNodesPerDim was not provided by the user on level0!");
81 Input(currentLevel,
"lNodesPerDim");
85 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
93 const std::string lineOrientation = pL.get<std::string>(
"orientation");
96 RCP<Matrix> A = Get<RCP<Matrix> >(currentLevel,
"A");
97 Array<LO> lNodesPerDir = Get<Array<LO> >(currentLevel,
"lNodesPerDim");
98 LO numNodes = lNodesPerDir[0] * lNodesPerDir[1] * lNodesPerDir[2];
99 VertLineId.
resize(numNodes);
100 if (lineOrientation ==
"X") {
101 NumZDir = lNodesPerDir[0];
102 }
else if (lineOrientation ==
"Y") {
103 NumZDir = lNodesPerDir[1];
104 }
else if (lineOrientation ==
"Z") {
105 NumZDir = lNodesPerDir[2];
108 for (
LO k = 0; k < lNodesPerDir[2]; ++k) {
109 for (
LO j = 0; j < lNodesPerDir[1]; ++j) {
110 for (
LO i = 0; i < lNodesPerDir[0]; ++i) {
111 if (lineOrientation ==
"X") {
112 VertLineId[k * lNodesPerDir[1] * lNodesPerDir[0] + j * lNodesPerDir[0] + i] = k * lNodesPerDir[1] + j;
113 }
else if (lineOrientation ==
"Y") {
114 VertLineId[k * lNodesPerDir[1] * lNodesPerDir[0] + j * lNodesPerDir[0] + i] = k * lNodesPerDir[0] + i;
115 }
else if (lineOrientation ==
"Z") {
116 VertLineId[k * lNodesPerDir[1] * lNodesPerDir[0] + j * lNodesPerDir[0] + i] = j * lNodesPerDir[0] + i;
122 Set(currentLevel,
"CoarseNumZLayers", NumZDir);
123 Set(currentLevel,
"LineDetection_VertLineIds", VertLineId);
128 #endif // MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static const NoFactory * get()
void resize(const size_type n, const T &val=T())
void Build(Level ¤tLevel) const
Build method.
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
Return a const parameter list of valid parameters that setParameterList() will accept.
int GetLevelID() const
Return level number.
Exception throws to report errors in the internal logical of the program.
void DeclareInput(Level ¤tLevel) const
Input.
void DeclareInput(const std::string &ename, const FactoryBase *factory, const FactoryBase *requestedBy=NoFactory::get())
Callback from FactoryBase::CallDeclareInput() and FactoryBase::DeclareInput()
bool IsAvailable(const std::string &ename, const FactoryBase *factory=NoFactory::get()) const
Test whether a need's value has been saved.