| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Galeri: Finite Element and Matrix Generation Package |
| 4 |
// |
| 5 |
// Copyright 2006 ETHZ/NTESS and the Galeri contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
/* |
| 10 |
Direct translation of parts of Galeri matrix generator. |
| 11 |
*/ |
| 12 |
#ifndef ADRPROBLEMFACTORY_HPP |
| 13 |
#define ADRPROBLEMXFACTORY_HPP |
| 14 |
|
| 15 |
#include <Teuchos_ParameterList.hpp> |
| 16 |
#include <Teuchos_Assert.hpp> |
| 17 |
|
| 18 |
#include "ADR_Problem.hpp" |
| 19 |
#include "CreateADRMatrix.hpp" |
| 20 |
|
| 21 |
#include <iostream> |
| 22 |
|
| 23 |
namespace ADR { |
| 24 |
|
| 25 |
namespace Xpetra { |
| 26 |
|
| 27 |
using Teuchos::RCP; |
| 28 |
|
| 29 |
template <typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Map, typename Matrix, typename MultiVector> |
| 30 |
RCP<Problem<Map, Matrix, MultiVector> > BuildProblem(const std::string& MatrixType, const RCP<const Map>& map, Teuchos::ParameterList& list) { |
| 31 |
RCP<Problem<Map, Matrix, MultiVector> > P; |
| 32 |
|
| 33 |
if (MatrixType == "ADR1D") |
| 34 |
P.reset(new ADR1DProblem<Scalar, LocalOrdinal, GlobalOrdinal, Map, Matrix, MultiVector>(list, map)); |
| 35 |
else if (MatrixType == "ADR2D") |
| 36 |
P.reset(new ADR2DProblem<Scalar, LocalOrdinal, GlobalOrdinal, Map, Matrix, MultiVector>(list, map)); |
| 37 |
else if (MatrixType == "ADR3D") |
| 38 |
P.reset(new ADR3DProblem<Scalar, LocalOrdinal, GlobalOrdinal, Map, Matrix, MultiVector>(list, map)); |
| 39 |
|
| 40 |
else |
| 41 |
TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, |
| 42 |
"`MatrixType' has incorrect value (" << MatrixType << ") in input to function CreateCrsMatrix()." |
| 43 |
<< "Check the documentation for a list of valid choices"); |
| 44 |
|
| 45 |
P->setObjectLabel(MatrixType); |
| 46 |
|
| 47 |
return P; |
| 48 |
} |
| 49 |
|
| 50 |
} // namespace Xpetra |
| 51 |
|
| 52 |
} // namespace ADR |
| 53 |
|
| 54 |
#endif // ifndef ADRPROBLEMFACTORY_HPP |