MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_HierarchyUtils_def.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// MueLu: A package for multigrid based preconditioning
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef MUELU_HIERARCHYUTILS_DEF_HPP
47#define MUELU_HIERARCHYUTILS_DEF_HPP
48
49#include "Teuchos_ScalarTraits.hpp"
50
51#include <Xpetra_Matrix.hpp>
52#include <Xpetra_Operator.hpp>
53
57#include "MueLu_SmootherFactory.hpp"
58#include "MueLu_FactoryManager.hpp"
59
60//TODO/FIXME: DeclareInput(, **this**) cannot be used here
61#ifdef HAVE_MUELU_INTREPID2
62#include "Kokkos_DynRankView.hpp"
63#endif
64
65namespace MueLu {
66
67 // Copy object from one hierarchy to another calling AddNewLevel as appropriate.
68 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
69 void HierarchyUtils<Scalar, LocalOrdinal, GlobalOrdinal, Node>::CopyBetweenHierarchies(Hierarchy& fromHierarchy, Hierarchy& toHierarchy, const std::string fromLabel, const std::string toLabel, const std::string dataType) {
70
71 // add any necessary levels
72 for (int i = toHierarchy.GetNumLevels(); i < fromHierarchy.GetNumLevels(); i++)
73 toHierarchy.AddNewLevel();
74
75 for (int i = 0; i < fromHierarchy.GetNumLevels(); i++) {
76 RCP<Level> fromLevel = fromHierarchy.GetLevel(i);
77 RCP<Level> toLevel = toHierarchy.GetLevel(i);
78
79 TEUCHOS_TEST_FOR_EXCEPTION(dataType != "RCP<Matrix>" && dataType != "RCP<const Import>"
81 std::string("MueLu::Utils::CopyBetweenHierarchies: unknown data type(") + dataType + ")");
82 if (fromLevel->IsAvailable(fromLabel)) {
83 if (dataType == "RCP<Matrix>" ) {
84 // Normally, we should only do
85 // toLevel->Set(toLabel,fromLevel->Get<RCP<Matrix> >(fromLabel));
86 // The logic below is meant to handle a special case when we
87 // repartition a processor away, leaving behind a RCP<Operator> on
88 // on the level instead of an RCP<Matrix>
89
90 auto tempOp = fromLevel->Get<RCP<Operator> >(fromLabel);
91 auto tempMatrix = rcp_dynamic_cast<Matrix>(tempOp);
92 if(!tempMatrix.is_null()) toLevel->Set(toLabel,tempMatrix);
93 else toLevel->Set(toLabel,tempOp);
94 }
95 if (dataType == "RCP<const Import>") {
96 toLevel->Set(toLabel,fromLevel->Get<RCP<const Import> >(fromLabel));
97 }
98 }
99 }
100 }
101
102 // Adds the following non-serializable data (A,P,R,Nullspace,Coordinates) from level-specific sublist nonSerialList,
103 // calling AddNewLevel as appropriate.
104 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
106 typedef typename Xpetra::MultiVector<typename Teuchos::ScalarTraits<Scalar>::coordinateType,
107 LocalOrdinal, GlobalOrdinal, Node> realvaluedmultivector_type;
108
109 for (ParameterList::ConstIterator nonSerialEntry = nonSerialList.begin(); nonSerialEntry != nonSerialList.end(); nonSerialEntry++) {
110 const std::string& levelName = nonSerialEntry->first;
111 // Check for match of the form "level X" where X is a positive integer
112 if (nonSerialList.isSublist(levelName) && levelName.find("level ") == 0 && levelName.size() > 6) {
113 int levelID = strtol(levelName.substr(6).c_str(), 0, 0);
114 if (levelID > 0)
115 {
116 // Do enough level adding so we can be sure to add the data to the right place
117 for (int i = H.GetNumLevels(); i <= levelID; i++)
118 H.AddNewLevel();
119 }
120 RCP<Level> level = H.GetLevel(levelID);
121
122 RCP<FactoryManager> M = Teuchos::rcp_dynamic_cast<FactoryManager>(HM.GetFactoryManager(levelID));
123 TEUCHOS_TEST_FOR_EXCEPTION(M.is_null(), Exceptions::InvalidArgument, "MueLu::Utils::AddNonSerializableDataToHierarchy: cannot get FactoryManager");
124
125 // Grab the level sublist & loop over parameters
126 const ParameterList& levelList = nonSerialList.sublist(levelName);
127 for (ParameterList::ConstIterator levelListEntry = levelList.begin(); levelListEntry != levelList.end(); levelListEntry++) {
128 const std::string& name = levelListEntry->first;
129 TEUCHOS_TEST_FOR_EXCEPTION(name != "A" && name != "P" && name != "R" && name != "K" && name != "M" && name != "Mdiag" &&
130 name != "D0" && name != "M1" && name != "Ms" && name != "M0inv" &&
131 name != "Pnodal" && name != "NodeMatrix" && name != "NodeAggMatrix" &&
132 name != "Nullspace" && name != "Coordinates" && name != "pcoarsen: element to node map" &&
133 name != "Node Comm" && name != "DualNodeID2PrimalNodeID" && name != "Primal interface DOF map" &&
135 std::string("MueLu::Utils::AddNonSerializableDataToHierarchy: parameter list contains unknown data type(") + name + ")");
136
137 // Get a valid communicator and lib
138 RCP<const Teuchos::Comm<int> > comm;
139 if (!level->GetComm().is_null())
140 comm = level->GetComm();
141 else if (level->IsAvailable("A")) {
142 RCP<Matrix> mat;
143 level->Get("A", mat);
144 comm = mat->getMap()->getComm();
145 } else {
146 RCP<Level> level0 = H.GetLevel(0);
147 if (!level0->GetComm().is_null())
148 comm = level0->GetComm();
149 else {
150 RCP<Matrix> mat;
151 level0->Get("A", mat);
152 comm = mat->getMap()->getComm();
153 }
154 }
155 Xpetra::UnderlyingLib lib = level->lib();
156
157 if (name == "A") {
158 RCP<Matrix> mat;
159 if (levelListEntry->second.isType<std::string>())
160 // We might also want to read maps here.
161 mat = Xpetra::IO<Scalar,LocalOrdinal,GlobalOrdinal,Node>::Read(Teuchos::getValue<std::string>(levelListEntry->second), lib, comm);
162 else
163 mat = Teuchos::getValue<RCP<Matrix > > (levelListEntry->second);
164 level->Set(name, mat, NoFactory::get());
165 M->SetFactory(name, NoFactory::getRCP()); // TAW: not sure about this: be aware that this affects all levels
166 // However, A is accessible through NoFactory anyway, so it should
167 // be fine here.
168 }
169 else if(name == "P" || name == "R" || name == "K" || name == "M" ) {
170 if (levelListEntry->second.isType<RCP<Operator> >()) {
171 RCP<Operator> mat;
172 mat = Teuchos::getValue<RCP<Operator> > (levelListEntry->second);
173
174 RCP<const FactoryBase> fact = M->GetFactory(name);
175 level->AddKeepFlag(name,fact.get(),MueLu::UserData);
176 level->Set(name, mat, fact.get());
177
178 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
179 level->Set(name, mat, NoFactory::get());
180 } else {
181 RCP<Matrix> mat;
182 if (levelListEntry->second.isType<std::string>())
183 // We might also want to read maps here.
184 mat = Xpetra::IO<Scalar,LocalOrdinal,GlobalOrdinal,Node>::Read(Teuchos::getValue<std::string>(levelListEntry->second), lib, comm);
185 else
186 mat = Teuchos::getValue<RCP<Matrix > > (levelListEntry->second);
187
188 RCP<const FactoryBase> fact = M->GetFactory(name);
189 level->AddKeepFlag(name,fact.get(),MueLu::UserData);
190 level->Set(name, mat, fact.get());
191
192 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
193 level->Set(name, mat, NoFactory::get());
194 }
195 }
196 else if (name == "D0" || name == "M1" || name == "Ms" || name == "M0inv" || name == "Pnodal" || name == "NodeMatrix" || name == "NodeAggMatrix") {
197 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
198 if (levelListEntry->second.isType<RCP<Operator> >())
199 level->Set(name, Teuchos::getValue<RCP<Operator> > (levelListEntry->second), NoFactory::get());
200 else
201 level->Set(name, Teuchos::getValue<RCP<Matrix> > (levelListEntry->second), NoFactory::get());
202 }
203 else if (name == "Mdiag")
204 {
205 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
206 level->Set(name, Teuchos::getValue<RCP<Vector > > (levelListEntry->second), NoFactory::get());
207 }
208 else if (name == "Nullspace")
209 {
210 RCP<MultiVector> vec;
211 if (levelListEntry->second.isType<std::string>()) {
212 TEUCHOS_ASSERT(level->IsAvailable("A"));
213 RCP<Matrix> mat;
214 level->Get("A", mat);
215 auto map = mat->getMap();
216 vec = Xpetra::IO<Scalar,LocalOrdinal,GlobalOrdinal,Node>::ReadMultiVector(Teuchos::getValue<std::string>(levelListEntry->second), map);
217 } else
218 vec = Teuchos::getValue<RCP<MultiVector> > (levelListEntry->second);
219 level->AddKeepFlag(name, NoFactory::get(), MueLu::UserData);
220 level->Set(name, vec, NoFactory::get());
221 //M->SetFactory(name, NoFactory::getRCP()); // TAW: generally it is a bad idea to overwrite the factory manager data here
222 // One should do this only in very special cases
223 }
224 else if(name == "Coordinates") //Scalar of Coordinates MV is always double
225 {
226 RCP<realvaluedmultivector_type> vec;
227 if (levelListEntry->second.isType<std::string>()) {
228 TEUCHOS_ASSERT(level->IsAvailable("A"));
229 RCP<Matrix> mat;
230 level->Get("A", mat);
231 size_t blkSize = mat->GetFixedBlockSize();
232 RCP<const Map> nodeMap = mat->getRowMap();
233 if (blkSize > 1) {
234 // Create a nodal map, as coordinates have not been expanded to a DOF map yet.
235 RCP<const Map> dofMap = mat->getRowMap();
236 GO indexBase = dofMap->getIndexBase();
237 size_t numLocalDOFs = dofMap->getLocalNumElements();
238 TEUCHOS_TEST_FOR_EXCEPTION(numLocalDOFs % blkSize, Exceptions::RuntimeError,
239 "HierarchyUtils: block size (" << blkSize << ") is incompatible with the number of local dofs in a row map (" << numLocalDOFs);
240 ArrayView<const GO> GIDs = dofMap->getLocalElementList();
241
242 Array<GO> nodeGIDs(numLocalDOFs/blkSize);
243 for (size_t i = 0; i < numLocalDOFs; i += blkSize)
244 nodeGIDs[i/blkSize] = (GIDs[i] - indexBase)/blkSize + indexBase;
245
246 Xpetra::global_size_t INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
247 nodeMap = MapFactory::Build(dofMap->lib(), INVALID, nodeGIDs(), indexBase, dofMap->getComm());
248 }
249 vec = Xpetra::IO<typename Teuchos::ScalarTraits<Scalar>::coordinateType,LocalOrdinal,GlobalOrdinal,Node>::ReadMultiVector(Teuchos::getValue<std::string>(levelListEntry->second), nodeMap);
250 } else
251 vec = Teuchos::getValue<RCP<realvaluedmultivector_type > > (levelListEntry->second);
252 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
253 level->Set(name, vec, NoFactory::get());
254 //M->SetFactory(name, NoFactory::getRCP()); // TAW: generally it is a bad idea to overwrite the factory manager data here
255 }
256 else if(name == "Node Comm")
257 {
258 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
259 level->Set(name, Teuchos::getValue<RCP<const Teuchos::Comm<int> > >(levelListEntry->second), NoFactory::get());
260 }
261 else if(name == "DualNodeID2PrimalNodeID")
262 {
263 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
264 level->Set(name, Teuchos::getValue<RCP<std::map<LO, LO>>>(levelListEntry->second), NoFactory::get());
265 }
266 else if(name == "Primal interface DOF map")
267 {
268 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
269 level->Set(name, Teuchos::getValue<RCP<const Map>>(levelListEntry->second), NoFactory::get());
270 }
271#ifdef HAVE_MUELU_INTREPID2
272 else if (name == "pcoarsen: element to node map")
273 {
274 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
275 level->Set(name, Teuchos::getValue<RCP<Kokkos::DynRankView<LocalOrdinal,typename Node::device_type> > >(levelListEntry->second), NoFactory::get());
276 }
277#endif
278 else
279#ifdef HAVE_MUELU_MATLAB
280 {
281 //Custom variable for Muemex
282 size_t typeNameStart = name.find_first_not_of(' ');
283 size_t typeNameEnd = name.find(' ', typeNameStart);
284 std::string typeName = name.substr(typeNameStart, typeNameEnd - typeNameStart);
285 std::transform(typeName.begin(), typeName.end(), typeName.begin(), ::tolower);
286 level->AddKeepFlag(name, NoFactory::get(), MueLu::UserData);
287 if(typeName == "matrix")
288 level->Set(name, Teuchos::getValue<RCP<Matrix> >(levelListEntry->second), NoFactory::get());
289 else if(typeName == "multivector")
290 level->Set(name, Teuchos::getValue<RCP<MultiVector> >(levelListEntry->second), NoFactory::get());
291 else if(typeName == "map")
292 level->Set(name, Teuchos::getValue<RCP<Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > >(levelListEntry->second), NoFactory::get());
293 else if(typeName == "ordinalvector")
294 level->Set(name, Teuchos::getValue<RCP<Xpetra::Vector<LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node> > >(levelListEntry->second), NoFactory::get());
295 else if(typeName == "scalar")
296 level->Set(name, Teuchos::getValue<Scalar>(levelListEntry->second), NoFactory::get());
297 else if(typeName == "double")
298 level->Set(name, Teuchos::getValue<double>(levelListEntry->second), NoFactory::get());
299 else if(typeName == "complex")
300 level->Set(name, Teuchos::getValue<std::complex<double> >(levelListEntry->second), NoFactory::get());
301 else if(typeName == "int")
302 level->Set(name, Teuchos::getValue<int>(levelListEntry->second), NoFactory::get());
303 else if(typeName == "string")
304 level->Set(name, Teuchos::getValue<std::string>(levelListEntry->second), NoFactory::get());
305 }
306#else
307 {
308 throw std::runtime_error("Invalid non-serializable data on list");
309 }
310#endif
311 }
312 } else if (nonSerialList.isSublist(levelName) && levelName.find("user data") != std::string::npos) {
313 // So far only put data on level 0
314 int levelID = 0;
315 RCP<Level> level = H.GetLevel(levelID);
316
317 RCP<FactoryManager> M = Teuchos::rcp_dynamic_cast<FactoryManager>(HM.GetFactoryManager(levelID));
318 TEUCHOS_TEST_FOR_EXCEPTION(M.is_null(), Exceptions::InvalidArgument, "MueLu::Utils::AddNonSerializableDataToHierarchy: cannot get FactoryManager");
319
320 // Grab the user data sublist & loop over parameters
321 const ParameterList& userList = nonSerialList.sublist(levelName);
322 for (ParameterList::ConstIterator userListEntry = userList.begin(); userListEntry != userList.end(); userListEntry++) {
323 const std::string& name = userListEntry->first;
324 TEUCHOS_TEST_FOR_EXCEPTION(name != "P" && name != "R" && name != "K" && name != "M" && name != "Mdiag" &&
325 name != "D0" && name != "M1" && name != "Ms" && name != "M0inv" &&
326 name != "Nullspace" && name != "Coordinates" && name != "pcoarsen: element to node map" &&
327 name != "Node Comm" && name != "DualNodeID2PrimalNodeID" && name != "Primal interface DOF map" &&
328 name != "output stream" &&
330 std::string("MueLu::Utils::AddNonSerializableDataToHierarchy: user data parameter list contains unknown data type (") + name + ")");
331 if( name == "P" || name == "R" || name == "K" || name == "M" || name == "D0" || name == "M1" || name == "Ms" || name == "M0inv" ) {
332 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
333 level->Set(name, Teuchos::getValue<RCP<Matrix > > (userListEntry->second), NoFactory::get());
334 } else if (name == "Mdiag") {
335 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
336 level->Set(name, Teuchos::getValue<RCP<Vector > >(userListEntry->second), NoFactory::get());
337 } else if (name == "Nullspace") {
338 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
339 level->Set(name, Teuchos::getValue<RCP<MultiVector > >(userListEntry->second), NoFactory::get());
340 //M->SetFactory(name, NoFactory::getRCP()); // TAW: generally it is a bad idea to overwrite the factory manager data here
341 // One should do this only in very special cases
342 } else if(name == "Coordinates") {//Scalar of Coordinates MV is always double
343 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
344 level->Set(name, Teuchos::getValue<RCP<realvaluedmultivector_type> >(userListEntry->second), NoFactory::get());
345 }
346 else if(name == "Node Comm") {
347 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
348 level->Set(name, Teuchos::getValue<RCP<const Teuchos::Comm<int> > >(userListEntry->second), NoFactory::get());
349 }
350 else if(name == "DualNodeID2PrimalNodeID")
351 {
352 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
353 level->Set(name, Teuchos::getValue<RCP<std::map<LO, LO>>>(userListEntry->second), NoFactory::get());
354 }
355 else if(name == "Primal interface DOF map")
356 {
357 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
358 level->Set(name, Teuchos::getValue<RCP<const Map>>(userListEntry->second), NoFactory::get());
359 }
360#ifdef HAVE_MUELU_INTREPID2
361 else if (name == "pcoarsen: element to node map")
362 {
363 level->AddKeepFlag(name,NoFactory::get(),MueLu::UserData);
364 level->Set(name, Teuchos::getValue<RCP<Kokkos::DynRankView<LocalOrdinal,typename Node::device_type> > >(userListEntry->second), NoFactory::get());
365 }
366#endif
367 else if (name == "output stream")
368 {
369 H.SetMueLuOStream(Teuchos::getValue<RCP<Teuchos::FancyOStream> >(userListEntry->second));
370 }
371 else {
372 //Custom variable
373 size_t typeNameStart = name.find_first_not_of(' ');
374 size_t typeNameEnd = name.find(' ', typeNameStart);
375 std::string typeName = name.substr(typeNameStart, typeNameEnd - typeNameStart);
376 size_t varNameStart = name.find_first_not_of(' ', typeNameEnd);
377 std::string varName = name.substr(varNameStart, name.size());
378 std::transform(typeName.begin(), typeName.end(), typeName.begin(), ::tolower);
379 level->AddKeepFlag(varName, NoFactory::get(), MueLu::UserData);
380 if(typeName == "matrix")
381 level->Set(varName, Teuchos::getValue<RCP<Matrix> >(userListEntry->second), NoFactory::get());
382 else if(typeName == "multivector")
383 level->Set(varName, Teuchos::getValue<RCP<MultiVector> >(userListEntry->second), NoFactory::get());
384 else if(typeName == "vector")
385 level->Set(varName, Teuchos::getValue<RCP<Vector> >(userListEntry->second), NoFactory::get());
386 else if(typeName == "map")
387 level->Set(varName, Teuchos::getValue<RCP<Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > >(userListEntry->second), NoFactory::get());
388 else if(typeName == "ordinalvector")
389 level->Set(varName, Teuchos::getValue<RCP<Xpetra::Vector<LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node> > >(userListEntry->second), NoFactory::get());
390 else if(typeName == "scalar")
391 level->Set(varName, Teuchos::getValue<Scalar>(userListEntry->second), NoFactory::get());
392 else if(typeName == "double")
393 level->Set(varName, Teuchos::getValue<double>(userListEntry->second), NoFactory::get());
394 else if(typeName == "complex")
395 level->Set(varName, Teuchos::getValue<std::complex<double> >(userListEntry->second), NoFactory::get());
396 else if(typeName == "int")
397 level->Set(varName, Teuchos::getValue<int>(userListEntry->second), NoFactory::get());
398 else if(typeName == "string")
399 level->Set(varName, Teuchos::getValue<std::string>(userListEntry->second), NoFactory::get());
400 else if(typeName == "array<go>")
401 level->Set(varName, Teuchos::getValue<Array<GlobalOrdinal> > (userListEntry->second), NoFactory::get());
402 else if(typeName == "array<lo>")
403 level->Set(varName, Teuchos::getValue<Array<LocalOrdinal> >(userListEntry->second), NoFactory::get());
404 else if(typeName == "arrayrcp<lo>")
405 level->Set(varName, Teuchos::getValue<ArrayRCP<LocalOrdinal> >(userListEntry->second), NoFactory::get());
406 else if(typeName == "arrayrcp<go>")
407 level->Set(varName, Teuchos::getValue<ArrayRCP<GlobalOrdinal> >(userListEntry->second), NoFactory::get());
408 else
409 throw std::runtime_error("Invalid non-serializable data on list");
410 }
411 }
412 // level->print(std::cout, MueLu::Debug);
413 }
414 }
415 }
416} // namespace MueLu
417
418#define MUELU_HIERARCHY_UTILS_SHORT
419#endif // MUELU_HIERARCHYHELPERS_DEF_HPP
MueLu::DefaultLocalOrdinal LocalOrdinal
MueLu::DefaultGlobalOrdinal GlobalOrdinal
MueLu::DefaultNode Node
Exception throws to report invalid user entry.
Exception throws to report errors in the internal logical of the program.
RCP< FactoryManagerBase > GetFactoryManager(int levelID) const
static void AddNonSerializableDataToHierarchy(HierarchyManager &HM, Hierarchy &H, const ParameterList &nonSerialList)
Add non-serializable data to Hierarchy.
static void CopyBetweenHierarchies(Hierarchy &fromHierarchy, Hierarchy &toHierarchy, const std::string fromLabel, const std::string toLabel, const std::string dataType)
Provides methods to build a multigrid hierarchy and apply multigrid cycles.
RCP< Level > & GetLevel(const int levelID=0)
Retrieve a certain level from hierarchy.
void AddNewLevel()
Add a new level at the end of the hierarchy.
static const RCP< const NoFactory > getRCP()
Static Get() functions.
static const NoFactory * get()
static void SetMueLuOStream(const Teuchos::RCP< Teuchos::FancyOStream > &mueluOStream)
Namespace for MueLu classes and methods.
bool IsParamMuemexVariable(const std::string &name)
@ UserData
User data are always kept. This flag is set automatically when Level::Set("data", data) is used....
bool IsParamValidVariable(const std::string &name)