46 #ifndef MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
47 #define MUELU_STRUCTUREDLINEDETECTIONFACTORY_DEF_HPP
53 #include "MueLu_FactoryManager.hpp"
59 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
64 validParamList->
set< std::string > (
"orientation",
"Z",
"Lines orientation");
65 validParamList->
set<
RCP<const FactoryBase> >(
"lNodesPerDim", Teuchos::null,
"Number of nodes per spatial dimension provided by CoordinatesTransferFactory.");
67 return validParamList;
70 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
72 Input(currentLevel,
"A");
80 "lNodesPerDim was not provided by the user on level0!");
83 Input(currentLevel,
"lNodesPerDim");
87 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
96 const std::string lineOrientation = pL.get<std::string>(
"orientation");
99 RCP<Matrix> A = Get< RCP<Matrix> >(currentLevel,
"A");
100 Array<LO> lNodesPerDir = Get<Array<LO> > (currentLevel,
"lNodesPerDim");
101 LO numNodes = lNodesPerDir[0]*lNodesPerDir[1]*lNodesPerDir[2];
102 VertLineId.
resize(numNodes);
103 if(lineOrientation ==
"X") {
104 NumZDir = lNodesPerDir[0];
105 }
else if(lineOrientation ==
"Y") {
106 NumZDir = lNodesPerDir[1];
107 }
else if(lineOrientation ==
"Z") {
108 NumZDir = lNodesPerDir[2];
111 for(
LO k = 0; k < lNodesPerDir[2]; ++k) {
112 for(
LO j = 0; j < lNodesPerDir[1]; ++j) {
113 for(
LO i = 0; i < lNodesPerDir[0]; ++i) {
114 if(lineOrientation ==
"X") {
115 VertLineId[k*lNodesPerDir[1]*lNodesPerDir[0] + j*lNodesPerDir[0] + i] = k*lNodesPerDir[1] + j;
116 }
else if(lineOrientation ==
"Y") {
117 VertLineId[k*lNodesPerDir[1]*lNodesPerDir[0] + j*lNodesPerDir[0] + i] = k*lNodesPerDir[0] + i;
118 }
else if(lineOrientation ==
"Z") {
119 VertLineId[k*lNodesPerDir[1]*lNodesPerDir[0] + j*lNodesPerDir[0] + i] = j*lNodesPerDir[0] + i;
125 Set(currentLevel,
"CoarseNumZLayers", NumZDir);
126 Set(currentLevel,
"LineDetection_VertLineIds", VertLineId);
131 #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.