Wildmeshing Toolkit
Loading...
Searching...
No Matches
import_cache.cpp
Go to the documentation of this file.
1
#include "
import_cache.hpp
"
2
3
#include <
wmtk/components/utils/resolve_path.hpp
>
4
#include <
wmtk/utils/Logger.hpp
>
5
6
#include "
ImportCacheOptions.hpp
"
7
8
namespace
wmtk::components
{
9
10
void
import_cache
(
const
utils::Paths& paths,
const
nlohmann::json& j,
io::Cache
& cache)
11
{
12
using namespace
internal
;
13
14
ImportCacheOptions
options = j.get<
ImportCacheOptions
>();
15
16
std::string import_location =
17
wmtk::utils::resolve_path(options.
folder
.string(), paths.root_path);
18
19
if
(!std::filesystem::exists(import_location)) {
20
log_and_throw_error
(
"Cannot import cache, folder {} does not exist"
, import_location);
21
}
22
23
if
(!cache.
import_cache
(import_location)) {
24
log_and_throw_error
(
"Could not import cache from {}"
, import_location);
25
}
26
}
27
}
// namespace wmtk::components
ImportCacheOptions.hpp
Logger.hpp
wmtk::io::Cache
Definition
Cache.hpp:13
wmtk::io::Cache::import_cache
bool import_cache(const std::filesystem::path &import_location)
Import a cache from the given location.
Definition
Cache.cpp:263
import_cache.hpp
internal
Definition
local_switch_tuple.hpp:11
wmtk::components
Definition
bicubic_interpolation.cpp:5
wmtk::components::import_cache
void import_cache(const utils::Paths &paths, const nlohmann::json &j, io::Cache &cache)
Definition
import_cache.cpp:10
wmtk::log_and_throw_error
void log_and_throw_error(const std::string &msg)
Definition
Logger.cpp:101
resolve_path.hpp
wmtk::components::internal::ImportCacheOptions
Definition
ImportCacheOptions.hpp:12
wmtk::components::internal::ImportCacheOptions::folder
std::filesystem::path folder
Definition
ImportCacheOptions.hpp:13
components
import_cache
wmtk
components
import_cache
import_cache.cpp
Generated by
1.9.8