libvcad_compilers — compiler classes#
-
class CompilerBase#
- #include <compiler_base.h>
Abstract base of every OpenVCAD compiler.
A compiler turns a node tree into an output format (slice images, archives, meshes, slicer projects, VDB grids). Each concrete compiler stores its root and settings at construction and does all work in compile(), which prepares the root itself. The base class owns the progress/status callbacks, cancellation, voxel-culling switches and the export statistics printed by report_stats().
Subclassed by ColorInkjetCompiler, GCVFCompiler, MaterialInkjetCompiler, MultiMaterialVatCompiler, MyersonCompiler, SimulationCompiler, SlicerProjectCompiler, VatCompiler, VdbCompiler
Public Functions
-
void cancel()#
Requests that a running compile() stop.
Thread-safe. compile() throws std::runtime_error(“Cancelled”) at its next check.
-
virtual void compile() = 0#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
-
CompilerBase() = default#
Default constructor.
-
bool culling_enabled() const#
Returns true unless set_culling_enabled(false) was called.
- Returns:
Whether culling is enabled.
-
CullingStats culling_stats() const#
Culling counts from the most recent compile(); inactive for compilers that do not cull.
- Returns:
The culling statistics.
-
void report_stats() const#
Prints the statistics of the most recent successful compile() to stdout.
Throws std::runtime_error if no compile() has finished.
-
void set_culling_enabled(bool enabled)#
Switches skipping of voxels proven empty on or off (on by default).
Culling never changes the output; turning it off is for A/B tests and debugging. The environment variable OPENVCAD_DISABLE_CULLING=1 also turns it off.
- Parameters:
enabled – False to sample every voxel.
-
void set_progress_callback(const std::function<void(double)> &progress_callback)#
Sets the callback that receives compile progress.
Values run from 0.0 to 1.0. They may be reported from worker threads. A cancelled or failed compile stops without reaching 1.0.
- Parameters:
progress_callback – Called with the current progress fraction.
-
void set_status_callback(const std::function<void(const std::string&)> &status_callback)#
Sets a callback for human-readable compiler stage updates.
- Parameters:
status_callback – Called with a short description of the current stage.
-
virtual std::vector<std::string> supported_attributes() const = 0#
Returns the attribute names this compiler works with.
The meaning depends on the compiler. MaterialInkjetCompiler, ColorInkjetCompiler, MyersonCompiler and SimulationCompiler (its direct_attributes) require the root to carry every listed attribute and throw at compile() otherwise. VatCompiler and MultiMaterialVatCompiler list the attribute they sample. The slicer project compilers list every attribute they understand. VdbCompiler and GCVFCompiler return an empty list.
- Returns:
Attribute names, possibly empty.
-
virtual ~CompilerBase() = default#
Virtual destructor.
Protected Types
-
using StatsClock = std::chrono::steady_clock#
Clock used for the prepare and export timings.
Protected Functions
-
void add_export_time(double seconds)#
Adds to the recorded export time.
- Parameters:
seconds – Seconds to add.
-
void add_prepare_time(double seconds)#
Adds to the recorded prepare time.
- Parameters:
seconds – Seconds to add.
-
LayerCuller::Options culling_options(bool y_fastest = false) const#
Culling options for this compile, honouring set_culling_enabled().
- Parameters:
y_fastest – True for loops with y innermost (mask index y + x * y_dim).
- Returns:
Options to pass to LayerCuller.
-
void finish_stats()#
Finalizes the thread count and marks the statistics valid for report_stats().
-
bool is_cancelled() const#
Returns true once cancel() has been called.
- Returns:
Whether a cancel is pending.
-
void merge_thread_count(size_t thread_count)#
Raises the recorded thread count to at least thread_count.
- Parameters:
thread_count – Number of threads used by a stage.
-
void merge_thread_usage(const ThreadUsageTracker &thread_usage_tracker)#
Merges the threads seen by another tracker into this compiler’s tracker.
- Parameters:
thread_usage_tracker – Tracker to merge.
-
void record_current_thread()#
Records the calling thread in the thread tracker.
-
void report_progress(double progress)#
Forwards a progress fraction to the progress callback, if set.
- Parameters:
progress – Progress in [0, 1].
-
void report_status(const std::string &status)#
Forwards a stage message to the status callback, if set.
- Parameters:
status – Human-readable stage description.
-
void reset_stats()#
Clears the export statistics, thread tracker and culling counts.
-
void set_culling_stats(const CullingStats &stats)#
Stores the counts of a culled sampling pass for culling_stats() and report_stats().
- Parameters:
stats – Counts from the LayerCuller.
-
void set_sample_stats(glm::vec3 sample_size, glm::vec3 bbox_size, size_t sample_count_x, size_t sample_count_y, size_t sample_count_z)#
Records the sample grid used by this compile.
- Parameters:
sample_size – Sample (voxel) size in mm.
bbox_size – Size of the sampled domain in mm.
sample_count_x – Samples along x.
sample_count_y – Samples along y.
sample_count_z – Samples along z.
-
ThreadUsageTracker &thread_usage_tracker()#
Returns the tracker of threads that did work in this compile.
- Returns:
Mutable tracker.
-
const ThreadUsageTracker &thread_usage_tracker() const#
Returns the tracker of threads that did work in this compile.
- Returns:
Read-only tracker.
-
void throw_if_cancelled() const#
Throws std::runtime_error(“Cancelled”) if cancel() has been called.
Throws std::runtime_error if the root lacks any attribute from supported_attributes().
Does nothing when supported_attributes() is empty.
- Parameters:
root – Root whose attribute_list() is checked.
Protected Attributes
-
std::function<void(double)> m_progress_callback = nullptr#
Set by set_progress_callback().
-
std::function<void(const std::string&)> m_status_callback = nullptr#
Set by set_status_callback().
Protected Static Functions
-
static double elapsed_seconds(const StatsClock::time_point &start)#
Seconds elapsed from start until now.
- Parameters:
start – Start time.
- Returns:
Elapsed seconds.
-
static double elapsed_seconds(const StatsClock::time_point &start, const StatsClock::time_point &end)#
Seconds elapsed from start to end.
- Parameters:
start – Start time.
end – End time.
- Returns:
Elapsed seconds.
-
static const ExportStats &stats_for(const CompilerBase &compiler)#
Returns another compiler’s statistics (used by meta-compilers such as GCVFCompiler).
- Parameters:
compiler – Compiler to read.
- Returns:
Its export statistics.
Private Members
-
bool m_culling_enabled = true#
-
CullingStats m_culling_stats#
-
ExportStats m_export_stats#
-
ThreadUsageTracker m_thread_usage_tracker#
-
struct ExportStats#
- #include <compiler_base.h>
Statistics of one compile(), printed by report_stats().
Public Members
-
glm::vec3 bbox_size = glm::vec3(0.0f)#
Size of the sampled domain in mm.
-
double export_time_seconds = 0.0#
Total time spent sampling and writing.
-
double prepare_time_seconds = 0.0#
Total time spent in prepare().
-
size_t sample_count = 0#
Product of the three per-axis counts.
-
size_t sample_count_x = 0#
Samples along x.
-
size_t sample_count_y = 0#
Samples along y.
-
size_t sample_count_z = 0#
Samples along z.
-
glm::vec3 sample_size = glm::vec3(0.0f)#
Sample (voxel) size in mm.
-
size_t thread_count = 0#
Number of threads that did work.
-
bool valid = false#
True once finish_stats() has run.
-
glm::vec3 bbox_size = glm::vec3(0.0f)#
-
void cancel()#
Enums
-
enum class MaterialInkjetExportMode#
Selects how volume fractions are quantized into discrete material voxels.
Values:
-
enumerator stochastic#
Independently sample each voxel from its local volume fractions.
-
enumerator dithered_3d#
Deterministically diffuse quantization error across the 3D voxel grid.
-
enumerator stochastic#
-
class MaterialInkjetCompiler : public CompilerBase#
- #include <material_inkjet_compiler.h>
Compiles VOLUME_FRACTIONS into material-coded PolyJet slice images.
Each inside voxel is assigned one material from its volume fractions and drawn in that material’s MaterialDefs color. Each layer is written as an RGBA PNG named
<file_prefix><z>.pngin the output directory; empty leading and trailing layers are removed and the rest renumbered from 0.Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
-
std::vector<std::string> liquid_keep_out_materials() const#
Returns the user-set keep-out material names (empty means the default liquid material).
- Returns:
The names passed to set_liquid_keep_out_materials().
-
std::unordered_map<uint8_t, size_t> material_voxel_counts() const#
Returns how many voxels each material ID received in the last compile().
- Returns:
Map from material ID to voxel count.
Constructs a material inkjet compiler.
- Parameters:
root – Root node of the design; compile() prepares it.
voxel_size – Voxel size in mm (can be anisotropic).
output_directory – Folder for the PNG slices; created if missing.
file_prefix – File name prefix; slice z is written as
<file_prefix><z>.png.material_defs – Material definitions that give each material ID its color.
liquid_keep_out_distance – Distance in mm from the surface within which the keep-out materials are removed (see set_liquid_keep_out_materials()). 0 disables it.
export_mode – Stochastic or 3D-dithered material assignment.
-
std::tuple<size_t, size_t, size_t> resolution() const#
Returns the slice resolution of the last compile().
- Returns:
(x, y, z) in voxels, where z counts the layers kept after trimming.
-
void set_fallback_material_id(uint8_t material_id)#
Sets the fallback material ID used for voxels where VOLUME_FRACTIONS is undefined.
Only used when strict mode is off.
- Parameters:
material_id – The fallback material ID (default is 0, the void material).
-
void set_liquid_keep_out_materials(const std::vector<std::string> &material_names)#
Sets the materials removed within the liquid keep-out distance of the surface.
Only used when liquid_keep_out_distance > 0. When the list is empty (default), the material named “liquid” (or “M.Cleanser”) is kept out. Every name must exist in the MaterialDefs or compile() throws.
- Parameters:
material_names – Names of the materials to keep out, in any number.
-
void set_strict_mode(bool strict)#
Enables or disables strict mode.
When strict mode is on, the compiler throws a std::runtime_error if any inside voxel is missing the required VOLUME_FRACTIONS attribute. When off (default), the fallback material is used instead.
- Parameters:
strict – True to throw on missing VOLUME_FRACTIONS.
Private Functions
-
void compile_dithered_3d()#
-
void compile_stochastic()#
-
std::vector<uint8_t> resolve_keep_out_material_ids() const#
Resolves the keep-out material names to IDs, falling back to the liquid material.
- Returns:
The material IDs to remove near the surface. Empty when keep-out is disabled.
Private Members
-
MaterialInkjetExportMode m_export_mode = MaterialInkjetExportMode::stochastic#
-
uint8_t m_fallback_material_id = 0#
-
std::string m_file_prefix#
-
double m_liquid_keep_out_distance#
-
std::vector<std::string> m_liquid_keep_out_materials#
-
std::shared_ptr<MaterialDefs> m_material_defs#
-
std::unordered_map<uint8_t, size_t> m_material_voxel_counts#
-
std::string m_output_directory#
-
bool m_strict_mode = false#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
-
virtual void compile() override#
Enums
-
class ColorInkjetCompiler : public CompilerBase#
- #include <color_inkjet_compiler.h>
Compiles COLOR_RGBA into full-color PolyJet slice images.
Each inside voxel’s sRGBA color goes through a ColorPipeline (gamma, ICC profile, CMYK affinity) and is assigned one ink (cyan, magenta, yellow, black, white or clear). Each layer is written as an RGBA PNG named
<file_prefix><z>.pngin the output directory; empty leading and trailing layers are removed and the rest renumbered from 0.Public Functions
Constructs a color inkjet compiler.
- Parameters:
root – Root node of the design; compile() prepares it.
voxel_size – Voxel size in mm (can be anisotropic).
output_directory – Folder for the PNG slices; created if missing.
file_prefix – File name prefix; slice z is written as
<file_prefix><z>.png.icc_profile – ICC profile name from ColorPipeline::get_icc_profiles().
export_mode – Stochastic or 3D-dithered ink assignment.
color_pipeline_options – Steps of the color correction pipeline to run.
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
-
std::tuple<size_t, size_t, size_t> resolution() const#
Returns the slice resolution of the last compile().
- Returns:
(x, y, z) in voxels, where z counts the layers kept after trimming.
-
void set_fallback_color(glm::vec4 color)#
Sets the fallback RGBA color used for voxels where COLOR_RGBA is undefined.
Each component is in [0, 1]. Only used when strict mode is off.
- Parameters:
color – The fallback sRGBA color (default is fully transparent: 0,0,0,0).
-
void set_strict_mode(bool strict)#
Enables or disables strict mode.
When strict mode is on, the compiler throws a std::runtime_error if any inside voxel is missing the required COLOR_RGBA attribute. When off (default), the fallback color is used instead.
- Parameters:
strict – True to throw on missing COLOR_RGBA.
Private Members
-
ColorPipelineOptions m_color_pipeline_options#
-
ColorInkjetExportMode m_export_mode = ColorInkjetExportMode::stochastic#
-
glm::vec4 m_fallback_color = glm::vec4(0.0f, 0.0f, 0.0f, 0.0f)#
-
std::string m_file_prefix#
-
std::string m_icc_profile#
-
std::string m_output_directory#
-
bool m_strict_mode = false#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
Enums
-
enum class GCVFBackend#
Selects which slice backend a GCVF export uses.
Values:
-
enumerator automatic#
Pick from the design’s attributes; fails if it has both volume_fractions and color_rgba.
-
enumerator material#
Resolve volume_fractions through MaterialInkjetCompiler.
-
enumerator color#
Resolve color_rgba through ColorInkjetCompiler.
-
enumerator automatic#
-
class GCVFCompiler : public CompilerBase#
- #include <gcvf_compiler.h>
Compiles an OpenVCAD node tree into a legacy Stratasys GCVF archive.
GCVFCompiler is a meta-compiler that selects either the MaterialInkjetCompiler or ColorInkjetCompiler backend, from the attributes advertised by the design or explicitly through set_backend() when the design carries both. It then packages the emitted PNG stack, z-buffer, STL mesh, bounding-box metadata, and XML configuration into a
.gcvfzip archive that matches the legacy exporter layout.Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
Constructs a GCVF compiler.
- Parameters:
root – Root node of the design tree.
voxel_size – Slice voxel size in millimeters. The XDpi, YDpi and SliceThicknessNanoMeter values in ConfigFile.xml are derived from it (round(25.4 / x), round(25.4 / y), round(z * 1e6)). The J750’s native resolution, (25.4 / 600, 25.4 / 300, 0.027) mm, is the usual choice.
output_file_path – Output
.gcvfpath.material_defs – Optional design material definitions. Required for
volume_fractionsworkflows and ignored forcolor_rgba.channel_material_map – Optional mapping from color channels to J750 material names. Keys are
cyan,magenta,yellow,black,white,clear, withkeyaccepted as an alias forblack.liquid_keep_out_distance – Optional liquid keep-out distance in millimeters. Only valid for
volume_fractions.mesh_voxel_size_override – Optional uniform voxel size override for mesh extraction. Use
0.0to keep the legacy heuristic.icc_profile – ICC profile name passed to ColorInkjetCompiler.
color_export_mode – ColorInkjetCompiler export mode for color backends.
color_pipeline_options – ColorPipelineOptions passed to ColorInkjetCompiler.
-
std::tuple<size_t, size_t, size_t> resolution() const#
Returns the emitted slice resolution as
(x, y, z).- Returns:
Resolution of the last compile(); zeros before it.
-
void set_backend(GCVFBackend backend)#
Chooses the slice backend instead of inferring it from the design.
Needed when a design has both volume_fractions and color_rgba; the attribute the chosen backend reads must be present or compile() throws.
- Parameters:
backend – The backend to use. Defaults to GCVFBackend::automatic.
-
void set_liquid_keep_out_materials(const std::vector<std::string> &material_names)#
Sets the materials removed within the liquid keep-out distance of the surface.
Forwarded to MaterialInkjetCompiler. When empty (default), the material named “liquid” (or “M.Cleanser”) is kept out.
- Parameters:
material_names – Names of design materials to keep out, in any number.
-
virtual std::vector<std::string> supported_attributes() const override#
Returns an empty list because backend validation is selected at runtime.
- Returns:
An empty list.
Private Functions
-
void cleanup() const#
-
void generate_bbox_file() const#
-
void generate_mesh()#
-
void generate_zbuffer_image()#
-
std::shared_ptr<MaterialDefs> load_canonical_j750_defs() const#
-
void prepare_temp_dir()#
-
void zip_files() const#
Private Members
-
std::unordered_map<std::string, std::string> m_channel_material_map#
-
std::unordered_map<std::string, std::uint64_t> m_color_channel_voxel_counts#
-
ColorInkjetExportMode m_color_export_mode = ColorInkjetExportMode::stochastic#
-
ColorPipelineOptions m_color_pipeline_options#
-
std::string m_icc_profile#
-
double m_liquid_keep_out_distance = 0.0#
-
std::vector<std::string> m_liquid_keep_out_materials#
-
std::shared_ptr<MaterialDefs> m_material_defs#
-
std::unordered_map<uint8_t, size_t> m_material_voxel_counts#
-
double m_mesh_voxel_size_override = 0.0#
-
std::string m_output_file_path#
-
GCVFBackend m_requested_backend = GCVFBackend::automatic#
-
std::string m_temp_path#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
Private Static Functions
-
static void validate_legacy_material_limits(const std::vector<MaterialEntry> &materials)#
-
struct MaterialEntry#
-
virtual void compile() override#
-
class MyersonCompiler : public CompilerBase#
- #include <myerson_compiler.h>
Generates per-material 1-bit BMP stacks for the legacy Myerson workflow.
This compiler consumes the VOLUME_FRACTIONS attribute and writes one bitmap stack per exported material. Each bitmap uses a fixed-width Myerson-style canvas, optional Y padding from taper/extra-width settings, and the legacy layer filename format. Each inside voxel gets one material by stochastic sampling of its volume fractions; a void (ID 0) pick leaves the voxel empty in every stack.
Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
Writes one folder per material found in the tree’s VOLUME_FRACTIONS attributes, with one bitmap per layer. Throws if the design is wider than MAX_IMAGE_WIDTH pixels.
Constructor preserving the legacy Myerson parameter surface.
- Parameters:
layer_height – Layer height in mm.
x_dpi – X resolution in dots per inch.
y_dpi – Y resolution in dots per inch.
taper_angle_deg – Taper angle in degrees.
extra_width – Additional per-side Y padding in mm.
output_path – Root output directory containing one subfolder per material.
root – Root node to compile; compile() prepares it.
material_defs – Material definitions used for folder naming and validation.
-
std::tuple<size_t, size_t, size_t> resolution() const#
Returns the exported bitmap resolution as (width, height, layers).
- Returns:
Resolution of the last compile(); zeros before it.
-
void set_fallback_material_id(uint8_t material_id)#
Sets the fallback material ID used for voxels where VOLUME_FRACTIONS is undefined.
Only used when strict mode is off.
The fallback must be one of the materials in the design’s VOLUME_FRACTIONS attributes (one of the exported folders). Otherwise compile() throws as soon as an inside voxel lacks VOLUME_FRACTIONS. The default, 0 (void), is never exported, so with the default every inside voxel needs VOLUME_FRACTIONS.
- Parameters:
material_id – The fallback material ID (default is 0, the void material).
-
void set_strict_mode(bool strict)#
Enables or disables strict mode.
When strict mode is on, the compiler throws a std::runtime_error if any inside voxel is missing the required VOLUME_FRACTIONS attribute. When off (default), the fallback material is used instead.
- Parameters:
strict – True to throw on missing VOLUME_FRACTIONS.
Public Static Attributes
-
static constexpr int MAX_IMAGE_WIDTH = 880#
Canvas width in pixels; narrower designs are centered on it, wider ones throw.
Private Functions
-
std::vector<unsigned char> center_and_pad_layer(const std::vector<unsigned char> &data, long original_width, long original_height, long y_padding, long output_width, long output_height) const#
Private Members
-
double m_extra_width = 0.0#
-
uint8_t m_fallback_material_id = 0#
-
std::shared_ptr<MaterialDefs> m_material_defs#
-
std::string m_output_path#
-
bool m_strict_mode = false#
-
double m_taper_angle_deg = 0.0#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
-
virtual void compile() override#
-
class VatCompiler : public CompilerBase#
- #include <vat_compiler.h>
Generates grayscale BMP slice stacks for vat-photo style printers.
This compiler consumes the scalar INTENSITY attribute in [0, 1] and maps it directly to 8-bit grayscale output. It can either sample the model bounding box or a fixed printer-volume XY canvas with the model centered in XY. Each layer is written as an 8-bit BMP named
<file_prefix><z>.bmp; empty leading and trailing layers are removed and the rest renumbered from 0.Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
-
std::tuple<size_t, size_t, size_t> resolution() const#
Returns the compiled slice resolution as (x, y, z_layers).
- Returns:
Resolution of the last compile(); z counts the layers kept after trimming.
-
void set_fallback_intensity(double intensity)#
Sets the fallback intensity used when INTENSITY is undefined.
The stored value is clamped into [0, 1]. The default is 1.0.
- Parameters:
intensity – The fallback exposure intensity.
-
void set_strict_mode(bool strict)#
Enables or disables strict mode for missing INTENSITY samples.
When on, compile() throws if an inside voxel has no INTENSITY. When off (default), the fallback intensity is used.
- Parameters:
strict – True to throw on missing INTENSITY.
-
virtual std::vector<std::string> supported_attributes() const override#
Returns {INTENSITY}, the attribute compile() samples.
Missing INTENSITY uses the fallback intensity unless strict mode is on.
- Returns:
The sampled attribute names.
Samples only the model bounding box.
- Parameters:
root – Root node of the design; compile() prepares it.
voxel_size – Voxel size in mm.
output_directory – Folder for the BMP slices; created if missing.
file_prefix – File name prefix; slice z is written as
<file_prefix><z>.bmp.
Samples a fixed printer-volume XY domain with centered XY placement.
compile() throws if the design’s bounding box is larger than printer_volume.
- Parameters:
root – Root node of the design; compile() prepares it.
voxel_size – Voxel size in mm.
printer_volume – Build volume in mm; its XY extent sets the image size.
output_directory – Folder for the BMP slices; created if missing.
file_prefix – File name prefix; slice z is written as
<file_prefix><z>.bmp.
Private Functions
-
double resolve_intensity(const glm::vec3 &voxel_pos, const std::optional<AttributeSamples> &samples) const#
-
glm::vec3 world_position(long x, long y, long z, const glm::vec3 &bbox_min, const glm::vec3 ¢er_offset) const#
Private Members
-
double m_fallback_intensity = 1.0#
-
std::string m_file_prefix#
-
std::string m_output_directory#
-
glm::vec3 m_printer_volume = glm::vec3(0.0f)#
-
bool m_strict_mode = false#
-
bool m_use_printer_volume = false#
-
glm::vec3 m_voxel_size#
-
size_t m_x_resolution = 0#
-
size_t m_y_resolution = 0#
-
size_t m_z_resolution = 0#
-
virtual void compile() override#
Enums
-
enum class MultiMaterialVatOutputMode#
Selects which sliced-image artifacts are retained.
Values:
-
enumerator directory#
Keep the vat_a … vat_d folders of PNG layers.
-
enumerator zip#
Write only the ZIP archive; the folders are removed afterwards.
-
enumerator directory_and_zip#
Keep the folders and also write the ZIP archive.
-
enumerator directory#
-
class MultiMaterialVatCompiler : public CompilerBase#
- #include <multi_material_vat_compiler.h>
Compiles volume fractions into synchronized grayscale PNG stacks for multi-material VAT printers.
Each inside sample draws one material from its volume fractions by deterministic weighted stochastic sampling. Void (material ID 0) takes part in the draw, so a sample whose draw lands on void, or whose fractions are all zero, leaves the pixel black in every vat. Otherwise the drawn material’s vat gets the pixel: its optional
<material_name>_intensityscalar sets the grayscale exposure (default 1.0) and all other vats receive black there. Every non-void material with a positive fraction must be assigned to a vat, or compile() throws. Images use a fixed 1280 by 800 build canvas spanning 55.01 by 34.38 mm, with the design centered in XY.Public Functions
-
std::string archive_path() const#
Returns the ZIP path derived from the configured output path.
- Returns:
The output path with any
.zipextension removed, then.zipappended.
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
Constructs a multi-material VAT compiler.
Throws std::runtime_error if root or material_defs is null, output_path is empty, layer_thickness is below 0.01 mm, or vat_material_names is empty, longer than the system’s vat count, repeats a name, names void, or names an undefined material.
- Parameters:
root – Root node; compile() prepares it. Must expose VOLUME_FRACTIONS.
output_path – Directory path used for directory output and as the ZIP filename stem.
material_defs – Material definitions used to resolve configured material names.
vat_material_names – Ordered material names mapped to vats A through D.
layer_thickness – Layer height in mm. The minimum supported value is 0.01 mm.
system – Dual-vat or quad-vat target system.
output_mode – Directory, ZIP, or both output forms.
random_seed – Seed for reproducible weighted material assignment.
-
glm::vec3 printer_volume() const#
Returns the printer build volume in mm.
- Returns:
(55.01, 34.38, 150).
Private Functions
-
void create_archive(const std::string &directory) const#
-
std::string output_directory() const#
-
void prepare_output_directories(const std::string &directory) const#
-
void remove_directory_output(const std::string &directory) const#
-
size_t vat_count() const#
Private Members
-
double m_layer_thickness#
-
std::shared_ptr<MaterialDefs> m_material_defs#
-
std::unordered_map<uint8_t, size_t> m_material_to_vat#
-
MultiMaterialVatOutputMode m_output_mode#
-
std::string m_output_path#
-
uint64_t m_random_seed#
-
MultiMaterialVatSystem m_system#
-
std::vector<VatMaterial> m_vat_materials#
-
size_t m_z_resolution = 0#
-
struct VatMaterial#
-
std::string archive_path() const#
-
class SlicerProjectCompiler : public CompilerBase#
- #include <slicer_project_base.h>
Shared base for slicer project compilers.
This base owns the OpenVCAD tree, output path, sampled voxel grid, and common helpers used by concrete slicer project dialects. Instantiate PrusaSlicerProjectCompiler or FullSpectrumSlicerProjectCompiler instead.
Subclassed by FullSpectrumSlicerProjectCompiler, PrusaSlicerProjectCompiler
Public Functions
-
virtual void compile() override = 0#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
-
virtual std::vector<std::string> supported_attributes() const override = 0#
Returns the attribute names this compiler works with.
The meaning depends on the compiler. MaterialInkjetCompiler, ColorInkjetCompiler, MyersonCompiler and SimulationCompiler (its direct_attributes) require the root to carry every listed attribute and throw at compile() otherwise. VatCompiler and MultiMaterialVatCompiler list the attribute they sample. The slicer project compilers list every attribute they understand. VdbCompiler and GCVFCompiler return an empty list.
- Returns:
Attribute names, possibly empty.
-
~SlicerProjectCompiler() override = default#
Virtual destructor.
Protected Functions
-
std::string derive_object_name() const#
Derives an object name from the output file path.
- Returns:
The file name of the output path without its extension.
-
void sample_tree()#
Prepares and samples the root tree and populates shared grid state.
Stores the shared inputs; nothing is sampled until compile().
- Parameters:
root – Root node of the design; sample_tree() prepares it.
voxel_size – Sampling voxel size in mm.
output_file_path – Path of the .3mf project to write.
Protected Attributes
-
glm::vec3 m_max_coord = {0.0f}#
Bounding-box maximum of the prepared root, filled by sample_tree().
-
glm::vec3 m_min_coord = {0.0f}#
Bounding-box minimum of the prepared root, filled by sample_tree().
-
std::string m_output_file_path#
Path of the .3mf project to write.
-
std::vector<std::pair<std::optional<double>, std::optional<AttributeSamples>>> m_sample_array#
Signed distance and attribute samples of every voxel, filled by sample_tree().
-
size_t m_size_x = 0#
Sample count along x, filled by sample_tree().
-
size_t m_size_y = 0#
Sample count along y, filled by sample_tree().
-
size_t m_size_z = 0#
Sample count along z, filled by sample_tree().
-
glm::vec3 m_voxel_size#
Sampling voxel size in mm.
-
virtual void compile() override = 0#
-
class PrusaSlicerProjectCompiler : public SlicerProjectCompiler#
- #include <slicer_project_prusa.h>
Compiles slicer attributes into a PrusaSlicer-compatible 3MF project.
Supports settings-mesh metadata, virtual-extrusion G-code, and PrusaSlicer ColorMix workflows in the Slic3r/Prusa project dialect.
Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
Uses ColorMix when enable_color_mix is set or the design has COLOR_RGB or VOLUME_FRACTIONS (COLOR_RGB wins if both are present); ColorMix cannot be combined with settings-mesh or virtual-extrusion attributes. Otherwise the design needs at least one registered slicer attribute.
Constructs a compiler with every setting given.
- Parameters:
root – Root node of the design; compile() prepares it.
voxel_size – Sampling voxel size in mm.
output_file_path – Path of the .3mf project to write.
settings – Export settings (copied).
Constructs a compiler for settings-mesh and virtual-extrusion export.
Equivalent to the settings constructor with only these three settings changed.
- Parameters:
root – Root node of the design; compile() prepares it.
voxel_size – Sampling voxel size in mm.
output_file_path – Path of the .3mf project to write.
num_regions – Sub-ranges per segmented attribute.
printer_profile_path – PrusaSlicer printer profile (.ini); required with virtual extrusion.
filament_profile_path – PrusaSlicer filament profile (.ini); required with virtual extrusion.
Private Functions
-
size_t add_extruder(int primary_value, const std::unordered_map<std::string, int> &companion_values)#
-
std::string build_color_mix_config_json(const std::vector<PrusaColorMixPaletteEntry> &palette) const#
-
std::string build_color_mix_project_config(const PrusaColorMixSettings &color_mix_settings) const#
-
PrusaColorMixSettings build_color_mix_settings(bool use_volume_fractions) const#
-
std::string build_project_config()#
-
void classify_attributes(const std::vector<std::string> &tree_attributes)#
-
void compile_color_mix(bool use_volume_fractions)#
-
std::unordered_map<std::string, std::pair<double, double>> compute_attribute_ranges()#
-
void compute_band_gap_dilation(const std::unordered_map<std::string, std::pair<double, double>> &min_max_map)#
-
vtkSmartPointer<vtkImageData> compute_band_sdf_image(const std::unordered_map<std::string, std::pair<double, double>> &attribute_ranges_map)#
-
double compute_companion_average(const std::string &primary_attribute, double range_min, double range_max, const std::string &companion_attribute) const#
Private Members
-
std::unordered_map<std::string, std::vector<float>> m_band_gap_dilation#
Per-voxel attribute-space dilation applied to band constraints, keyed by segmented attribute.
Non-zero only where the field jumps by more than one band between neighbouring voxels; see compute_band_gap_dilation.
-
std::vector<ExtruderEntry> m_extruders#
-
std::string m_filament_profile_path#
-
size_t m_num_regions#
-
std::string m_printer_profile_path#
-
std::vector<std::string> m_segmented_attributes#
-
PrusaSlicerProjectSettings m_settings#
-
std::vector<const SettingsMeshDescriptor*> m_settings_mesh_active#
-
bool m_uses_virtual_extrusion = false#
-
std::vector<const VirtualExtrusionDescriptor*> m_virtual_extrusion_active#
Private Static Functions
-
static std::string expand_gcode_template(const VirtualExtrusionDescriptor &descriptor, int primary_value, const std::unordered_map<std::string, int> &companion_values)#
-
struct ExtruderEntry#
-
virtual void compile() override#
-
struct PrusaSlicerProjectSettings#
- #include <slicer_project_prusa.h>
Options for PrusaSlicer settings-mesh, virtual-extrusion, and ColorMix export.
Public Members
-
bool close_unresolved_band_gaps = true#
Closes the sub-voxel gap where a segmented attribute jumps by more than one region between neighbouring voxels.
False keeps the legacy behaviour.
-
std::vector<PrusaColorMixPhysicalFilament> color_mix_filaments#
Physical ColorMix filaments.
Empty uses the default CMYKW set, limited to total_physical_extruders. For VOLUME_FRACTIONS designs, mapped slots missing here are added with the material’s MaterialDefs color.
-
PrusaColorMixRecipePreset color_mix_recipe_preset = PrusaColorMixRecipePreset::Expanded#
Printable recipe set for COLOR_RGB ColorMix export.
-
double direct_physical_delta_e = 1.0#
Legacy setting kept for compatibility; COLOR_RGB export picks physical and virtual recipes from one candidate set.
-
bool enable_color_mix = false#
Forces ColorMix export; COLOR_RGB or VOLUME_FRACTIONS on the design also select it.
-
std::string filament_profile_path#
PrusaSlicer filament profile (.ini). Required with virtual-extrusion attributes.
-
std::string material_defs_path#
MaterialDefs JSON used to resolve volume_fraction_materials.
Empty uses the bundled configs/default.json.
-
size_t max_palette_size = 32#
Largest generated ColorMix palette.
-
size_t max_recipe_components = 3#
Most physical filaments per ColorMix recipe, up to 3.
-
int min_component_percent = 15#
Smallest component weight, in percent, of a mixed recipe.
-
size_t num_regions = 10#
Sub-ranges per segmented attribute for settings-mesh and virtual-extrusion export.
-
std::string printer_profile_path#
PrusaSlicer printer profile (.ini).
Required with virtual-extrusion attributes; for ColorMix, it (or filament_profile_path) adds a project config.
-
double region_overlap_mm = 0.2#
Spatial overlap in mm between generated ColorMix regions.
-
size_t total_physical_extruders = 5#
Physical extruder slots in PrusaSlicer; virtual ColorMix extruder IDs start after it.
-
std::vector<PrusaColorMixMaterialMapping> volume_fraction_materials#
Material-name to physical-slot mapping.
Required when the design has VOLUME_FRACTIONS and no COLOR_RGB; compile() throws if it is empty then.
-
PrusaVolumeFractionPaletteMode volume_fraction_palette_mode = PrusaVolumeFractionPaletteMode::Uniform#
How VOLUME_FRACTIONS palette recipes are chosen.
-
bool close_unresolved_band_gaps = true#
-
class FullSpectrumSlicerProjectCompiler : public SlicerProjectCompiler#
- #include <slicer_project_full_spectrum.h>
Compiles COLOR_RGB or VOLUME_FRACTIONS into an Orca FullSpectrum project.
Writes the Bambu/Orca component-based 3MF dialect with physical and virtual FullSpectrum mixed-filament assignments.
Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
The design needs COLOR_RGB or VOLUME_FRACTIONS (COLOR_RGB wins if both are present) and no settings-mesh or virtual-extrusion attributes.
Constructs an Orca FullSpectrum project compiler.
- Parameters:
root – Root node of the design; compile() prepares it.
voxel_size – Sampling voxel size in mm.
output_file_path – Path of the .3mf project to write.
settings – Export settings (copied).
Private Functions
-
std::string build_full_spectrum_color_report_json(const std::vector<FullSpectrumPaletteEntry> &palette) const#
-
std::vector<FullSpectrumPaletteEntry> build_full_spectrum_palette() const#
-
std::string build_full_spectrum_project_config(const std::vector<FullSpectrumPaletteEntry> &palette) const#
-
std::vector<FullSpectrumMeshRegion> build_full_spectrum_regions(const std::vector<FullSpectrumPaletteEntry> &palette)#
-
std::vector<FullSpectrumPaletteEntry> build_full_spectrum_volume_fraction_palette() const#
-
void validate_full_spectrum_settings() const#
Private Members
-
FullSpectrumSlicerProjectSettings m_settings#
-
struct FullSpectrumMeshRegion#
-
struct FullSpectrumPaletteEntry#
Public Members
-
int extruder_id = 0#
-
std::vector<double> fraction_weights#
-
FullSpectrumLab preview_lab#
-
FullSpectrumRecipe recipe#
-
size_t sample_count = 0#
-
FullSpectrumRgb8 target_color#
-
FullSpectrumLab target_lab#
-
int extruder_id = 0#
-
virtual void compile() override#
-
struct FullSpectrumSlicerProjectFilament#
- #include <slicer_project_full_spectrum.h>
Physical filament slot description for Orca FullSpectrum export.
Public Members
-
std::string color_hex#
Filament color as “#RRGGBB”; must not be empty at compile time.
-
std::string filament_id#
Optional Orca filament ID written to the project’s filament_ids.
-
std::string filament_profile_path#
Orca filament profile path or name.
Empty uses FullSpectrumSlicerProjectSettings::orca_default_filament_profile_path.
-
std::string filament_settings_id#
Optional Orca filament_settings_id written to the project.
-
double nozzle_diameter_mm = 0.4#
Nozzle diameter written to the project, in mm.
-
unsigned int slot = 0#
Physical slot; slots must run 1, 2, … without gaps.
-
std::string color_hex#
-
struct FullSpectrumSlicerProjectMaterialMapping#
- #include <slicer_project_full_spectrum.h>
Maps a VCAD volume-fraction material to a physical filament slot.
Public Members
-
uint8_t material_id = 0#
Filled from material_name by compile(); leave 0.
-
std::string material_name#
MaterialDefs name of a non-void material.
-
unsigned int slot = 0#
Physical filament slot (from 1) that prints this material.
-
uint8_t material_id = 0#
-
struct FullSpectrumSlicerProjectSettings#
- #include <slicer_project_full_spectrum.h>
Options for COLOR_RGB or VOLUME_FRACTIONS to Orca FullSpectrum project export.
Public Members
-
std::string base_project_settings_path#
Optional Orca project settings JSON merged over the resolved profiles, before the FullSpectrum keys are written.
-
PrintableColorMixRecipePreset color_mix_recipe_preset = PrintableColorMixRecipePreset::Expanded#
Printable recipe set for COLOR_RGB export.
-
double direct_physical_delta_e = 1.0#
Legacy setting kept for compatibility; COLOR_RGB export picks physical and virtual recipes from one candidate set.
-
std::string material_defs_path#
MaterialDefs JSON used to resolve volume_fraction_materials.
Empty uses the bundled configs/default.json.
-
size_t max_palette_size = 32#
Largest color palette, or volume-fraction region count.
-
size_t max_recipe_components = 3#
Most physical filaments per mixed recipe, capped at 3.
-
int min_component_percent = 15#
Smallest component weight, in percent, of a mixed recipe.
-
std::string orca_default_filament_profile_path#
Orca filament profile for filaments without their own. Empty uses the bundled PLA profile.
-
std::string orca_machine_profile_path#
Orca machine profile path or name. Empty uses the bundled “Prusa XL 5T 0.4 nozzle”.
-
std::string orca_process_profile_path#
Orca process profile path or name. Empty uses the bundled “0.20mm Speed @Prusa XL 5T 0.4”.
-
std::vector<std::string> orca_profile_search_paths#
Extra folders searched for Orca JSON profiles, after the bundled ones.
-
std::vector<FullSpectrumSlicerProjectFilament> physical_filaments#
Physical filaments, 2 to 9, in slot order.
For COLOR_RGB designs, empty uses a default CMYKW set. For VOLUME_FRACTIONS designs, mapped slots missing here are added with the material’s MaterialDefs color.
-
double region_overlap_mm = 0.2#
Spatial overlap in mm between generated regions.
-
std::vector<FullSpectrumSlicerProjectMaterialMapping> volume_fraction_materials#
Material-to-slot mapping.
Required when the design has VOLUME_FRACTIONS and no COLOR_RGB; compile() throws if it is empty then.
-
PrintableVolumeFractionPaletteMode volume_fraction_palette_mode = PrintableVolumeFractionPaletteMode::Uniform#
How VOLUME_FRACTIONS palette recipes are chosen.
-
std::string base_project_settings_path#
-
struct SettingsMeshDescriptor#
- #include <slicer_attribute_registry.h>
Descriptor for an attribute handled via PrusaSlicer per-volume XML metadata (settings mesh).
Each entry maps an OpenVCAD attribute name to the corresponding PrusaSlicer key and provides a formatting function that converts the sub-range endpoints into the string PrusaSlicer expects.
Public Members
-
std::function<std::string(double min_val, double max_val)> format_value#
Formats (min_value, max_value) of a sub-range into the string value PrusaSlicer expects for the corresponding key.
Example: for infill_density the midpoint is rounded to the nearest integer and suffixed with “%”, yielding “45%”.
-
std::string slicer_key#
PrusaSlicer XML metadata key (e.g. “fill_density”).
-
std::string vcad_attribute#
OpenVCAD attribute name (e.g. “infill_density”).
-
std::function<std::string(double min_val, double max_val)> format_value#
-
struct VirtualExtrusionDescriptor#
- #include <slicer_attribute_registry.h>
Descriptor for an attribute handled via synthetic toolchanges with injected G-code (virtual extrusion).
The primary attribute drives mesh segmentation. Companion attributes are averaged within each segment but do not create additional segmentation dimensions. The G-code template is expanded per region and emitted inside PrusaSlicer conditional blocks in the toolchange_gcode printer setting.
Template placeholder syntax: {value} - mid-range value of the primary attribute, truncated to int. {companion:<name>} - companion average for this region times 100, truncated to int (-1 when no sample falls in the region). <name> must match an entry in companion_attributes.
Example template:
"M104 S{value}\nM221 S{companion:flow_rate}"Public Members
-
std::vector<std::string> companion_attributes#
Attributes that are averaged within each primary-attribute segment but do not create additional segmentation dimensions.
E.g. {“flow_rate”} - flow rate is computed as the mean of all samples whose primary attribute falls in the current sub-range.
-
std::string gcode_template#
G-code template string. See struct-level docs for placeholder syntax.
-
std::string vcad_attribute#
The primary attribute that drives segmentation (e.g. “temperature”).
-
std::vector<std::string> companion_attributes#
-
namespace SlicerAttributeRegistry#
Compile-time registry of attributes supported by PrusaSlicerProjectCompiler.
Each OpenVCAD attribute is either handled via a settings mesh (per-volume PrusaSlicer XML metadata) or via virtual extrusion (synthetic toolchanges with injected G-code). The registry determines which mode applies for each attribute.
To add support for a new attribute, add a descriptor to the appropriate vector in slicer_attribute_registry.cpp.
Functions
-
const SettingsMeshDescriptor *find_settings_mesh(const std::string &attribute)#
Looks up a settings-mesh descriptor by OpenVCAD attribute name.
- Parameters:
attribute – OpenVCAD attribute name.
- Returns:
Pointer to the matching descriptor, or nullptr if not found.
-
const VirtualExtrusionDescriptor *find_virtual_extrusion(const std::string &attribute)#
Looks up a virtual-extrusion descriptor by OpenVCAD attribute name.
- Parameters:
attribute – OpenVCAD attribute name.
- Returns:
Pointer to the matching descriptor, or nullptr if not found.
-
bool is_companion_attribute(const std::string &attribute)#
Checks whether an attribute is listed as a companion of any virtual-extrusion descriptor.
- Parameters:
attribute – OpenVCAD attribute name.
- Returns:
true if the attribute appears in any descriptor’s companion list.
-
const std::vector<SettingsMeshDescriptor> &settings_mesh_descriptors()#
- Returns:
All settings-mesh descriptors (compile-time constant table).
-
const std::vector<VirtualExtrusionDescriptor> &virtual_extrusion_descriptors()#
- Returns:
All virtual-extrusion descriptors (compile-time constant table).
-
const SettingsMeshDescriptor *find_settings_mesh(const std::string &attribute)#
-
class VdbCompiler : public CompilerBase#
- #include <vdb_compiler.h>
Exports an OpenVCAD tree to a single OpenVDB file.
The output always contains a FloatGrid level set named “surface”. It can optionally include a BoolGrid named “occupancy” and typed attribute grids for scalar, vec3, and vec4 attributes. volume_fractions is never exported, and attributes of any other type are skipped.
Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
-
virtual std::vector<std::string> supported_attributes() const override#
Returns an empty list; no attribute is required.
- Returns:
An empty list.
Creates a VDB compiler.
- Parameters:
root – The root node to export.
voxel_size – The sampling voxel size in model units.
output_file_path – The .vdb file path to write.
attributes_to_export – Attribute names to export. An empty vector exports every attribute in the root’s attribute_list(); std::nullopt exports none. volume_fractions is always left out. compile() throws if an exported attribute has no sample inside or on the surface, or mixes scalar, vec3 and vec4 values.
include_occupancy – True to include a BoolGrid named “occupancy”.
-
virtual void compile() override#
Enums
-
enum class SimulationBackend#
Output transport of the SimulationCompiler.
Values:
-
enumerator generic#
No files; the prepared SimulationModel is available from SimulationCompiler::model().
-
enumerator abaqus_inp#
Abaqus input file (
<file_prefix>.inp).
-
enumerator fenicsx_xdmf#
FEniCSx/DOLFINx mesh bundle (
<file_prefix>.xdmf+<file_prefix>.h5).
-
enumerator lsdyna_k#
LS-DYNA keyword deck (
<file_prefix>.k), geometry only; see SimulationLsDynaSettings.
-
enumerator generic#
-
class SimulationCompiler : public CompilerBase#
- #include <simulation_compiler.h>
Meshes an OpenVCAD tree (hex or tet), samples attributes at element centroids, and writes the result through one backend (generic in-memory model, Abaqus .inp, FEniCSx .xdmf/.h5, or LS-DYNA .k).
Public Functions
-
virtual void compile() override#
Runs the compiler and writes its output.
Prepares the root, samples it, and writes the output. Throws std::runtime_error on invalid input, missing attributes, or cancel().
-
size_t element_count() const#
Number of mesh elements from the last compile(), before any backend filtering (such as lsdyna_k dropping void elements).
- Returns:
Element count.
-
const SimulationModel &model() const#
The model built by the last compile() with the generic backend.
Throws std::runtime_error if the last compile() used another backend or none ran.
- Returns:
Reference valid until the next compile() or the compiler’s destruction.
-
size_t node_count() const#
Number of mesh nodes from the last compile(), before any backend filtering.
- Returns:
Node count.
Constructs a simulation compiler.
Private Members
-
size_t m_element_count = 0#
-
std::optional<SimulationModel> m_model#
-
size_t m_node_count = 0#
-
SimulationCompilerSettings m_settings#
-
std::vector<std::string> m_written_files#
-
virtual void compile() override#
-
struct SimulationCompilerSettings#
- #include <simulation_compiler.h>
Settings of the SimulationCompiler.
Public Members
-
SimulationBackend backend = SimulationBackend::abaqus_inp#
Output transport.
-
std::vector<std::string> direct_attributes#
Scalar attributes sampled per element into SimulationModel::scalar_fields.
Only modulus, poissons_ratio and density are supported, and the root must carry each one.
-
std::string file_prefix = "simulation"#
Output file name without extension; unused by generic.
-
SimulationHexMeshSettings hex_settings#
Used when mesh_kind is hex.
-
SimulationLsDynaSettings lsdyna_settings#
Options used only by SimulationBackend::lsdyna_k.
-
std::shared_ptr<MaterialDefs> material_defs = nullptr#
Names volume-fraction materials (others become
material_<id>); lsdyna_k also reads optional density, modulus and poissons_ratio entries from it.
-
SimulationMeshKind mesh_kind = SimulationMeshKind::hex#
Element family.
-
std::string output_directory#
Folder for file backends (created if missing); unused by generic.
-
uint64_t random_seed = 0#
Seed for tet meshing and the per-element material_id draw.
-
SimulationTetAdaptiveMeshSettings tet_adaptive_settings#
Used for tet meshes when use_adaptive_tet_sizing is true.
-
SimulationTetFixedMeshSettings tet_fixed_settings#
Used for tet meshes when use_adaptive_tet_sizing is false.
-
bool use_adaptive_tet_sizing = false#
Selects tet_adaptive_settings over tet_fixed_settings.
-
SimulationBackend backend = SimulationBackend::abaqus_inp#
-
struct SimulationHexMeshSettings#
- #include <simulation_compiler.h>
Hexahedral mesh settings.
Public Members
-
glm::vec3 voxel_size = glm::vec3(1.0f)#
Hexahedron size in mm; also the sampling and prepare() voxel size.
-
glm::vec3 voxel_size = glm::vec3(1.0f)#
-
struct SimulationTetAdaptiveMeshSettings#
- #include <simulation_compiler.h>
Adaptive tetrahedral mesh settings (CGAL Mesh_3 criteria with a variable cell size).
Public Members
-
size_t cell_radius_edge_ratio = 3#
Largest circumradius to shortest edge ratio of a tetrahedron.
-
double cell_size_lower = 0.1#
Smallest cell size in mm (min_cell in the expression).
-
double cell_size_upper = 1.0#
Largest cell size in mm (max_cell in the expression).
-
double facet_angle = 30.0#
Smallest surface-triangle angle in degrees.
-
double facet_distance = 0.01#
Largest distance in mm between a surface triangle and the true surface.
-
double facet_size = 0.1#
Largest surface-triangle size in mm.
-
std::string variable_cell_size_expression = "min_cell + h * (max_cell - min_cell)"#
Cell-size expression of min_cell, max_cell and h, the length of the tree’s gradient.
-
size_t cell_radius_edge_ratio = 3#
-
struct SimulationTetFixedMeshSettings#
- #include <simulation_compiler.h>
Fixed-size tetrahedral mesh settings (CGAL Mesh_3 criteria).
Public Members
-
size_t cell_radius_edge_ratio = 3#
Largest circumradius to shortest edge ratio of a tetrahedron.
-
double cell_size = 0.1#
Largest tetrahedron circumradius in mm.
-
double facet_angle = 30.0#
Smallest surface-triangle angle in degrees.
-
double facet_distance = 0.01#
Largest distance in mm between a surface triangle and the true surface.
-
double facet_size = 0.1#
Largest surface-triangle size in mm.
-
size_t cell_radius_edge_ratio = 3#