70 const int interpolationOrder,
72 const ArrayView<const LO> LFineNodesPerDir,
73 const ArrayView<const int> CoarseRate) :
77 RCP<Teuchos::FancyOStream> out;
78 if(
const char* dbg = std::getenv(
"MUELU_INDEXMANAGER_DEBUG")) {
79 out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
80 out->setShowAllFrontMatter(
false).setShowProcRank(
true);
82 out = Teuchos::getFancyOStream(rcp(
new Teuchos::oblackholestream()));
85 setupIM(NumDimensions, interpolationOrder, CoarseRate, LFineNodesPerDir);
87 *out <<
"Done setting up the IndexManager" << std::endl;
91 *out <<
"Computed Mesh Parameters" << std::endl;
97 setupIM(
const int NumDimensions,
const int interpolationOrder,
98 const ArrayView<const int> CoarseRate,
const ArrayView<const LO> LFineNodesPerDir) {
103 TEUCHOS_TEST_FOR_EXCEPTION((LFineNodesPerDir.size() != 3)
106 "LFineNodesPerDir has to be of size 3 or of size numDimensions!");
108 typename Kokkos::View<LO[3], device_type>::HostMirror lFineNodesPerDir_h = Kokkos::create_mirror_view(
lFineNodesPerDir);
110 typename Kokkos::View<LO[3], device_type>::HostMirror coarseRate_h = Kokkos::create_mirror_view(
coarseRate);
115 for(
int dim = 0; dim < 3; ++dim) {
117 lFineNodesPerDir_h(dim) = LFineNodesPerDir[dim];
118 if(CoarseRate.size() == 1) {
119 coarseRate_h(dim) = CoarseRate[0];
121 coarseRate_h(dim) = CoarseRate[dim];
124 lFineNodesPerDir_h(dim) = 1;
125 coarseRate_h(dim) = 1;
137 RCP<Teuchos::FancyOStream> out;
138 if(
const char* dbg = std::getenv(
"MUELU_INDEXMANAGER_DEBUG")) {
139 out = Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
140 out->setShowAllFrontMatter(
false).setShowProcRank(
true);
142 out = Teuchos::getFancyOStream(rcp(
new Teuchos::oblackholestream()));
145 typename Kokkos::View<int[3], device_type>::HostMirror coarseRate_h = Kokkos::create_mirror_view(
coarseRate);
146 typename Kokkos::View<int[3], device_type>::HostMirror endRate_h = Kokkos::create_mirror_view(
endRate);
149 typename Kokkos::View<LO[3], device_type>::HostMirror lFineNodesPerDir_h = Kokkos::create_mirror_view(
lFineNodesPerDir);
150 typename Kokkos::View<LO[3], device_type>::HostMirror coarseNodesPerDir_h = Kokkos::create_mirror_view(
coarseNodesPerDir);
156 for(
int dim = 0; dim < 3; ++dim) {
158 endRate_h(dim) = (lFineNodesPerDir_h(dim) - 1) % coarseRate_h(dim);
159 if(endRate_h(dim) == 0) {endRate_h(dim) = coarseRate_h(dim);}
166 *out <<
"lFineNodesPerDir: {" << lFineNodesPerDir_h(0) <<
", " << lFineNodesPerDir_h(1) <<
", "
167 << lFineNodesPerDir_h(2) <<
"}" << std::endl;
168 *out <<
"endRate: {" << endRate_h(0) <<
", " << endRate_h(1) <<
", "
169 << endRate_h(2) <<
"}" << std::endl;
184 for(
int dim = 0; dim < 3; ++dim) {
189 coarseNodesPerDir_h(dim) = (lFineNodesPerDir_h(dim) - endRate_h(dim) - 1)
190 / coarseRate_h(dim) + 2;
194 coarseNodesPerDir_h(dim) = 1;
199 if(lFineNodesPerDir_h(dim) < 1) {coarseNodesPerDir_h(dim) = 0;}
206 *out <<
"coarseNodesPerDir: {" << coarseNodesPerDir_h(0) <<
", "
207 << coarseNodesPerDir_h(1) <<
", " << coarseNodesPerDir_h(2) <<
"}" << std::endl;
212 Kokkos::deep_copy(
endRate, endRate_h);
void setupIM(const int NumDimensions, const int interpolationOrder, const ArrayView< const int > coarseRate, const ArrayView< const LO > LFineNodesPerDir)
Common setup pattern used for all the different types of undelying mesh.