| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// MueLu: A package for multigrid based preconditioning |
| 4 |
// |
| 5 |
// Copyright 2012 NTESS and the MueLu contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#include <Teuchos_UnitTestRepository.hpp> |
| 11 |
|
| 12 |
#include "MueLu_TestHelpers_kokkos.hpp" |
| 13 |
|
| 14 |
namespace MueLuTests { |
| 15 |
|
| 16 |
// static members initialization of the class TestHelpers::Parameters |
| 17 |
Xpetra::Parameters TestHelpers_kokkos::Parameters::xpetraParameters = Xpetra::Parameters(Teuchos::UnitTestRepository::getCLP()); |
| 18 |
|
| 19 |
} // namespace MueLuTests |
| 20 |
|
| 21 |
namespace MueLuTests { |
| 22 |
namespace TestHelpers_kokkos { |
| 23 |
|
| 24 |
ArrayRCP<std::string> GetFileList(const std::string& dirPath, const std::string& filter) { |
| 25 |
RCP<std::vector<std::string> > files = rcp(new std::vector<std::string>()); |
| 26 |
|
| 27 |
DIR* dir = opendir(dirPath.c_str()); |
| 28 |
TEUCHOS_TEST_FOR_EXCEPTION(dir == NULL, MueLu::Exceptions::RuntimeError, "GetFileList(\"" + dirPath + "\") : " + strerror(errno)); |
| 29 |
|
| 30 |
struct dirent* dirEntry; |
| 31 |
while ((dirEntry = readdir(dir)) != NULL) { |
| 32 |
std::string dirEntryS(dirEntry->d_name); |
| 33 |
|
| 34 |
size_t pos = dirEntryS.rfind(filter); |
| 35 |
if (pos != std::string::npos && pos + filter.size() == dirEntryS.size()) |
| 36 |
files->push_back(std::string(dirEntryS)); |
| 37 |
} |
| 38 |
|
| 39 |
closedir(dir); |
| 40 |
|
| 41 |
return arcp(files); |
| 42 |
} |
| 43 |
|
| 44 |
} // namespace TestHelpers_kokkos |
| 45 |
} // namespace MueLuTests |