MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ save_volume() [1/2]

bool MayaFlux::IO::IOManager::save_volume ( const std::shared_ptr< Buffers::VolumeGridBuffer > &  volume,
const std::string &  filepath,
const IO::VolumeWriteOptions &  options = {},
const std::vector< std::string > &  field_names = {} 
)

Download and save a GPU-resident volume to disk asynchronously.

Mirrors save_image(VKImage): download, writer lookup and write all happen inside the dispatched task, so this returns as soon as the task is queued rather than blocking the caller. The future is tracked in the same pool as every other save task; wait_for_pending_saves() waits on it like any other.

Parameters
volumeVolume to read from.
filepathDestination path; extension selects the writer.
optionsWriter options.
field_namesFields to save. Empty means every declared field.
Returns
True once the task is queued. Download or write failure is logged from the task and does not surface here.

Definition at line 1329 of file IOManager.cpp.

1334{
1335 if (!volume) {
1337 "save_volume: null volume");
1338 return false;
1339 }
1340
1341 track_save_task(std::async(std::launch::async,
1342 [volume, filepath, options, field_names]() -> bool {
1343 auto data = IO::download_volume(volume, field_names);
1344 if (!data) {
1346 "save_volume task: download failed for '{}'", filepath);
1347 return false;
1348 }
1349
1350 return Detail::execute_volume_write(filepath, *data, options);
1351 }));
1352
1353 return true;
1354}
#define MF_ERROR(comp, ctx,...)
void track_save_task(std::future< bool > fut)
Retain a save task in m_save_tasks and opportunistically reclaim finished ones.
bool execute_volume_write(const std::string &filepath, const Kakshya::VolumeData &data, const VolumeWriteOptions &options)
std::optional< Kakshya::VolumeData > download_volume(const std::shared_ptr< Buffers::VolumeGridBuffer > &volume, const std::vector< std::string > &field_names)
Download named fields from a GPU-resident volume into host VolumeData.
@ FileIO
Filesystem I/O operations.
@ IO
Networking, file handling, streaming.

References MayaFlux::IO::download_volume(), MayaFlux::IO::Detail::execute_volume_write(), MayaFlux::Journal::FileIO, MayaFlux::Journal::IO, MF_ERROR, and track_save_task().

+ Here is the call graph for this function: