10 #ifndef MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
11 #define MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
21 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
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;
32 template <
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");
49 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
57 const std::string lineOrientation = pL.get<std::string>(
"orientation");
60 RCP<Matrix> A = Get<RCP<Matrix> >(currentLevel,
"A");
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);
92 #endif // MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
#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)
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.