|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
| std::vector< std::string > MayaFlux::Buffers::VolumeGridBuffer::ensure_fields | ( | const std::vector< FieldDecl > & | decls | ) |
Declare whichever of decls are not already present.
Built for a buffer whose fields were not all declared by the same call: IOManager::load_volume declares one field per grid a file reported, and a caller then wanting to run a simulation over that data needs velocity, pressure and the rest besides. Declaring those blind risks exactly what allocate_field already logs an error for — a name the file also happened to use, silently discarded, cascading into an empty-name ref everywhere that field is passed next. This checks first, so a name already present — whether reported by a loader or declared earlier by hand, nothing here distinguishes the two — is left alone rather than collided with.
A caller who wants a ScalarRef/VectorRef for an entry already present builds one directly: ScalarRef{name, owner} from its own name and this buffer, the same way declare_scalar builds the ref for a field it also just allocated. This does not return refs itself, since FieldDecl does not distinguish scalar from vector cleanly enough to hand back a uniformly typed collection.
| decls | Fields to ensure exist. Semantics and stride only take effect for an entry actually declared here; an entry already present keeps whatever it already has. |
Definition at line 201 of file VolumeGridBuffer.cpp.
References allocate_field(), MayaFlux::Journal::Buffers, has_field(), MayaFlux::Journal::Init, and MF_DEBUG.
Here is the call graph for this function: