From 142cdd05cb9145562a84d5dce13b0166bc99b980 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 5 Feb 2026 13:54:30 -0800 Subject: [PATCH 01/50] Save state post resolving conpilation bug :( --- .../ascent_runtime_param_check.cpp | 74 ++++++ .../ascent_runtime_param_check.hpp | 13 ++ .../ascent_runtime_vtkh_filters.cpp | 218 +++++++++--------- src/libs/flow/flow_filter.cpp | 28 ++- src/libs/flow/flow_filter.hpp | 1 + 5 files changed, 218 insertions(+), 116 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index fa8c76a3c..9291cb84e 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -58,6 +58,42 @@ bool is_valid_expression(const std::string expr, std::string &err_msg) return res; } +conduit::Node number_schema() +{ + conduit::Node n; + n["type"] = "number"; + return n; +} + +conduit::Node string_schema() +{ + conduit::Node n; + n["type"] = "string"; + return n; +} + +conduit::Node vec3_schema(const std::string var1, const std::string var2, const std::string var3) +{ + conduit::Node n; + n["type"] = "object"; + n["additionalProperties"] = false; + + n["properties/" + var1].set(number_schema()); + n["properties/" + var2].set(number_schema()); + n["properties/" + var3].set(number_schema()); + + n["required"].append() = var1; + n["required"].append() = var2; + n["required"].append() = var3; + + return n; +} + +conduit::Node vec3_schema() +{ + return vec3_schema("x", "y", "z"); +} + //----------------------------------------------------------------------------- bool check_numeric(const std::string path, @@ -322,6 +358,44 @@ surprise_check(const std::vector &valid_paths, return ss.str(); } +//----------------------------------------------------------------------------- +std::string +surprise_check(const conduit::Node &properties, + const conduit::Node ¶ms) +{ + // only children can surprise us + if(params.number_of_children() == 0) + { + return ""; + } + + std::stringstream ss; +// std::vector paths; +// path_helper(paths, params); +// const int num_paths = static_cast(paths.size()); +// // const int num_valid_paths = static_cast(properties.size()); +// std::string curr_path = params.path() == "" ? "" :params.path() + "/"; +// for(int i = 0; i < num_paths; ++i) +// { +// bool found = false; +// for(int f = 0; f < num_valid_paths; ++f) +// { +// if(curr_path + valid_paths[f] == paths[i]) +// { +// found = true; +// break; +// } +// } + +// if(!found) +// { +// ss<<"Surprise parameter '"< &paths, const conduit::Node &node) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index c2874fe43..9c0c557f3 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -41,6 +41,16 @@ namespace runtime namespace filters { +conduit::Node ASCENT_API number_schema(); + +conduit::Node ASCENT_API string_schema(); + +conduit::Node ASCENT_API vec3_schema(); + +conduit::Node ASCENT_API vec3_schema(const std::string var1, + const std::string var2, + const std::string var3); + bool ASCENT_API check_numeric(const std::string path, const conduit::Node ¶ms, conduit::Node &info, @@ -77,6 +87,9 @@ void ASCENT_API path_helper(std::vector &paths, std::string ASCENT_API surprise_check(const std::vector &valid_paths, const conduit::Node &node); + +std::string ASCENT_API surprise_check(const conduit::Node &properties, + const conduit::Node &node); // // Ignore paths only ignores top level paths, differing lower level // paths to another surprise check. diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 6f4684f10..2a3b91b5b 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -806,6 +806,102 @@ VTKHSlice::declare_interface(Node &i) i["type_name"] = "vtkh_slice"; i["port_names"].append() = "in"; i["output_port"] = "true"; + + // ----------- Define Param Schema ----------- + conduit::Node vtkhslice_schema; + vtkhslice_schema["type"] = "object"; + vtkhslice_schema["additionalProperties"] = false; + vtkhslice_schema["constraints/exclusiveChildren"].append() = "sphere"; + vtkhslice_schema["constraints/exclusiveChildren"].append() = "cylinder"; + vtkhslice_schema["constraints/exclusiveChildren"].append() = "box"; + vtkhslice_schema["constraints/exclusiveChildren"].append() = "plane"; + vtkhslice_schema["constraints/exclusiveChildren"].append() = "point"; + vtkhslice_schema["constraints/allowNoneInExclusiveGroup"] = false; + + // optional + vtkhslice_schema["properties/topology"].set(string_schema()); + + // --- sphere --- + conduit::Node sphere_schema; + sphere_schema["type"] = "object"; + sphere_schema["additionalProperties"] = false; + sphere_schema["properties/center"].set(vec3_schema()); + sphere_schema["properties/radius"].set(number_schema()); + sphere_schema["required"].append() = "center"; + sphere_schema["required"].append() = "radius"; + vtkhslice_schema["properties/sphere"].set(sphere_schema); + + // --- cylinder --- + conduit::Node cylinder_schema; + cylinder_schema["type"] = "object"; + cylinder_schema["additionalProperties"] = false; + cylinder_schema["properties/center"].set(vec3_schema()); + cylinder_schema["properties/axis"].set(vec3_schema()); + cylinder_schema["properties/radius"].set(number_schema()); + cylinder_schema["required"].append() = "center"; + cylinder_schema["required"].append() = "axis"; + cylinder_schema["required"].append() = "radius"; + vtkhslice_schema["properties/cylinder"].set(cylinder_schema); + + // --- box --- + conduit::Node box_schema; + box_schema["type"] = "object"; + box_schema["additionalProperties"] = false; + box_schema["properties/min"].set(vec3_schema()); + box_schema["properties/max"].set(vec3_schema()); + box_schema["required"].append() = "min"; + box_schema["required"].append() = "max"; + vtkhslice_schema["properties/box"].set(box_schema); + + // --- plane --- + conduit::Node plane_schema; + plane_schema["type"] = "object"; + plane_schema["additionalProperties"] = false; + plane_schema["properties/point"].set(vec3_schema()); + plane_schema["properties/normal"].set(vec3_schema()); + plane_schema["required"].append() = "point"; + plane_schema["required"].append() = "normal"; + vtkhslice_schema["properties/plane"].set(plane_schema); + + // --- old point style + conduit::Node point_schema; + point_schema["type"] = "object"; + point_schema["additionalProperties"] = false; + + point_schema["properties/x"].set(number_schema()); + point_schema["properties/y"].set(number_schema()); + point_schema["properties/z"].set(number_schema()); + point_schema["properties/x_offset"].set(number_schema()); + point_schema["properties/y_offset"].set(number_schema()); + point_schema["properties/z_offset"].set(number_schema()); + + // Option A: explicit + conduit::Node option_1_explicit; + option_1_explicit["type"] = "object"; + option_1_explicit["required"].append() = "x"; + option_1_explicit["required"].append() = "y"; + option_1_explicit["required"].append() = "z"; + option_1_explicit["constraints/forbid"].append() = "x_offset"; + option_1_explicit["constraints/forbid"].append() = "y_offset"; + option_1_explicit["constraints/forbid"].append() = "z_offset"; + point_schema["oneOf"].append().set(option_1_explicit); + + // Option B: offset + conduit::Node option_2_offset; + option_2_offset["type"] = "object"; + option_2_offset["required"].append() = "x_offset"; + option_2_offset["required"].append() = "y_offset"; + option_2_offset["required"].append() = "z_offset"; + option_2_offset["constraints/forbid"].append() = "x"; + option_2_offset["constraints/forbid"].append() = "y"; + option_2_offset["constraints/forbid"].append() = "z"; + point_schema["oneOf"].append().set(option_2_offset); + + vtkhslice_schema["properties/point"].set(point_schema); + vtkhslice_schema["properties/normal"].set(vec3_schema()); + vtkhslice_schema["constraints/dependencies/normal"].append() = "point"; + + i["param_schema"].set(vtkhslice_schema); } //----------------------------------------------------------------------------- @@ -815,129 +911,21 @@ VTKHSlice::verify_params(const conduit::Node ¶ms, { info.reset(); - bool res = true; - - res &= check_string("topology",params, info, false); - if(params.has_child("sphere")) - { - res = check_numeric("sphere/center/x",params, info, true, true) && res; - res = check_numeric("sphere/center/y",params, info, true, true) && res; - res = check_numeric("sphere/center/z",params, info, true, true) && res; - res = check_numeric("sphere/radius",params, info, true, true) && res; - } - else if(params.has_child("cylinder")) - { - res = check_numeric("cylinder/center/x",params, info, true, true) && res; - res = check_numeric("cylinder/center/y",params, info, true, true) && res; - res = check_numeric("cylinder/center/z",params, info, true, true) && res; - res = check_numeric("cylinder/axis/x",params, info, true, true) && res; - res = check_numeric("cylinder/axis/y",params, info, true, true) && res; - res = check_numeric("cylinder/axis/z",params, info, true, true) && res; - res = check_numeric("cylinder/radius",params, info, true, true) && res; - } - else if(params.has_child("box")) - { - res = check_numeric("box/min/x",params, info, true, true) && res; - res = check_numeric("box/min/y",params, info, true, true) && res; - res = check_numeric("box/min/z",params, info, true, true) && res; - res = check_numeric("box/max/x",params, info, true, true) && res; - res = check_numeric("box/max/y",params, info, true, true) && res; - res = check_numeric("box/max/z",params, info, true, true) && res; - } - else if(params.has_child("plane")) - { - res = check_numeric("plane/point/x",params, info, true, true) && res; - res = check_numeric("plane/point/y",params, info, true, true) && res; - res = check_numeric("plane/point/z",params, info, true, true) && res; - res = check_numeric("plane/normal/x",params, info, true, true) && res; - res = check_numeric("plane/normal/y",params, info, true, true) && res; - res = check_numeric("plane/normal/z",params, info, true, true) && res; - } - - // old style plane - if(params.has_path("point/x_offset") && params.has_path("point/x")) - { - info["errors"] - .append() = "Cannot specify the plane point as both an offset and explicit point"; - res = false; - } - - if(params.has_path("point/x")) - { - res &= check_numeric("point/x",params, info, true, true); - res = check_numeric("point/y",params, info, true, true) && res; - res = check_numeric("point/z",params, info, true, true) && res; - } - else if(params.has_path("point/x_offset")) - { - res &= check_numeric("point/x_offset",params, info, true, true); - res = check_numeric("point/y_offset",params, info, true, true) && res; - res = check_numeric("point/z_offset",params, info, true, true) && res; - } - // else - // { - // info["errors"] - // .append() = "Slice must specify a point for the plane."; - // res = false; - // } - if(params.has_path("normal/x")) - { - res = check_numeric("normal/x",params, info, true, true) && res; - res = check_numeric("normal/y",params, info, true, true) && res; - res = check_numeric("normal/z",params, info, true, true) && res; - } - - std::vector valid_paths; - // old style plane - valid_paths.push_back("point/x"); - valid_paths.push_back("point/y"); - valid_paths.push_back("point/z"); - valid_paths.push_back("point/x_offset"); - valid_paths.push_back("point/y_offset"); - valid_paths.push_back("point/z_offset"); - valid_paths.push_back("normal/x"); - valid_paths.push_back("normal/y"); - valid_paths.push_back("normal/z"); - valid_paths.push_back("topology"); - - // sphere - valid_paths.push_back("sphere/center/x"); - valid_paths.push_back("sphere/center/y"); - valid_paths.push_back("sphere/center/z"); - valid_paths.push_back("sphere/radius"); - // cylinder - valid_paths.push_back("cylinder/center/x"); - valid_paths.push_back("cylinder/center/y"); - valid_paths.push_back("cylinder/center/z"); - valid_paths.push_back("cylinder/axis/x"); - valid_paths.push_back("cylinder/axis/y"); - valid_paths.push_back("cylinder/axis/z"); - valid_paths.push_back("cylinder/radius"); - // box - valid_paths.push_back("box/min/x"); - valid_paths.push_back("box/min/y"); - valid_paths.push_back("box/min/z"); - valid_paths.push_back("box/max/x"); - valid_paths.push_back("box/max/y"); - valid_paths.push_back("box/max/z"); - // new style plane - valid_paths.push_back("plane/point/x"); - valid_paths.push_back("plane/point/y"); - valid_paths.push_back("plane/point/z"); - valid_paths.push_back("plane/normal/x"); - valid_paths.push_back("plane/normal/y"); - valid_paths.push_back("plane/normal/z"); + std::cout << "\nSlice Properties!!" << std::endl; + param_schema().print(); + std::cout << "\nParams!!" << std::endl; + params.print(); - std::string surprises = surprise_check(valid_paths, params); + std::string surprises = surprise_check(param_schema(), params); if(surprises != "") { - res = false; info["errors"].append() = surprises; + return false; } - return res; + return true; } //----------------------------------------------------------------------------- diff --git a/src/libs/flow/flow_filter.cpp b/src/libs/flow/flow_filter.cpp index 4bce67aa1..39691752b 100644 --- a/src/libs/flow/flow_filter.cpp +++ b/src/libs/flow/flow_filter.cpp @@ -111,6 +111,10 @@ Filter::init(Graph *g, n_iface["port_names"] = DataType::empty(); } + if( !n_iface.has_child("param_schema") ) + { + n_iface["param_schema"] = DataType::empty(); + } params().update(default_params()); params().update(p); @@ -137,6 +141,13 @@ Filter::default_params() const return properties()["interface/default_params"]; } +//----------------------------------------------------------------------------- +const Node & +Filter::param_schema() const +{ + return properties()["interface/param_schema"]; +} + //----------------------------------------------------------------------------- const Node & Filter::port_names() const @@ -209,10 +220,25 @@ Filter::params() //----------------------------------------------------------------------------- bool -Filter::verify_params(const Node &, // unused: params, +Filter::verify_params(const Node ¶ms, Node &info) { info.reset(); + + std::cout << "\nSlice Properties!!" << std::endl; + param_schema().print(); + + std::cout << "\nParams!!" << std::endl; + params.print(); + + std::string surprises = "";// surprise_check(param_schema(), params); + + if(surprises != "") + { + info["errors"].append() = surprises; + return false; + } + return true; } diff --git a/src/libs/flow/flow_filter.hpp b/src/libs/flow/flow_filter.hpp index 7fbccd00c..f5d7258e5 100644 --- a/src/libs/flow/flow_filter.hpp +++ b/src/libs/flow/flow_filter.hpp @@ -138,6 +138,7 @@ class FLOW_API Filter bool output_port() const; const conduit::Node &default_params() const; + const conduit::Node ¶m_schema() const; int number_of_input_ports() const; bool has_port(const std::string &name) const; From f11830765edcf8f08d7e2957c3e913390627819d Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 5 Feb 2026 14:42:33 -0800 Subject: [PATCH 02/50] Removing slide verify_params --- .../ascent_runtime_vtkh_filters.cpp | 24 ------------------- .../ascent_runtime_vtkh_filters.hpp | 2 -- 2 files changed, 26 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 2a3b91b5b..9a4e85016 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -904,30 +904,6 @@ VTKHSlice::declare_interface(Node &i) i["param_schema"].set(vtkhslice_schema); } -//----------------------------------------------------------------------------- -bool -VTKHSlice::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - std::cout << "\nSlice Properties!!" << std::endl; - param_schema().print(); - - std::cout << "\nParams!!" << std::endl; - params.print(); - - std::string surprises = surprise_check(param_schema(), params); - - if(surprises != "") - { - info["errors"].append() = surprises; - return false; - } - - return true; -} - //----------------------------------------------------------------------------- void VTKHSlice::execute() diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp index b52f95815..1c5386777 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp @@ -90,8 +90,6 @@ class ASCENT_API VTKHSlice : public ::flow::Filter virtual ~VTKHSlice(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; From 736daf9a6bf88bbff2ab2a66f498e2c5458430b4 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 24 Feb 2026 12:37:06 -0800 Subject: [PATCH 03/50] Adding some more json schema examples --- .../ascent_runtime_vtkh_filters.cpp | 667 ++++++------------ .../ascent_runtime_vtkh_filters.hpp | 14 - 2 files changed, 207 insertions(+), 474 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 9a4e85016..8fcbee5f7 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -708,32 +708,16 @@ VTKHCleanGrid::declare_interface(Node &i) i["type_name"] = "vtkh_clean"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHCleanGrid::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res = check_string("topology",params, info, false) && res; - - std::vector valid_paths; - valid_paths.push_back("topology"); - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + // optional + param_schema["properties/topology"].set(string_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -808,18 +792,18 @@ VTKHSlice::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node vtkhslice_schema; - vtkhslice_schema["type"] = "object"; - vtkhslice_schema["additionalProperties"] = false; - vtkhslice_schema["constraints/exclusiveChildren"].append() = "sphere"; - vtkhslice_schema["constraints/exclusiveChildren"].append() = "cylinder"; - vtkhslice_schema["constraints/exclusiveChildren"].append() = "box"; - vtkhslice_schema["constraints/exclusiveChildren"].append() = "plane"; - vtkhslice_schema["constraints/exclusiveChildren"].append() = "point"; - vtkhslice_schema["constraints/allowNoneInExclusiveGroup"] = false; + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + param_schema["constraints/exclusiveChildren"].append() = "sphere"; + param_schema["constraints/exclusiveChildren"].append() = "cylinder"; + param_schema["constraints/exclusiveChildren"].append() = "box"; + param_schema["constraints/exclusiveChildren"].append() = "plane"; + param_schema["constraints/exclusiveChildren"].append() = "point"; + param_schema["constraints/allowNoneInExclusiveGroup"] = false; // optional - vtkhslice_schema["properties/topology"].set(string_schema()); + param_schema["properties/topology"].set(string_schema()); // --- sphere --- conduit::Node sphere_schema; @@ -829,7 +813,7 @@ VTKHSlice::declare_interface(Node &i) sphere_schema["properties/radius"].set(number_schema()); sphere_schema["required"].append() = "center"; sphere_schema["required"].append() = "radius"; - vtkhslice_schema["properties/sphere"].set(sphere_schema); + param_schema["properties/sphere"].set(sphere_schema); // --- cylinder --- conduit::Node cylinder_schema; @@ -841,7 +825,7 @@ VTKHSlice::declare_interface(Node &i) cylinder_schema["required"].append() = "center"; cylinder_schema["required"].append() = "axis"; cylinder_schema["required"].append() = "radius"; - vtkhslice_schema["properties/cylinder"].set(cylinder_schema); + param_schema["properties/cylinder"].set(cylinder_schema); // --- box --- conduit::Node box_schema; @@ -851,7 +835,7 @@ VTKHSlice::declare_interface(Node &i) box_schema["properties/max"].set(vec3_schema()); box_schema["required"].append() = "min"; box_schema["required"].append() = "max"; - vtkhslice_schema["properties/box"].set(box_schema); + param_schema["properties/box"].set(box_schema); // --- plane --- conduit::Node plane_schema; @@ -861,7 +845,7 @@ VTKHSlice::declare_interface(Node &i) plane_schema["properties/normal"].set(vec3_schema()); plane_schema["required"].append() = "point"; plane_schema["required"].append() = "normal"; - vtkhslice_schema["properties/plane"].set(plane_schema); + param_schema["properties/plane"].set(plane_schema); // --- old point style conduit::Node point_schema; @@ -897,11 +881,11 @@ VTKHSlice::declare_interface(Node &i) option_2_offset["constraints/forbid"].append() = "z"; point_schema["oneOf"].append().set(option_2_offset); - vtkhslice_schema["properties/point"].set(point_schema); - vtkhslice_schema["properties/normal"].set(vec3_schema()); - vtkhslice_schema["constraints/dependencies/normal"].append() = "point"; + param_schema["properties/point"].set(point_schema); + param_schema["properties/normal"].set(vec3_schema()); + param_schema["constraints/dependencies/normal"].append() = "point"; - i["param_schema"].set(vtkhslice_schema); + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1082,48 +1066,21 @@ VTKHAutoSliceLevels::declare_interface(Node &i) i["type_name"] = "vtkh_autoslicelevels"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHAutoSliceLevels::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("field",params, info, true); - - if(!params.has_path("levels")) - { - info["errors"] - .append() = "AutoSliceLevels must specify number of slices to consider via 'levels'."; - res = false; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - res = check_numeric("normal/x",params, info, true, true) && res; - res = check_numeric("normal/y",params, info, true, true) && res; - res = check_numeric("normal/z",params, info, true, true) && res; - - res = check_numeric("levels",params, info, true, true) && res; - - std::vector valid_paths; - valid_paths.push_back("levels"); - valid_paths.push_back("field"); - valid_paths.push_back("normal/x"); - valid_paths.push_back("normal/y"); - valid_paths.push_back("normal/z"); - + param_schema["properties/field"].set(string_schema()); + param_schema["properties/normal"].set(vec3_schema()); + param_schema["properties/levels"].set(number_schema()); - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "normal"; + param_schema["required"].append() = "levels"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1283,33 +1240,21 @@ VTKHGhostStripper::declare_interface(Node &i) i["type_name"] = "vtkh_ghost_stripper"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHGhostStripper::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - - res = check_numeric("min_value",params, info, true, true) && res; - res = check_numeric("max_value",params, info, true, true) && res; - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/min_value"].set(number_schema()); + param_schema["properties/max_value"].set(number_schema()); - return res; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "min_value"; + param_schema["required"].append() = "max_value"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1396,31 +1341,17 @@ VTKHAddRanks::declare_interface(Node &i) i["type_name"] = "vtkh_add_mpi_ranks"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHAddRanks::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("topology",params, info, false); - res = check_string("output",params, info, false); - - std::vector valid_paths; - valid_paths.push_back("output"); - valid_paths.push_back("topology"); - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + // optional + param_schema["properties/topology"].set(string_schema()); + param_schema["properties/output"].set(string_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1505,31 +1436,17 @@ VTKHAddDomains::declare_interface(Node &i) i["type_name"] = "vtkh_add_domain_ids"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -VTKHAddDomains::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("topology",params, info, false); - res = check_string("output",params, info, false); - - std::vector valid_paths; - valid_paths.push_back("output"); - valid_paths.push_back("topology"); - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + // optional + param_schema["properties/topology"].set(string_schema()); + param_schema["properties/output"].set(string_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1609,177 +1526,86 @@ VTKHThreshold::declare_interface(Node &i) i["type_name"] = "vtkh_threshold"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHThreshold::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - bool type_present = false; - - if(params.has_child("field")) - { - type_present = true; - } - else if(params.has_child("sphere")) - { - type_present = true; - } - else if(params.has_child("cylinder")) - { - type_present = true; - } - else if(params.has_child("box")) - { - type_present = true; - } - else if(params.has_child("plane")) - { - type_present = true; - } - else if(params.has_child("multi_plane")) - { - type_present = true; - } - - if(!type_present) - { - info["errors"].append() = "Missing required parameter. Threshold must specify 'field', 'sphere', 'cylinder', 'box', or 'plane'"; - res = false; - } - else - { - if(params.has_child("sphere")) - { - res = check_numeric("sphere/center/x",params, info, true, true) && res; - res = check_numeric("sphere/center/y",params, info, true, true) && res; - res = check_numeric("sphere/center/z",params, info, true, true) && res; - res = check_numeric("sphere/radius",params, info, true, true) && res; - } - else if(params.has_child("cylinder")) - { - res = check_numeric("cylinder/center/x",params, info, true, true) && res; - res = check_numeric("cylinder/center/y",params, info, true, true) && res; - res = check_numeric("cylinder/center/z",params, info, true, true) && res; - res = check_numeric("cylinder/axis/x",params, info, true, true) && res; - res = check_numeric("cylinder/axis/y",params, info, true, true) && res; - res = check_numeric("cylinder/axis/z",params, info, true, true) && res; - res = check_numeric("cylinder/radius",params, info, true, true) && res; - } - else if(params.has_child("box")) - { - res = check_numeric("box/min/x",params, info, true, true) && res; - res = check_numeric("box/min/y",params, info, true, true) && res; - res = check_numeric("box/min/z",params, info, true, true) && res; - res = check_numeric("box/max/x",params, info, true, true) && res; - res = check_numeric("box/max/y",params, info, true, true) && res; - res = check_numeric("box/max/z",params, info, true, true) && res; - } - else if(params.has_child("plane")) - { - res = check_numeric("plane/point/x",params, info, true, true) && res; - res = check_numeric("plane/point/y",params, info, true, true) && res; - res = check_numeric("plane/point/z",params, info, true, true) && res; - res = check_numeric("plane/normal/x",params, info, true, true) && res; - res = check_numeric("plane/normal/y",params, info, true, true) && res; - res = check_numeric("plane/normal/z",params, info, true, true) && res; - } - else if(params.has_child("multi_plane")) - { - res = check_numeric("multi_plane/point1/x",params, info, true, true) && res; - res = check_numeric("multi_plane/point1/y",params, info, true, true) && res; - res = check_numeric("multi_plane/point1/z",params, info, true, true) && res; - res = check_numeric("multi_plane/normal1/x",params, info, true, true) && res; - res = check_numeric("multi_plane/normal1/y",params, info, true, true) && res; - res = check_numeric("multi_plane/normal1/z",params, info, true, true) && res; - - res = check_numeric("multi_plane/point2/x",params, info, true, true) && res; - res = check_numeric("multi_plane/point2/y",params, info, true, true) && res; - res = check_numeric("multi_plane/point2/z",params, info, true, true) && res; - res = check_numeric("multi_plane/normal2/x",params, info, true, true) && res; - res = check_numeric("multi_plane/normal2/y",params, info, true, true) && res; - res = check_numeric("multi_plane/normal2/z",params, info, true, true) && res; - } - } - // we either need 'field` or `topology` - if(!params.has_child("field")) - { - res &= check_string("topology",params, info, false); - } - - // field case - res = check_string("field",params, info, false); - res = check_numeric("min_value",params, info, false, true) && res; - res = check_numeric("max_value",params, info, false, true) && res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + param_schema["constraints/exclusiveChildren"].append() = "field"; + param_schema["constraints/exclusiveChildren"].append() = "sphere"; + param_schema["constraints/exclusiveChildren"].append() = "cylinder"; + param_schema["constraints/exclusiveChildren"].append() = "box"; + param_schema["constraints/exclusiveChildren"].append() = "plane"; + param_schema["constraints/exclusiveChildren"].append() = "multi_plane"; + param_schema["constraints/allowNoneInExclusiveGroup"] = false; - res = check_string("invert",params, info, false) && res; + // optional + param_schema["properties/field"].set(string_schema()); + param_schema["properties/topology"].set(string_schema()); + param_schema["properties/min_value"].set(number_schema()); + param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/invert"].set(string_schema()); + param_schema["properties/extract"].set(string_schema()); - std::vector valid_paths; - valid_paths.push_back("invert"); - valid_paths.push_back("field"); - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); + // --- sphere --- + conduit::Node sphere_schema; + sphere_schema["type"] = "object"; + sphere_schema["additionalProperties"] = false; + sphere_schema["properties/center"].set(vec3_schema()); + sphere_schema["properties/radius"].set(number_schema()); + sphere_schema["required"].append() = "center"; + sphere_schema["required"].append() = "radius"; + param_schema["properties/sphere"].set(sphere_schema); - valid_paths.push_back("topology"); - valid_paths.push_back("extract"); - - valid_paths.push_back("sphere/center/x"); - valid_paths.push_back("sphere/center/y"); - valid_paths.push_back("sphere/center/z"); - valid_paths.push_back("sphere/radius"); - - valid_paths.push_back("cylinder/center/x"); - valid_paths.push_back("cylinder/center/y"); - valid_paths.push_back("cylinder/center/z"); - valid_paths.push_back("cylinder/axis/x"); - valid_paths.push_back("cylinder/axis/y"); - valid_paths.push_back("cylinder/axis/z"); - valid_paths.push_back("cylinder/radius"); - - valid_paths.push_back("box/min/x"); - valid_paths.push_back("box/min/y"); - valid_paths.push_back("box/min/z"); - valid_paths.push_back("box/max/x"); - valid_paths.push_back("box/max/y"); - valid_paths.push_back("box/max/z"); - - valid_paths.push_back("plane/point/x"); - valid_paths.push_back("plane/point/y"); - valid_paths.push_back("plane/point/z"); - valid_paths.push_back("plane/normal/x"); - valid_paths.push_back("plane/normal/y"); - valid_paths.push_back("plane/normal/z"); - - valid_paths.push_back("multi_plane/point1/x"); - valid_paths.push_back("multi_plane/point1/y"); - valid_paths.push_back("multi_plane/point1/z"); - valid_paths.push_back("multi_plane/normal1/x"); - valid_paths.push_back("multi_plane/normal1/y"); - valid_paths.push_back("multi_plane/normal1/z"); - - valid_paths.push_back("multi_plane/point2/x"); - valid_paths.push_back("multi_plane/point2/y"); - valid_paths.push_back("multi_plane/point2/z"); - valid_paths.push_back("multi_plane/normal2/x"); - valid_paths.push_back("multi_plane/normal2/y"); - valid_paths.push_back("multi_plane/normal2/z"); - std::string surprises = surprise_check(valid_paths, params); + // --- cylinder --- + conduit::Node cylinder_schema; + cylinder_schema["type"] = "object"; + cylinder_schema["additionalProperties"] = false; + cylinder_schema["properties/center"].set(vec3_schema()); + cylinder_schema["properties/axis"].set(vec3_schema()); + cylinder_schema["properties/radius"].set(number_schema()); + cylinder_schema["required"].append() = "center"; + cylinder_schema["required"].append() = "axis"; + cylinder_schema["required"].append() = "radius"; + param_schema["properties/cylinder"].set(cylinder_schema); - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // --- box --- + conduit::Node box_schema; + box_schema["type"] = "object"; + box_schema["additionalProperties"] = false; + box_schema["properties/min"].set(vec3_schema()); + box_schema["properties/max"].set(vec3_schema()); + box_schema["required"].append() = "min"; + box_schema["required"].append() = "max"; + param_schema["properties/box"].set(box_schema); - return res; + // --- plane --- + conduit::Node plane_schema; + plane_schema["type"] = "object"; + plane_schema["additionalProperties"] = false; + plane_schema["properties/point"].set(vec3_schema()); + plane_schema["properties/normal"].set(vec3_schema()); + plane_schema["required"].append() = "point"; + plane_schema["required"].append() = "normal"; + param_schema["properties/plane"].set(plane_schema); + + // --- multi plane --- + conduit::Node multi_plane_schema; + multi_plane_schema["type"] = "object"; + multi_plane_schema["additionalProperties"] = false; + multi_plane_schema["properties/point1"].set(vec3_schema()); + multi_plane_schema["properties/point2"].set(vec3_schema()); + multi_plane_schema["properties/normal1"].set(vec3_schema()); + multi_plane_schema["properties/normal2"].set(vec3_schema()); + multi_plane_schema["required"].append() = "point1"; + multi_plane_schema["required"].append() = "point2"; + multi_plane_schema["required"].append() = "normal1"; + multi_plane_schema["required"].append() = "normal2"; + param_schema["properties/multi_plane"].set(multi_plane_schema); + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void VTKHThreshold::execute() @@ -1971,160 +1797,81 @@ VTKHClip::declare_interface(Node &i) i["type_name"] = "vtkh_clip"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHClip::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - bool type_present = false; - - if(params.has_child("sphere")) - { - type_present = true; - } - else if(params.has_child("cylinder")) - { - type_present = true; - } - else if(params.has_child("box")) - { - type_present = true; - } - else if(params.has_child("plane")) - { - type_present = true; - } - else if(params.has_child("multi_plane")) - { - type_present = true; - } - if(!type_present) - { - info["errors"].append() = "Missing required parameter. Clip must specify a 'sphere', 'cylinder', 'box', 'plane', or 'mulit_plane'"; - res = false; - } - else - { - - res &= check_string("topology",params, info, false); - if(params.has_child("sphere")) - { - res = check_numeric("sphere/center/x",params, info, true, true) && res; - res = check_numeric("sphere/center/y",params, info, true, true) && res; - res = check_numeric("sphere/center/z",params, info, true, true) && res; - res = check_numeric("sphere/radius",params, info, true, true) && res; - } - else if(params.has_child("cylinder")) - { - res = check_numeric("cylinder/center/x",params, info, true, true) && res; - res = check_numeric("cylinder/center/y",params, info, true, true) && res; - res = check_numeric("cylinder/center/z",params, info, true, true) && res; - res = check_numeric("cylinder/axis/x",params, info, true, true) && res; - res = check_numeric("cylinder/axis/y",params, info, true, true) && res; - res = check_numeric("cylinder/axis/z",params, info, true, true) && res; - res = check_numeric("cylinder/radius",params, info, true, true) && res; - } - else if(params.has_child("box")) - { - res = check_numeric("box/min/x",params, info, true, true) && res; - res = check_numeric("box/min/y",params, info, true, true) && res; - res = check_numeric("box/min/z",params, info, true, true) && res; - res = check_numeric("box/max/x",params, info, true, true) && res; - res = check_numeric("box/max/y",params, info, true, true) && res; - res = check_numeric("box/max/z",params, info, true, true) && res; - } - else if(params.has_child("plane")) - { - res = check_numeric("plane/point/x",params, info, true, true) && res; - res = check_numeric("plane/point/y",params, info, true, true) && res; - res = check_numeric("plane/point/z",params, info, true, true) && res; - res = check_numeric("plane/normal/x",params, info, true, true) && res; - res = check_numeric("plane/normal/y",params, info, true, true) && res; - res = check_numeric("plane/normal/z",params, info, true, true) && res; - } - else if(params.has_child("multi_plane")) - { - res = check_numeric("multi_plane/point1/x",params, info, true, true) && res; - res = check_numeric("multi_plane/point1/y",params, info, true, true) && res; - res = check_numeric("multi_plane/point1/z",params, info, true, true) && res; - res = check_numeric("multi_plane/normal1/x",params, info, true, true) && res; - res = check_numeric("multi_plane/normal1/y",params, info, true, true) && res; - res = check_numeric("multi_plane/normal1/z",params, info, true, true) && res; - - res = check_numeric("multi_plane/point2/x",params, info, true, true) && res; - res = check_numeric("multi_plane/point2/y",params, info, true, true) && res; - res = check_numeric("multi_plane/point2/z",params, info, true, true) && res; - res = check_numeric("multi_plane/normal2/x",params, info, true, true) && res; - res = check_numeric("multi_plane/normal2/y",params, info, true, true) && res; - res = check_numeric("multi_plane/normal2/z",params, info, true, true) && res; - } - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + param_schema["constraints/exclusiveChildren"].append() = "sphere"; + param_schema["constraints/exclusiveChildren"].append() = "cylinder"; + param_schema["constraints/exclusiveChildren"].append() = "box"; + param_schema["constraints/exclusiveChildren"].append() = "plane"; + param_schema["constraints/exclusiveChildren"].append() = "multi_plane"; + param_schema["constraints/allowNoneInExclusiveGroup"] = false; - res = check_string("invert",params, info, false) && res; - res = check_string("topology",params, info, false) && res; + // optional + param_schema["properties/topology"].set(string_schema()); + param_schema["properties/invert"].set(string_schema()); - std::vector valid_paths; - valid_paths.push_back("topology"); - valid_paths.push_back("invert"); + // --- sphere --- + conduit::Node sphere_schema; + sphere_schema["type"] = "object"; + sphere_schema["additionalProperties"] = false; + sphere_schema["properties/center"].set(vec3_schema()); + sphere_schema["properties/radius"].set(number_schema()); + sphere_schema["required"].append() = "center"; + sphere_schema["required"].append() = "radius"; + param_schema["properties/sphere"].set(sphere_schema); - valid_paths.push_back("sphere/center/x"); - valid_paths.push_back("sphere/center/y"); - valid_paths.push_back("sphere/center/z"); - valid_paths.push_back("sphere/radius"); - - valid_paths.push_back("cylinder/center/x"); - valid_paths.push_back("cylinder/center/y"); - valid_paths.push_back("cylinder/center/z"); - valid_paths.push_back("cylinder/axis/x"); - valid_paths.push_back("cylinder/axis/y"); - valid_paths.push_back("cylinder/axis/z"); - valid_paths.push_back("cylinder/radius"); - - valid_paths.push_back("box/min/x"); - valid_paths.push_back("box/min/y"); - valid_paths.push_back("box/min/z"); - valid_paths.push_back("box/max/x"); - valid_paths.push_back("box/max/y"); - valid_paths.push_back("box/max/z"); - - valid_paths.push_back("plane/point/x"); - valid_paths.push_back("plane/point/y"); - valid_paths.push_back("plane/point/z"); - valid_paths.push_back("plane/normal/x"); - valid_paths.push_back("plane/normal/y"); - valid_paths.push_back("plane/normal/z"); - - valid_paths.push_back("multi_plane/point1/x"); - valid_paths.push_back("multi_plane/point1/y"); - valid_paths.push_back("multi_plane/point1/z"); - valid_paths.push_back("multi_plane/normal1/x"); - valid_paths.push_back("multi_plane/normal1/y"); - valid_paths.push_back("multi_plane/normal1/z"); - - valid_paths.push_back("multi_plane/point2/x"); - valid_paths.push_back("multi_plane/point2/y"); - valid_paths.push_back("multi_plane/point2/z"); - valid_paths.push_back("multi_plane/normal2/x"); - valid_paths.push_back("multi_plane/normal2/y"); - valid_paths.push_back("multi_plane/normal2/z"); - std::string surprises = surprise_check(valid_paths, params); + // --- cylinder --- + conduit::Node cylinder_schema; + cylinder_schema["type"] = "object"; + cylinder_schema["additionalProperties"] = false; + cylinder_schema["properties/center"].set(vec3_schema()); + cylinder_schema["properties/axis"].set(vec3_schema()); + cylinder_schema["properties/radius"].set(number_schema()); + cylinder_schema["required"].append() = "center"; + cylinder_schema["required"].append() = "axis"; + cylinder_schema["required"].append() = "radius"; + param_schema["properties/cylinder"].set(cylinder_schema); - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // --- box --- + conduit::Node box_schema; + box_schema["type"] = "object"; + box_schema["additionalProperties"] = false; + box_schema["properties/min"].set(vec3_schema()); + box_schema["properties/max"].set(vec3_schema()); + box_schema["required"].append() = "min"; + box_schema["required"].append() = "max"; + param_schema["properties/box"].set(box_schema); - return res; + // --- plane --- + conduit::Node plane_schema; + plane_schema["type"] = "object"; + plane_schema["additionalProperties"] = false; + plane_schema["properties/point"].set(vec3_schema()); + plane_schema["properties/normal"].set(vec3_schema()); + plane_schema["required"].append() = "point"; + plane_schema["required"].append() = "normal"; + param_schema["properties/plane"].set(plane_schema); + + // --- multi plane --- + conduit::Node multi_plane_schema; + multi_plane_schema["type"] = "object"; + multi_plane_schema["additionalProperties"] = false; + multi_plane_schema["properties/point1"].set(vec3_schema()); + multi_plane_schema["properties/point2"].set(vec3_schema()); + multi_plane_schema["properties/normal1"].set(vec3_schema()); + multi_plane_schema["properties/normal2"].set(vec3_schema()); + multi_plane_schema["required"].append() = "point1"; + multi_plane_schema["required"].append() = "point2"; + multi_plane_schema["required"].append() = "normal1"; + multi_plane_schema["required"].append() = "normal2"; + param_schema["properties/multi_plane"].set(multi_plane_schema); + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void VTKHClip::execute() diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp index 1c5386777..7cffa8a49 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp @@ -101,8 +101,6 @@ class ASCENT_API VTKHAutoSliceLevels : public ::flow::Filter virtual ~VTKHAutoSliceLevels(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; //----------------------------------------------------------------------------- @@ -126,8 +124,6 @@ class ASCENT_API VTKHThreshold : public ::flow::Filter virtual ~VTKHThreshold(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -139,8 +135,6 @@ class ASCENT_API VTKHGhostStripper: public ::flow::Filter virtual ~VTKHGhostStripper(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -152,8 +146,6 @@ class ASCENT_API VTKHAddRanks : public ::flow::Filter virtual ~VTKHAddRanks(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -166,8 +158,6 @@ class ASCENT_API VTKHAddDomains : public ::flow::Filter virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -181,8 +171,6 @@ class ASCENT_API VTKHClip: public ::flow::Filter virtual ~VTKHClip(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -456,8 +444,6 @@ class ASCENT_API VTKHCleanGrid : public ::flow::Filter virtual ~VTKHCleanGrid(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; From f6a94d20a8dee59864284a56e2ba823ebfcaaece Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 24 Feb 2026 17:17:06 -0800 Subject: [PATCH 04/50] Adding a schema validator for flow filters --- src/libs/flow/CMakeLists.txt | 2 + src/libs/flow/flow_filter.cpp | 18 +- src/libs/flow/flow_schema_validator.cpp | 407 ++++++++++++++++++++++++ src/libs/flow/flow_schema_validator.hpp | 108 +++++++ 4 files changed, 525 insertions(+), 10 deletions(-) create mode 100644 src/libs/flow/flow_schema_validator.cpp create mode 100644 src/libs/flow/flow_schema_validator.hpp diff --git a/src/libs/flow/CMakeLists.txt b/src/libs/flow/CMakeLists.txt index c17075196..249af3b54 100644 --- a/src/libs/flow/CMakeLists.txt +++ b/src/libs/flow/CMakeLists.txt @@ -25,6 +25,7 @@ set(flow_sources flow_graph.cpp flow_workspace.cpp flow_timer.cpp + flow_schema_validator.cpp filters/flow_builtin_filters.cpp) set(flow_headers @@ -38,6 +39,7 @@ set(flow_headers flow_graph.hpp flow_workspace.hpp flow_timer.hpp + flow_schema_validator.hpp filters/flow_builtin_filters.hpp) set(flow_thirdparty_libs diff --git a/src/libs/flow/flow_filter.cpp b/src/libs/flow/flow_filter.cpp index 39691752b..9f502c767 100644 --- a/src/libs/flow/flow_filter.cpp +++ b/src/libs/flow/flow_filter.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace conduit; @@ -225,18 +226,15 @@ Filter::verify_params(const Node ¶ms, { info.reset(); - std::cout << "\nSlice Properties!!" << std::endl; - param_schema().print(); - - std::cout << "\nParams!!" << std::endl; - params.print(); + if (!param_schema().dtype().is_empty() && !(param_schema().dtype().is_object() && param_schema().number_of_children() == 0)) + { + // std::cout << "\nSlice Properties!!" << std::endl; + // param_schema().print(); - std::string surprises = "";// surprise_check(param_schema(), params); + // std::cout << "\nParams!!" << std::endl; + // params.print(); - if(surprises != "") - { - info["errors"].append() = surprises; - return false; + return flow::schema::validate(param_schema(), params, info); } return true; diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp new file mode 100644 index 000000000..09ae400da --- /dev/null +++ b/src/libs/flow/flow_schema_validator.cpp @@ -0,0 +1,407 @@ +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// +// Copyright (c) Lawrence Livermore National Security, LLC and other Ascent +// Project developers. See top-level LICENSE AND COPYRIGHT files for dates and +// other details. No copyright assignment is required to contribute to Ascent. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// + + +//----------------------------------------------------------------------------- +/// +/// file: flow_schema_validator.cpp +/// +//----------------------------------------------------------------------------- + +#include "flow_schema_validator.hpp" + +// standard lib includes +#include +#include + +//----------------------------------------------------------------------------- +// -- begin flow -- +//----------------------------------------------------------------------------- +namespace flow +{ + +//----------------------------------------------------------------------------- +// -- begin flow::schema -- +//----------------------------------------------------------------------------- +namespace schema +{ + +// ---------- General Helpers ---------- +static void add_error(conduit::Node &info, const std::string &msg) +{ + if(!info.has_child("errors")) + { + info["errors"].reset(); + } + info["errors"].append() = msg; +} + +static std::string get_type_string(const conduit::Node &schema) +{ + if(schema.has_child("type") && schema["type"].dtype().is_string()) + { + return schema["type"].as_string(); + } + return ""; +} + +static bool check_type(const conduit::Node &input, + const conduit::Node &schema, + conduit::Node &info, + const std::string &path) +{ + const std::string schema_defined_type = get_type_string(schema); + if(schema_defined_type.empty()) return true; // schema didn't specify; treat as "accept anything" + + const auto data_type = input.dtype(); + bool ok = true; + + if(schema_defined_type == "object") ok = data_type.is_object(); + else if(schema_defined_type == "string") ok = data_type.is_string(); + else if(schema_defined_type == "number") ok = data_type.is_number(); + else + { + add_error(info, "At '" + (path.empty() ? std::string("") : path) + + "': unknown schema type '" + schema_defined_type + "'"); + return false; + } + + if(!ok) + { + add_error(info, "Type mismatch at '" + (path.empty() ? std::string("") : path) + + "': expected " + schema_defined_type + ", got " + input.dtype().name()); + } + + return ok; +} + +// ---------- Object-Specific Validation Helpers ---------- +static bool validate_required(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_child("required")) return true; + if(!input.dtype().is_object()) return true; // type error handled elsewhere + + bool ok = true; + const conduit::Node &req = schema["required"]; + for(conduit::index_t i = 0; i < req.number_of_children(); ++i) + { + const std::string k = req.child(i).as_string(); + if(!input.has_child(k)) + { + add_error(info, "Missing required field '" + conduit::utils::join_file_path(path, k) + "'"); + ok = false; + } + } + return ok; +} + +static bool validate_forbid(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_path("constraints/forbid")) return true; + if(!input.dtype().is_object()) return true; + + bool ok = true; + const conduit::Node &forbid = schema["constraints/forbid"]; + for(conduit::index_t i = 0; i < forbid.number_of_children(); ++i) + { + const std::string k = forbid.child(i).as_string(); + if(input.has_child(k)) + { + add_error(info, "Field '" + conduit::utils::join_file_path(path, k) + "' is forbidden by schema"); + ok = false; + } + } + return ok; +} + +static bool validate_properties(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_child("properties")) return true; + if(!input.dtype().is_object()) return true; + + bool ok = true; + const conduit::Node &props = schema["properties"]; + for(conduit::index_t i = 0; i < props.number_of_children(); ++i) + { + const std::string k = props[i].name(); + if(input.has_child(k)) + { + ok = validate_node(props[k], input[k], info, conduit::utils::join_file_path(path, k)) && ok; + } + } + return ok; +} + +static bool validate_additional_properties(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!input.dtype().is_object()) return true; + + bool allow_additional = true; + if(schema.has_child("additionalProperties")) + { + allow_additional = schema["additionalProperties"].to_int() != 0; + } + + if(allow_additional) return true; + + const bool has_props = schema.has_child("properties"); + const conduit::Node props_dummy; + const conduit::Node &props = has_props ? schema["properties"] : props_dummy; + + bool ok = true; + for(conduit::index_t i = 0; i < input.number_of_children(); ++i) + { + const std::string k = input[i].name(); + if(!has_props || !props.has_child(k)) + { + add_error(info, "Unexpected field '" + conduit::utils::join_file_path(path, k) + + "' (additionalProperties=false)"); + ok = false; + } + } + return ok; +} + +static bool validate_dependencies(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_path("constraints/dependencies")) return true; + if(!input.dtype().is_object()) return true; + + bool ok = true; + const conduit::Node &deps = schema["constraints/dependencies"]; + + for(conduit::index_t i = 0; i < deps.number_of_children(); ++i) + { + const std::string trigger = deps[i].name(); + if(!input.has_child(trigger)) continue; + + const conduit::Node &reqs = deps[trigger]; + for(conduit::index_t j = 0; j < reqs.number_of_children(); ++j) + { + const std::string needed = reqs.child(j).as_string(); + if(!input.has_child(needed)) + { + add_error(info, "Dependency violation at '" + + (path.empty() ? std::string("") : path) + + "': if '" + trigger + "' is provided, '" + + needed + "' must also be provided"); + ok = false; + } + } + } + return ok; +} + +static bool validate_exclusive_children(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_path("constraints/exclusiveChildren")) return true; + if(!input.dtype().is_object()) return true; + + const conduit::Node &keys = schema["constraints/exclusiveChildren"]; + const bool allow_none = schema.has_path("constraints/allowNoneInExclusiveGroup") + ? (schema["constraints/allowNoneInExclusiveGroup"].to_int() != 0) + : true; + + std::vector present; + present.reserve((size_t)keys.number_of_children()); + + for(conduit::index_t i = 0; i < keys.number_of_children(); ++i) + { + const std::string k = keys.child(i).as_string(); + if(input.has_child(k)) present.push_back(k); + } + + const int count = (int)present.size(); + const bool ok = allow_none ? (count <= 1) : (count == 1); + + if(ok) return true; + + std::ostringstream oss; + oss << "Exclusive-children violation at '" + << (path.empty() ? "" : path) << "': expected " + << (allow_none ? "zero or one" : "exactly one") + << " of {"; + + for(conduit::index_t i = 0; i < keys.number_of_children(); ++i) + { + if(i) oss << ", "; + oss << keys.child(i).as_string(); + } + oss << "}"; + + if(count > 0) + { + oss << ", but found: {"; + for(size_t i = 0; i < present.size(); ++i) + { + if(i) oss << ", "; + oss << present[i]; + } + oss << "}"; + } + else + { + oss << ", but found none"; + } + + add_error(info, oss.str()); + return false; +} + +static bool validate_one_of(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_child("oneOf")) return true; + + const conduit::Node &opts = schema["oneOf"]; + int matches = 0; + + // keep at most one representative failure per option for clarity + std::vector option_msgs; + + for(conduit::index_t i = 0; i < opts.number_of_children(); ++i) + { + const conduit::Node &opt = opts.child(i); + + conduit::Node tmp; + tmp.reset(); + + bool ok = true; + ok = check_type(input, opt, tmp, path) && ok; + ok = validate_required(opt, input, tmp, path) && ok; + ok = validate_forbid(opt, input, tmp, path) && ok; + ok = validate_dependencies(opt, input, tmp, path) && ok; + ok = validate_exclusive_children(opt, input, tmp, path) && ok; + + if(ok) + { + matches++; + } + else + { + // pick first error as representative + if(tmp.has_child("errors") && tmp["errors"].number_of_children() > 0) + { + option_msgs.push_back(tmp["errors"].child(0).as_string()); + } + else + { + option_msgs.push_back("Option " + std::to_string((int)i) + " failed"); + } + } + } + + if(matches == 1) return true; + + std::ostringstream oss; + oss << "oneOf violation at '" << (path.empty() ? "" : path) << "': "; + if(matches == 0) oss << "input did not match any supported schemas"; + else oss << "input matched " << matches << " options (ambiguous)"; + add_error(info, oss.str()); + + // give a couple of hints + for(size_t i = 0; i < option_msgs.size() && i < 2; ++i) + { + add_error(info, std::string(" hint: ") + option_msgs[i]); + } + + return false; +} + +static bool validate_object(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + bool ok = true; + + // Base checks first + ok = validate_required(schema, input, info, path) && ok; + ok = validate_forbid(schema, input, info, path) && ok; + ok = validate_dependencies(schema, input, info, path) && ok; + ok = validate_exclusive_children(schema, input, info, path) && ok; + + // Enforce unknown fields after we know properties + ok = validate_additional_properties(schema, input, info, path) && ok; + + // Recurse into declared properties that exist in input + ok = validate_properties(schema, input, info, path) && ok; + + // Finally, enforce oneOf (treating options as extra constraints on this same object) + ok = validate_one_of(schema, input, info, path) && ok; + + return ok; +} + +static bool validate_node(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + bool ok = true; + + ok = check_type(input, schema, info, path) && ok; + if(!ok) return false; // type mismatch stops recursion + + const std::string schema_defined_type = get_type_string(schema); + if(schema_defined_type == "object") + { + return validate_object(schema, input, info, path); + } + + ok = validate_one_of(schema, input, info, path) && ok; + + return ok; +} + +// ---------- Schema Validation Entry-Point ---------- +bool validate(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info) +{ + info.reset(); + bool ok = validate_node(schema, input, info, ""); + + if(!ok && !info.has_child("errors")) + { + info["errors"].append() = "Validation failed (no details)"; + } + + return ok; +} + + +}; +//----------------------------------------------------------------------------- +// -- end flow::schema -- +//----------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- +}; +//----------------------------------------------------------------------------- +// -- end flow -- +//----------------------------------------------------------------------------- \ No newline at end of file diff --git a/src/libs/flow/flow_schema_validator.hpp b/src/libs/flow/flow_schema_validator.hpp new file mode 100644 index 000000000..11043ff70 --- /dev/null +++ b/src/libs/flow/flow_schema_validator.hpp @@ -0,0 +1,108 @@ +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// +// Copyright (c) Lawrence Livermore National Security, LLC and other Ascent +// Project developers. See top-level LICENSE AND COPYRIGHT files for dates and +// other details. No copyright assignment is required to contribute to Ascent. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// + + +//----------------------------------------------------------------------------- +/// +/// file: flow_schema_validator.hpp +/// +//----------------------------------------------------------------------------- + +#ifndef FLOW_SCHEMA_VALIDATOR_HPP +#define FLOW_SCHEMA_VALIDATOR_HPP + +#include + +#include +#include + +//----------------------------------------------------------------------------- +// -- begin flow -- +//----------------------------------------------------------------------------- +namespace flow +{ + +//----------------------------------------------------------------------------- +// -- begin flow::schema -- +//----------------------------------------------------------------------------- +namespace schema +{ + +bool FLOW_API validate(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info); + + +static bool validate_node(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_object(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_one_of(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_exclusive_children(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_dependencies(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_properties(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_additional_properties(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_required(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool validate_forbid(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +static bool check_type(const conduit::Node &input, + const conduit::Node &schema, + conduit::Node &info, + const std::string &path); + +static std::string get_type_string(const conduit::Node &schema); + +static void add_error(conduit::Node &info, const std::string &msg); + +}; +//----------------------------------------------------------------------------- +// -- end flow::schema -- +//----------------------------------------------------------------------------- + + +//----------------------------------------------------------------------------- +}; +//----------------------------------------------------------------------------- +// -- end flow -- +//----------------------------------------------------------------------------- + +#endif +//----------------------------------------------------------------------------- +// -- end header ifdef guard +//----------------------------------------------------------------------------- \ No newline at end of file From 6d5d6e139be9c980997e168ccc18bda55e7eafb3 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Fri, 27 Feb 2026 15:59:50 -0800 Subject: [PATCH 05/50] Translating all filters in ascent_runtime_vtkh_filters to json schema format. Also adding additional validator constructs needed to complete this. --- .../ascent_runtime_param_check.cpp | 56 + .../ascent_runtime_param_check.hpp | 12 + .../ascent_runtime_vtkh_filters.cpp | 1577 +++++------------ .../ascent_runtime_vtkh_filters.hpp | 62 - src/libs/flow/flow_schema_validator.cpp | 186 +- 5 files changed, 722 insertions(+), 1171 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 9291cb84e..0e75196c7 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -72,6 +72,39 @@ conduit::Node string_schema() return n; } +conduit::Node vec3_schema_anyOf(const std::string var1, const std::string var2, const std::string var3) +{ + conduit::Node n; + n["type"] = "object"; + n["additionalProperties"] = false; + + n["properties/" + var1].set(number_schema()); + n["properties/" + var2].set(number_schema()); + n["properties/" + var3].set(number_schema()); + + conduit::Node var1_required; + var1_required["type"] = "object"; + var1_required["required"] = var1; + n["anyOf"].append().set(var1_required); + + conduit::Node var2_required; + var2_required["type"] = "object"; + var2_required["required"] = var1; + n["anyOf"].append().set(var2_required); + + conduit::Node var3_required; + var3_required["type"] = "object"; + var3_required["required"] = var1; + n["anyOf"].append().set(var3_required); + + return n; +} + +conduit::Node vec3_schema_anyOf() +{ + return vec3_schema_anyOf("x", "y", "z"); +} + conduit::Node vec3_schema(const std::string var1, const std::string var2, const std::string var3) { conduit::Node n; @@ -94,6 +127,29 @@ conduit::Node vec3_schema() return vec3_schema("x", "y", "z"); } +conduit::Node array_schema(const conduit::Node &item_schema) +{ + conduit::Node n; + n["type"] = "array"; + n["items"].set(item_schema); + return n; +} + +conduit::Node array_schema() +{ + conduit::Node n; + n["type"] = "array"; + return n; +} + +conduit::Node ignore_schema() +{ + conduit::Node n; + n["type"] = "object"; + n["constraints/skip"] = true; + return n; +} + //----------------------------------------------------------------------------- bool check_numeric(const std::string path, diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 9c0c557f3..50413c9a0 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -51,6 +51,18 @@ conduit::Node ASCENT_API vec3_schema(const std::string var1, const std::string var2, const std::string var3); +conduit::Node ASCENT_API vec3_schema_anyOf(); + +conduit::Node ASCENT_API vec3_schema_anyOf(const std::string var1, + const std::string var2, + const std::string var3); + +conduit::Node ASCENT_API array_schema(); + +conduit::Node ASCENT_API array_schema(const conduit::Node &item_schema); + +conduit::Node ASCENT_API ignore_schema(); + bool ASCENT_API check_numeric(const std::string path, const conduit::Node ¶ms, conduit::Node &info, diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 8fcbee5f7..95445f6b0 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -134,40 +134,22 @@ VTKHMarchingCubes::declare_interface(Node &i) i["type_name"] = "vtkh_marchingcubes"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHMarchingCubes::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("field",params, info, true); - bool has_values = check_numeric("iso_values",params, info, false); - bool has_levels = check_numeric("levels",params, info, false); - - if(!has_values && !has_levels) - { - info["errors"].append() = "Missing required numeric parameter. Contour must" - " specify 'iso_values' or 'levels'."; - res = false; - } - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("levels"); - valid_paths.push_back("iso_values"); - valid_paths.push_back("use_contour_tree"); - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/levels"].set(number_schema()); + param_schema["properties/iso_values"].set(number_schema()); + param_schema["properties/use_contour_tree"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + param_schema["anyOf"].append() = "levels"; + param_schema["anyOf"].append() = "iso_values"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -245,7 +227,6 @@ VTKHMarchingCubes::execute() set_output(res); } -//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- VTKHExternalSurfaces::VTKHExternalSurfaces() :Filter() @@ -266,31 +247,15 @@ VTKHExternalSurfaces::declare_interface(Node &i) i["type_name"] = "vtkh_external_surfaces"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHExternalSurfaces::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - res = check_string("topology",params, info, false) && res; - - std::vector valid_paths; - valid_paths.push_back("topology"); - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/topology"].set(string_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -360,30 +325,18 @@ VTKHVectorMagnitude::declare_interface(Node &i) i["type_name"] = "vtkh_vector_magnitude"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHVectorMagnitude::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("field",params, info, true); - res = check_string("output_name",params, info, false) && res; - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -464,36 +417,18 @@ VTKH3Slice::declare_interface(Node &i) i["type_name"] = "vtkh_3slice"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKH3Slice::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - std::vector valid_paths; - res &= check_string("topology",params, info, false); - valid_paths.push_back("topology"); - res &= check_numeric("x_offset",params, info, false, true); - res &= check_numeric("y_offset",params, info, false, true); - res &= check_numeric("z_offset",params, info, false, true); - res = check_string("topology",params, info, false) && res; - - valid_paths.push_back("x_offset"); - valid_paths.push_back("y_offset"); - valid_paths.push_back("z_offset"); - - std::string surprises = surprise_check(valid_paths, params); - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/topology"].set(string_schema()); + param_schema["properties/x_offset"].set(number_schema()); + param_schema["properties/y_offset"].set(number_schema()); + param_schema["properties/z_offset"].set(number_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -613,32 +548,15 @@ VTKHTriangulate::declare_interface(Node &i) i["type_name"] = "vtkh_triangulate"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHTriangulate::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - res = check_string("topology",params, info, false) && res; - - std::vector valid_paths; - valid_paths.push_back("topology"); - - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/topology"].set(string_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2024,34 +1942,22 @@ VTKHClipWithField::declare_interface(Node &i) i["type_name"] = "vtkh_clip_with_field"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -VTKHClipWithField::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_numeric("clip_value",params, info, true, true); - res = check_string("field",params, info, true) && res; - res = check_string("invert",params, info, false) && res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::vector valid_paths; - valid_paths.push_back("clip_value"); - valid_paths.push_back("invert"); - valid_paths.push_back("field"); - std::string surprises = surprise_check(valid_paths, params); + param_schema["properties/clip_value"].set(number_schema()); + param_schema["properties/field"].set(string_schema()); + param_schema["properties/invert"].set(string_schema()); - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["required"].append() = "clip_value"; + param_schema["required"].append() = "field"; - return res; + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void VTKHClipWithField::execute() @@ -2136,35 +2042,23 @@ VTKHIsoVolume::declare_interface(Node &i) i["type_name"] = "vtkh_iso_volume"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHIsoVolume::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_numeric("min_value",params, info, true, true); - res = check_numeric("max_value",params, info, true, true) && res; - res = check_string("field",params, info, true) && res; - std::vector valid_paths; - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); - valid_paths.push_back("field"); - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/min_value"].set(number_schema()); + param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/field"].set(string_schema()); - return res; + param_schema["required"].append() = "min_value"; + param_schema["required"].append() = "max_value"; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void VTKHIsoVolume::execute() @@ -2242,44 +2136,31 @@ VTKHLagrangian::declare_interface(Node &i) i["type_name"] = "vtkh_lagrangian"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -VTKHLagrangian::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("field",params, info, true); - res &= check_numeric("step_size", params, info, true); - res &= check_numeric("write_frequency", params, info, true); - res &= check_numeric("cust_res", params, info, true); - res &= check_numeric("x_res", params, info, true); - res &= check_numeric("y_res", params, info, true); - res &= check_numeric("z_res", params, info, true); - - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("step_size"); - valid_paths.push_back("write_frequency"); - valid_paths.push_back("cust_res"); - valid_paths.push_back("x_res"); - valid_paths.push_back("y_res"); - valid_paths.push_back("z_res"); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::string surprises = surprise_check(valid_paths, params); + param_schema["properties/field"].set(string_schema()); + param_schema["properties/step_size"].set(number_schema()); + param_schema["properties/write_frequency"].set(number_schema()); + param_schema["properties/cust_res"].set(number_schema()); + param_schema["properties/x_res"].set(number_schema()); + param_schema["properties/y_res"].set(number_schema()); + param_schema["properties/z_res"].set(number_schema()); - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "step_size"; + param_schema["required"].append() = "write_frequency"; + param_schema["required"].append() = "cust_res"; + param_schema["required"].append() = "x_res"; + param_schema["required"].append() = "y_res"; + param_schema["required"].append() = "z_res"; + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void VTKHLagrangian::execute() @@ -2364,33 +2245,19 @@ VTKHLog::declare_interface(Node &i) i["type_name"] = "vtkh_log"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHLog::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_string("output_name",params, info, false); - res &= check_numeric("clamp_min_value",params, info, false, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - valid_paths.push_back("clamp_min_value"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/clamp_min_value"].set(number_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2474,33 +2341,19 @@ VTKHLog10::declare_interface(Node &i) i["type_name"] = "vtkh_log10"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHLog10::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_string("output_name",params, info, false); - res &= check_numeric("clamp_min_value",params, info, false, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - valid_paths.push_back("clamp_min_value"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/clamp_min_value"].set(number_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2584,33 +2437,19 @@ VTKHLog2::declare_interface(Node &i) i["type_name"] = "vtkh_log2"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHLog2::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_string("output_name",params, info, false); - res &= check_numeric("clamp_min_value",params, info, false, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - valid_paths.push_back("clamp_min_value"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/clamp_min_value"].set(number_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2694,31 +2533,19 @@ VTKHRecenter::declare_interface(Node &i) i["type_name"] = "vtkh_recenter"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHRecenter::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_string("association",params, info, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("association"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/association"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "association"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2808,33 +2635,19 @@ VTKHHistSampling::declare_interface(Node &i) i["type_name"] = "vtkh_hist_sampling"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHHistSampling::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_numeric("bins",params, info, false, true); - res &= check_numeric("sample_rate",params, info, false, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("bins"); - valid_paths.push_back("sample_rate"); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::string surprises = surprise_check(valid_paths, params); + param_schema["properties/field"].set(string_schema()); + param_schema["properties/bins"].set(number_schema()); + param_schema["properties/sample_rate"].set(number_schema()); - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["required"].append() = "field"; - return res; + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2961,32 +2774,19 @@ VTKHQCriterion::declare_interface(Node &i) i["type_name"] = "vtkh_qcriterion"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHQCriterion::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_string("output_name",params, info, false); - res &= check_string("use_cell_gradient",params, info, false); - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - valid_paths.push_back("use_cell_gradient"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/use_cell_gradient"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3083,32 +2883,19 @@ VTKHDivergence::declare_interface(Node &i) i["type_name"] = "vtkh_divergence"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHDivergence::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_string("output_name",params, info, false); - res &= check_string("use_cell_gradient",params, info, false); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - valid_paths.push_back("use_cell_gradient"); - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/use_cell_gradient"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3204,33 +2991,20 @@ VTKHVorticity::declare_interface(Node &i) i["type_name"] = "vtkh_curl"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -VTKHVorticity::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_string("output_name",params, info, false); - res &= check_string("use_cell_gradient",params, info, false); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - valid_paths.push_back("use_cell_gradient"); + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/use_cell_gradient"].set(string_schema()); - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; -} + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); +} //----------------------------------------------------------------------------- void @@ -3325,33 +3099,19 @@ VTKHGradient::declare_interface(Node &i) i["type_name"] = "vtkh_gradient"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHGradient::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("field",params, info, true); - res &= check_string("output_name",params, info, false); - res &= check_string("use_cell_gradient",params, info, false); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("output_name"); - valid_paths.push_back("use_cell_gradient"); - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/use_cell_gradient"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3439,70 +3199,23 @@ VTKHUniformGrid::declare_interface(Node &i) i["type_name"] = "vtkh_uniform_grid"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -VTKHUniformGrid::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - res &= check_string("field",params, info, false); - res &= check_numeric("dims/i",params, info, false); - res &= check_numeric("dims/j",params, info, false); - res &= check_numeric("dims/k",params, info, false); - res &= check_numeric("origin/x",params, info, false); - res &= check_numeric("origin/y",params, info, false); - res &= check_numeric("origin/z",params, info, false); - res &= check_numeric("spacing/dx",params, info, false); - res &= check_numeric("spacing/dx",params, info, false); - res &= check_numeric("spacing/dy",params, info, false); - res &= check_numeric("spacing/dz",params, info, false); - res &= check_numeric("invalid_value",params, info, false); - - if(!params.has_child("field") && !params.has_child("fields")) - { - res = false; - info["errors"].append() = "Uniform Grid Sampling requires 'field' or 'fields'"; - } - - if(params.has_child("fields") && !params["fields"].dtype().is_list()) - { - res = false; - info["errors"].append() = "'fields' is not a list"; - } - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("fields"); - valid_paths.push_back("dims/i"); - valid_paths.push_back("dims/j"); - valid_paths.push_back("dims/k"); - valid_paths.push_back("origin/x"); - valid_paths.push_back("origin/y"); - valid_paths.push_back("origin/z"); - valid_paths.push_back("spacing/dx"); - valid_paths.push_back("spacing/dy"); - valid_paths.push_back("spacing/dz"); - valid_paths.push_back("invalid_value"); - - std::string surprises = ""; - - std::vector ignore_paths; - ignore_paths.push_back("fields"); - - if(params.number_of_children() != 0) - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/field"].set(string_schema()); + param_schema["properties/fields"].set(array_schema(ignore_schema())); + param_schema["properties/dims"].set(vec3_schema_anyOf("i", "j", "k")); + param_schema["properties/origin"].set(vec3_schema_anyOf()); + param_schema["properties/spacing"].set(vec3_schema_anyOf("dx", "dy", "dz")); + param_schema["properties/invalid_value"].set(number_schema()); + + param_schema["anyOf"].append() = "field"; + param_schema["anyOf"].append() = "fields"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3663,78 +3376,32 @@ VTKHSample::declare_interface(Node &i) i["type_name"] = "vtkh_sample"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -VTKHSample::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - bool res = true; - res &= check_string("field",params, info, false); - res &= check_numeric("invalid_value",params, info, false); + param_schema["properties/field"].set(string_schema()); + param_schema["properties/fields"].set(array_schema(ignore_schema())); + param_schema["properties/invalid_value"].set(number_schema()); + + // --- Line --- + conduit::Node line_schema; + line_schema["type"] = "object"; + line_schema["additionalProperties"] = false; + line_schema["properties/num_samples"].set(number_schema()); + line_schema["properties/start"].set(vec3_schema_anyOf()); + line_schema["properties/end"].set(vec3_schema_anyOf()); + param_schema["properties/line"].set(line_schema); + + // --- Points --- + param_schema["properties/points"].set(vec3_schema_anyOf()); + + param_schema["anyOf"].append() = "field"; + param_schema["anyOf"].append() = "fields"; - res &= check_numeric("line/num_samples",params, info, false); - res &= check_numeric("line/start/x",params, info, false); - res &= check_numeric("line/start/y",params, info, false); - res &= check_numeric("line/start/z",params, info, false); - res &= check_numeric("line/end/x",params, info, false); - res &= check_numeric("line/end/y",params, info, false); - res &= check_numeric("line/end/z",params, info, false); - - res &= check_numeric("points/x",params, info, false); - res &= check_numeric("points/y",params, info, false); - res &= check_numeric("points/z",params, info, false); - - - if(!params.has_child("field") && !params.has_child("fields")) - { - res = false; - info["errors"].append() = "Sampling requires 'field' or 'fields'"; - } - - if(params.has_child("fields") && !params["fields"].dtype().is_list()) - { - res = false; - info["errors"].append() = "'fields' is not a list"; - } - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("fields"); - valid_paths.push_back("invalid_value"); - - valid_paths.push_back("line/num_samples"); - valid_paths.push_back("line/start/x"); - valid_paths.push_back("line/start/y"); - valid_paths.push_back("line/start/z"); - valid_paths.push_back("line/end/x"); - valid_paths.push_back("line/end/y"); - valid_paths.push_back("line/end/z"); - - valid_paths.push_back("points/x"); - valid_paths.push_back("points/y"); - valid_paths.push_back("points/z"); - - std::string surprises = ""; - - std::vector ignore_paths; - ignore_paths.push_back("fields"); - - if(params.number_of_children() != 0) - { - surprises = surprise_check(valid_paths, ignore_paths, params); - } - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3902,29 +3569,16 @@ VTKHStats::declare_interface(Node &i) i["type_name"] = "vtkh_stats"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -VTKHStats::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("field",params, info, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/field"].set(string_schema()); + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3996,31 +3650,18 @@ VTKHHistogram::declare_interface(Node &i) i["type_name"] = "vtkh_histogram"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -VTKHHistogram::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_string("field",params, info, true); - res &= check_numeric("bins",params, info, false, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("bins"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/bins"].set(number_schema()); - return res; + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -4096,49 +3737,22 @@ VTKHProject2d::declare_interface(Node &i) i["type_name"] = "vtkh_project_2d"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHProject2d::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("topology",params, info, false); - res &= check_numeric("image_width",params, info, false); - res &= check_numeric("image_height",params, info, false); - - if(params.has_child("fields") && !params["fields"].dtype().is_list()) - { - res = false; - info["errors"].append() = "fields is not a list"; - } - - std::vector valid_paths; - std::vector ignore_paths; - valid_paths.push_back("topology"); - valid_paths.push_back("image_width"); - valid_paths.push_back("image_height"); - valid_paths.push_back("dataset_bounds"); - valid_paths.push_back("camera"); - valid_paths.push_back("fields"); - ignore_paths.push_back("camera"); - ignore_paths.push_back("fields"); - ignore_paths.push_back("dataset_bounds"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/topology"].set(string_schema()); + param_schema["properties/image_width"].set(number_schema()); + param_schema["properties/image_height"].set(number_schema()); + param_schema["properties/dataset_bounds"].set(ignore_schema()); + param_schema["properties/camera"].set(ignore_schema()); + param_schema["properties/fields"].set(array_schema(ignore_schema())); + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void VTKHProject2d::execute() @@ -4278,29 +3892,16 @@ VTKHNoOp::declare_interface(Node &i) i["type_name"] = "vtkh_no_op"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHNoOp::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/field"].set(string_schema()); + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -4376,33 +3977,21 @@ VTKHVectorComponent::declare_interface(Node &i) i["type_name"] = "vtkh_vector_component"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHVectorComponent::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_numeric("component",params, info, true); - res &= check_string("output_name",params, info, true); - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("component"); - valid_paths.push_back("output_name"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/component"].set(number_schema()); + param_schema["properties/output_name"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "component"; + param_schema["required"].append() = "output_name"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -4482,35 +4071,22 @@ VTKHCompositeVector::declare_interface(Node &i) i["type_name"] = "vtkh_composite_vector"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHCompositeVector::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field1",params, info, true); - res &= check_string("field2",params, info, true); - res &= check_string("field3",params, info, false); - res &= check_string("output_name",params, info, true); - - std::vector valid_paths; - valid_paths.push_back("field1"); - valid_paths.push_back("field2"); - valid_paths.push_back("field3"); - valid_paths.push_back("output_name"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field1"].set(string_schema()); + param_schema["properties/field2"].set(string_schema()); + param_schema["properties/field3"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); - return res; + param_schema["required"].append() = "field1"; + param_schema["required"].append() = "field2"; + param_schema["required"].append() = "output_name"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -4620,33 +4196,9 @@ VTKHScale::declare_interface(Node &i) i["type_name"] = "vtkh_scale_transform"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHScale::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = check_numeric("x_scale",params, info, true, true); - res &= check_numeric("y_scale",params, info, true, true); - res &= check_numeric("z_scale",params, info, true, true); - - std::vector valid_paths; - valid_paths.push_back("x_scale"); - valid_paths.push_back("y_scale"); - valid_paths.push_back("z_scale"); - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema = vec3_schema("x_scale", "y_scale", "z_scale"); } //----------------------------------------------------------------------------- @@ -4720,168 +4272,39 @@ VTKHTransform::declare_interface(Node &i) i["type_name"] = "vtkh_transform"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHTransform::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); -/* - scale/x,y,z - translate/x,y,z - rotate/x,y,z - reflect/x,y,z - transform_matrix: float64 x 16 -*/ + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + param_schema["constraints/exclusiveChildren"].append() = "scale"; + param_schema["constraints/exclusiveChildren"].append() = "translate"; + param_schema["constraints/exclusiveChildren"].append() = "reflect"; + param_schema["constraints/exclusiveChildren"].append() = "rotate"; + param_schema["constraints/exclusiveChildren"].append() = "matrix"; + param_schema["constraints/allowNoneInExclusiveGroup"] = false; - bool res = true; + param_schema["properties/scale"].set(vec3_schema_anyOf()); + param_schema["properties/translate"].set(vec3_schema_anyOf()); + param_schema["properties/reflect"].set(vec3_schema_anyOf()); + + // --- rotate --- + conduit::Node rotate_schema; + rotate_schema["type"] = "object"; + rotate_schema["additionalProperties"] = false; + rotate_schema["properties/angle"].set(number_schema()); + rotate_schema["properties/axis"].set(vec3_schema_anyOf()); + rotate_schema["required"].append() = "angle"; + rotate_schema["required"].append() = "axis"; + param_schema["properties/rotate"].set(rotate_schema); + + // --- matrix --- + conduit::Node matrix_schema = array_schema(number_schema()); + matrix_schema["minItems"] = 16; + matrix_schema["miaxItems"] = 16; + param_schema["properties/matrix"].set(matrix_schema); - std::vector modes = {"scale", - "translate", - "rotate", - "reflect", - "matrix"}; - - index_t mode_count = 0; - for( auto mode : modes) - { - if(params.has_child(mode)) - { - mode_count++; - } - } - - if(mode_count > 1) - { - info["errors"].append() = "transform only supports one of: scale, translate, rotate, reflect, or matrix"; - res = false; - } - - if(mode_count == 0) - { - info["errors"].append() = "transform requires parameters for: scale, translate, rotate, reflect, or matrix"; - res = false; - } - - if(params.has_child("scale")) - { - const Node &p_vals = params["scale"]; - if( ! p_vals.has_child("x") && - ! p_vals.has_child("y") && - ! p_vals.has_child("z") ) - { - res = false; - info["errors"].append()="scale transform requires: scale/x, scale/y, and/or scale/z"; - } - res &= check_numeric("x", p_vals, info, false, true); - res &= check_numeric("y", p_vals, info, false, true); - res &= check_numeric("z", p_vals, info, false, true); - } - - if(params.has_child("translate")) - { - const Node &p_vals = params["translate"]; - if( ! p_vals.has_child("x") && - ! p_vals.has_child("y") && - ! p_vals.has_child("z") ) - { - res = false; - info["errors"].append() = "translate transform requires: translate/x, translate/y, and/or translate/z"; - } - res &= check_numeric("x", p_vals, info, false, true); - res &= check_numeric("y", p_vals, info, false, true); - res &= check_numeric("z", p_vals, info, false, true); - } - - if(params.has_child("rotate")) - { - const Node &p_vals = params["rotate"]; - bool rotate_ok = check_numeric("angle", p_vals, info, true, true); - - if(p_vals.has_child("axis")) - { - const Node &p_axis = p_vals["axis"]; - if( ! p_axis.has_child("x") && - ! p_axis.has_child("y") && - ! p_axis.has_child("z") ) - { - rotate_ok = false; - } - - res &= check_numeric("x", p_axis, info, false, true); - res &= check_numeric("y", p_axis, info, false, true); - res &= check_numeric("z", p_axis, info, false, true); - - } - else - { - rotate_ok = false; - } - - if(!rotate_ok) - { - res = false; - info["errors"].append()="rotate transform requires: rotate/angle and rotate/axis/x, rotate/axis/y, and/or rotate/axis/z"; - } - } - - if(params.has_child("reflect")) - { - const Node &p_vals = params["reflect"]; - if( ! p_vals.has_child("x") && - ! p_vals.has_child("y") && - ! p_vals.has_child("z") ) - { - res = false; - info["errors"].append() = "reflect transform requires: reflect/x, reflect/y, and/or reflect/z"; - } - res &= check_numeric("x", p_vals, info, false, true); - res &= check_numeric("y", p_vals, info, false, true); - res &= check_numeric("z", p_vals, info, false, true); - } - - if(params.has_child("matrix")) - { - res &= check_numeric("matrix",params, info, true, true); - if(res) - { - // make sure it is 16 long - index_t matrix_len = params["matrix"].dtype().number_of_elements(); - if(matrix_len != 16) - { - res = false; - info["errors"].append()="matrix must an array with 16 entries (representing a 4x4 transform matrix)"; - } - } - } - - std::vector valid_paths = { "scale/x", - "scale/y", - "scale/z", - "translate/x", - "translate/y", - "translate/z", - "rotate/angle", - "rotate/axis/x", - "rotate/axis/y", - "rotate/axis/z", - "reflect/x", - "reflect/y", - "reflect/z", - "matrix"}; - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -5096,126 +4519,121 @@ VTKHParticleAdvection::declare_interface(Node &i) i["type_name"] = "vtkh_particle_advection"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHParticleAdvection::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - bool res = check_string("field", params, info, true); - res &= check_numeric("num_steps", params, info, true, true); - res &= check_numeric("step_size", params, info, true, true); - info.reset(); - - if(!params.has_child("seeds")) - { - info["errors"].append() = "Missing required parameter. Particle Advection must specify seeds"; - res = false; - } - else - { - conduit::Node seed_params = params["seeds"]; - if(!seed_params.has_child("type")) - { - info["errors"].append() = "Missing required parameter. Particle Advection must specify seed type"; - res = false; - } - else - { - - res &= check_string("type", seed_params, info, true); - std::string type = seed_params["type"].as_string(); - if(type == "point") - { - res &= check_numeric("location",seed_params,info,true); - } - else if(type == "point_list") - { - res &= check_numeric("location",seed_params,info,true); - } - else if(type == "line") - { - res &= check_numeric("start",seed_params,info,true); - res &= check_numeric("end",seed_params,info,true); - res &= check_numeric("num_seeds",seed_params,info,true); - res &= check_string("sampling_type", seed_params, info, true); - } - else if(type == "box") - { - res &= check_string("sampling_space", seed_params, info, true); - res &= check_string("sampling_type", seed_params, info, true); - string sampling_type = seed_params["sampling_type"].as_string(); - if(sampling_type == "uniform") - { - res &= check_numeric("num_seeds_x",seed_params,info,true); - res &= check_numeric("num_seeds_y",seed_params,info,true); - res &= check_numeric("num_seeds_z",seed_params,info,true); - } - else - { - res &= check_numeric("num_seeds",seed_params,info,true); - } - - if(seed_params.has_child("extents_x")) - { - res &= check_numeric("extents_x",seed_params,info,true); - res &= check_numeric("extents_y",seed_params,info,true); - res &= check_numeric("extents_z",seed_params,info,true); - } - } - else - { - info["errors"].append() = "Unrecognized parameter. Particle Advection supports seed types 'point', 'point_list', 'line', or 'box'."; - res = false; - } - } - } - - if(params.has_child("rendering")) - { - res &= check_string("rendering/enable_tubes", params, info, false); - res &= check_string("rendering/tube_capping", params, info, false); - res &= check_numeric("rendering/tube_size", params, info, false); - res &= check_numeric("rendering/tube_sides", params, info, false); - res &= check_numeric("rendering/tube_value", params, info, false); - res &= check_string("rendering/output_field", params, info, false); - } - - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("num_steps"); - valid_paths.push_back("step_size"); - valid_paths.push_back("seeds/type"); - valid_paths.push_back("seeds/location"); - valid_paths.push_back("seeds/start"); - valid_paths.push_back("seeds/end"); - valid_paths.push_back("seeds/num_seeds"); - valid_paths.push_back("seeds/num_seeds_x"); - valid_paths.push_back("seeds/num_seeds_y"); - valid_paths.push_back("seeds/num_seeds_z"); - valid_paths.push_back("seeds/extents_x"); - valid_paths.push_back("seeds/extents_y"); - valid_paths.push_back("seeds/extents_z"); - valid_paths.push_back("seeds/sampling_type"); - valid_paths.push_back("seeds/sampling_space"); - valid_paths.push_back("rendering/enable_tubes"); - valid_paths.push_back("rendering/tube_capping"); - valid_paths.push_back("rendering/tube_size"); - valid_paths.push_back("rendering/tube_sides"); - valid_paths.push_back("rendering/tube_value"); - valid_paths.push_back("rendering/output_field"); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::string surprises = surprise_check(valid_paths, params); + param_schema["properties/field"].set(string_schema()); + param_schema["properties/num_steps"].set(number_schema()); + param_schema["properties/step_size"].set(number_schema()); + + // --- seed --- + conduit::Node seed_schema; + seed_schema["type"] = "object"; + seed_schema["additionalProperties"] = false; + seed_schema["properties/type"].set(string_schema()); + seed_schema["properties/location"].set(number_schema()); + seed_schema["properties/start"].set(number_schema()); + seed_schema["properties/end"].set(number_schema()); + seed_schema["properties/num_seeds"].set(number_schema()); + seed_schema["properties/num_seeds_x"].set(number_schema()); + seed_schema["properties/num_seeds_y"].set(number_schema()); + seed_schema["properties/num_seeds_z"].set(number_schema()); + seed_schema["properties/extents_x"].set(number_schema()); + seed_schema["properties/extents_y"].set(number_schema()); + seed_schema["properties/extents_z"].set(number_schema()); + seed_schema["properties/sampling_type"].set(string_schema()); + seed_schema["properties/sampling_space"].set(string_schema()); + seed_schema["required"].append() = "type"; + + seed_schema["constraints/dependencies/extents_x"].append() = "extents_y"; + seed_schema["constraints/dependencies/extents_x"].append() = "extents_z"; + seed_schema["constraints/dependencies/extents_y"].append() = "extents_x"; + seed_schema["constraints/dependencies/extents_y"].append() = "extents_z"; + seed_schema["constraints/dependencies/extents_z"].append() = "extents_x"; + seed_schema["constraints/dependencies/extents_z"].append() = "extents_y"; + + // type == point + conduit::Node point_option; + point_option["type"] = "object"; + point_option["properties/type/type"] = "string"; + point_option["properties/type/constraints/const"] = "point"; + point_option["required"].append() = "type"; + point_option["required"].append() = "location"; + seed_schema["oneOf"].append().set(point_option); + + // type == point_list + conduit::Node point_list_option; + point_list_option["type"] = "object"; + point_list_option["properties/type/type"] = "string"; + point_list_option["properties/type/constraints/const"] = "point_list"; + point_list_option["required"].append() = "type"; + point_list_option["required"].append() = "location"; + seed_schema["oneOf"].append().set(point_list_option); + + // type == line + conduit::Node line_option; + line_option["type"] = "object"; + line_option["properties/type/type"] = "string"; + line_option["properties/type/constraints/const"] = "line"; + line_option["required"].append() = "type"; + line_option["required"].append() = "start"; + line_option["required"].append() = "end"; + line_option["required"].append() = "num_seeds"; + line_option["required"].append() = "sampling_type"; + seed_schema["oneOf"].append().set(line_option); + + // type == box + conduit::Node box_option; + box_option["type"] = "object"; + box_option["properties/type/type"] = "string"; + box_option["properties/type/constraints/const"] = "box"; + box_option["required"].append() = "type"; + box_option["required"].append() = "sampling_space"; + box_option["required"].append() = "sampling_type"; + { + conduit::Node box_option_uniform; + box_option_uniform["type"] = "object"; + box_option_uniform["properties/sampling_type/type"] = "string"; + box_option_uniform["properties/sampling_type/constraints/const"] = "uniform"; + box_option_uniform["required"].append() = "sampling_type"; + box_option_uniform["required"].append() = "num_seeds_x"; + box_option_uniform["required"].append() = "num_seeds_y"; + box_option_uniform["required"].append() = "num_seeds_z"; + box_option["oneOf"].append().set(box_option_uniform); + } + { + conduit::Node box_option_non_uniform; + box_option_non_uniform["type"] = "object"; + box_option_non_uniform["required"].append() = "sampling_type"; + box_option_non_uniform["required"].append() = "num_seeds"; + box_option_non_uniform["constraints/not_const/sampling_type"] = "uniform"; + box_option["oneOf"].append().set(box_option_non_uniform); + } + seed_schema["oneOf"].append().set(box_option); + + param_schema["properties/seed"].set(seed_schema); + + // --- rendering --- + conduit::Node rendering_schema; + rendering_schema["type"] = "object"; + rendering_schema["additionalProperties"] = false; + rendering_schema["properties/enable_tubes"].set(string_schema()); + rendering_schema["properties/tube_capping"].set(string_schema()); + rendering_schema["properties/tube_size"].set(number_schema()); + rendering_schema["properties/tube_sides"].set(number_schema()); + rendering_schema["properties/tube_value"].set(number_schema()); + rendering_schema["properties/output_field"].set(string_schema()); + param_schema["properties/rendering"].set(rendering_schema); - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["required"].append() = "field"; + param_schema["required"].append() = "num_steps"; + param_schema["required"].append() = "step_size"; + param_schema["required"].append() = "seed"; - return res; + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -5749,55 +5167,35 @@ VTKHWarpXStreamline::declare_interface(Node &i) i["type_name"] = "vtkh_warpx_streamline"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHWarpXStreamline::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("b_field", params, info, false); - res &= check_string("e_field", params, info, false); - res &= check_numeric("num_steps", params, info, true, true); - res &= check_numeric("step_size", params, info, true, true); - - if(params.has_child("rendering")) - { - res &= check_string("rendering/enable_tubes", params, info, false); - res &= check_string("rendering/tube_capping", params, info, false); - res &= check_numeric("rendering/tube_size", params, info, false); - res &= check_numeric("rendering/tube_sides", params, info, false); - res &= check_numeric("rendering/tube_value", params, info, false); - res &= check_string("rendering/output_field", params, info, false); - } - - std::vector valid_paths; - valid_paths.push_back("b_field"); - valid_paths.push_back("e_field"); - valid_paths.push_back("charge_field"); - valid_paths.push_back("mass_field"); - valid_paths.push_back("momentum_field"); - valid_paths.push_back("weighting_field"); - valid_paths.push_back("num_steps"); - valid_paths.push_back("step_size"); - valid_paths.push_back("rendering/enable_tubes"); - valid_paths.push_back("rendering/tube_capping"); - valid_paths.push_back("rendering/tube_size"); - valid_paths.push_back("rendering/tube_sides"); - valid_paths.push_back("rendering/tube_value"); - valid_paths.push_back("rendering/output_field"); - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - return res; + param_schema["properties/b_field"].set(string_schema()); + param_schema["properties/e_field"].set(string_schema()); + param_schema["properties/num_steps"].set(number_schema()); + param_schema["properties/step_size"].set(number_schema()); + + // --- rendering --- + conduit::Node rendering_schema; + rendering_schema["type"] = "object"; + rendering_schema["additionalProperties"] = false; + rendering_schema["properties/enable_tubes"].set(string_schema()); + rendering_schema["properties/tube_capping"].set(string_schema()); + rendering_schema["properties/tube_size"].set(number_schema()); + rendering_schema["properties/tube_sides"].set(number_schema()); + rendering_schema["properties/tube_value"].set(number_schema()); + rendering_schema["properties/output_field"].set(string_schema()); + param_schema["properties/rendering"].set(rendering_schema); + + param_schema["required"].append() = "num_steps"; + param_schema["required"].append() = "step_size"; + + i["param_schema"].set(param_schema); } + //----------------------------------------------------------------------------- void VTKHWarpXStreamline::execute() @@ -5959,38 +5357,18 @@ VTKHVTKFileExtract::declare_interface(Node &i) i["type_name"] = "vtkh_vtk_file_extract"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -VTKHVTKFileExtract::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - - if( !params.has_child("path") ) - { - info["errors"].append() = "missing required entry 'path'"; - res = false; - } - - res = check_string("topology",params, info, false) && res; - - std::vector valid_paths; - valid_paths.push_back("path"); - valid_paths.push_back("topology"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/path"].set(string_schema()); + param_schema["properties/topology"].set(string_schema()); - return res; + param_schema["required"].append() = "path"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -6171,39 +5549,22 @@ VTKHMIR::declare_interface(Node &i) i["type_name"] = "vtkh_mir"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -VTKHMIR::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("matset",params, info, true); - res &= check_string("output_name", params, info, false); - res &= check_numeric("error_scaling", params, info, false); - res &= check_numeric("scaling_decay", params, info, false); - res &= check_numeric("iterations", params, info, false); - res &= check_numeric("max_error", params, info, false); - - std::vector valid_paths; - valid_paths.push_back("matset"); - valid_paths.push_back("output_name"); - valid_paths.push_back("error_scaling"); - valid_paths.push_back("scaling_decay"); - valid_paths.push_back("iterations"); - valid_paths.push_back("max_error"); - - std::string surprises = surprise_check(valid_paths, params); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/matset"].set(string_schema()); + param_schema["properties/output_name"].set(string_schema()); + param_schema["properties/error_scaling"].set(number_schema()); + param_schema["properties/scaling_decay"].set(number_schema()); + param_schema["properties/iterations"].set(number_schema()); + param_schema["properties/max_error"].set(number_schema()); - return res; + param_schema["required"].append() = "matset"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp index 7cffa8a49..96b3484ac 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.hpp @@ -51,8 +51,6 @@ class ASCENT_API VTKHMarchingCubes : public ::flow::Filter virtual ~VTKHMarchingCubes(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -64,8 +62,6 @@ class ASCENT_API VTKHExternalSurfaces : public ::flow::Filter virtual ~VTKHExternalSurfaces(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -77,8 +73,6 @@ class ASCENT_API VTKHVectorMagnitude : public ::flow::Filter virtual ~VTKHVectorMagnitude(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -111,8 +105,6 @@ class ASCENT_API VTKH3Slice : public ::flow::Filter virtual ~VTKH3Slice(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -182,8 +174,6 @@ class ASCENT_API VTKHClipWithField : public ::flow::Filter virtual ~VTKHClipWithField(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -195,8 +185,6 @@ class ASCENT_API VTKHIsoVolume : public ::flow::Filter virtual ~VTKHIsoVolume(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -208,8 +196,6 @@ class ASCENT_API VTKHLagrangian : public ::flow::Filter virtual ~VTKHLagrangian(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -221,8 +207,6 @@ class ASCENT_API VTKHLog: public ::flow::Filter virtual ~VTKHLog(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -234,8 +218,6 @@ class ASCENT_API VTKHLog10: public ::flow::Filter virtual ~VTKHLog10(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -247,8 +229,6 @@ class ASCENT_API VTKHLog2: public ::flow::Filter virtual ~VTKHLog2(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -260,8 +240,6 @@ class ASCENT_API VTKHRecenter: public ::flow::Filter virtual ~VTKHRecenter(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -273,8 +251,6 @@ class ASCENT_API VTKHHistSampling : public ::flow::Filter virtual ~VTKHHistSampling(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -286,8 +262,6 @@ class ASCENT_API VTKHQCriterion: public ::flow::Filter virtual ~VTKHQCriterion(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -299,8 +273,6 @@ class ASCENT_API VTKHDivergence: public ::flow::Filter virtual ~VTKHDivergence(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -312,8 +284,6 @@ class ASCENT_API VTKHVorticity: public ::flow::Filter virtual ~VTKHVorticity(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -325,8 +295,6 @@ class ASCENT_API VTKHGradient : public ::flow::Filter virtual ~VTKHGradient(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -338,8 +306,6 @@ class ASCENT_API VTKHNoOp : public ::flow::Filter virtual ~VTKHNoOp(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -351,8 +317,6 @@ class ASCENT_API VTKHVectorComponent : public ::flow::Filter virtual ~VTKHVectorComponent(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -364,8 +328,6 @@ class ASCENT_API VTKHCompositeVector : public ::flow::Filter virtual ~VTKHCompositeVector(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -377,8 +339,6 @@ class ASCENT_API VTKHStats : public ::flow::Filter virtual ~VTKHStats(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -390,8 +350,6 @@ class ASCENT_API VTKHUniformGrid : public ::flow::Filter virtual ~VTKHUniformGrid(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -403,8 +361,6 @@ class ASCENT_API VTKHSample : public ::flow::Filter virtual ~VTKHSample(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -416,8 +372,6 @@ class ASCENT_API VTKHHistogram : public ::flow::Filter virtual ~VTKHHistogram(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -430,8 +384,6 @@ class ASCENT_API VTKHProject2d : public ::flow::Filter virtual ~VTKHProject2d(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -455,8 +407,6 @@ class ASCENT_API VTKHScale : public ::flow::Filter virtual ~VTKHScale(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -468,8 +418,6 @@ class ASCENT_API VTKHTransform : public ::flow::Filter virtual ~VTKHTransform(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -481,8 +429,6 @@ class ASCENT_API VTKHTriangulate : public ::flow::Filter virtual ~VTKHTriangulate(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -494,8 +440,6 @@ class ASCENT_API VTKHParticleAdvection : public ::flow::Filter virtual ~VTKHParticleAdvection(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); protected: @@ -519,8 +463,6 @@ class ASCENT_API VTKHWarpXStreamline : public ::flow::Filter virtual ~VTKHWarpXStreamline(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); protected: @@ -535,8 +477,6 @@ class ASCENT_API VTKHVTKFileExtract : public ::flow::Filter virtual ~VTKHVTKFileExtract(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -550,8 +490,6 @@ class ASCENT_API VTKHMIR : public ::flow::Filter virtual ~VTKHMIR(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 09ae400da..e6c4232a3 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -62,6 +62,7 @@ static bool check_type(const conduit::Node &input, if(schema_defined_type == "object") ok = data_type.is_object(); else if(schema_defined_type == "string") ok = data_type.is_string(); else if(schema_defined_type == "number") ok = data_type.is_number(); + else if(schema_defined_type == "array") ok = (data_type.is_list() || (data_type.is_number() && data_type.number_of_elements() >= 1)); else { add_error(info, "At '" + (path.empty() ? std::string("") : path) + @@ -123,6 +124,59 @@ static bool validate_forbid(const conduit::Node &schema, return ok; } +static bool validate_const(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_path("constraints/const")) return true; + + const conduit::Node &c = schema["constraints/const"]; + // Only implement string const for now (that’s all we used above) + if(input.dtype().is_string() && c.dtype().is_string()) + { + const std::string got = input.as_string(); + const std::string expect = c.as_string(); + if(got != expect) + { + add_error(info, "Value mismatch at '" + (path.empty() ? std::string("") : path) + + "': expected '" + expect + "', got '" + got + "'"); + return false; + } + } + return true; +} + +static bool validate_not_const_fields(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_path("constraints/not_const")) return true; + if(!input.dtype().is_object()) return true; + + bool ok = true; + const conduit::Node &nc = schema["constraints/not_const"]; + for(conduit::index_t i = 0; i < nc.number_of_children(); ++i) + { + const std::string field = nc[i].name(); + const conduit::Node &forbidden_val = nc[field]; + + if(input.has_child(field) && input[field].dtype().is_string() && forbidden_val.dtype().is_string()) + { + const std::string got = input[field].as_string(); + const std::string bad = forbidden_val.as_string(); + if(got == bad) + { + add_error(info, "Value forbidden at '" + conduit::utils::join_file_path(path, field) + + "': must not be '" + bad + "'"); + ok = false; + } + } + } + return ok; +} + static bool validate_properties(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, @@ -331,6 +385,56 @@ static bool validate_one_of(const conduit::Node &schema, return false; } +static bool validate_any_of(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_child("anyOf")) return true; + + const conduit::Node &opts = schema["anyOf"]; + int matches = 0; + + // collect a couple representative failures for hints + std::vector option_msgs; + + for(conduit::index_t i = 0; i < opts.number_of_children(); ++i) + { + const conduit::Node &opt = opts.child(i); + + conduit::Node tmp; + tmp.reset(); + + bool ok = true; + ok = check_type(input, opt, tmp, path) && ok; + ok = validate_required(opt, input, tmp, path) && ok; + ok = validate_forbid(opt, input, tmp, path) && ok; + ok = validate_dependencies(opt, input, tmp, path) && ok; + ok = validate_exclusive_children(opt, input, tmp, path) && ok; + + if(ok) + { + matches++; + } + else if(tmp.has_child("errors") && tmp["errors"].number_of_children() > 0) + { + option_msgs.push_back(tmp["errors"].child(0).as_string()); + } + } + + if(matches >= 1) return true; + + add_error(info, "anyOf violation at '" + (path.empty() ? std::string("") : path) + + "': input did not match any option"); + + for(size_t i = 0; i < option_msgs.size() && i < 2; ++i) + { + add_error(info, std::string(" hint: ") + option_msgs[i]); + } + + return false; +} + static bool validate_object(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, @@ -341,6 +445,7 @@ static bool validate_object(const conduit::Node &schema, // Base checks first ok = validate_required(schema, input, info, path) && ok; ok = validate_forbid(schema, input, info, path) && ok; + ok = validate_not_const_fields(schema, input, info, path) && ok; ok = validate_dependencies(schema, input, info, path) && ok; ok = validate_exclusive_children(schema, input, info, path) && ok; @@ -352,7 +457,60 @@ static bool validate_object(const conduit::Node &schema, // Finally, enforce oneOf (treating options as extra constraints on this same object) ok = validate_one_of(schema, input, info, path) && ok; + ok = validate_any_of(schema, input, info, path) && ok; + + return ok; +} + +static bool validate_array(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + bool ok = true; + + const auto data_type = input.dtype(); + const conduit::index_t count = data_type.is_list() ? input.number_of_children() : data_type.number_of_elements(); + + // Json Schema uses min/max bounds for array length. + if(schema.has_child("minItems")) + { + const conduit::index_t min_items = (conduit::index_t)schema["minItems"].to_int(); + if(count < min_items) + { + add_error(info, + "Array at '" + (path.empty() ? std::string("") : path) + + "' has too few items: expected at least " + + std::to_string((long long)min_items) + ", got " + + std::to_string((long long)count)); + ok = false; + } + } + if(schema.has_child("maxItems")) + { + const conduit::index_t max_items = (conduit::index_t)schema["maxItems"].to_int(); + if(count > max_items) + { + add_error(info, + "Array at '" + (path.empty() ? std::string("") : path) + + "' has too many items: expected at most " + + std::to_string((long long)max_items) + ", got " + + std::to_string((long long)count)); + ok = false; + } + } + + if(!schema.has_child("items")) return true; // unconstrained items + + const conduit::Node &item_schema = schema["items"]; + if(data_type.is_list()) { + for(conduit::index_t i = 0; i < count; ++i) + { + ok = validate_node(item_schema, input.child(i), info, + path + "[" + std::to_string((int)i) + "]") && ok; + } + } return ok; } @@ -361,18 +519,44 @@ static bool validate_node(const conduit::Node &schema, conduit::Node &info, const std::string &path) { + if (schema.has_path("constraints/skip") && schema["constraints/skip"].to_int() != 0) + { + return true; + } + + const std::string schema_defined_type = get_type_string(schema); + if(schema_defined_type == "object" && input.dtype().is_empty()) + { + conduit::Node empty_obj; + empty_obj.set(conduit::DataType::object()); + return validate_object(schema, empty_obj, info, path); + } + if(schema_defined_type == "array" && input.dtype().is_empty()) + { + conduit::Node empty_list; + empty_list.set(conduit::DataType::list()); + return validate_array(schema, empty_list, info, path); + } + bool ok = true; ok = check_type(input, schema, info, path) && ok; + ok = validate_const(schema, input, info, path) && ok; if(!ok) return false; // type mismatch stops recursion - const std::string schema_defined_type = get_type_string(schema); + + if(schema_defined_type == "object") { return validate_object(schema, input, info, path); } + if (schema_defined_type == "array") + { + return validate_array(schema, input, info, path); + } ok = validate_one_of(schema, input, info, path) && ok; + ok = validate_any_of(schema, input, info, path) && ok; return ok; } From 96efc0e56ddee27df31d66ba0ebb276af3c262da Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Fri, 27 Feb 2026 16:49:49 -0800 Subject: [PATCH 06/50] Removing temporary helpers and cleaning up files --- .../ascent_runtime_param_check.cpp | 82 +++++-------------- .../ascent_runtime_param_check.hpp | 2 - src/libs/flow/flow_schema_validator.cpp | 2 +- src/libs/flow/flow_schema_validator.hpp | 2 +- 4 files changed, 24 insertions(+), 64 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 0e75196c7..a3288f702 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -72,6 +72,28 @@ conduit::Node string_schema() return n; } +conduit::Node vec3_schema(const std::string var1, const std::string var2, const std::string var3) +{ + conduit::Node n; + n["type"] = "object"; + n["additionalProperties"] = false; + + n["properties/" + var1].set(number_schema()); + n["properties/" + var2].set(number_schema()); + n["properties/" + var3].set(number_schema()); + + n["required"].append() = var1; + n["required"].append() = var2; + n["required"].append() = var3; + + return n; +} + +conduit::Node vec3_schema() +{ + return vec3_schema("x", "y", "z"); +} + conduit::Node vec3_schema_anyOf(const std::string var1, const std::string var2, const std::string var3) { conduit::Node n; @@ -105,28 +127,6 @@ conduit::Node vec3_schema_anyOf() return vec3_schema_anyOf("x", "y", "z"); } -conduit::Node vec3_schema(const std::string var1, const std::string var2, const std::string var3) -{ - conduit::Node n; - n["type"] = "object"; - n["additionalProperties"] = false; - - n["properties/" + var1].set(number_schema()); - n["properties/" + var2].set(number_schema()); - n["properties/" + var3].set(number_schema()); - - n["required"].append() = var1; - n["required"].append() = var2; - n["required"].append() = var3; - - return n; -} - -conduit::Node vec3_schema() -{ - return vec3_schema("x", "y", "z"); -} - conduit::Node array_schema(const conduit::Node &item_schema) { conduit::Node n; @@ -414,44 +414,6 @@ surprise_check(const std::vector &valid_paths, return ss.str(); } -//----------------------------------------------------------------------------- -std::string -surprise_check(const conduit::Node &properties, - const conduit::Node ¶ms) -{ - // only children can surprise us - if(params.number_of_children() == 0) - { - return ""; - } - - std::stringstream ss; -// std::vector paths; -// path_helper(paths, params); -// const int num_paths = static_cast(paths.size()); -// // const int num_valid_paths = static_cast(properties.size()); -// std::string curr_path = params.path() == "" ? "" :params.path() + "/"; -// for(int i = 0; i < num_paths; ++i) -// { -// bool found = false; -// for(int f = 0; f < num_valid_paths; ++f) -// { -// if(curr_path + valid_paths[f] == paths[i]) -// { -// found = true; -// break; -// } -// } - -// if(!found) -// { -// ss<<"Surprise parameter '"< &paths, const conduit::Node &node) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 50413c9a0..e137446dd 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -100,8 +100,6 @@ void ASCENT_API path_helper(std::vector &paths, std::string ASCENT_API surprise_check(const std::vector &valid_paths, const conduit::Node &node); -std::string ASCENT_API surprise_check(const conduit::Node &properties, - const conduit::Node &node); // // Ignore paths only ignores top level paths, differing lower level // paths to another surprise check. diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index e6c4232a3..d9faef8be 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -588,4 +588,4 @@ bool validate(const conduit::Node &schema, }; //----------------------------------------------------------------------------- // -- end flow -- -//----------------------------------------------------------------------------- \ No newline at end of file +//----------------------------------------------------------------------------- diff --git a/src/libs/flow/flow_schema_validator.hpp b/src/libs/flow/flow_schema_validator.hpp index 11043ff70..835081c4e 100644 --- a/src/libs/flow/flow_schema_validator.hpp +++ b/src/libs/flow/flow_schema_validator.hpp @@ -105,4 +105,4 @@ static void add_error(conduit::Node &info, const std::string &msg); #endif //----------------------------------------------------------------------------- // -- end header ifdef guard -//----------------------------------------------------------------------------- \ No newline at end of file +//----------------------------------------------------------------------------- From d95a9062fcd6fd23184974d7fbd7746a67b8354b Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 3 Mar 2026 14:59:03 -0800 Subject: [PATCH 07/50] Seed should be seeds --- .../ascent_runtime_vtkh_filters.cpp | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 60d63013f..58ca96165 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -4692,30 +4692,30 @@ VTKHParticleAdvection::declare_interface(Node &i) param_schema["properties/step_size"].set(number_schema()); // --- seed --- - conduit::Node seed_schema; - seed_schema["type"] = "object"; - seed_schema["additionalProperties"] = false; - seed_schema["properties/type"].set(string_schema()); - seed_schema["properties/location"].set(number_schema()); - seed_schema["properties/start"].set(number_schema()); - seed_schema["properties/end"].set(number_schema()); - seed_schema["properties/num_seeds"].set(number_schema()); - seed_schema["properties/num_seeds_x"].set(number_schema()); - seed_schema["properties/num_seeds_y"].set(number_schema()); - seed_schema["properties/num_seeds_z"].set(number_schema()); - seed_schema["properties/extents_x"].set(number_schema()); - seed_schema["properties/extents_y"].set(number_schema()); - seed_schema["properties/extents_z"].set(number_schema()); - seed_schema["properties/sampling_type"].set(string_schema()); - seed_schema["properties/sampling_space"].set(string_schema()); - seed_schema["required"].append() = "type"; - - seed_schema["constraints/dependencies/extents_x"].append() = "extents_y"; - seed_schema["constraints/dependencies/extents_x"].append() = "extents_z"; - seed_schema["constraints/dependencies/extents_y"].append() = "extents_x"; - seed_schema["constraints/dependencies/extents_y"].append() = "extents_z"; - seed_schema["constraints/dependencies/extents_z"].append() = "extents_x"; - seed_schema["constraints/dependencies/extents_z"].append() = "extents_y"; + conduit::Node seeds_schema; + seeds_schema["type"] = "object"; + seeds_schema["additionalProperties"] = false; + seeds_schema["properties/type"].set(string_schema()); + seeds_schema["properties/location"].set(number_schema()); + seeds_schema["properties/start"].set(number_schema()); + seeds_schema["properties/end"].set(number_schema()); + seeds_schema["properties/num_seeds"].set(number_schema()); + seeds_schema["properties/num_seeds_x"].set(number_schema()); + seeds_schema["properties/num_seeds_y"].set(number_schema()); + seeds_schema["properties/num_seeds_z"].set(number_schema()); + seeds_schema["properties/extents_x"].set(number_schema()); + seeds_schema["properties/extents_y"].set(number_schema()); + seeds_schema["properties/extents_z"].set(number_schema()); + seeds_schema["properties/sampling_type"].set(string_schema()); + seeds_schema["properties/sampling_space"].set(string_schema()); + seeds_schema["required"].append() = "type"; + + seeds_schema["constraints/dependencies/extents_x"].append() = "extents_y"; + seeds_schema["constraints/dependencies/extents_x"].append() = "extents_z"; + seeds_schema["constraints/dependencies/extents_y"].append() = "extents_x"; + seeds_schema["constraints/dependencies/extents_y"].append() = "extents_z"; + seeds_schema["constraints/dependencies/extents_z"].append() = "extents_x"; + seeds_schema["constraints/dependencies/extents_z"].append() = "extents_y"; // type == point conduit::Node point_option; @@ -4724,7 +4724,7 @@ VTKHParticleAdvection::declare_interface(Node &i) point_option["properties/type/constraints/const"] = "point"; point_option["required"].append() = "type"; point_option["required"].append() = "location"; - seed_schema["oneOf"].append().set(point_option); + seeds_schema["oneOf"].append().set(point_option); // type == point_list conduit::Node point_list_option; @@ -4733,7 +4733,7 @@ VTKHParticleAdvection::declare_interface(Node &i) point_list_option["properties/type/constraints/const"] = "point_list"; point_list_option["required"].append() = "type"; point_list_option["required"].append() = "location"; - seed_schema["oneOf"].append().set(point_list_option); + seeds_schema["oneOf"].append().set(point_list_option); // type == line conduit::Node line_option; @@ -4745,7 +4745,7 @@ VTKHParticleAdvection::declare_interface(Node &i) line_option["required"].append() = "end"; line_option["required"].append() = "num_seeds"; line_option["required"].append() = "sampling_type"; - seed_schema["oneOf"].append().set(line_option); + seeds_schema["oneOf"].append().set(line_option); // type == box conduit::Node box_option; @@ -4774,9 +4774,9 @@ VTKHParticleAdvection::declare_interface(Node &i) box_option_non_uniform["constraints/not_const/sampling_type"] = "uniform"; box_option["oneOf"].append().set(box_option_non_uniform); } - seed_schema["oneOf"].append().set(box_option); + seeds_schema["oneOf"].append().set(box_option); - param_schema["properties/seed"].set(seed_schema); + param_schema["properties/seeds"].set(seeds_schema); // --- rendering --- conduit::Node rendering_schema; @@ -4793,7 +4793,7 @@ VTKHParticleAdvection::declare_interface(Node &i) param_schema["required"].append() = "field"; param_schema["required"].append() = "num_steps"; param_schema["required"].append() = "step_size"; - param_schema["required"].append() = "seed"; + param_schema["required"].append() = "seeds"; i["param_schema"].set(param_schema); } From 69a3cbf075bf9acf62ef0582141c13c91bac4a69 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 3 Mar 2026 14:59:26 -0800 Subject: [PATCH 08/50] adding a detail namespace to validator --- src/libs/flow/flow_schema_validator.cpp | 136 ++++++++++++++---------- src/libs/flow/flow_schema_validator.hpp | 55 ---------- 2 files changed, 77 insertions(+), 114 deletions(-) diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index d9faef8be..1734d9532 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -29,8 +29,14 @@ namespace flow namespace schema { +//----------------------------------------------------------------------------- +// -- begin flow::schema::detail -- +//----------------------------------------------------------------------------- +namespace detail +{ + // ---------- General Helpers ---------- -static void add_error(conduit::Node &info, const std::string &msg) +void add_error(conduit::Node &info, const std::string &msg) { if(!info.has_child("errors")) { @@ -39,7 +45,7 @@ static void add_error(conduit::Node &info, const std::string &msg) info["errors"].append() = msg; } -static std::string get_type_string(const conduit::Node &schema) +std::string get_type_string(const conduit::Node &schema) { if(schema.has_child("type") && schema["type"].dtype().is_string()) { @@ -48,10 +54,10 @@ static std::string get_type_string(const conduit::Node &schema) return ""; } -static bool check_type(const conduit::Node &input, - const conduit::Node &schema, - conduit::Node &info, - const std::string &path) +bool check_type(const conduit::Node &input, + const conduit::Node &schema, + conduit::Node &info, + const std::string &path) { const std::string schema_defined_type = get_type_string(schema); if(schema_defined_type.empty()) return true; // schema didn't specify; treat as "accept anything" @@ -80,10 +86,17 @@ static bool check_type(const conduit::Node &input, } // ---------- Object-Specific Validation Helpers ---------- -static bool validate_required(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) + +// Earlier declaration so validate node can be refrenced by helpers. +bool validate_node(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path); + +bool validate_required(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_child("required")) return true; if(!input.dtype().is_object()) return true; // type error handled elsewhere @@ -102,10 +115,10 @@ static bool validate_required(const conduit::Node &schema, return ok; } -static bool validate_forbid(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_forbid(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_path("constraints/forbid")) return true; if(!input.dtype().is_object()) return true; @@ -124,10 +137,10 @@ static bool validate_forbid(const conduit::Node &schema, return ok; } -static bool validate_const(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_const(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_path("constraints/const")) return true; @@ -147,10 +160,10 @@ static bool validate_const(const conduit::Node &schema, return true; } -static bool validate_not_const_fields(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_not_const_fields(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_path("constraints/not_const")) return true; if(!input.dtype().is_object()) return true; @@ -177,10 +190,10 @@ static bool validate_not_const_fields(const conduit::Node &schema, return ok; } -static bool validate_properties(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_properties(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_child("properties")) return true; if(!input.dtype().is_object()) return true; @@ -198,10 +211,10 @@ static bool validate_properties(const conduit::Node &schema, return ok; } -static bool validate_additional_properties(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_additional_properties(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!input.dtype().is_object()) return true; @@ -231,10 +244,10 @@ static bool validate_additional_properties(const conduit::Node &schema, return ok; } -static bool validate_dependencies(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_dependencies(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_path("constraints/dependencies")) return true; if(!input.dtype().is_object()) return true; @@ -264,10 +277,10 @@ static bool validate_dependencies(const conduit::Node &schema, return ok; } -static bool validate_exclusive_children(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_exclusive_children(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_path("constraints/exclusiveChildren")) return true; if(!input.dtype().is_object()) return true; @@ -323,10 +336,10 @@ static bool validate_exclusive_children(const conduit::Node &schema, return false; } -static bool validate_one_of(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_one_of(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_child("oneOf")) return true; @@ -385,10 +398,10 @@ static bool validate_one_of(const conduit::Node &schema, return false; } -static bool validate_any_of(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_any_of(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if(!schema.has_child("anyOf")) return true; @@ -435,10 +448,10 @@ static bool validate_any_of(const conduit::Node &schema, return false; } -static bool validate_object(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_object(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { bool ok = true; @@ -462,10 +475,10 @@ static bool validate_object(const conduit::Node &schema, return ok; } -static bool validate_array(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_array(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { bool ok = true; @@ -514,10 +527,10 @@ static bool validate_array(const conduit::Node &schema, return ok; } -static bool validate_node(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path) +bool validate_node(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) { if (schema.has_path("constraints/skip") && schema["constraints/skip"].to_int() != 0) { @@ -561,13 +574,18 @@ static bool validate_node(const conduit::Node &schema, return ok; } +}; +//----------------------------------------------------------------------------- +// -- end flow::schema::detail -- +//----------------------------------------------------------------------------- + // ---------- Schema Validation Entry-Point ---------- bool validate(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info) { info.reset(); - bool ok = validate_node(schema, input, info, ""); + bool ok = detail::validate_node(schema, input, info, ""); if(!ok && !info.has_child("errors")) { diff --git a/src/libs/flow/flow_schema_validator.hpp b/src/libs/flow/flow_schema_validator.hpp index 835081c4e..5d970e104 100644 --- a/src/libs/flow/flow_schema_validator.hpp +++ b/src/libs/flow/flow_schema_validator.hpp @@ -35,61 +35,6 @@ bool FLOW_API validate(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info); - -static bool validate_node(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_object(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_one_of(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_exclusive_children(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_dependencies(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_properties(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_additional_properties(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_required(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool validate_forbid(const conduit::Node &schema, - const conduit::Node &input, - conduit::Node &info, - const std::string &path); - -static bool check_type(const conduit::Node &input, - const conduit::Node &schema, - conduit::Node &info, - const std::string &path); - -static std::string get_type_string(const conduit::Node &schema); - -static void add_error(conduit::Node &info, const std::string &msg); - }; //----------------------------------------------------------------------------- // -- end flow::schema -- From 6bbaed17b03218d63f7932d47b7688a26241d328 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 5 Mar 2026 14:29:26 -0800 Subject: [PATCH 09/50] Converting over the expression filters --- .../expressions/ascent_expression_filters.cpp | 568 ++---------------- .../expressions/ascent_expression_filters.hpp | 52 -- 2 files changed, 64 insertions(+), 556 deletions(-) diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp b/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp index 6bdd9cd12..04cccf516 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -944,20 +945,16 @@ ExprBoolean::declare_interface(Node &i) i["type_name"] = "expr_bool"; i["port_names"] = DataType::empty(); i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprBoolean::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - if(!params.has_path("value")) - { - info["errors"].append() = "Missing required numeric parameter 'value'"; - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/value"].set(filters::number_schema()); + param_schema["required"].append() = "value"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -993,20 +990,16 @@ ExprInteger::declare_interface(Node &i) i["type_name"] = "expr_integer"; i["port_names"] = DataType::empty(); i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprInteger::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - if(!params.has_path("value")) - { - info["errors"].append() = "Missing required numeric parameter 'value'"; - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/value"].set(filters::number_schema()); + param_schema["required"].append() = "value"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1043,20 +1036,16 @@ ExprDouble::declare_interface(Node &i) i["type_name"] = "expr_double"; i["port_names"] = DataType::empty(); i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprDouble::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - if(!params.has_path("value")) - { - info["errors"].append() = "Missing required numeric parameter 'value'"; - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/value"].set(filters::number_schema()); + param_schema["required"].append() = "value"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1094,20 +1083,16 @@ ExprString::declare_interface(Node &i) i["type_name"] = "expr_string"; i["port_names"] = DataType::empty(); i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprString::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - if(!params.has_path("value")) - { - info["errors"].append() = "Missing required string parameter 'value'"; - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/value"].set(filters::string_schema()); + param_schema["required"].append() = "value"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1146,15 +1131,6 @@ ExprNan::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprNan::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprNan::execute() @@ -1192,15 +1168,6 @@ ExprNull::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprNull::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprNull::execute() @@ -1233,20 +1200,16 @@ ExprIdentifier::declare_interface(Node &i) i["type_name"] = "expr_identifier"; i["port_names"] = DataType::empty(); i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprIdentifier::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - if(!params.has_path("value")) - { - info["errors"].append() = "Missing required string parameter 'value'"; - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/value"].set(filters::string_schema()); + param_schema["required"].append() = "value"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1301,20 +1264,16 @@ ExprObjectDotAccess::declare_interface(Node &i) i["type_name"] = "expr_dot"; i["port_names"].append() = "obj"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprObjectDotAccess::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - if(!params.has_path("name")) - { - info["errors"].append() = "DotAccess: Missing required parameter 'name'"; - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/name"].set(filters::string_schema()); + param_schema["required"].append() = "name"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1390,15 +1349,6 @@ ExprIf::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprIf::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprIf::execute() @@ -1447,20 +1397,16 @@ ExprBinaryOp::declare_interface(Node &i) i["port_names"].append() = "lhs"; i["port_names"].append() = "rhs"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprBinaryOp::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - if(!params.has_path("op_string")) - { - info["errors"].append() = "Missing required string parameter 'op_string'"; - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/op_string"].set(filters::string_schema()); + param_schema["required"].append() = "op_string"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1575,15 +1521,6 @@ ExprScalarMin::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprScalarMin::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprScalarMin::execute() @@ -1639,15 +1576,6 @@ ExprScalarMax::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprScalarMax::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprScalarMax::execute() @@ -1704,15 +1632,6 @@ ExprScalarAbs::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprScalarAbs::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprScalarAbs::execute() @@ -1770,15 +1689,6 @@ ExprScalarExp::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprScalarExp::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprScalarExp::execute() @@ -1821,15 +1731,6 @@ ExprScalarLog::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprScalarLog::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprScalarLog::execute() @@ -1872,15 +1773,6 @@ ExprScalarPow::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprScalarPow::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprScalarPow::execute() @@ -1937,15 +1829,6 @@ ExprVector::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprVector::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprVector::execute() @@ -1993,16 +1876,6 @@ ExprVectorMagnitude::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprVectorMagnitude::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprVectorMagnitude::execute() @@ -2056,15 +1929,6 @@ ExprArrayAccess::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprArrayAccess::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprArrayAccess::execute() @@ -2118,15 +1982,6 @@ ExprArrayReplace::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprArrayReplace::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprArrayReplace::execute() @@ -2218,15 +2073,6 @@ ExprArrayReductionMin::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprArrayReductionMin::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprArrayReductionMin::execute() @@ -2266,15 +2112,6 @@ ExprArrayReductionMax::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprArrayReductionMax::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprArrayReductionMax::execute() @@ -2314,15 +2151,6 @@ ExprArrayReductionAvg::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprArrayReductionAvg::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprArrayReductionAvg::execute() @@ -2362,15 +2190,6 @@ ExprArrayReductionSum::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprArrayReductionSum::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprArrayReductionSum::execute() @@ -2421,15 +2240,6 @@ ExprHistory::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistory::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistory::execute() @@ -2538,16 +2348,6 @@ ExprHistoryRange::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistoryRange::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - - //----------------------------------------------------------------------------- void ExprHistoryRange::execute() @@ -2615,15 +2415,6 @@ ExprHistoryGradient::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistoryGradient::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistoryGradient::execute() @@ -2823,16 +2614,6 @@ ExprHistoryGradientRange::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistoryGradientRange::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - - //----------------------------------------------------------------------------- void ExprHistoryGradientRange::execute() @@ -2930,15 +2711,6 @@ ExprHistogram::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistogram::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistogram::execute() @@ -3041,15 +2813,6 @@ ExprHistogramEntropy::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistogramEntropy::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistogramEntropy::execute() @@ -3094,15 +2857,6 @@ ExprHistogramPDF::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistogramPDF::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistogramPDF::execute() @@ -3146,15 +2900,6 @@ ExprHistogramCDF::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistogramCDF::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistogramCDF::execute() @@ -3201,15 +2946,6 @@ ExprHistogramCDFQuantile::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistogramCDFQuantile::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistogramCDFQuantile::execute() @@ -3276,15 +3012,6 @@ ExprHistogramBinByIndex::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistogramBinByIndex::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistogramBinByIndex::execute() @@ -3337,16 +3064,6 @@ ExprHistogramBinByValue::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprHistogramBinByValue::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprHistogramBinByValue::execute() @@ -3413,15 +3130,6 @@ ExprMeshCycle::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshCycle::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshCycle::execute() @@ -3471,15 +3179,6 @@ ExprMeshTime::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshTime::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshTime::execute() @@ -3531,15 +3230,6 @@ ExprMeshField::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshField::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshField::execute() @@ -3653,15 +3343,6 @@ ExprMeshTopology::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshTopology::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshTopology::execute() @@ -3726,15 +3407,6 @@ ExprMeshBounds::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshBounds::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshBounds::execute() @@ -3824,15 +3496,6 @@ ExprMeshLineout::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshLineout::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshLineout::execute() @@ -3994,15 +3657,6 @@ ExprMeshFieldReductionMin::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshFieldReductionMin::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshFieldReductionMin::execute() @@ -4067,15 +3721,6 @@ ExprMeshFieldReductionMax::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshFieldReductionMax::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshFieldReductionMax::execute() @@ -4138,15 +3783,6 @@ ExprMeshFieldReductionAvg::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshFieldReductionAvg::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshFieldReductionAvg::execute() @@ -4200,15 +3836,6 @@ ExprMeshFieldReductionSum::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshFieldReductionSum::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshFieldReductionSum::execute() @@ -4252,15 +3879,6 @@ ExprMeshFieldReductionNanCount::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshFieldReductionNanCount::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshFieldReductionNanCount::execute() @@ -4305,15 +3923,6 @@ ExprMeshFieldReductionInfCount::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshFieldReductionInfCount::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshFieldReductionInfCount::execute() @@ -4372,15 +3981,6 @@ ExprMeshBinning::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshBinning::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshBinning::execute() @@ -4461,16 +4061,6 @@ ExprMeshBinningAxis::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshBinningAxis::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshBinningAxis::execute() @@ -4641,16 +4231,6 @@ ExprMeshBinningBinByIndex::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshBinningBinByIndex::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshBinningBinByIndex::execute() @@ -4735,16 +4315,6 @@ ExprMeshBinningPointAndAxis::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshBinningPointAndAxis::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshBinningPointAndAxis::execute() @@ -4872,16 +4442,6 @@ ExprMeshBinningMaxFromPoint::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprMeshBinningMaxFromPoint::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprMeshBinningMaxFromPoint::execute() diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_filters.hpp b/src/libs/ascent/runtimes/expressions/ascent_expression_filters.hpp index 861ffb7b6..e029a7839 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_filters.hpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_filters.hpp @@ -77,7 +77,6 @@ class ExprBoolean : public ::flow::Filter ~ExprBoolean(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -89,7 +88,6 @@ class ExprInteger : public ::flow::Filter ~ExprInteger(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -101,7 +99,6 @@ class ExprDouble : public ::flow::Filter ~ExprDouble(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -113,7 +110,6 @@ class ExprString : public ::flow::Filter ~ExprString(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -125,7 +121,6 @@ class ExprNan : public ::flow::Filter ~ExprNan(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -137,7 +132,6 @@ class ExprNull : public ::flow::Filter ~ExprNull(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -149,7 +143,6 @@ class ExprIdentifier : public ::flow::Filter ~ExprIdentifier(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -161,7 +154,6 @@ class ExprObjectDotAccess : public ::flow::Filter ~ExprObjectDotAccess(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -173,7 +165,6 @@ class ExprIf : public ::flow::Filter ~ExprIf(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -185,7 +176,6 @@ class ExprBinaryOp : public ::flow::Filter ~ExprBinaryOp(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -206,7 +196,6 @@ class ExprScalarMin : public ::flow::Filter ~ExprScalarMin(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -218,7 +207,6 @@ class ExprScalarMax : public ::flow::Filter ~ExprScalarMax(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -230,7 +218,6 @@ class ExprScalarAbs : public ::flow::Filter ~ExprScalarAbs(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -242,7 +229,6 @@ class ExprScalarExp : public ::flow::Filter ~ExprScalarExp(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -254,7 +240,6 @@ class ExprScalarLog : public ::flow::Filter ~ExprScalarLog(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -266,7 +251,6 @@ class ExprScalarPow : public ::flow::Filter ~ExprScalarPow(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -287,7 +271,6 @@ class ExprVector : public ::flow::Filter ~ExprVector(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -299,7 +282,6 @@ class ExprVectorMagnitude : public ::flow::Filter ~ExprVectorMagnitude(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -320,7 +302,6 @@ class ExprArrayAccess : public ::flow::Filter ~ExprArrayAccess(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -332,7 +313,6 @@ class ExprArrayReplace : public ::flow::Filter ~ExprArrayReplace(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -344,7 +324,6 @@ class ExprArrayReductionMin : public ::flow::Filter ~ExprArrayReductionMin(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -356,7 +335,6 @@ class ExprArrayReductionMax : public ::flow::Filter ~ExprArrayReductionMax(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -368,7 +346,6 @@ class ExprArrayReductionAvg : public ::flow::Filter ~ExprArrayReductionAvg(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -380,7 +357,6 @@ class ExprArrayReductionSum : public ::flow::Filter ~ExprArrayReductionSum(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -401,7 +377,6 @@ class ExprHistory: public ::flow::Filter ~ExprHistory(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -413,7 +388,6 @@ class ExprHistoryRange : public ::flow::Filter ~ExprHistoryRange(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -425,7 +399,6 @@ class ExprHistoryGradient : public ::flow::Filter ~ExprHistoryGradient(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -437,7 +410,6 @@ class ExprHistoryGradientRange : public ::flow::Filter ~ExprHistoryGradientRange(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -458,7 +430,6 @@ class ExprHistogram : public ::flow::Filter ~ExprHistogram(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -470,7 +441,6 @@ class ExprHistogramEntropy : public ::flow::Filter ~ExprHistogramEntropy(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -482,7 +452,6 @@ class ExprHistogramPDF : public ::flow::Filter ~ExprHistogramPDF(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -494,7 +463,6 @@ class ExprHistogramCDF : public ::flow::Filter ~ExprHistogramCDF(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -506,7 +474,6 @@ class ExprHistogramCDFQuantile : public ::flow::Filter ~ExprHistogramCDFQuantile(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -519,7 +486,6 @@ class ExprHistogramBinByIndex : public ::flow::Filter ~ExprHistogramBinByIndex(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -531,7 +497,6 @@ class ExprHistogramBinByValue : public ::flow::Filter ~ExprHistogramBinByValue(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -552,7 +517,6 @@ class ExprMeshCycle : public ::flow::Filter ~ExprMeshCycle(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -564,7 +528,6 @@ class ExprMeshTime : public ::flow::Filter ~ExprMeshTime(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -576,7 +539,6 @@ class ExprMeshField : public ::flow::Filter ~ExprMeshField(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -588,7 +550,6 @@ class ExprMeshTopology : public ::flow::Filter ~ExprMeshTopology(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -600,7 +561,6 @@ class ExprMeshBounds : public ::flow::Filter ~ExprMeshBounds(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -612,7 +572,6 @@ class ExprMeshLineout : public ::flow::Filter ~ExprMeshLineout(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -633,7 +592,6 @@ class ExprMeshFieldReductionMin : public ::flow::Filter ~ExprMeshFieldReductionMin(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -645,7 +603,6 @@ class ExprMeshFieldReductionMax : public ::flow::Filter ~ExprMeshFieldReductionMax(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -657,7 +614,6 @@ class ExprMeshFieldReductionAvg : public ::flow::Filter ~ExprMeshFieldReductionAvg(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -669,7 +625,6 @@ class ExprMeshFieldReductionSum : public ::flow::Filter ~ExprMeshFieldReductionSum(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -681,7 +636,6 @@ class ExprMeshFieldReductionNanCount : public ::flow::Filter ~ExprMeshFieldReductionNanCount(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -693,7 +647,6 @@ class ExprMeshFieldReductionInfCount : public ::flow::Filter ~ExprMeshFieldReductionInfCount(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -715,7 +668,6 @@ class ExprMeshBinning : public ::flow::Filter ~ExprMeshBinning(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -727,7 +679,6 @@ class ExprMeshBinningAxis : public ::flow::Filter ~ExprMeshBinningAxis(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -739,7 +690,6 @@ class ExprMeshBinningBinByIndex: public ::flow::Filter ~ExprMeshBinningBinByIndex(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -751,7 +701,6 @@ class ExprMeshBinningPointAndAxis : public ::flow::Filter ~ExprMeshBinningPointAndAxis(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; @@ -763,7 +712,6 @@ class ExprMeshBinningMaxFromPoint : public ::flow::Filter ~ExprMeshBinningMaxFromPoint(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); }; From 5116d52b5b1e0e1825d0f312d4582641ff21d57d Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 5 Mar 2026 14:30:20 -0800 Subject: [PATCH 10/50] converting another file --- .../ascent_expression_jit_filters.cpp | 51 +++++++------------ .../ascent_expression_jit_filters.hpp | 2 - 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp index b435f7321..84de61184 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp @@ -140,31 +140,25 @@ ExprJitFilter::declare_interface(Node &i) i["port_names"].append() = ss.str(); } i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -ExprJitFilter::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = filters::check_string("func", params, info, true); - res &= filters::check_string("filter_name", params, info, true); - if(!params.has_path("inputs")) - { - info["errors"].append() = "Missing required parameter 'inputs'"; - res = false; - } - else if(params["inputs"].number_of_children() != num_inputs) - { - stringstream ss; - ss << "Expected parameter 'inputs' to have " << num_inputs - << " inputs but it has " << params["inputs"].number_of_children() - << " inputs."; - info["errors"].append() = ss.str(); - res = false; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/func"].set(filters::string_schema()); + param_schema["properties/filter_name"].set(filters::string_schema()); + + conduit::Node inputs_schema = filters::array_schema(filters::number_schema()); + inputs_schema["minItems"] = num_inputs; + inputs_schema["miaxItems"] = num_inputs; + param_schema["properties/inputs"].set(inputs_schema); + + param_schema["required"].append() = "func"; + param_schema["required"].append() = "filter_name"; + param_schema["required"].append() = "inputs"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -784,15 +778,6 @@ ExprExpressionList::declare_interface(Node &i) i["output_port"] = "true"; } -//----------------------------------------------------------------------------- -bool -ExprExpressionList::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void ExprExpressionList::execute() diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.hpp b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.hpp index 4b9c9a38f..cc8b80850 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.hpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.hpp @@ -39,7 +39,6 @@ class ExprJitFilter : public ::flow::Filter ~ExprJitFilter(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); private: @@ -58,7 +57,6 @@ class ExprExpressionList : public ::flow::Filter ~ExprExpressionList(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, conduit::Node &info); virtual void execute(); protected: From 47f63768d9988eb5358d59a1178c7a3d97d382d4 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 5 Mar 2026 14:31:11 -0800 Subject: [PATCH 11/50] Trying to add some support for expressions again --- .../ascent_runtime_param_check.cpp | 19 ++++++++- .../ascent_runtime_param_check.hpp | 6 ++- src/libs/flow/flow_schema_validator.cpp | 40 ++++++++++++++++--- src/libs/flow/flow_schema_validator.hpp | 10 ++++- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index a3288f702..bbaf0d515 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -58,6 +58,20 @@ bool is_valid_expression(const std::string expr, std::string &err_msg) return res; } +conduit::Node string_schema() +{ + conduit::Node n; + n["type"] = "string"; + return n; +} + +conduit::Node expression_schema() +{ + conduit::Node n = string_schema(); + n["format"] = "expression"; + return n; +} + conduit::Node number_schema() { conduit::Node n; @@ -65,10 +79,11 @@ conduit::Node number_schema() return n; } -conduit::Node string_schema() +conduit::Node number_or_expression_schema() { conduit::Node n; - n["type"] = "string"; + n["anyOf"].append().set(number_schema()); + n["anyOf"].append().set(expression_schema()); return n; } diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index e137446dd..45c69fa50 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -41,9 +41,13 @@ namespace runtime namespace filters { +conduit::Node ASCENT_API string_schema(); + +conduit::Node ASCENT_API expression_schema(); + conduit::Node ASCENT_API number_schema(); -conduit::Node ASCENT_API string_schema(); +conduit::Node ASCENT_API number_or_expression_schema(); conduit::Node ASCENT_API vec3_schema(); diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 1734d9532..32354ac57 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -475,6 +475,35 @@ bool validate_object(const conduit::Node &schema, return ok; } +static bool validate_format(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path, + const flow::schema::Hooks *hooks) +{ + if(!schema.has_child("format")) return true; + if(!schema["format"].dtype().is_string()) return true; + + const std::string fmt = schema["format"].as_string(); + if(fmt != "expression") return true; + if(!input.dtype().is_string()) return true; + + // If no is_valid_expression hook then move on + if(hooks == nullptr || hooks->is_valid_expression == nullptr) + { + return true; + } + + std::string err; + bool ok = hooks->is_valid_expression(input.as_string(), err); + if(!ok) + { + add_error(info, + "Invalid expression at '" + (path.empty() ? std::string("") : path) + "': " + err); + } + return ok; +} + bool validate_array(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, @@ -530,7 +559,8 @@ bool validate_array(const conduit::Node &schema, bool validate_node(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, - const std::string &path) + const std::string &path, + const Hooks *hooks = nullptr) { if (schema.has_path("constraints/skip") && schema["constraints/skip"].to_int() != 0) { @@ -557,8 +587,6 @@ bool validate_node(const conduit::Node &schema, ok = validate_const(schema, input, info, path) && ok; if(!ok) return false; // type mismatch stops recursion - - if(schema_defined_type == "object") { return validate_object(schema, input, info, path); @@ -570,6 +598,7 @@ bool validate_node(const conduit::Node &schema, ok = validate_one_of(schema, input, info, path) && ok; ok = validate_any_of(schema, input, info, path) && ok; + ok = validate_format(input, schema, info, path, hooks) && ok; return ok; } @@ -582,10 +611,11 @@ bool validate_node(const conduit::Node &schema, // ---------- Schema Validation Entry-Point ---------- bool validate(const conduit::Node &schema, const conduit::Node &input, - conduit::Node &info) + conduit::Node &info, + const Hooks *hooks = nullptr) { info.reset(); - bool ok = detail::validate_node(schema, input, info, ""); + bool ok = detail::validate_node(schema, input, info, "", hooks); if(!ok && !info.has_child("errors")) { diff --git a/src/libs/flow/flow_schema_validator.hpp b/src/libs/flow/flow_schema_validator.hpp index 5d970e104..6f27bf7fd 100644 --- a/src/libs/flow/flow_schema_validator.hpp +++ b/src/libs/flow/flow_schema_validator.hpp @@ -31,9 +31,17 @@ namespace flow namespace schema { +using ExpressionCheckFunc = bool (*)(const std::string &expr, std::string &err_msg); + +struct Hooks +{ + ExpressionCheckFunc is_valid_expression = nullptr; +}; + bool FLOW_API validate(const conduit::Node &schema, const conduit::Node &input, - conduit::Node &info); + conduit::Node &info, + const Hooks *hooks = nullptr); }; //----------------------------------------------------------------------------- From ddc3b89092af658ab07ff1069184c57cf28e7269 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 12 Mar 2026 13:18:37 -0700 Subject: [PATCH 12/50] Adding a way to pass our expression validator into the flow filter --- .../ascent_runtime_param_check.cpp | 8 ++++- src/libs/flow/flow_schema_validator.cpp | 35 +++++++++++-------- src/libs/flow/flow_schema_validator.hpp | 10 ++---- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index bbaf0d515..09127e0d8 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -17,6 +17,7 @@ #include "expressions/ascent_expressions_tokens.hpp" #include "expressions/ascent_expressions_parser.hpp" #include +#include #include @@ -43,7 +44,7 @@ namespace filters //----------------------------------------------------------------------------- // this detects if the syntax is valid, not // whether the expression will actually work -bool is_valid_expression(const std::string expr, std::string &err_msg) +bool is_valid_expression(const std::string &expr, std::string &err_msg) { bool res = true; try @@ -58,6 +59,11 @@ bool is_valid_expression(const std::string expr, std::string &err_msg) return res; } +void ascent_register_flow_schema_hooks() +{ + flow::schema::set_expression_checker(&is_valid_expression); +} + conduit::Node string_schema() { conduit::Node n; diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 32354ac57..1abd727d4 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -36,6 +36,12 @@ namespace detail { // ---------- General Helpers ---------- +ExpressionCheckFn &expr_checker() +{ + static ExpressionCheckFn fn = nullptr; + return fn; +} + void add_error(conduit::Node &info, const std::string &msg) { if(!info.has_child("errors")) @@ -478,8 +484,7 @@ bool validate_object(const conduit::Node &schema, static bool validate_format(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, - const std::string &path, - const flow::schema::Hooks *hooks) + const std::string &path) { if(!schema.has_child("format")) return true; if(!schema["format"].dtype().is_string()) return true; @@ -489,17 +494,14 @@ static bool validate_format(const conduit::Node &schema, if(!input.dtype().is_string()) return true; // If no is_valid_expression hook then move on - if(hooks == nullptr || hooks->is_valid_expression == nullptr) - { - return true; - } + auto expr_fn = expr_checker(); + if(expr_fn == nullptr) return true; std::string err; - bool ok = hooks->is_valid_expression(input.as_string(), err); + bool ok = expr_fn(input.as_string(), err); if(!ok) { - add_error(info, - "Invalid expression at '" + (path.empty() ? std::string("") : path) + "': " + err); + add_error(info, "Invalid expression at '" + (path.empty() ? std::string("") : path) + "': " + err); } return ok; } @@ -559,8 +561,7 @@ bool validate_array(const conduit::Node &schema, bool validate_node(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, - const std::string &path, - const Hooks *hooks = nullptr) + const std::string &path) { if (schema.has_path("constraints/skip") && schema["constraints/skip"].to_int() != 0) { @@ -598,7 +599,7 @@ bool validate_node(const conduit::Node &schema, ok = validate_one_of(schema, input, info, path) && ok; ok = validate_any_of(schema, input, info, path) && ok; - ok = validate_format(input, schema, info, path, hooks) && ok; + ok = validate_format(schema, input, info, path) && ok; return ok; } @@ -608,14 +609,18 @@ bool validate_node(const conduit::Node &schema, // -- end flow::schema::detail -- //----------------------------------------------------------------------------- +void set_expression_checker(ExpressionCheckFn fn) +{ + detail::expr_checker() = fn; +} + // ---------- Schema Validation Entry-Point ---------- bool validate(const conduit::Node &schema, const conduit::Node &input, - conduit::Node &info, - const Hooks *hooks = nullptr) + conduit::Node &info) { info.reset(); - bool ok = detail::validate_node(schema, input, info, "", hooks); + bool ok = detail::validate_node(schema, input, info, ""); if(!ok && !info.has_child("errors")) { diff --git a/src/libs/flow/flow_schema_validator.hpp b/src/libs/flow/flow_schema_validator.hpp index 6f27bf7fd..26587ff81 100644 --- a/src/libs/flow/flow_schema_validator.hpp +++ b/src/libs/flow/flow_schema_validator.hpp @@ -31,17 +31,13 @@ namespace flow namespace schema { -using ExpressionCheckFunc = bool (*)(const std::string &expr, std::string &err_msg); +using ExpressionCheckFn = bool (*)(const std::string &expr, std::string &err_msg); -struct Hooks -{ - ExpressionCheckFunc is_valid_expression = nullptr; -}; +void FLOW_API set_expression_checker(ExpressionCheckFn fn); bool FLOW_API validate(const conduit::Node &schema, const conduit::Node &input, - conduit::Node &info, - const Hooks *hooks = nullptr); + conduit::Node &info); }; //----------------------------------------------------------------------------- From d068b1a8e9a2de0836d770e8e5c079e600a28941 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 12 Mar 2026 15:25:43 -0700 Subject: [PATCH 13/50] We have a valid expression checker! --- src/libs/ascent/ascent.cpp | 5 +++++ .../ascent_runtime_param_check.cpp | 4 ++-- .../ascent_runtime_param_check.hpp | 2 ++ .../ascent_runtime_vtkh_filters.cpp | 4 ++-- src/libs/flow/flow_schema_validator.cpp | 21 +++---------------- 5 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/libs/ascent/ascent.cpp b/src/libs/ascent/ascent.cpp index 3194006e5..156a00d14 100644 --- a/src/libs/ascent/ascent.cpp +++ b/src/libs/ascent/ascent.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include @@ -649,6 +651,9 @@ Ascent::open(const conduit::Node &options) m_runtime->Initialize(m_options); + // Set the flow filter expression checker: + flow::schema::set_expression_checker(&runtime::filters::is_valid_expression); + // don't print info messages unless we are using verbose // Runtimes may set their own handlers in initialize, so // make sure to do this after. diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 09127e0d8..465dd71fa 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -88,8 +88,8 @@ conduit::Node number_schema() conduit::Node number_or_expression_schema() { conduit::Node n; - n["anyOf"].append().set(number_schema()); - n["anyOf"].append().set(expression_schema()); + n["oneOf"].append().set(number_schema()); + n["oneOf"].append().set(expression_schema()); return n; } diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 45c69fa50..ddc211cc3 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -41,6 +41,8 @@ namespace runtime namespace filters { +bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_msg); + conduit::Node ASCENT_API string_schema(); conduit::Node ASCENT_API expression_schema(); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 58ca96165..9687dbc95 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -1460,8 +1460,8 @@ VTKHThreshold::declare_interface(Node &i) // optional param_schema["properties/field"].set(string_schema()); param_schema["properties/topology"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema()); - param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/min_value"].set(number_or_expression_schema()); + param_schema["properties/max_value"].set(number_or_expression_schema()); param_schema["properties/invert"].set(string_schema()); param_schema["properties/extract"].set(string_schema()); diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 1abd727d4..4469dac84 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -357,17 +357,10 @@ bool validate_one_of(const conduit::Node &schema, for(conduit::index_t i = 0; i < opts.number_of_children(); ++i) { - const conduit::Node &opt = opts.child(i); - conduit::Node tmp; tmp.reset(); - bool ok = true; - ok = check_type(input, opt, tmp, path) && ok; - ok = validate_required(opt, input, tmp, path) && ok; - ok = validate_forbid(opt, input, tmp, path) && ok; - ok = validate_dependencies(opt, input, tmp, path) && ok; - ok = validate_exclusive_children(opt, input, tmp, path) && ok; + bool ok = validate_node(opts.child(i), input, tmp, path); if(ok) { @@ -419,17 +412,10 @@ bool validate_any_of(const conduit::Node &schema, for(conduit::index_t i = 0; i < opts.number_of_children(); ++i) { - const conduit::Node &opt = opts.child(i); - conduit::Node tmp; tmp.reset(); - bool ok = true; - ok = check_type(input, opt, tmp, path) && ok; - ok = validate_required(opt, input, tmp, path) && ok; - ok = validate_forbid(opt, input, tmp, path) && ok; - ok = validate_dependencies(opt, input, tmp, path) && ok; - ok = validate_exclusive_children(opt, input, tmp, path) && ok; + bool ok = validate_node(opts.child(i), input, tmp, path); if(ok) { @@ -481,7 +467,7 @@ bool validate_object(const conduit::Node &schema, return ok; } -static bool validate_format(const conduit::Node &schema, +bool validate_format(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, const std::string &path) @@ -493,7 +479,6 @@ static bool validate_format(const conduit::Node &schema, if(fmt != "expression") return true; if(!input.dtype().is_string()) return true; - // If no is_valid_expression hook then move on auto expr_fn = expr_checker(); if(expr_fn == nullptr) return true; From 3661bedefbedad1eca99b7f80dc6976e1958fcfa Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 12 Mar 2026 16:03:14 -0700 Subject: [PATCH 14/50] Integrating the expression checking into the vtkh number schemas :) --- .../ascent_runtime_param_check.cpp | 50 +++--- .../ascent_runtime_param_check.hpp | 16 +- .../ascent_runtime_vtkh_filters.cpp | 145 +++++++++--------- 3 files changed, 109 insertions(+), 102 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 465dd71fa..bec88d983 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -78,30 +78,33 @@ conduit::Node expression_schema() return n; } -conduit::Node number_schema() +conduit::Node number_schema(bool supports_expressions) { conduit::Node n; - n["type"] = "number"; - return n; -} - -conduit::Node number_or_expression_schema() -{ - conduit::Node n; - n["oneOf"].append().set(number_schema()); - n["oneOf"].append().set(expression_schema()); + if (supports_expressions) + { + n["oneOf"].append().set(number_schema()); + n["oneOf"].append().set(expression_schema()); + } + else + { + n["type"] = "number"; + } return n; } -conduit::Node vec3_schema(const std::string var1, const std::string var2, const std::string var3) +conduit::Node vec3_schema(const std::string var1, + const std::string var2, + const std::string var3, + bool supports_expressions) { conduit::Node n; n["type"] = "object"; n["additionalProperties"] = false; - n["properties/" + var1].set(number_schema()); - n["properties/" + var2].set(number_schema()); - n["properties/" + var3].set(number_schema()); + n["properties/" + var1].set(number_schema(supports_expressions)); + n["properties/" + var2].set(number_schema(supports_expressions)); + n["properties/" + var3].set(number_schema(supports_expressions)); n["required"].append() = var1; n["required"].append() = var2; @@ -110,20 +113,23 @@ conduit::Node vec3_schema(const std::string var1, const std::string var2, const return n; } -conduit::Node vec3_schema() +conduit::Node vec3_schema(bool supports_expressions) { - return vec3_schema("x", "y", "z"); + return vec3_schema("x", "y", "z", supports_expressions); } -conduit::Node vec3_schema_anyOf(const std::string var1, const std::string var2, const std::string var3) +conduit::Node vec3_schema_anyOf(const std::string var1, + const std::string var2, + const std::string var3, + bool supports_expressions) { conduit::Node n; n["type"] = "object"; n["additionalProperties"] = false; - n["properties/" + var1].set(number_schema()); - n["properties/" + var2].set(number_schema()); - n["properties/" + var3].set(number_schema()); + n["properties/" + var1].set(number_schema(supports_expressions)); + n["properties/" + var2].set(number_schema(supports_expressions)); + n["properties/" + var3].set(number_schema(supports_expressions)); conduit::Node var1_required; var1_required["type"] = "object"; @@ -143,9 +149,9 @@ conduit::Node vec3_schema_anyOf(const std::string var1, const std::string var2, return n; } -conduit::Node vec3_schema_anyOf() +conduit::Node vec3_schema_anyOf(bool supports_expressions) { - return vec3_schema_anyOf("x", "y", "z"); + return vec3_schema_anyOf("x", "y", "z", supports_expressions); } conduit::Node array_schema(const conduit::Node &item_schema) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index ddc211cc3..f5ff163ce 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -45,23 +45,21 @@ bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_ms conduit::Node ASCENT_API string_schema(); -conduit::Node ASCENT_API expression_schema(); +conduit::Node ASCENT_API number_schema(bool supports_expressions = false); -conduit::Node ASCENT_API number_schema(); - -conduit::Node ASCENT_API number_or_expression_schema(); - -conduit::Node ASCENT_API vec3_schema(); +conduit::Node ASCENT_API vec3_schema(bool supports_expressions = false); conduit::Node ASCENT_API vec3_schema(const std::string var1, const std::string var2, - const std::string var3); + const std::string var3, + bool supports_expressions = false); -conduit::Node ASCENT_API vec3_schema_anyOf(); +conduit::Node ASCENT_API vec3_schema_anyOf(bool supports_expressions = false); conduit::Node ASCENT_API vec3_schema_anyOf(const std::string var1, const std::string var2, - const std::string var3); + const std::string var3, + bool supports_expressions = false); conduit::Node ASCENT_API array_schema(); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 9687dbc95..99fa9387a 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -424,9 +424,9 @@ VTKH3Slice::declare_interface(Node &i) param_schema["additionalProperties"] = false; param_schema["properties/topology"].set(string_schema()); - param_schema["properties/x_offset"].set(number_schema()); - param_schema["properties/y_offset"].set(number_schema()); - param_schema["properties/z_offset"].set(number_schema()); + param_schema["properties/x_offset"].set(number_schema(true)); + param_schema["properties/y_offset"].set(number_schema(true)); + param_schema["properties/z_offset"].set(number_schema(true)); i["param_schema"].set(param_schema); } @@ -727,8 +727,8 @@ VTKHSlice::declare_interface(Node &i) conduit::Node sphere_schema; sphere_schema["type"] = "object"; sphere_schema["additionalProperties"] = false; - sphere_schema["properties/center"].set(vec3_schema()); - sphere_schema["properties/radius"].set(number_schema()); + sphere_schema["properties/center"].set(vec3_schema(true)); + sphere_schema["properties/radius"].set(number_schema(true)); sphere_schema["required"].append() = "center"; sphere_schema["required"].append() = "radius"; param_schema["properties/sphere"].set(sphere_schema); @@ -737,9 +737,9 @@ VTKHSlice::declare_interface(Node &i) conduit::Node cylinder_schema; cylinder_schema["type"] = "object"; cylinder_schema["additionalProperties"] = false; - cylinder_schema["properties/center"].set(vec3_schema()); - cylinder_schema["properties/axis"].set(vec3_schema()); - cylinder_schema["properties/radius"].set(number_schema()); + cylinder_schema["properties/center"].set(vec3_schema(true)); + cylinder_schema["properties/axis"].set(vec3_schema(true)); + cylinder_schema["properties/radius"].set(number_schema(true)); cylinder_schema["required"].append() = "center"; cylinder_schema["required"].append() = "axis"; cylinder_schema["required"].append() = "radius"; @@ -749,8 +749,8 @@ VTKHSlice::declare_interface(Node &i) conduit::Node box_schema; box_schema["type"] = "object"; box_schema["additionalProperties"] = false; - box_schema["properties/min"].set(vec3_schema()); - box_schema["properties/max"].set(vec3_schema()); + box_schema["properties/min"].set(vec3_schema(true)); + box_schema["properties/max"].set(vec3_schema(true)); box_schema["required"].append() = "min"; box_schema["required"].append() = "max"; param_schema["properties/box"].set(box_schema); @@ -759,8 +759,8 @@ VTKHSlice::declare_interface(Node &i) conduit::Node plane_schema; plane_schema["type"] = "object"; plane_schema["additionalProperties"] = false; - plane_schema["properties/point"].set(vec3_schema()); - plane_schema["properties/normal"].set(vec3_schema()); + plane_schema["properties/point"].set(vec3_schema(true)); + plane_schema["properties/normal"].set(vec3_schema(true)); plane_schema["required"].append() = "point"; plane_schema["required"].append() = "normal"; param_schema["properties/plane"].set(plane_schema); @@ -770,12 +770,12 @@ VTKHSlice::declare_interface(Node &i) point_schema["type"] = "object"; point_schema["additionalProperties"] = false; - point_schema["properties/x"].set(number_schema()); - point_schema["properties/y"].set(number_schema()); - point_schema["properties/z"].set(number_schema()); - point_schema["properties/x_offset"].set(number_schema()); - point_schema["properties/y_offset"].set(number_schema()); - point_schema["properties/z_offset"].set(number_schema()); + point_schema["properties/x"].set(number_schema(true)); + point_schema["properties/y"].set(number_schema(true)); + point_schema["properties/z"].set(number_schema(true)); + point_schema["properties/x_offset"].set(number_schema(true)); + point_schema["properties/y_offset"].set(number_schema(true)); + point_schema["properties/z_offset"].set(number_schema(true)); // Option A: explicit conduit::Node option_1_explicit; @@ -800,7 +800,7 @@ VTKHSlice::declare_interface(Node &i) point_schema["oneOf"].append().set(option_2_offset); param_schema["properties/point"].set(point_schema); - param_schema["properties/normal"].set(vec3_schema()); + param_schema["properties/normal"].set(vec3_schema(true)); param_schema["constraints/dependencies/normal"].append() = "point"; i["param_schema"].set(param_schema); @@ -991,8 +991,8 @@ VTKHAutoSliceLevels::declare_interface(Node &i) param_schema["additionalProperties"] = false; param_schema["properties/field"].set(string_schema()); - param_schema["properties/normal"].set(vec3_schema()); - param_schema["properties/levels"].set(number_schema()); + param_schema["properties/normal"].set(vec3_schema(true)); + param_schema["properties/levels"].set(number_schema(true)); param_schema["required"].append() = "field"; param_schema["required"].append() = "normal"; @@ -1165,8 +1165,8 @@ VTKHGhostStripper::declare_interface(Node &i) param_schema["additionalProperties"] = false; param_schema["properties/field"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema()); - param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/min_value"].set(number_schema(true)); + param_schema["properties/max_value"].set(number_schema(true)); param_schema["required"].append() = "field"; param_schema["required"].append() = "min_value"; @@ -1460,17 +1460,20 @@ VTKHThreshold::declare_interface(Node &i) // optional param_schema["properties/field"].set(string_schema()); param_schema["properties/topology"].set(string_schema()); - param_schema["properties/min_value"].set(number_or_expression_schema()); - param_schema["properties/max_value"].set(number_or_expression_schema()); + param_schema["properties/min_value"].set(number_schema(true)); + param_schema["properties/max_value"].set(number_schema(true)); param_schema["properties/invert"].set(string_schema()); param_schema["properties/extract"].set(string_schema()); + // param_schema["oneOf"].append("field"); + // param_schema["oneOf"].append("topology") + // --- sphere --- conduit::Node sphere_schema; sphere_schema["type"] = "object"; sphere_schema["additionalProperties"] = false; - sphere_schema["properties/center"].set(vec3_schema()); - sphere_schema["properties/radius"].set(number_schema()); + sphere_schema["properties/center"].set(vec3_schema(true)); + sphere_schema["properties/radius"].set(number_schema(true)); sphere_schema["required"].append() = "center"; sphere_schema["required"].append() = "radius"; param_schema["properties/sphere"].set(sphere_schema); @@ -1479,9 +1482,9 @@ VTKHThreshold::declare_interface(Node &i) conduit::Node cylinder_schema; cylinder_schema["type"] = "object"; cylinder_schema["additionalProperties"] = false; - cylinder_schema["properties/center"].set(vec3_schema()); - cylinder_schema["properties/axis"].set(vec3_schema()); - cylinder_schema["properties/radius"].set(number_schema()); + cylinder_schema["properties/center"].set(vec3_schema(true)); + cylinder_schema["properties/axis"].set(vec3_schema(true)); + cylinder_schema["properties/radius"].set(number_schema(true)); cylinder_schema["required"].append() = "center"; cylinder_schema["required"].append() = "axis"; cylinder_schema["required"].append() = "radius"; @@ -1491,8 +1494,8 @@ VTKHThreshold::declare_interface(Node &i) conduit::Node box_schema; box_schema["type"] = "object"; box_schema["additionalProperties"] = false; - box_schema["properties/min"].set(vec3_schema()); - box_schema["properties/max"].set(vec3_schema()); + box_schema["properties/min"].set(vec3_schema(true)); + box_schema["properties/max"].set(vec3_schema(true)); box_schema["required"].append() = "min"; box_schema["required"].append() = "max"; param_schema["properties/box"].set(box_schema); @@ -1501,8 +1504,8 @@ VTKHThreshold::declare_interface(Node &i) conduit::Node plane_schema; plane_schema["type"] = "object"; plane_schema["additionalProperties"] = false; - plane_schema["properties/point"].set(vec3_schema()); - plane_schema["properties/normal"].set(vec3_schema()); + plane_schema["properties/point"].set(vec3_schema(true)); + plane_schema["properties/normal"].set(vec3_schema(true)); plane_schema["required"].append() = "point"; plane_schema["required"].append() = "normal"; param_schema["properties/plane"].set(plane_schema); @@ -1511,10 +1514,10 @@ VTKHThreshold::declare_interface(Node &i) conduit::Node multi_plane_schema; multi_plane_schema["type"] = "object"; multi_plane_schema["additionalProperties"] = false; - multi_plane_schema["properties/point1"].set(vec3_schema()); - multi_plane_schema["properties/point2"].set(vec3_schema()); - multi_plane_schema["properties/normal1"].set(vec3_schema()); - multi_plane_schema["properties/normal2"].set(vec3_schema()); + multi_plane_schema["properties/point1"].set(vec3_schema(true)); + multi_plane_schema["properties/point2"].set(vec3_schema(true)); + multi_plane_schema["properties/normal1"].set(vec3_schema(true)); + multi_plane_schema["properties/normal2"].set(vec3_schema(true)); multi_plane_schema["required"].append() = "point1"; multi_plane_schema["required"].append() = "point2"; multi_plane_schema["required"].append() = "normal1"; @@ -1735,8 +1738,8 @@ VTKHClip::declare_interface(Node &i) conduit::Node sphere_schema; sphere_schema["type"] = "object"; sphere_schema["additionalProperties"] = false; - sphere_schema["properties/center"].set(vec3_schema()); - sphere_schema["properties/radius"].set(number_schema()); + sphere_schema["properties/center"].set(vec3_schema(true)); + sphere_schema["properties/radius"].set(number_schema(true)); sphere_schema["required"].append() = "center"; sphere_schema["required"].append() = "radius"; param_schema["properties/sphere"].set(sphere_schema); @@ -1745,9 +1748,9 @@ VTKHClip::declare_interface(Node &i) conduit::Node cylinder_schema; cylinder_schema["type"] = "object"; cylinder_schema["additionalProperties"] = false; - cylinder_schema["properties/center"].set(vec3_schema()); - cylinder_schema["properties/axis"].set(vec3_schema()); - cylinder_schema["properties/radius"].set(number_schema()); + cylinder_schema["properties/center"].set(vec3_schema(true)); + cylinder_schema["properties/axis"].set(vec3_schema(true)); + cylinder_schema["properties/radius"].set(number_schema(true)); cylinder_schema["required"].append() = "center"; cylinder_schema["required"].append() = "axis"; cylinder_schema["required"].append() = "radius"; @@ -1757,8 +1760,8 @@ VTKHClip::declare_interface(Node &i) conduit::Node box_schema; box_schema["type"] = "object"; box_schema["additionalProperties"] = false; - box_schema["properties/min"].set(vec3_schema()); - box_schema["properties/max"].set(vec3_schema()); + box_schema["properties/min"].set(vec3_schema(true)); + box_schema["properties/max"].set(vec3_schema(true)); box_schema["required"].append() = "min"; box_schema["required"].append() = "max"; param_schema["properties/box"].set(box_schema); @@ -1767,8 +1770,8 @@ VTKHClip::declare_interface(Node &i) conduit::Node plane_schema; plane_schema["type"] = "object"; plane_schema["additionalProperties"] = false; - plane_schema["properties/point"].set(vec3_schema()); - plane_schema["properties/normal"].set(vec3_schema()); + plane_schema["properties/point"].set(vec3_schema(true)); + plane_schema["properties/normal"].set(vec3_schema(true)); plane_schema["required"].append() = "point"; plane_schema["required"].append() = "normal"; param_schema["properties/plane"].set(plane_schema); @@ -1777,10 +1780,10 @@ VTKHClip::declare_interface(Node &i) conduit::Node multi_plane_schema; multi_plane_schema["type"] = "object"; multi_plane_schema["additionalProperties"] = false; - multi_plane_schema["properties/point1"].set(vec3_schema()); - multi_plane_schema["properties/point2"].set(vec3_schema()); - multi_plane_schema["properties/normal1"].set(vec3_schema()); - multi_plane_schema["properties/normal2"].set(vec3_schema()); + multi_plane_schema["properties/point1"].set(vec3_schema(true)); + multi_plane_schema["properties/point2"].set(vec3_schema(true)); + multi_plane_schema["properties/normal1"].set(vec3_schema(true)); + multi_plane_schema["properties/normal2"].set(vec3_schema(true)); multi_plane_schema["required"].append() = "point1"; multi_plane_schema["required"].append() = "point2"; multi_plane_schema["required"].append() = "normal1"; @@ -1948,7 +1951,7 @@ VTKHClipWithField::declare_interface(Node &i) param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/clip_value"].set(number_schema()); + param_schema["properties/clip_value"].set(number_schema(true)); param_schema["properties/field"].set(string_schema()); param_schema["properties/invert"].set(string_schema()); @@ -2048,8 +2051,8 @@ VTKHIsoVolume::declare_interface(Node &i) param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/min_value"].set(number_schema()); - param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/min_value"].set(number_schema(true)); + param_schema["properties/max_value"].set(number_schema(true)); param_schema["properties/field"].set(string_schema()); param_schema["required"].append() = "min_value"; @@ -2253,7 +2256,7 @@ VTKHLog::declare_interface(Node &i) param_schema["properties/field"].set(string_schema()); param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/clamp_min_value"].set(number_schema()); + param_schema["properties/clamp_min_value"].set(number_schema(true)); param_schema["required"].append() = "field"; @@ -2349,7 +2352,7 @@ VTKHLog10::declare_interface(Node &i) param_schema["properties/field"].set(string_schema()); param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/clamp_min_value"].set(number_schema()); + param_schema["properties/clamp_min_value"].set(number_schema(true)); param_schema["required"].append() = "field"; @@ -2445,7 +2448,7 @@ VTKHLog2::declare_interface(Node &i) param_schema["properties/field"].set(string_schema()); param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/clamp_min_value"].set(number_schema()); + param_schema["properties/clamp_min_value"].set(number_schema(true)); param_schema["required"].append() = "field"; @@ -2642,8 +2645,8 @@ VTKHHistSampling::declare_interface(Node &i) param_schema["additionalProperties"] = false; param_schema["properties/field"].set(string_schema()); - param_schema["properties/bins"].set(number_schema()); - param_schema["properties/sample_rate"].set(number_schema()); + param_schema["properties/bins"].set(number_schema(true)); + param_schema["properties/sample_rate"].set(number_schema(true)); param_schema["required"].append() = "field"; @@ -3819,7 +3822,7 @@ VTKHHistogram::declare_interface(Node &i) param_schema["additionalProperties"] = false; param_schema["properties/field"].set(string_schema()); - param_schema["properties/bins"].set(number_schema()); + param_schema["properties/bins"].set(number_schema(true)); param_schema["required"].append() = "field"; @@ -4360,7 +4363,7 @@ VTKHScale::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema = vec3_schema("x_scale", "y_scale", "z_scale"); + conduit::Node param_schema = vec3_schema("x_scale", "y_scale", "z_scale", true); } //----------------------------------------------------------------------------- @@ -4446,22 +4449,22 @@ VTKHTransform::declare_interface(Node &i) param_schema["constraints/exclusiveChildren"].append() = "matrix"; param_schema["constraints/allowNoneInExclusiveGroup"] = false; - param_schema["properties/scale"].set(vec3_schema_anyOf()); - param_schema["properties/translate"].set(vec3_schema_anyOf()); - param_schema["properties/reflect"].set(vec3_schema_anyOf()); + param_schema["properties/scale"].set(vec3_schema_anyOf(true)); + param_schema["properties/translate"].set(vec3_schema_anyOf(true)); + param_schema["properties/reflect"].set(vec3_schema_anyOf(true)); // --- rotate --- conduit::Node rotate_schema; rotate_schema["type"] = "object"; rotate_schema["additionalProperties"] = false; - rotate_schema["properties/angle"].set(number_schema()); - rotate_schema["properties/axis"].set(vec3_schema_anyOf()); + rotate_schema["properties/angle"].set(number_schema(true)); + rotate_schema["properties/axis"].set(vec3_schema_anyOf(true)); rotate_schema["required"].append() = "angle"; rotate_schema["required"].append() = "axis"; param_schema["properties/rotate"].set(rotate_schema); // --- matrix --- - conduit::Node matrix_schema = array_schema(number_schema()); + conduit::Node matrix_schema = array_schema(number_schema(true)); matrix_schema["minItems"] = 16; matrix_schema["miaxItems"] = 16; param_schema["properties/matrix"].set(matrix_schema); @@ -4688,8 +4691,8 @@ VTKHParticleAdvection::declare_interface(Node &i) param_schema["additionalProperties"] = false; param_schema["properties/field"].set(string_schema()); - param_schema["properties/num_steps"].set(number_schema()); - param_schema["properties/step_size"].set(number_schema()); + param_schema["properties/num_steps"].set(number_schema(true)); + param_schema["properties/step_size"].set(number_schema(true)); // --- seed --- conduit::Node seeds_schema; @@ -5337,8 +5340,8 @@ VTKHWarpXStreamline::declare_interface(Node &i) param_schema["properties/b_field"].set(string_schema()); param_schema["properties/e_field"].set(string_schema()); - param_schema["properties/num_steps"].set(number_schema()); - param_schema["properties/step_size"].set(number_schema()); + param_schema["properties/num_steps"].set(number_schema(true)); + param_schema["properties/step_size"].set(number_schema(true)); // --- rendering --- conduit::Node rendering_schema; From ce5e6266f1dfe272ed97cc42156222b827b1c586 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Fri, 13 Mar 2026 14:07:38 -0700 Subject: [PATCH 15/50] Taking a pass at trying to get the JIT tests to pass --- .../runtimes/expressions/ascent_expression_jit_filters.cpp | 4 ++-- src/libs/flow/flow_schema_validator.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp index 84de61184..a0b93cf60 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp @@ -144,12 +144,12 @@ ExprJitFilter::declare_interface(Node &i) // ----------- Define Param Schema ----------- conduit::Node param_schema; param_schema["type"] = "object"; - param_schema["additionalProperties"] = false; + param_schema["additionalProperties"] = true; param_schema["properties/func"].set(filters::string_schema()); param_schema["properties/filter_name"].set(filters::string_schema()); - conduit::Node inputs_schema = filters::array_schema(filters::number_schema()); + conduit::Node inputs_schema = filters::array_schema(filters::ignore_schema()); inputs_schema["minItems"] = num_inputs; inputs_schema["miaxItems"] = num_inputs; param_schema["properties/inputs"].set(inputs_schema); diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 4469dac84..e4e8befa0 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -74,7 +74,7 @@ bool check_type(const conduit::Node &input, if(schema_defined_type == "object") ok = data_type.is_object(); else if(schema_defined_type == "string") ok = data_type.is_string(); else if(schema_defined_type == "number") ok = data_type.is_number(); - else if(schema_defined_type == "array") ok = (data_type.is_list() || (data_type.is_number() && data_type.number_of_elements() >= 1)); + else if(schema_defined_type == "array") ok = (data_type.is_list() || (data_type.is_number() && data_type.number_of_elements() >= 1) || data_type.is_object()); else { add_error(info, "At '" + (path.empty() ? std::string("") : path) + @@ -499,7 +499,7 @@ bool validate_array(const conduit::Node &schema, bool ok = true; const auto data_type = input.dtype(); - const conduit::index_t count = data_type.is_list() ? input.number_of_children() : data_type.number_of_elements(); + const conduit::index_t count = (data_type.is_list() || data_type.is_object()) ? input.number_of_children() : data_type.number_of_elements(); // Json Schema uses min/max bounds for array length. if(schema.has_child("minItems")) From fc14616df8234cfec9a8e7b15df1c036216ed1f8 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 17 Mar 2026 13:40:09 -0700 Subject: [PATCH 16/50] Require that either field or topology be given for a threshold filter --- .../runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 99fa9387a..f1609e0d7 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -1465,8 +1465,8 @@ VTKHThreshold::declare_interface(Node &i) param_schema["properties/invert"].set(string_schema()); param_schema["properties/extract"].set(string_schema()); - // param_schema["oneOf"].append("field"); - // param_schema["oneOf"].append("topology") + param_schema["anyOf"].append() = "field"; + param_schema["anyOf"].append() = "topology"; // --- sphere --- conduit::Node sphere_schema; From 1c72710ddae6fb9c3ed7208e4047461473cb3c5c Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 13:10:40 -0700 Subject: [PATCH 17/50] Converting more filters to new schema - tested --- .../ascent_runtime_babelflow_compose.cpp | 32 +- .../ascent_runtime_babelflow_filters.hpp | 6 - .../ascent_runtime_babelflow_iso.cpp | 34 +- .../ascent_runtime_babelflow_pmt.cpp | 34 +- .../ascent_runtime_blueprint_filters.cpp | 385 +++++------------- .../ascent_runtime_blueprint_filters.hpp | 12 - src/libs/blaze | 1 + 7 files changed, 156 insertions(+), 348 deletions(-) create mode 160000 src/libs/blaze diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp index 0890afc10..27d2243c0 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp @@ -42,23 +42,23 @@ void ascent::runtime::filters::BFlowCompose::declare_interface(conduit::Node &i) i["type_name"] = "bflow_comp"; i["port_names"].append() = "in"; i["output_port"] = "false"; // true -- means filter, false -- means extract -} - -//----------------------------------------------------------------------------- - -bool ascent::runtime::filters::BFlowCompose::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res &= check_string("color_field", params, info, true); - res &= check_string("depth_field", params, info, true); - res &= check_string("image_prefix", params, info, true); - res &= check_numeric("compositing", params, info, true); - res &= check_numeric("fanin", params, info, false); - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + + param_schema["properties/color_field"].set(string_schema()); + param_schema["properties/depth_field"].set(string_schema()); + param_schema["properties/image_prefix"].set(string_schema()); + param_schema["properties/compositing"].set(number_schema()); + param_schema["properties/fanin"].set(number_schema()); + + param_schema["required"].append() = "color_field"; + param_schema["required"].append() = "depth_field"; + param_schema["required"].append() = "image_prefix"; + param_schema["required"].append() = "compositing"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_filters.hpp index 07e9eaad4..738b80aea 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_filters.hpp @@ -37,8 +37,6 @@ class BFlowPmt : public ::flow::Filter virtual ~BFlowPmt() {} virtual void declare_interface(conduit::Node &i) override; - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info) override; virtual void execute() override; }; @@ -53,8 +51,6 @@ class BFlowCompose : public ::flow::Filter virtual ~BFlowCompose() {} virtual void declare_interface(conduit::Node &i) override; - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info) override; virtual void execute() override; }; @@ -67,8 +63,6 @@ class BFlowIso : public ::flow::Filter virtual ~BFlowIso() {} virtual void declare_interface(conduit::Node &i) override; - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info) override; virtual void execute() override; }; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp index 76dc00fec..7533535ff 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp @@ -530,25 +530,23 @@ void ascent::runtime::filters::BFlowIso::declare_interface(conduit::Node &i) i["type_name"] = "bflow_iso"; i["port_names"].append() = "in"; i["output_port"] = "false"; // true -- means filter, false -- means extract -} - -//----------------------------------------------------------------------------- -bool ascent::runtime::filters::BFlowIso::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res &= check_string("field", params, info, true); - res &= check_numeric("iso_values", params, info, true); - res &= check_string("image_name", params, info, true); - res &= check_numeric("radices", params, info, false); - res &= check_numeric("width", params, info, false); - res &= check_numeric("height", params, info, false); - // res &= check_string("col_field", params, info, true); - - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + + param_schema["properties/field"].set(string_schema()); + param_schema["properties/iso_values"].set(number_schema()); + param_schema["properties/image_name"].set(string_schema()); + param_schema["properties/radices"].set(number_schema()); + param_schema["properties/width"].set(number_schema()); + param_schema["properties/height"].set(number_schema()); + + param_schema["required"].append() = "field"; + param_schema["required"].append() = "iso_values"; + param_schema["required"].append() = "image_name"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp index 3eb6236df..bb72694c2 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp @@ -1464,6 +1464,23 @@ void ascent::runtime::filters::BFlowPmt::declare_interface(conduit::Node &i) i["type_name"] = "bflow_pmt"; i["port_names"].append() = "in"; i["output_port"] = "true"; // true -- means filter, false -- means extract + + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + + param_schema["properties/field"].set(string_schema()); + param_schema["properties/fanin"].set(number_schema()); + param_schema["properties/threshold"].set(number_schema()); + param_schema["properties/gen_segment"].set(number_schema()); + param_schema["properties/ugrid_select"].set(number_schema()); + + param_schema["required"].append() = "field"; + param_schema["required"].append() = "fanin"; + param_schema["required"].append() = "threshold"; + param_schema["required"].append() = "gen_segment"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1847,20 +1864,3 @@ void ascent::runtime::filters::BFlowPmt::execute() set_output(d_input); } - -//----------------------------------------------------------------------------- - -bool ascent::runtime::filters::BFlowPmt::verify_params(const conduit::Node ¶ms, conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res &= check_string("field", params, info, true); - res &= check_numeric("fanin", params, info, true); - res &= check_numeric("threshold", params, info, true); - res &= check_numeric("gen_segment", params, info, true); - res &= check_numeric("ugrid_select", params, info, false); - - return res; -} diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp index 1189463cc..07181577a 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp @@ -103,23 +103,15 @@ BlueprintVerify::declare_interface(Node &i) i["type_name"] = "blueprint_verify"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -BlueprintVerify::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; - if(! params.has_child("protocol") || - ! params["protocol"].dtype().is_string() ) - { - info["errors"].append() = "Missing required string parameter 'protocol'"; - } + param_schema["properties/protocol"].set(string_schema()); + param_schema["required"].append() = "protocol"; - return res; + i["param_schema"].set(param_schema); } @@ -241,19 +233,6 @@ ConduitExtract::declare_interface(Node &i) i["output_port"] = "false"; } -//----------------------------------------------------------------------------- -bool -ConduitExtract::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - // so far, no params - - return res; -} - //----------------------------------------------------------------------------- void ConduitExtract::execute() @@ -310,73 +289,44 @@ BlueprintPartition::declare_interface(Node &i) i["type_name"] = "blueprint_data_partition"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -BlueprintPartition::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - res &= check_numeric("target",params, info, false, false); - - if(params.has_child("selections")) - { - res &= check_string("selections/type",params, info, true); - //domain_id can be int or "any" - res &= (check_string("selections/domain_id",params, info, false) || check_numeric("selections/domain_id", params, info, false, false)); - res &= check_string("selections/topology",params, info, false); - } - - if(params.has_child("fields")) - { - if(!params["fields"].dtype().is_list()) - { - res = false; - info["errors"].append() = "fields is not a list"; - } - } - - res &= check_numeric("mapping",params, info, false, false); - res &= check_numeric("merge_tolerance",params, info, false, false); - res &= check_numeric("build_adjsets",params, info, false, false); - res &= check_string("original_element_ids",params, info, false); - res &= check_string("original_vertex_ids",params, info, false); - - std::vector valid_paths; - valid_paths.push_back("target"); - valid_paths.push_back("selections/type"); - valid_paths.push_back("selections/domain_id"); - valid_paths.push_back("selections/field"); - valid_paths.push_back("selections/topology"); - valid_paths.push_back("selections/start"); - valid_paths.push_back("selections/end"); - valid_paths.push_back("selections/elements"); - valid_paths.push_back("selections/ranges"); - valid_paths.push_back("selections/field"); - valid_paths.push_back("mapping"); - valid_paths.push_back("merge_tolerance"); - valid_paths.push_back("build_adjsets"); - valid_paths.push_back("original_element_ids"); - valid_paths.push_back("original_vertex_ids"); - valid_paths.push_back("distributed"); - - std::vector ingore_paths = {"fields"}; - - std::string surprises = surprise_check(valid_paths,ingore_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/target"].set(number_schema()); + param_schema["properties/fields"].set(array_schema(ignore_schema())); + param_schema["properties/mapping"].set(number_schema()); + param_schema["properties/merge_tolerance"].set(number_schema()); + param_schema["properties/build_adjsets"].set(number_schema()); + param_schema["properties/original_element_ids"].set(string_schema()); + param_schema["properties/original_vertex_ids"].set(string_schema()); + param_schema["properties/distributed"].set(ignore_schema()); + + // --- selections --- + conduit::Node domain_id_schema; + domain_id_schema["type"] = "object"; + domain_id_schema["oneOf"].append().set(string_schema()); + domain_id_schema["oneOf"].append().set(number_schema()); + + conduit::Node selections_schema; + selections_schema["type"] = "object"; + selections_schema["additionalProperties"] = false; + selections_schema["properties/type"].set(string_schema()); + selections_schema["properties/domain_id"].set(domain_id_schema); + selections_schema["properties/topology"].set(string_schema()); + selections_schema["properties/field"].set(ignore_schema()); + selections_schema["properties/start"].set(ignore_schema()); + selections_schema["properties/end"].set(ignore_schema()); + selections_schema["properties/elements"].set(ignore_schema()); + selections_schema["properties/ranges"].set(ignore_schema()); + selections_schema["required"].append() = "type"; + param_schema["properties/selections"].set(selections_schema); + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void BlueprintPartition::execute() @@ -467,114 +417,52 @@ DataBinning::declare_interface(Node &i) i["type_name"] = "data_binning"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -DataBinning::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - if(!params.has_path("reduction_op")) - { - res = false; - info["errors"].append() = "Missing 'reduction_op'"; - } - - // note: `var` is deprecated, new arg reduction_field - if(!params.has_path("reduction_field")) - { - if(!params.has_path("var")) - { - res = false; - info["errors"].append() = "Missing 'reduction_field'"; - } - } - - std::vector valid_paths; - valid_paths.push_back("reduction_op"); - valid_paths.push_back("reduction_field"); - valid_paths.push_back("empty_bin_val"); - valid_paths.push_back("output_type"); - valid_paths.push_back("output_field"); - valid_paths.push_back("var"); - - std::vector ignore_paths; - ignore_paths.push_back("axes"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(!params.has_path("output_field")) - { - res = false; - info["errors"].append() = "Missing param 'output_field'"; - } - - if(!params.has_path("axes")) - { - res = false; - info["errors"].append() = "Missing binning axes"; - } - else if(!params["axes"].dtype().is_list()) - { - res = false; - info["errors"].append() = "Axes is not a list"; - } - else - { - const int num_axes = params["axes"].number_of_children(); - if(num_axes < 1 || num_axes > 3) - { - res = false; - info["errors"].append() = "Number of axes must be between 1 and 3"; - } - else - { - for(int i = 0; i < num_axes; ++i) - { - const conduit::Node &axis = params["axes"].child(i); - if(!axis.has_path("num_bins")) - { - res = false; - info["errors"].append() = "Axis missing 'num_bins'"; - } - - if(!axis.has_child("field")) - { - if(!axis.has_child("var")) - { - std::ostringstream oss; - oss << "Axis " << i << " missing 'field' parameter"; - res = false; - info["errors"].append() = oss.str(); - } - } - - std::vector avalid_paths; - avalid_paths.push_back("min_val"); - avalid_paths.push_back("max_val"); - avalid_paths.push_back("num_bins"); - avalid_paths.push_back("clamp"); - avalid_paths.push_back("field"); - avalid_paths.push_back("var"); - - surprises += surprise_check(avalid_paths, axis); - } - } - } - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + param_schema["constraints/exclusiveChildren"].append() = "reduction_field"; + param_schema["constraints/exclusiveChildren"].append() = "var"; + param_schema["constraints/allowNoneInExclusiveGroup"] = false; + + param_schema["properties/reduction_op"].set(ignore_schema()); + param_schema["properties/reduction_field"].set(ignore_schema()); + param_schema["properties/empty_bin_val"].set(ignore_schema()); + param_schema["properties/output_type"].set(string_schema()); + param_schema["properties/output_field"].set(ignore_schema()); + param_schema["properties/var"].set(ignore_schema()); + + // --- Axes --- + { + conduit::Node single_axis_schema; + single_axis_schema["type"] = "object"; + single_axis_schema["additionalProperties"] = false; + single_axis_schema["constraints/exclusiveChildren"].append() = "field"; + single_axis_schema["constraints/exclusiveChildren"].append() = "var"; + single_axis_schema["constraints/allowNoneInExclusiveGroup"] = false; + + single_axis_schema["properties/min_val"].set(number_schema(true)); + single_axis_schema["properties/max_val"].set(number_schema(true)); + single_axis_schema["properties/num_bins"].set(number_schema(true)); + single_axis_schema["properties/clamp"].set(number_schema(true)); + single_axis_schema["properties/field"].set(number_schema(true)); + single_axis_schema["properties/var"].set(number_schema(true)); + single_axis_schema["required"].append() = "num_bins"; + + conduit::Node axes_schema = array_schema(single_axis_schema); + axes_schema["minItems"] = 1; + axes_schema["miaxItems"] = 3; + param_schema["properties/axes"].set(axes_schema); + } + + param_schema["required"].append() = "reduction_op"; + param_schema["required"].append() = "output_field"; + param_schema["required"].append() = "axes"; + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void DataBinning::execute() @@ -794,50 +682,19 @@ AddFields::declare_interface(Node &i) i["type_name"] = "add_fields"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -AddFields::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - - if(!params.has_path("output_field")) - { - res = false; - info["errors"].append() = "Missing param 'output_field'"; - } - - if(!params.has_path("fields")) - { - res = false; - info["errors"].append() = "Missing 'fields'"; - } - else if(!params["fields"].dtype().is_list()) - { - res = false; - info["errors"].append() = "fields is not a list"; - } - std::vector valid_paths; - std::vector ignore_paths; - valid_paths.push_back("fields"); - valid_paths.push_back("output_field"); - ignore_paths.push_back("fields"); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + param_schema["properties/output_field"].set(string_schema()); + param_schema["properties/fields"].set(array_schema(ignore_schema())); - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + param_schema["required"].append() = "output_field"; + param_schema["required"].append() = "fields"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -902,51 +759,21 @@ PowerOfField::declare_interface(Node &i) i["type_name"] = "power_of_field"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -PowerOfField::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - - if(!params.has_path("output_field")) - { - res = false; - info["errors"].append() = "Missing param 'output_field'"; - } - if(!params.has_path("field")) - { - res = false; - info["errors"].append() = "Missing param 'field'"; - } - - if(!params.has_path("exponent")) - { - res = false; - info["errors"].append() = "Missing param 'exponent'"; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::vector valid_paths; - std::vector ignore_paths; - valid_paths.push_back("field"); - valid_paths.push_back("exponent"); - valid_paths.push_back("output_field"); + param_schema["properties/output_field"].set(string_schema()); + param_schema["properties/field"].set(string_schema()); + param_schema["properties/exponent"].set(number_schema()); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + param_schema["required"].append() = "output_field"; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "exponent"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.hpp index 3e0b39f71..8b6a17d8c 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.hpp @@ -51,8 +51,6 @@ class ASCENT_API BlueprintVerify : public ::flow::Filter ~BlueprintVerify(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -66,8 +64,6 @@ class ASCENT_API ConduitExtract: public ::flow::Filter ~ConduitExtract(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -80,8 +76,6 @@ class ASCENT_API BlueprintPartition : public ::flow::Filter ~BlueprintPartition(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -93,8 +87,6 @@ class ASCENT_API DataBinning : public ::flow::Filter ~DataBinning(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -106,8 +98,6 @@ class ASCENT_API AddFields : public ::flow::Filter ~AddFields(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -119,8 +109,6 @@ class ASCENT_API PowerOfField : public ::flow::Filter ~PowerOfField(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; diff --git a/src/libs/blaze b/src/libs/blaze new file mode 160000 index 000000000..e4d790d56 --- /dev/null +++ b/src/libs/blaze @@ -0,0 +1 @@ +Subproject commit e4d790d56981aa746702a4041a205cc3afdfcfb1 From 1026bcafaf80788dd1b038b812d19947b9f54665 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 13:19:46 -0700 Subject: [PATCH 18/50] Adding new template schemas to make further filter conversion possible --- .../ascent_runtime_param_check.cpp | 74 +++++++++++++++++-- .../ascent_runtime_param_check.hpp | 20 ++++- 2 files changed, 85 insertions(+), 9 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index bec88d983..61c8208d9 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -59,18 +59,35 @@ bool is_valid_expression(const std::string &expr, std::string &err_msg) return res; } -void ascent_register_flow_schema_hooks() -{ - flow::schema::set_expression_checker(&is_valid_expression); -} +//----------------------------------------------------------------------------- -conduit::Node string_schema() +conduit::Node string_schema(std::optional minLength, + std::optional maxLength) { conduit::Node n; n["type"] = "string"; + if(minLength) n["minLength"] = *minLength; + if(maxLength) n["minLength"] = *maxLength; + return n; +} + +conduit::Node string_enum_schema(std::vector options) +{ + conduit::Node n = string_schema(); + for (const auto& value: options) + { + n["constraints/enum"].append() = value; + } return n; } +conduit::Node bool_schema() +{ + return string_enum_schema({"true", "false"}); +} + +//----------------------------------------------------------------------------- + conduit::Node expression_schema() { conduit::Node n = string_schema(); @@ -78,21 +95,60 @@ conduit::Node expression_schema() return n; } -conduit::Node number_schema(bool supports_expressions) +//----------------------------------------------------------------------------- + +conduit::Node number_schema(bool supports_expressions, + std::optional minimum, + std::optional maximum, + std::optional exclusiveMinimum, + std::optional exclusiveMaximum) { conduit::Node n; if (supports_expressions) { - n["oneOf"].append().set(number_schema()); + n["oneOf"].append().set(number_schema(false, minimum, maximum, exclusiveMinimum, exclusiveMaximum)); n["oneOf"].append().set(expression_schema()); } else { n["type"] = "number"; + + if(exclusiveMinimum) n["exclusiveMinimum"] = *exclusiveMinimum; + else if(minimum) n["minimum"] = *minimum; + + if(exclusiveMaximum) n["exclusiveMaximum"] = *exclusiveMaximum; + else if(maximum) n["maximum"] = *maximum; } return n; } +conduit::Node integer_schema(bool supports_expressions, + std::optional minimum, + std::optional maximum, + std::optional exclusiveMinimum, + std::optional exclusiveMaximum) +{ + conduit::Node n; + if (supports_expressions) + { + n["oneOf"].append().set(number_schema(false, minimum, maximum, exclusiveMinimum, exclusiveMaximum)); + n["oneOf"].append().set(expression_schema()); + } + else + { + n["type"] = "integer"; + + if(exclusiveMinimum) n["exclusiveMinimum"] = *exclusiveMinimum; + else if(minimum) n["minimum"] = *minimum; + + if(exclusiveMaximum) n["exclusiveMaximum"] = *exclusiveMaximum; + else if(maximum) n["maximum"] = *maximum; + } + return n; +} + +//----------------------------------------------------------------------------- + conduit::Node vec3_schema(const std::string var1, const std::string var2, const std::string var3, @@ -154,6 +210,8 @@ conduit::Node vec3_schema_anyOf(bool supports_expressions) return vec3_schema_anyOf("x", "y", "z", supports_expressions); } +//----------------------------------------------------------------------------- + conduit::Node array_schema(const conduit::Node &item_schema) { conduit::Node n; @@ -169,6 +227,8 @@ conduit::Node array_schema() return n; } +//----------------------------------------------------------------------------- + conduit::Node ignore_schema() { conduit::Node n; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index f5ff163ce..9be242b92 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -43,9 +44,24 @@ namespace filters bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_msg); -conduit::Node ASCENT_API string_schema(); +conduit::Node ASCENT_API string_schema(std::optional minLength = std::nullopt, + std::optional maxLength = std::nullopt); -conduit::Node ASCENT_API number_schema(bool supports_expressions = false); +conduit::Node ASCENT_API string_enum_schema(std::vector options); + +conduit::Node ASCENT_API bool_schema(); + +conduit::Node ASCENT_API number_schema(bool supports_expressions = false, + std::optional minimum = std::nullopt, + std::optional maximum = std::nullopt, + std::optional exclusiveMinimum = std::nullopt, + std::optional exclusiveMaximum= std::nullopt); + +conduit::Node ASCENT_API integer_schema(bool supports_expressions = false, + std::optional minimum = std::nullopt, + std::optional maximum = std::nullopt, + std::optional exclusiveMinimum = std::nullopt, + std::optional exclusiveMaximum= std::nullopt); conduit::Node ASCENT_API vec3_schema(bool supports_expressions = false); From 58f6b0f24700c1d2b043c1fc7f4c33b7a799e830 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 13:38:09 -0700 Subject: [PATCH 19/50] Updating the param check and flow schema validator with additional capabilities --- .../ascent_runtime_param_check.cpp | 10 +- src/libs/flow/flow_schema_validator.cpp | 147 +++++++++++++++++- 2 files changed, 151 insertions(+), 6 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 61c8208d9..62cd3f1fa 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -67,7 +67,7 @@ conduit::Node string_schema(std::optional minLength, conduit::Node n; n["type"] = "string"; if(minLength) n["minLength"] = *minLength; - if(maxLength) n["minLength"] = *maxLength; + if(maxLength) n["maxLength"] = *maxLength; return n; } @@ -76,7 +76,7 @@ conduit::Node string_enum_schema(std::vector options) conduit::Node n = string_schema(); for (const auto& value: options) { - n["constraints/enum"].append() = value; + n["enum"].append() = value; } return n; } @@ -131,7 +131,7 @@ conduit::Node integer_schema(bool supports_expressions, conduit::Node n; if (supports_expressions) { - n["oneOf"].append().set(number_schema(false, minimum, maximum, exclusiveMinimum, exclusiveMaximum)); + n["oneOf"].append().set(integer_schema(false, minimum, maximum, exclusiveMinimum, exclusiveMaximum)); n["oneOf"].append().set(expression_schema()); } else @@ -194,12 +194,12 @@ conduit::Node vec3_schema_anyOf(const std::string var1, conduit::Node var2_required; var2_required["type"] = "object"; - var2_required["required"] = var1; + var2_required["required"] = var2; n["anyOf"].append().set(var2_required); conduit::Node var3_required; var3_required["type"] = "object"; - var3_required["required"] = var1; + var3_required["required"] = var3; n["anyOf"].append().set(var3_required); return n; diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index e4e8befa0..827d64659 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -91,6 +91,121 @@ bool check_type(const conduit::Node &input, return ok; } +bool validate_string_bounds(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!input.dtype().is_string()) return true; + + const std::string s = input.as_string(); + bool ok = true; + + if(schema.has_child("minLength")) + { + int mn = schema["minLength"].to_int(); + if((int)s.size() < mn) + { + add_error(info, "String at '" + (path.empty() ? "" : path) + + "' is shorter than minLength=" + std::to_string(mn)); + ok = false; + } + } + + if(schema.has_child("maxLength")) + { + int mx = schema["maxLength"].to_int(); + if((int)s.size() > mx) + { + add_error(info, "String at '" + (path.empty() ? "" : path) + + "' is longer than maxLength=" + std::to_string(mx)); + ok = false; + } + } + + return ok; +} + +bool validate_enum(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + const conduit::Node *e = nullptr; + if(schema.has_child("enum")) e = &schema["enum"]; + else return true; + + if(!input.dtype().is_string()) return true; + + const std::string got = input.as_string(); + for(conduit::index_t i = 0; i < e->number_of_children(); ++i) + { + if(got == e->child(i).as_string()) return true; + } + + add_error(info, "Value not in enum at '" + + (path.empty() ? "" : path) + + "': got '" + got + "'"); + return false; +} + +bool validate_number_bounds(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!input.dtype().is_number()) return true; + + const double v = input.to_float64(); + bool ok = true; + + if(schema.has_child("minimum")) + { + double mn = schema["minimum"].to_float64(); + if(v < mn) + { + add_error(info, "Number at '" + (path.empty() ? "" : path) + + "' must be >= " + std::to_string(mn)); + ok = false; + } + } + + if(schema.has_child("exclusiveMinimum")) + { + double mn = schema["exclusiveMinimum"].to_float64(); + if(v <= mn) + { + add_error(info, "Number at '" + (path.empty() ? "" : path) + + "' must be > " + std::to_string(mn)); + ok = false; + } + } + + if(schema.has_child("maximum")) + { + double mx = schema["maximum"].to_float64(); + if(v > mx) + { + add_error(info, "Number at '" + (path.empty() ? "" : path) + + "' must be <= " + std::to_string(mx)); + ok = false; + } + } + + if(schema.has_child("exclusiveMaximum")) + { + double mx = schema["exclusiveMaximum"].to_float64(); + if(v >= mx) + { + add_error(info, "Number at '" + (path.empty() ? "" : path) + + "' must be < " + std::to_string(mx)); + ok = false; + } + } + + return ok; +} + // ---------- Object-Specific Validation Helpers ---------- // Earlier declaration so validate node can be refrenced by helpers. @@ -342,6 +457,22 @@ bool validate_exclusive_children(const conduit::Node &schema, return false; } +static bool validate_all_of(const conduit::Node &schema, + const conduit::Node &input, + conduit::Node &info, + const std::string &path) +{ + if(!schema.has_child("allOf")) return true; + + bool ok = true; + const conduit::Node &opts = schema["allOf"]; + for(conduit::index_t i = 0; i < opts.number_of_children(); ++i) + { + ok = validate_node(opts.child(i), input, info, path) && ok; + } + return ok; +} + bool validate_one_of(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, @@ -461,6 +592,7 @@ bool validate_object(const conduit::Node &schema, ok = validate_properties(schema, input, info, path) && ok; // Finally, enforce oneOf (treating options as extra constraints on this same object) + ok = validate_all_of(schema, input, info, path) && ok; ok = validate_one_of(schema, input, info, path) && ok; ok = validate_any_of(schema, input, info, path) && ok; @@ -530,7 +662,7 @@ bool validate_array(const conduit::Node &schema, } } - if(!schema.has_child("items")) return true; // unconstrained items + if(!schema.has_child("items")) return ok; // unconstrained items const conduit::Node &item_schema = schema["items"]; if(data_type.is_list()) { @@ -571,6 +703,18 @@ bool validate_node(const conduit::Node &schema, ok = check_type(input, schema, info, path) && ok; ok = validate_const(schema, input, info, path) && ok; + ok = validate_enum(schema, input, info, path) && ok; + + if(schema_defined_type == "string") + { + ok = validate_string_bounds(schema, input, info, path) && ok; + } + + if(schema_defined_type == "number" || schema_defined_type == "integer") + { + ok = validate_number_bounds(schema, input, info, path) && ok; + } + if(!ok) return false; // type mismatch stops recursion if(schema_defined_type == "object") @@ -582,6 +726,7 @@ bool validate_node(const conduit::Node &schema, return validate_array(schema, input, info, path); } + ok = validate_all_of(schema, input, info, path) && ok; ok = validate_one_of(schema, input, info, path) && ok; ok = validate_any_of(schema, input, info, path) && ok; ok = validate_format(schema, input, info, path) && ok; From 9fbe4e91ac0d6d8a8a45b21842d9e1e328fe284a Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 13:40:43 -0700 Subject: [PATCH 20/50] Forgot to also add a type for integers --- src/libs/flow/flow_schema_validator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 827d64659..8daa7a4dc 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -74,6 +74,7 @@ bool check_type(const conduit::Node &input, if(schema_defined_type == "object") ok = data_type.is_object(); else if(schema_defined_type == "string") ok = data_type.is_string(); else if(schema_defined_type == "number") ok = data_type.is_number(); + else if(schema_defined_type == "integer") ok = data_type.is_integer(); else if(schema_defined_type == "array") ok = (data_type.is_list() || (data_type.is_number() && data_type.number_of_elements() >= 1) || data_type.is_object()); else { From 04ef548e89b6f2df45d1a20ef35a8c2f879d407e Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 13:51:38 -0700 Subject: [PATCH 21/50] Converting more filters to new schema - tested --- .../ascent_runtime_adios2_filters.cpp | 54 ++++++-------- .../ascent_runtime_adios2_filters.hpp | 2 - .../ascent_runtime_command_filters.cpp | 63 ++++------------ .../ascent_runtime_command_filters.hpp | 2 - .../ascent_runtime_genten_filters.cpp | 12 ---- .../ascent_runtime_genten_filters.hpp | 2 - .../ascent_runtime_hola_filters.cpp | 32 +++------ .../ascent_runtime_hola_filters.hpp | 2 - .../ascent_runtime_htg_filters.cpp | 72 ++++--------------- .../ascent_runtime_htg_filters.hpp | 2 - 10 files changed, 59 insertions(+), 184 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp index 0a9597010..18c3929c0 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp @@ -114,43 +114,33 @@ ADIOS2::declare_interface(Node &i) i["type_name"] = "adios2"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -ADIOS2::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - bool res = true; - if (!params.has_child("filename") || - !params["filename"].dtype().is_string()) - { - info["errors"].append() = "missing required entry 'filename'"; - res = false; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if (!params.has_child("engine") || - !params["engine"].dtype().is_string()) - { - info["errors"].append() = "missing required entry 'engine'"; - res = false; - } + param_schema["properties/filename"].set(string_schema()); // Can't be a directory... need to add regex filter + param_schema["properties/engine"].set(string_schema()); - std::string engineType = params["engine"].as_string(); - if (engineType != "BPFile" && engineType != "SST") - { - info["errors"].append() = "unsupported engine type: " + engineType; - res = false; - } + conduit::Node bpfile_schema; + bpfile_schema["type"] = "object"; + bpfile_schema["properties/engine"].set(string_schema()); + bpfile_schema["properties/engine/constraints/const"] = "BPFile"; + param_schema["oneOf"].append().set(bpfile_schema); - std::string fileName = params["filename"].as_string(); - if (engineType == "SST" && fileName.find("/") != std::string::npos ) - { - info["errors"].append() = "filename with directory not supported for SST engine"; - res = false; - } + conduit::Node sst_schema; + sst_schema["type"] = "object"; + sst_schema["properties/engine"].set(string_schema()); + sst_schema["properties/engine/constraints/const"] = "SST"; + + conduit::Node fname = string_schema(); + fname["pattern"] = "^[^/]*$"; + sst_schema["properties/filename"].set(fname); - return res; + param_schema["oneOf"].append().set(sst_schema); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.hpp index 3f74c5ab1..d3905a660 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.hpp @@ -52,8 +52,6 @@ class ADIOS2 : public ::flow::Filter ~ADIOS2(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); private: diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp index bab0686ba..e128d3418 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp @@ -78,57 +78,20 @@ Command::declare_interface(Node &i) i["type_name"] = "command"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} - -//----------------------------------------------------------------------------- -bool -Command::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool has_callback = params.has_path("callback"); - bool has_shell_command = params.has_path("shell_command"); - - bool res = false; - if (!has_callback && !has_shell_command) - { - info["errors"].append() = "There was no callback or shell command defined"; - } - else if (has_callback && has_shell_command) - { - info["errors"].append() = "Both a callback and shell command are " - "present. Choose one or the other."; - } - else if(has_callback && !params["callback"].dtype().is_string()) - { - info["errors"].append() = "Callbacks must be a string"; - } - else if(has_shell_command && !params["shell_command"].dtype().is_string()) - { - info["errors"].append() = "Shell commands must be a string"; - } - else - { - res = true; - } - - std::vector valid_paths; - valid_paths.push_back("callback"); - valid_paths.push_back("shell_command"); - valid_paths.push_back("mpi_behavior"); - - std::vector ignore_paths; - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if (surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + param_schema["constraints/exclusiveChildren"].append() = "callback"; + param_schema["constraints/exclusiveChildren"].append() = "shell_command"; + param_schema["constraints/allowNoneInExclusiveGroup"] = false; + + param_schema["properties/callback"].set(string_schema()); + param_schema["properties/shell_command"].set(string_schema()); + param_schema["properties/mpi_behavior"].set(string_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.hpp index 66e61b842..b4bd61927 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.hpp @@ -48,8 +48,6 @@ class ASCENT_API Command : public ::flow::Filter Command(); ~Command(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); void static execute_command_list(const std::vector commands, diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.cpp index 8a54e210d..60d72dedc 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.cpp @@ -235,18 +235,6 @@ Learn::declare_interface(Node &i) i["output_port"] = "false"; } - -//----------------------------------------------------------------------------- -bool -Learn::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - // TODO: Anything goes right now :-) - bool res = true; - return res; -} - //----------------------------------------------------------------------------- void Learn::execute() diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.hpp index f73ccdb73..1df89f2c4 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_genten_filters.hpp @@ -52,8 +52,6 @@ class ASCENT_API Learn : public ::flow::Filter ~Learn(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp index 88f9b30f3..c5f48f16d 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp @@ -29,6 +29,7 @@ //----------------------------------------------------------------------------- #include #include +#include #include #include @@ -76,32 +77,21 @@ HolaMPIExtract::declare_interface(Node &i) i["type_name"] = "hola_mpi"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -HolaMPIExtract::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(! params.has_child("mpi_comm") || - ! params["mpi_comm"].dtype().is_integer() ) - { - info["errors"].append() = "Missing required integer parameter 'mpi_comm'"; - } + param_schema["properties/mpi_comm"].set(integer_schema()); + param_schema["properties/rank_split"].set(integer_schema()); - if(! params.has_child("rank_split") || - ! params["rank_split"].dtype().is_integer() ) - { - info["errors"].append() = "Missing required integer parameter 'rank_split'"; - } - - return res; + param_schema["required"].append() = "mpi_comm"; + param_schema["required"].append() = "rank_split"; + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void HolaMPIExtract::execute() diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.hpp index 8129bd0a9..dc6410bcd 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.hpp @@ -51,8 +51,6 @@ class ASCENT_API HolaMPIExtract: public ::flow::Filter ~HolaMPIExtract(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp index 5f9e56804..95244097b 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp @@ -75,58 +75,6 @@ namespace detail //----------------------------------------------------------------------------- // helper used by io save -//----------------------------------------------------------------------------- -bool -verify_htg_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - bool res = true; - - if( !params.has_child("path") ) - { - info["errors"].append() = "missing required entry 'path'"; - res = false; - } - else if(!params["path"].dtype().is_string()) - { - info["errors"].append() = "'path' must be a string"; - res = false; - } - else if(params["path"].as_string().empty()) - { - info["errors"].append() = "'path' is an empty string"; - res = false; - } - - if( !params.has_child("blank_value") ) - { - info["errors"].append() = "missing required entry 'blank_value'"; - res = false; - } - else if(!params["blank_value"].dtype().is_number()) - { - info["errors"].append() = "'blank_value' must be a number"; - res = false; - } - - std::vector valid_paths; - std::vector ignore_paths; - valid_paths.push_back("path"); - valid_paths.push_back("fields"); - valid_paths.push_back("blank_value"); - ignore_paths.push_back("fields"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(surprises != "") - { - info["errors"].append() = surprises; - res = false; - } - - return res; -} - //----------------------------------------------------------------------------- float htg_create(const float *var_in, float *var_out, @@ -659,14 +607,20 @@ HTGIOSave::declare_interface(Node &i) i["type_name"] = "htg_io_save"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -HTGIOSave::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - return verify_htg_params(params,info); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/path"].set(string_schema(1)); + param_schema["properties/blank_value"].set(number_schema()); + param_schema["properties/fields"].set(ignore_schema()); + + param_schema["required"].append() = "path"; + param_schema["required"].append() = "blank_value"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.hpp index 988de1292..f60b4efc6 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.hpp @@ -51,8 +51,6 @@ class ASCENT_API HTGIOSave : public ::flow::Filter ~HTGIOSave(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; From c1883019be31cc0b0c324bd1a62982bd6cbce9d6 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 14:09:50 -0700 Subject: [PATCH 22/50] Converting more filters to new schema - tested --- .../ascent_runtime_query_filters.cpp | 48 ++++---- .../ascent_runtime_query_filters.hpp | 4 - .../ascent_runtime_steering_filters.cpp | 25 ++--- .../ascent_runtime_steering_filters.hpp | 2 - .../ascent_runtime_trigger_filters.cpp | 103 +++++------------- .../ascent_runtime_trigger_filters.hpp | 2 - 6 files changed, 52 insertions(+), 132 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp index 223162a25..1bbc03e05 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp @@ -81,25 +81,21 @@ BasicQuery::declare_interface(Node &i) // adding an output port to chain queries together // so they execute in order of declaration i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -BasicQuery::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("expression",params, info, true); - res &= check_string("name",params, info, true); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::vector valid_paths; - valid_paths.push_back("expression"); - valid_paths.push_back("name"); + param_schema["properties/expression"].set(string_schema()); + param_schema["properties/name"].set(string_schema()); - return res; + param_schema["required"].append() = "expression"; + param_schema["required"].append() = "name"; + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void BasicQuery::execute() @@ -152,25 +148,21 @@ FilterQuery::declare_interface(Node &i) i["type_name"] = "expression"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -FilterQuery::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("expression",params, info, true); - res &= check_string("name",params, info, true); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::vector valid_paths; - valid_paths.push_back("expression"); - valid_paths.push_back("name"); + param_schema["properties/expression"].set(string_schema()); + param_schema["properties/name"].set(string_schema()); - return res; + param_schema["required"].append() = "expression"; + param_schema["required"].append() = "name"; + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void FilterQuery::execute() diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.hpp index eed65ad10..dcdbfec40 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.hpp @@ -51,8 +51,6 @@ class ASCENT_API BasicQuery : public ::flow::Filter ~BasicQuery(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -63,8 +61,6 @@ class ASCENT_API FilterQuery : public ::flow::Filter ~FilterQuery(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp index 5abbd16d2..76638d9cd 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp @@ -73,25 +73,14 @@ Steering::declare_interface(Node &i) i["type_name"] = "steering"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -Steering::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - bool res = true; - // This optional parameter exists for automated testing purposes - if(params.has_child("explicit_command")) - { - if(!params["explicit_command"].dtype().is_string()) - { - info["errors"].append() = "optional entry 'explicit_command' must" - " be a string"; - res = false; - } - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + + param_schema["properties/explicit_command"].set(string_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.hpp index 518856674..a08de3269 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.hpp @@ -55,8 +55,6 @@ class ASCENT_API Steering : public ::flow::Filter Steering(); ~Steering(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); private: std::map> m_commands; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp index 850aabd29..48e9779c1 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp @@ -85,87 +85,34 @@ BasicTrigger::declare_interface(Node &i) i["type_name"] = "basic_trigger"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -BasicTrigger::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("condition",params, info, false); - res &= check_string("callback",params, info, false); - res &= check_string("actions_file",params, info, false); - res &= check_list("actions_files",params, info, false); - res &= check_list("actions",params, info, false); - - bool has_condition = params.has_child("condition"); - bool has_callback = params.has_child("callback"); - bool has_actions = params.has_child("actions"); - bool has_actions_file = params.has_child("actions_file"); - bool has_actions_files = params.has_child("actions_files"); - - if( has_condition && has_callback ) - { - res = false; - info["errors"].append() = "Both `condition` and `callback` are " - "present. Choose one or the other."; - } - - if( ! (has_condition || has_callback) ) - { - res = false; - info["errors"].append() = "No `condition` or `callback` provided. " - "Choose please provide trigger `condition`" - " or `callback`"; - } - - if( has_actions_file && has_actions_files ) - { - res = false; - info["errors"].append() = "Both `actions_file` and `actions_files` are " - "present. Choose one or the other."; - } - - if(has_actions && (has_actions_file || has_actions_files)) - { - res = false; - info["errors"].append() = "Both `actions` and `actions_file(s)` are " - "present. Choose one or the other."; - } - - if(!has_actions && !(has_actions_file || has_actions_files)) - { - res = false; - info["errors"].append() = "No trigger actions provided. Please " - "specify either 'actions_file(s)' or " - "'actions'."; - } - - std::vector valid_paths; - valid_paths.push_back("condition"); - valid_paths.push_back("callback"); - valid_paths.push_back("actions_file"); - valid_paths.push_back("actions_files"); - valid_paths.push_back("actions"); - - std::vector ignore_paths; - // don't go down the actions or actions_files path - ignore_paths.push_back("actions"); - ignore_paths.push_back("actions_files"); - - std::string surprises = surprise_check(valid_paths, ignore_paths,params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/condition"].set(string_schema()); + param_schema["properties/callback"].set(string_schema()); + param_schema["properties/actions_file"].set(string_schema()); + param_schema["properties/actions_files"].set(array_schema(string_schema())); + param_schema["properties/actions"].set(array_schema(ignore_schema())); + + conduit::Node trigger_schema; + trigger_schema["constraints/exclusiveChildren"].append() = "condition"; + trigger_schema["constraints/exclusiveChildren"].append() = "callback"; + trigger_schema["constraints/allowNoneInExclusiveGroup"] = false; + param_schema["allOf"].append().set(trigger_schema); + + conduit::Node action_schema; + action_schema["constraints/exclusiveChildren"].append() = "actions_file"; + action_schema["constraints/exclusiveChildren"].append() = "actions_files"; + action_schema["constraints/exclusiveChildren"].append() = "actions"; + action_schema["constraints/allowNoneInExclusiveGroup"] = false; + param_schema["allOf"].append().set(action_schema); + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void BasicTrigger::execute() diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.hpp index bb5a1538b..dcb14c1d9 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.hpp @@ -51,8 +51,6 @@ class ASCENT_API BasicTrigger : public ::flow::Filter ~BasicTrigger(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; From 70a82c88015a0fb6abd4b7bd786164eb99d872bd Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 14:12:24 -0700 Subject: [PATCH 23/50] rover filter schemas --- .../ascent_runtime_rover_filters.cpp | 442 +++--------------- .../ascent_runtime_rover_filters.hpp | 4 - 2 files changed, 69 insertions(+), 377 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp index 302786877..3552fc632 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp @@ -97,346 +97,65 @@ RoverXRay::declare_interface(Node &i) i["type_name"] = "xray"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} - -//----------------------------------------------------------------------------- -bool -RoverXRay::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - // TODO: We want to be more rigorous about param checking at some point, so - // that rover can safely assume its inputs are valid - info.reset(); - - // Early return if none of the rover params were passed - if (!params.has_child("rover")) - { - info["errors"].append() = "Missing required string parameters: 'rover/absorption', 'rover/filename'"; - return false; - } - - const conduit::Node &n_rover = params["rover"]; - bool res = true; - - // - // Required rover parameters - // - - if (!n_rover.has_child("absorption")) - { - info["errors"].append() = "Missing required string parameter 'rover/absorption'"; - res = false; - } - else if (!n_rover["absorption"].dtype().is_string()) - { - info["errors"].append() = "Expected string parameter 'rover/absorption' is not a string"; - res = false; - } - else // (n_rover.has_child("absorption") && n_rover["absorption"].dtype().is_string()) - { - const std::string absorption = n_rover["absorption"].as_string(); - if (absorption.empty()) - { - info["errors"].append() = "Expected string parameter 'rover/absorption' cannot be an empty string"; - res = false; - } - } - - // This can either be a "filename" or a "/path/to/filename" - if (!n_rover.has_child("filename")) - { - info["errors"].append() = "Missing required string parameter 'rover/filename'"; - res = false; - } - else if (!n_rover["filename"].dtype().is_string()) - { - info["errors"].append() = "Expected string parameter 'rover/filename' is not a string"; - res = false; - } - else // (n_rover.has_child("filename") && n_rover["filename"].dtype().is_string()) - { - const std::string filename = n_rover["filename"].as_string(); - if (filename.empty()) - { - info["errors"].append() = "Expected string parameter 'rover/filename' cannot be an empty string"; - res = false; - } - } - - // - // Optional rover parameters - // - - if (n_rover.has_child("background_intensity")) - { - if (!n_rover["background_intensity"].dtype().is_number()) - { - info["errors"].append() = "Optional numeric parameter 'rover/background_intensity' is not numeric"; - res = false; - } - else // (n_rover["background_intensity"].dtype().is_number()) - { - const float64 background_intensity = n_rover["background_intensity"].to_float64(); - if (background_intensity < 0) - { - info["errors"].append() = "Optional numeric parameter 'rover/unit_scalar' must be positive"; - res = false; - } - } - } - - if (n_rover.has_child("divide_emis_by_absorb")) - { - if (!n_rover["divide_emis_by_absorb"].dtype().is_string()) - { - info["errors"].append() = "Optional bool string parameter 'rover/divide_emis_by_absorb' is not a string"; - res = false; - } - else // (n_rover["divide_emis_by_absorb"].dtype().is_string()) - { - const std::string divide_emis_by_absorb = n_rover["divide_emis_by_absorb"].as_string(); - if ("true" != divide_emis_by_absorb && "false" != divide_emis_by_absorb) - { - info["errors"].append() = "Optional bool string parameter 'rover/divide_emis_by_absorb' must be 'true' or 'false'"; - res = false; - } - } - } - - if (n_rover.has_child("emission")) - { - if (!n_rover["emission"].dtype().is_string()) - { - info["errors"].append() = "Optional string parameter 'rover/emission' is not a string"; - res = false; - } - else // (n_rover["emission"].dtype().is_string()) - { - const std::string emission = n_rover["emission"].as_string(); - if (emission.empty()) - { - info["errors"].append() = "Optional string parameter 'rover/emission' cannot be an empty string"; - res = false; - } - } - } - - if (n_rover.has_child("enable_rays_mesh")) - { - if (!n_rover["enable_rays_mesh"].dtype().is_string()) - { - info["errors"].append() = "Optional bool string parameter 'rover/enable_rays_mesh' is not a string"; - res = false; - } - else // (n_rover["enable_rays_mesh"].dtype().is_string()) - { - const std::string enable_rays_mesh = n_rover["enable_rays_mesh"].as_string(); - if ("true" != enable_rays_mesh && "false" != enable_rays_mesh) - { - info["errors"].append() = "Optional bool string parameter 'rover/enable_rays_mesh' must be 'true' or 'false'"; - res = false; - } - } - } - - const bool has_height = n_rover.has_child("height"); - if (has_height) - { - if (!n_rover["height"].dtype().is_integer()) - { - info["errors"].append() = "Optional integer parameter 'rover/height' is not an integer"; - res = false; - } - else // (n_rover["height"].dtype().is_integer()) - { - const int64 height = n_rover["height"].to_int64(); - if (height <= 0) - { - info["errors"].append() = "Optional integer parameter 'rover/height' must be greater than 0"; - res = false; - } - } - } - - if (n_rover.has_child("output_type")) - { - if (!n_rover["output_type"].dtype().is_string()) - { - info["errors"].append() = "Optional string parameter 'rover/output_type' is not a string"; - res = false; - } - else // (n_rover["output_type"].dtype().is_string()) - { - const std::string output_type = n_rover["output_type"].as_string(); - const std::string valid_types[] = {"hdf5", "yaml", "json", "png", "bov"}; - - if (std::find(std::begin(valid_types), std::end(valid_types), output_type) == std::end(valid_types)) - { - info["errors"].append() = "Optional string parameter 'rover/output_type' must be 'hdf5' or 'yaml' or 'json' or 'png' or 'bov'"; - res = false; - } - } - } - if (n_rover.has_child("precision")) - { - if (!n_rover["precision"].dtype().is_string()) - { - info["errors"].append() = "Optional string parameter 'rover/precision' is not a string"; - res = false; - } - else // (n_rover["precision"].dtype().is_string()) - { - const std::string precision = n_rover["precision"].as_string(); - if ("single" != precision && "double" != precision) - { - info["errors"].append() = "Optional string parameter 'rover/precision' must be 'single' or 'double'"; - res = false; - } - } - } - - const bool has_width = n_rover.has_child("width"); - if (has_width) - { - if (!n_rover["width"].dtype().is_integer()) - { - info["errors"].append() = "Optional integer parameter 'rover/width' is not an integer"; - res = false; - } - else // (n_rover["width"].dtype().is_integer()) - { - const int64 width = n_rover["width"].to_int64(); - if (width <= 0) - { - info["errors"].append() = "Optional integer parameter 'rover/width' must be greater than 0"; - res = false; - } - } - } - - // If either 'rover/width' or 'rover/height' are set, they must both be set - if (has_width && !has_height) - { - info["errors"].append() = "Optional integer parameter 'rover/width' requires 'rover/height' to also be set"; - res = false; - } - else if (!has_width && has_height) - { - info["errors"].append() = "Optional integer parameter 'rover/height' requires 'rover/width' to also be set"; - res = false; - } - - if (n_rover.has_child("unit_scalar")) - { - if (!n_rover["unit_scalar"].dtype().is_number()) - { - info["errors"].append() = "Optional numeric parameter 'rover/unit_scalar' is not numeric"; - res = false; - } - else // (n_rover["unit_scalar"].dtype().is_number() - { - const float64 unit_scalar = n_rover["unit_scalar"].to_float64(); - if (unit_scalar <= 0) - { - info["errors"].append() = "Optional numeric parameter 'rover/unit_scalar' must be greater than 0"; - res = false; - } - } - } - - // - // Optional image parameters - // - - if (params.has_child("image_params")) - { - // If any 'image_params' parameters are set, they must all be set - const conduit::Node &n_image = params["image_params"]; - - if (!n_image.has_child("log_scale")) - { - info["errors"].append() = "Missing bool string parameter 'image_params/log_scale'"; - res = false; - } - else if (!n_image["log_scale"].dtype().is_string()) - { - info["errors"].append() = "Optional bool string parameter 'image_params/log_scale' is not a string"; - res = false; - } - else // (n_image.has_child("log_scale") && n_image["log_scale"].dtype().is_string()) - { - const std::string log_scale = n_image["log_scale"].as_string(); - if ("true" != log_scale && "false" != log_scale) - { - info["errors"].append() = "Optional bool string parameter 'image_params/log_scale' must be 'true' or 'false'"; - res = false; - } - } - - if (!n_image.has_child("min_value")) - { - info["errors"].append() = "Missing numeric parameter 'image_params/min_value'"; - res = false; - } - else if (!n_image["min_value"].dtype().is_number()) - { - info["errors"].append() = "Expected numeric parameter 'image_params/min_value' is not numeric"; - res = false; - } - - if (!n_image.has_child("max_value")) - { - info["errors"].append() = "Missing numeric parameter 'image_params/max_value'"; - res = false; - } - else if (!n_image["max_value"].dtype().is_number()) - { - info["errors"].append() = "Expected numeric parameter 'image_params/max_value' is not numeric"; - res = false; - } - } - - // - // Surprise check - // - - const std::vector valid_paths = { - "camera/azimuth", - "camera/elevation", - "camera/far_plane", - "camera/fov", - "camera/look_at", - "camera/near_plane", - "camera/position", - "camera/up", - "camera/xpan", - "camera/ypan", - "camera/zoom", - "image_params/log_scale", - "image_params/max_value", - "image_params/min_value", - "rover/absorption", - "rover/background_intensity", - "rover/divide_emis_by_absorb", - "rover/emission", - "rover/enable_rays_mesh", - "rover/filename", - "rover/height", - "rover/output_type", - "rover/precision", - "rover/width", - "rover/unit_scalar" - }; - - const std::string surprises = surprise_check(valid_paths, params); - if (!surprises.empty()) - { - info["errors"].append() = surprises; - res = false; - } - - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/condition"].set(string_schema()); + param_schema["properties/callback"].set(string_schema()); + param_schema["properties/actions_file"].set(string_schema()); + param_schema["properties/actions_files"].set(array_schema(ignore_schema())); + param_schema["properties/actions"].set(array_schema(ignore_schema())); + + // --- Rover --- + conduit::Node rover_schema; + rover_schema["properties/absorption"].set(string_schema(1)); + rover_schema["properties/filename"].set(string_schema(1)); + rover_schema["properties/background_intensity"].set(number_schema(false, 0)); + rover_schema["properties/divide_emis_by_absorb"].set(bool_schema()); + rover_schema["properties/emission"].set(string_schema(1)); + rover_schema["properties/enable_rays_mesh"].set(bool_schema()); + rover_schema["properties/height"].set(integer_schema(false, std::nullopt, std::nullopt, 0)); + rover_schema["properties/width"].set(integer_schema(false, std::nullopt, std::nullopt, 0)); + rover_schema["properties/output_type"].set(string_enum_schema({"hdf5", "yaml", "json", "png", "bov"})); + rover_schema["properties/precision"].set(string_enum_schema({"single", "double"})); + rover_schema["properties/unit_scalar"].set(number_schema(false, std::nullopt, std::nullopt, 0)); + + rover_schema["constraints/dependencies/height"].append() = "width"; + rover_schema["constraints/dependencies/width"].append() = "height"; + + rover_schema["required"].append() = "absorption"; + rover_schema["required"].append() = "filename"; + + param_schema["properties/rover"].set(rover_schema); + + // --- Image --- + conduit::Node image_schema; + image_schema["properties/log_scale"].set(bool_schema()); + image_schema["properties/min_value"].set(number_schema()); + image_schema["properties/max_value"].set(number_schema()); + param_schema["properties/image_params"].set(image_schema); + + // --- Camera --- + conduit::Node camera_schema; + camera_schema["properties/azimuth"].set(ignore_schema()); + camera_schema["properties/elevation"].set(ignore_schema()); + camera_schema["properties/far_plane"].set(ignore_schema()); + camera_schema["properties/near_plane"].set(ignore_schema()); + camera_schema["properties/fov"].set(ignore_schema()); + camera_schema["properties/look_at"].set(ignore_schema()); + camera_schema["properties/position"].set(ignore_schema()); + camera_schema["properties/up"].set(ignore_schema()); + camera_schema["properties/xpan"].set(ignore_schema()); + camera_schema["properties/ypan"].set(ignore_schema()); + camera_schema["properties/zoom"].set(ignore_schema()); + param_schema["properties/camera"].set(camera_schema); + + param_schema["required"].append() = "rover"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -587,43 +306,20 @@ RoverVolume::declare_interface(Node &i) i["type_name"] = "rover_volume"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -RoverVolume::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - if(! params.has_child("field") || - ! params["field"].dtype().is_string() ) - { - info["errors"].append() = "Missing required string parameter 'field'"; - res = false; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if(! params.has_child("filename") || - ! params["filename"].dtype().is_string() ) - { - info["errors"].append() = "Missing required string parameter 'filename'"; - res = false; - } - - if( params.has_child("precision") && - ! params["precision"].dtype().is_string() ) - { - info["errors"].append() = "Optional parameter 'precision' must be a string"; - std::string prec = params["precision"].as_string(); - if(prec != "single" || prec != "double") - { - info["errors"].append() = "Parameter 'precision' must be 'single' or 'double'"; - } - res = false; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/filename"].set(string_schema()); + param_schema["properties/precision"].set(string_enum_schema({"single", "double"})); - return res; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "filename"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.hpp index 86a543094..54bc1612e 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.hpp @@ -50,8 +50,6 @@ class ASCENT_API RoverXRay: public ::flow::Filter virtual ~RoverXRay(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -63,8 +61,6 @@ class ASCENT_API RoverVolume : public ::flow::Filter virtual ~RoverVolume(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; #endif From 35f372514e414a1a6a38558f9dbf87ab22c6dd29 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 15:26:23 -0700 Subject: [PATCH 24/50] Adding dray filter schemas --- .../ascent_runtime_dray_filters.cpp | 685 ++++++++---------- .../ascent_runtime_dray_filters.hpp | 14 - src/libs/flow/flow_schema_validator.cpp | 2 +- 3 files changed, 285 insertions(+), 416 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp index 0f0b44504..0d7b7ab13 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp @@ -155,71 +155,55 @@ dray::Collection boundary(dray::Collection &collection) return bounder.execute(collection); } -std::string -dray_color_table_surprises(const conduit::Node &color_table) -{ - std::string surprises; - - std::vector valid_paths; - valid_paths.push_back("name"); - valid_paths.push_back("reverse"); - - std::vector ignore_paths; - ignore_paths.push_back("control_points"); - - surprises += surprise_check(valid_paths, ignore_paths, color_table); - if(color_table.has_path("control_points")) - { - const Node &control_points_node = color_table.fetch("control_points"); - - if (control_points_node.dtype().is_list()) - { - std::vector c_valid_paths; - c_valid_paths.push_back("type"); - c_valid_paths.push_back("alpha"); - c_valid_paths.push_back("color"); - c_valid_paths.push_back("position"); - - const conduit::Node &control_points = color_table["control_points"]; - const int num_points = control_points.number_of_children(); - for(int i = 0; i < num_points; ++i) - { - const conduit::Node &point = control_points.child(i); - surprises += surprise_check(c_valid_paths, point); - } - } - else if (control_points_node.dtype().is_object()) - { - // Valid path options for the compressed control points input format - std::vector c_valid_paths; - c_valid_paths.push_back("r"); - c_valid_paths.push_back("g"); - c_valid_paths.push_back("b"); - c_valid_paths.push_back("a"); - c_valid_paths.push_back("position"); - - - surprises += surprise_check(c_valid_paths, control_points_node); +void dray_color_table_schema(conduit::Node ¶m_schema) { + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/name"].set(string_schema()); + param_schema["properties/reverse"].set(bool_schema()); + + // --- Control Points --- + { + conduit::Node cp_compressed_schema; + cp_compressed_schema["type"] = "object"; + cp_compressed_schema["additionalProperties"] = false; + cp_compressed_schema["properties/r"].set(ignore_schema()); + cp_compressed_schema["properties/g"].set(ignore_schema()); + cp_compressed_schema["properties/b"].set(ignore_schema()); + cp_compressed_schema["properties/a"].set(ignore_schema()); + cp_compressed_schema["properties/position"].set(ignore_schema()); + cp_compressed_schema["constraints/forbid"].append() = "type"; + cp_compressed_schema["constraints/forbid"].append() = "alpha"; + cp_compressed_schema["constraints/forbid"].append() = "color"; + + conduit::Node cp_list_item_schema; + cp_list_item_schema["type"] = "object"; + cp_list_item_schema["additionalProperties"] = false; + cp_list_item_schema["properties/type"].set(ignore_schema()); + cp_list_item_schema["properties/alpha"].set(ignore_schema()); + cp_list_item_schema["properties/color"].set(ignore_schema()); + cp_list_item_schema["properties/position"].set(ignore_schema()); + cp_list_item_schema["constraints/forbid"].append() = "r"; + cp_list_item_schema["constraints/forbid"].append() = "g"; + cp_list_item_schema["constraints/forbid"].append() = "b"; + cp_list_item_schema["constraints/forbid"].append() = "a"; + + conduit::Node control_points_schema; + control_points_schema["type"] = "object"; + control_points_schema["oneOf"].append().set(cp_compressed_schema); + control_points_schema["oneOf"].append().set(array_schema(cp_list_item_schema)); + param_schema["properties/control_points"].set(control_points_schema); } - } - - return surprises; } -std::string -dray_load_balance_surprises(const conduit::Node &load_balance) -{ - std::string surprises; - - std::vector valid_paths; - valid_paths.push_back("enabled"); - valid_paths.push_back("factor"); - valid_paths.push_back("threshold"); - valid_paths.push_back("use_prefix"); +void dray_load_balance_schema(conduit::Node ¶m_schema) { + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - surprises += surprise_check(valid_paths, load_balance); - - return surprises; + param_schema["properties/enabled"].set(bool_schema()); + param_schema["properties/factor"].set(number_schema()); + param_schema["properties/threshold"].set(number_schema()); + param_schema["properties/use_prefix"].set(bool_schema()); } dray::Vec @@ -1079,30 +1063,6 @@ class DrayCinemaDatabases std::map DrayCinemaDatabases::m_databases; - - -bool check_image_names(const conduit::Node ¶ms, conduit::Node &info) -{ - bool res = true; - if(!params.has_path("image_prefix") && - !params.has_path("camera/db_name")) - { - res = false; - info.append() = "Devil ray rendering paths must include either " - "a 'image_prefix' (if its a single image) or a " - "'camera/db_name' (if using a cinema camere)"; - } - if(params.has_path("image_prefix") && - params.has_path("camera/db_name")) - { - res = false; - info.append() = "Devil ray rendering paths cannot use both " - "a 'image_prefix' (if its a single image) and a " - "'camera/db_name' (if using a cinema camere)"; - } - return res; -} - void parse_params(const conduit::Node ¶ms, dray::Collection *dcol, @@ -1268,62 +1228,59 @@ DRayPseudocolor::declare_interface(Node &i) i["type_name"] = "dray_pseudocolor"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} - -//----------------------------------------------------------------------------- -bool -DRayPseudocolor::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - - res &= check_string("field",params, info, true); - res &= detail::check_image_names(params, info); - res &= check_numeric("min_value",params, info, false); - res &= check_numeric("max_value",params, info, false); - res &= check_numeric("image_width",params, info, false); - res &= check_numeric("image_height",params, info, false); - res &= check_string("log_scale",params, info, false); - res &= check_string("annotations",params, info, false); - - std::vector valid_paths; - std::vector ignore_paths; - - valid_paths.push_back("field"); - valid_paths.push_back("image_prefix"); - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); - valid_paths.push_back("image_width"); - valid_paths.push_back("image_height"); - valid_paths.push_back("log_scale"); - valid_paths.push_back("annotations"); - - // filter knobs - valid_paths.push_back("draw_mesh"); - valid_paths.push_back("line_thickness"); - valid_paths.push_back("line_color"); - res &= check_numeric("line_color",params, info, false); - res &= check_numeric("line_thickness",params, info, false); - res &= check_string("draw_mesh",params, info, false); - - ignore_paths.push_back("camera"); - ignore_paths.push_back("color_table"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(params.has_path("color_table")) - { - surprises += detail::dray_color_table_surprises(params["color_table"]); - } - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/field"].set(string_schema()); + param_schema["properties/image_prefix"].set(string_schema()); + param_schema["properties/min_value"].set(number_schema()); + param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/image_width"].set(number_schema()); + param_schema["properties/image_height"].set(number_schema()); + param_schema["properties/log_scale"].set(string_schema()); + param_schema["properties/annotations"].set(string_schema()); + param_schema["properties/draw_mesh"].set(string_schema()); + param_schema["properties/line_thickness"].set(number_schema()); + param_schema["properties/line_color"].set(number_schema()); + param_schema["properties/camera"].set(ignore_schema()); + + conduit::Node color_table_schema; + detail::dray_color_table_schema(color_table_schema); + param_schema["properties/color_table"].set(color_table_schema); + + param_schema["required"].append() = "field"; + + // --- check image name --- + { + conduit::Node db_name_schema; + db_name_schema["type"] = "object"; + db_name_schema["required"].append() = "camera"; + db_name_schema["constraints/forbid"].append() = "image_prefix"; + + conduit::Node camera_schema_1; + camera_schema_1["type"] = "object"; + camera_schema_1["required"].append() = "db_name"; + db_name_schema["properties/camera"].append().set(camera_schema_1); + + param_schema["oneOf"].append().set(db_name_schema); + } + { + conduit::Node image_prefix_schema; + image_prefix_schema["type"] = "object"; + image_prefix_schema["required"].append() = "image_prefix"; + + conduit::Node camera_schema_2; + camera_schema_2["type"] = "object"; + camera_schema_2["constraints/forbid"].append() = "db_name"; + image_prefix_schema["properties/camera"].append().set(camera_schema_2); + + param_schema["oneOf"].append().set(image_prefix_schema); + } + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1453,72 +1410,69 @@ DRay3Slice::declare_interface(Node &i) i["type_name"] = "dray_3slice"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} - -//----------------------------------------------------------------------------- -bool -DRay3Slice::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - res &= check_string("field",params, info, true); - res &= detail::check_image_names(params, info); - res &= check_numeric("min_value",params, info, false); - res &= check_numeric("max_value",params, info, false); - res &= check_numeric("image_width",params, info, false); - res &= check_numeric("image_height",params, info, false); - res &= check_string("log_scale",params, info, false); - res &= check_string("annotations",params, info, false); - - std::vector valid_paths; - std::vector ignore_paths; - - valid_paths.push_back("field"); - valid_paths.push_back("image_prefix"); - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); - valid_paths.push_back("annotations"); - valid_paths.push_back("image_width"); - valid_paths.push_back("image_height"); - valid_paths.push_back("log_scale"); - - // filter knobs - res &= check_numeric("x_offset",params, info, false); - res &= check_numeric("y_offset",params, info, false); - res &= check_numeric("z_offset",params, info, false); - - res &= check_numeric("sweep/count",params, info, false); - res &= check_string("sweep/axis",params, info, false); - - valid_paths.push_back("x_offset"); - valid_paths.push_back("y_offset"); - valid_paths.push_back("z_offset"); - - valid_paths.push_back("sweep/count"); - valid_paths.push_back("sweep/axis"); - - ignore_paths.push_back("camera"); - ignore_paths.push_back("color_table"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(params.has_path("color_table")) - { - surprises += detail::dray_color_table_surprises(params["color_table"]); - } - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/field"].set(string_schema()); + param_schema["properties/image_prefix"].set(string_schema()); + param_schema["properties/min_value"].set(number_schema()); + param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/image_width"].set(number_schema()); + param_schema["properties/image_height"].set(number_schema()); + param_schema["properties/log_scale"].set(string_schema()); + param_schema["properties/annotations"].set(string_schema()); + param_schema["properties/x_offset"].set(number_schema()); + param_schema["properties/y_offset"].set(number_schema()); + param_schema["properties/z_offset"].set(number_schema()); + param_schema["properties/camera"].set(ignore_schema()); + + conduit::Node color_table_schema; + detail::dray_color_table_schema(color_table_schema); + param_schema["properties/color_table"].set(color_table_schema); + + // --- sweep --- + conduit::Node sweep_schema; + sweep_schema["type"] = "object"; + sweep_schema["additionalProperties"] = false; + sweep_schema["properties/count"].set(number_schema()); + sweep_schema["properties/axis"].set(string_schema()); + param_schema["properties/sweep"].set(sweep_schema); + + param_schema["required"].append() = "field"; + + // --- check image name --- + { + conduit::Node db_name_schema; + db_name_schema["type"] = "object"; + db_name_schema["required"].append() = "camera"; + db_name_schema["constraints/forbid"].append() = "image_prefix"; + + conduit::Node camera_schema_1; + camera_schema_1["type"] = "object"; + camera_schema_1["required"].append() = "db_name"; + db_name_schema["properties/camera"].append().set(camera_schema_1); + + param_schema["oneOf"].append().set(db_name_schema); + } + { + conduit::Node image_prefix_schema; + image_prefix_schema["type"] = "object"; + image_prefix_schema["required"].append() = "image_prefix"; + + conduit::Node camera_schema_2; + camera_schema_2["type"] = "object"; + camera_schema_2["constraints/forbid"].append() = "db_name"; + image_prefix_schema["properties/camera"].append().set(camera_schema_2); + + param_schema["oneOf"].append().set(image_prefix_schema); + } + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void DRay3Slice::execute() @@ -1848,67 +1802,62 @@ DRayVolume::declare_interface(Node &i) i["type_name"] = "dray_volume"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -DRayVolume::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res &= check_string("field",params, info, true); - res &= detail::check_image_names(params, info); - res &= check_numeric("min_value",params, info, false); - res &= check_numeric("max_value",params, info, false); - res &= check_numeric("image_width",params, info, false); - res &= check_numeric("image_height",params, info, false); - res &= check_string("log_scale",params, info, false); - res &= check_string("annotations",params, info, false); - - std::vector valid_paths; - std::vector ignore_paths; - - valid_paths.push_back("field"); - valid_paths.push_back("image_prefix"); - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); - valid_paths.push_back("image_width"); - valid_paths.push_back("image_height"); - valid_paths.push_back("log_scale"); - valid_paths.push_back("annotations"); - - // filter knobs - res &= check_numeric("samples",params, info, false); - res &= check_string("use_lighing",params, info, false); - - valid_paths.push_back("samples"); - valid_paths.push_back("use_lighting"); - - ignore_paths.push_back("camera"); - ignore_paths.push_back("color_table"); - ignore_paths.push_back("load_balancing"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(params.has_path("color_table")) - { - surprises += detail::dray_color_table_surprises(params["color_table"]); - } - - if(params.has_path("load_balancing")) - { - surprises += detail::dray_load_balance_surprises(params["load_balancing"]); - } - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/field"].set(string_schema()); + param_schema["properties/image_prefix"].set(string_schema()); + param_schema["properties/min_value"].set(number_schema()); + param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/image_width"].set(number_schema()); + param_schema["properties/image_height"].set(number_schema()); + param_schema["properties/log_scale"].set(string_schema()); + param_schema["properties/annotations"].set(string_schema()); + param_schema["properties/samples"].set(number_schema()); + param_schema["properties/use_lighing"].set(bool_schema()); + param_schema["properties/camera"].set(ignore_schema()); + + conduit::Node color_table_schema; + detail::dray_color_table_schema(color_table_schema); + param_schema["properties/color_table"].set(color_table_schema); + + conduit::Node load_balance_schema; + detail::dray_load_balance_schema(load_balance_schema); + param_schema["properties/load_balancing"].set(load_balance_schema); + + param_schema["required"].append() = "field"; + + // --- check image name --- + { + conduit::Node db_name_schema; + db_name_schema["type"] = "object"; + db_name_schema["required"].append() = "camera"; + db_name_schema["constraints/forbid"].append() = "image_prefix"; + + conduit::Node camera_schema_1; + camera_schema_1["type"] = "object"; + camera_schema_1["required"].append() = "db_name"; + db_name_schema["properties/camera"].append().set(camera_schema_1); + + param_schema["oneOf"].append().set(db_name_schema); + } + { + conduit::Node image_prefix_schema; + image_prefix_schema["type"] = "object"; + image_prefix_schema["required"].append() = "image_prefix"; + + conduit::Node camera_schema_2; + camera_schema_2["type"] = "object"; + camera_schema_2["constraints/forbid"].append() = "db_name"; + image_prefix_schema["properties/camera"].append().set(camera_schema_2); + + param_schema["oneOf"].append().set(image_prefix_schema); + } + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2062,43 +2011,35 @@ DRayReflect::declare_interface(Node &i) i["type_name"] = "dray_reflect"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -DRayReflect::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res &= check_numeric("point/x",params, info, true); - res &= check_numeric("point/y",params, info, true); - res &= check_numeric("point/z",params, info, false); - res &= check_numeric("normal/x",params, info, true); - res &= check_numeric("normal/y",params, info, true); - res &= check_numeric("normal/z",params, info, false); - - std::vector valid_paths; - std::vector ignore_paths; - valid_paths.push_back("point/x"); - valid_paths.push_back("point/y"); - valid_paths.push_back("point/z"); - valid_paths.push_back("normal/x"); - valid_paths.push_back("normal/y"); - valid_paths.push_back("normal/z"); - - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + // --- point --- + conduit::Node point_schema; + point_schema["type"] = "object"; + point_schema["additionalProperties"] = false; + point_schema["properties/x"].set(number_schema()); + point_schema["properties/y"].set(number_schema()); + point_schema["properties/z"].set(number_schema()); + point_schema["required"].append() = "x"; + point_schema["required"].append() = "y"; + param_schema["properties/point"].set(point_schema); + + // --- normal --- + conduit::Node normal_schema; + normal_schema["type"] = "object"; + normal_schema["additionalProperties"] = false; + normal_schema["properties/x"].set(number_schema()); + normal_schema["properties/y"].set(number_schema()); + normal_schema["properties/z"].set(number_schema()); + normal_schema["required"].append() = "x"; + normal_schema["required"].append() = "y"; + param_schema["properties/normal"].set(normal_schema); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2174,39 +2115,19 @@ DRayProject2d::declare_interface(Node &i) i["type_name"] = "dray_project_2d"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -DRayProject2d::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res &= check_numeric("image_width",params, info, false); - res &= check_numeric("image_height",params, info, false); - - std::vector valid_paths; - std::vector ignore_paths; - - valid_paths.push_back("image_width"); - valid_paths.push_back("image_height"); - valid_paths.push_back("fields"); - - ignore_paths.push_back("camera"); - ignore_paths.push_back("plane"); - ignore_paths.push_back("fields"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/fields"].set(ignore_schema()); + param_schema["properties/image_width"].set(number_schema()); + param_schema["properties/image_height"].set(number_schema()); + param_schema["properties/camera"].set(ignore_schema()); + param_schema["properties/plane"].set(ignore_schema()); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2362,53 +2283,27 @@ DRayProjectColors2d::declare_interface(Node &i) i["type_name"] = "dray_project_colors_2d"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -DRayProjectColors2d::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - - bool res = true; - - res &= check_numeric("image_width",params, info, false); - res &= check_numeric("image_height",params, info, false); - res &= check_string("field",params, info, true); - - res &= check_numeric("min_value",params, info, false); - res &= check_numeric("max_value",params, info, false); - res &= check_numeric("image_width",params, info, false); - res &= check_numeric("image_height",params, info, false); - res &= check_string("log_scale",params, info, false); - - std::vector valid_paths; - std::vector ignore_paths; - valid_paths.push_back("image_width"); - valid_paths.push_back("image_height"); - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); - valid_paths.push_back("log_scale"); - valid_paths.push_back("field"); - - ignore_paths.push_back("camera"); - ignore_paths.push_back("color_table"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(params.has_path("color_table")) - { - surprises += detail::dray_color_table_surprises(params["color_table"]); - } - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/field"].set(string_schema()); + param_schema["properties/min_value"].set(number_schema()); + param_schema["properties/max_value"].set(number_schema()); + param_schema["properties/image_width"].set(number_schema()); + param_schema["properties/image_height"].set(number_schema()); + param_schema["properties/log_scale"].set(string_schema()); + param_schema["properties/camera"].set(ignore_schema()); + + conduit::Node color_table_schema; + detail::dray_color_table_schema(color_table_schema); + param_schema["properties/color_table"].set(color_table_schema); + + param_schema["required"].append() = "field"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2505,33 +2400,21 @@ DRayVectorComponent::declare_interface(Node &i) i["type_name"] = "dray_vector_component"; i["port_names"].append() = "in"; i["output_port"] = "true"; -} - -//----------------------------------------------------------------------------- -bool -DRayVectorComponent::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("field",params, info, true); - res &= check_numeric("component",params, info, true); - res &= check_string("output_name",params, info, true); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::vector valid_paths; - valid_paths.push_back("field"); - valid_paths.push_back("component"); - valid_paths.push_back("output_name"); - - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } + param_schema["properties/field"].set(string_schema()); + param_schema["properties/component"].set(number_schema()); + param_schema["properties/output_name"].set(string_schema()); - return res; + param_schema["required"].append() = "field"; + param_schema["required"].append() = "component"; + param_schema["required"].append() = "output_name"; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.hpp index 316bf8aca..3c12c30cf 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.hpp @@ -50,8 +50,6 @@ class ASCENT_API DRayPseudocolor : public ::flow::Filter virtual ~DRayPseudocolor(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -63,8 +61,6 @@ class ASCENT_API DRay3Slice : public ::flow::Filter virtual ~DRay3Slice(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -76,8 +72,6 @@ class ASCENT_API DRayVolume : public ::flow::Filter virtual ~DRayVolume(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -88,8 +82,6 @@ class ASCENT_API DRayProject2d: public ::flow::Filter DRayProject2d(); virtual ~DRayProject2d(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -100,8 +92,6 @@ class ASCENT_API DRayProjectColors2d: public ::flow::Filter DRayProjectColors2d(); virtual ~DRayProjectColors2d(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -113,8 +103,6 @@ class ASCENT_API DRayReflect : public ::flow::Filter virtual ~DRayReflect(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -126,8 +114,6 @@ class ASCENT_API DRayVectorComponent : public ::flow::Filter virtual ~DRayVectorComponent(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 8daa7a4dc..358990c6e 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -666,7 +666,7 @@ bool validate_array(const conduit::Node &schema, if(!schema.has_child("items")) return ok; // unconstrained items const conduit::Node &item_schema = schema["items"]; - if(data_type.is_list()) { + if(data_type.is_list() || data_type.is_object()) { for(conduit::index_t i = 0; i < count; ++i) { ok = validate_node(item_schema, input.child(i), info, From 36d8a51eeca73e9f5418ce9a81999a452eb0145b Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 16:39:06 -0700 Subject: [PATCH 25/50] Adding schemas for rendering filters (Also fixing a bug in the dray rendering filter :( ) --- .../ascent_runtime_dray_filters.cpp | 1 - .../ascent_runtime_rendering_filters.cpp | 464 ++++++++---------- .../ascent_runtime_rendering_filters.hpp | 4 - src/tests/ascent/t_ascent_render_3d.cpp | 4 +- 4 files changed, 196 insertions(+), 277 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp index 0d7b7ab13..b8fdc1ebe 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp @@ -189,7 +189,6 @@ void dray_color_table_schema(conduit::Node ¶m_schema) { cp_list_item_schema["constraints/forbid"].append() = "a"; conduit::Node control_points_schema; - control_points_schema["type"] = "object"; control_points_schema["oneOf"].append().set(cp_compressed_schema); control_points_schema["oneOf"].append().set(array_schema(cp_list_item_schema)); param_schema["properties/control_points"].set(control_points_schema); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp index 6abbbb4cd..7c7a1948b 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp @@ -87,192 +87,47 @@ namespace filters //----------------------------------------------------------------------------- namespace detail { -std::string -check_color_table_surprises(const conduit::Node &color_table) -{ - std::string surprises; - - std::vector valid_paths; - valid_paths.push_back("name"); - valid_paths.push_back("reverse"); - valid_paths.push_back("annotation"); - valid_paths.push_back("discrete"); - - std::vector ignore_paths; - ignore_paths.push_back("control_points"); - - surprises += surprise_check(valid_paths, ignore_paths, color_table); - if(color_table.has_path("control_points")) - { - const Node &control_points_node = color_table.fetch("control_points"); - - if (control_points_node.dtype().is_list()) - { - // Valid path options for the expanded control points input format - std::vector c_valid_paths; - c_valid_paths.push_back("type"); - c_valid_paths.push_back("alpha"); - c_valid_paths.push_back("color"); - c_valid_paths.push_back("position"); - - const int num_points = control_points_node.number_of_children(); - for(int i = 0; i < num_points; ++i) - { - const conduit::Node &point = control_points_node.child(i); - surprises += surprise_check(c_valid_paths, point); - } - } - else if (control_points_node.dtype().is_object()) - { - // Valid path options for the compressed control points input format - std::vector c_valid_paths; - c_valid_paths.push_back("r"); - c_valid_paths.push_back("g"); - c_valid_paths.push_back("b"); - c_valid_paths.push_back("a"); - c_valid_paths.push_back("position"); - - surprises += surprise_check(c_valid_paths, control_points_node); +void color_table_schema(conduit::Node ¶m_schema) { + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/name"].set(string_schema()); + param_schema["properties/reverse"].set(bool_schema()); + param_schema["properties/annotation"].set(string_schema()); + param_schema["properties/discrete"].set(string_schema()); + + // --- Control Points --- + { + conduit::Node cp_compressed_schema; + cp_compressed_schema["type"] = "object"; + cp_compressed_schema["additionalProperties"] = false; + cp_compressed_schema["properties/r"].set(ignore_schema()); + cp_compressed_schema["properties/g"].set(ignore_schema()); + cp_compressed_schema["properties/b"].set(ignore_schema()); + cp_compressed_schema["properties/a"].set(ignore_schema()); + cp_compressed_schema["properties/position"].set(ignore_schema()); + cp_compressed_schema["constraints/forbid"].append() = "type"; + cp_compressed_schema["constraints/forbid"].append() = "alpha"; + cp_compressed_schema["constraints/forbid"].append() = "color"; + + conduit::Node cp_list_item_schema; + cp_list_item_schema["type"] = "object"; + cp_list_item_schema["additionalProperties"] = false; + cp_list_item_schema["properties/type"].set(ignore_schema()); + cp_list_item_schema["properties/alpha"].set(ignore_schema()); + cp_list_item_schema["properties/color"].set(ignore_schema()); + cp_list_item_schema["properties/position"].set(ignore_schema()); + cp_list_item_schema["constraints/forbid"].append() = "r"; + cp_list_item_schema["constraints/forbid"].append() = "g"; + cp_list_item_schema["constraints/forbid"].append() = "b"; + cp_list_item_schema["constraints/forbid"].append() = "a"; + + conduit::Node control_points_schema; + control_points_schema["oneOf"].append().set(cp_compressed_schema); + control_points_schema["oneOf"].append().set(array_schema(cp_list_item_schema)); + param_schema["properties/control_points"].set(control_points_schema); } - } - - return surprises; -} - -std::string -check_renders_surprises(const conduit::Node &renders_node) -{ - std::string surprises; - const int num_renders = renders_node.number_of_children(); - // render paths - std::vector r_valid_paths; - r_valid_paths.push_back("camera/2d"); - r_valid_paths.push_back("image_name"); - r_valid_paths.push_back("image_prefix"); - r_valid_paths.push_back("image_width"); - r_valid_paths.push_back("image_height"); - r_valid_paths.push_back("scene_bounds"); - r_valid_paths.push_back("type"); - r_valid_paths.push_back("phi"); - r_valid_paths.push_back("phi_range"); - r_valid_paths.push_back("dphi"); - r_valid_paths.push_back("phi_num_angles"); - r_valid_paths.push_back("phi_angles"); - r_valid_paths.push_back("theta"); - r_valid_paths.push_back("theta_range"); - r_valid_paths.push_back("dtheta"); - r_valid_paths.push_back("theta_num_angles"); - r_valid_paths.push_back("theta_angles"); - r_valid_paths.push_back("phi_theta_positions"); - r_valid_paths.push_back("db_name"); - r_valid_paths.push_back("output_path"); - r_valid_paths.push_back("render_bg"); - r_valid_paths.push_back("annotations"); - r_valid_paths.push_back("world_annotations"); - r_valid_paths.push_back("screen_annotations"); - r_valid_paths.push_back("axis_scale_x"); - r_valid_paths.push_back("axis_scale_y"); - r_valid_paths.push_back("axis_scale_z"); - r_valid_paths.push_back("fg_color"); - r_valid_paths.push_back("bg_color"); - r_valid_paths.push_back("shading"); - r_valid_paths.push_back("use_original_bounds"); - r_valid_paths.push_back("dataset_bounds"); - r_valid_paths.push_back("auto_camera/metric"); - r_valid_paths.push_back("auto_camera/field"); - r_valid_paths.push_back("auto_camera/samples"); - r_valid_paths.push_back("auto_camera/bins"); - r_valid_paths.push_back("auto_camera/height"); - r_valid_paths.push_back("auto_camera/width"); - r_valid_paths.push_back("color_bar_position"); - r_valid_paths.push_back("tiled_rendering"); - r_valid_paths.push_back("tiled_rendering_type"); - r_valid_paths.push_back("tile_width"); - r_valid_paths.push_back("tile_height"); - - std::vector r_ignore_paths; - r_ignore_paths.push_back("phi_theta_positions"); - r_ignore_paths.push_back("camera"); - - // Valid Ascent input camera format - std::vector c_ascent_valid_paths; - c_ascent_valid_paths.push_back("2d"); - c_ascent_valid_paths.push_back("look_at"); - c_ascent_valid_paths.push_back("position"); - c_ascent_valid_paths.push_back("up"); - c_ascent_valid_paths.push_back("fov"); - c_ascent_valid_paths.push_back("xpan"); - c_ascent_valid_paths.push_back("ypan"); - c_ascent_valid_paths.push_back("zoom"); - c_ascent_valid_paths.push_back("near_plane"); - c_ascent_valid_paths.push_back("far_plane"); - c_ascent_valid_paths.push_back("azimuth"); - c_ascent_valid_paths.push_back("elevation"); - - // Valid Visit input camera format - std::vector c_visit_valid_paths; - c_visit_valid_paths.push_back("windowCoords"); - c_visit_valid_paths.push_back("view_normal"); - c_visit_valid_paths.push_back("focus"); - c_visit_valid_paths.push_back("view_up"); - c_visit_valid_paths.push_back("view_angle"); - c_visit_valid_paths.push_back("parallel_scale"); - c_visit_valid_paths.push_back("near_plane"); - c_visit_valid_paths.push_back("far_plane"); - c_visit_valid_paths.push_back("image_pan"); - c_visit_valid_paths.push_back("image_zoom"); - c_visit_valid_paths.push_back("perspective"); - c_visit_valid_paths.push_back("eye_angle"); - c_visit_valid_paths.push_back("center_of_rotation_set"); - c_visit_valid_paths.push_back("center_of_rotation"); - c_visit_valid_paths.push_back("axis_3d_scale_flag"); - c_visit_valid_paths.push_back("axis_3d_scale"); - c_visit_valid_paths.push_back("shear"); - c_visit_valid_paths.push_back("window_valid"); - - std::vector c_ignore_paths; - - for(int i = 0; i < num_renders; ++i) - { - const conduit::Node &render_node = renders_node.child(i); - surprises += surprise_check(r_valid_paths, r_ignore_paths, render_node); - - if(render_node.has_path("phi_theta_positions")) - { - const conduit::Node &phi_theta_positions = render_node["phi_theta_positions"]; - const int num_positions = phi_theta_positions.number_of_children(); - for(int i = 0; i < num_positions; ++i) - { - const conduit::Node &position = phi_theta_positions.child(i); - std::stringstream ss; - ss << "[" << i << "]"; - if (position.name() != ss.str()) - { - surprises += "Surprise parameter '"; - surprises += position.name(); - surprises += "'\n"; - } - } - } - - if(render_node.has_path("camera")) - { - const conduit::Node &camera_node = render_node["camera"]; - std::string c_ascent_surprises = surprise_check(c_ascent_valid_paths, c_ignore_paths, camera_node); - std::string c_visit_surprises = surprise_check(c_visit_valid_paths, c_ignore_paths, camera_node); - - if(!c_ascent_surprises.empty() && !c_visit_surprises.empty()) - { - surprises += "Cameras must follow either an ascent format or a visit format, not both.\n"; - surprises += "\nAscent camera surpises:\n"; - surprises += c_ascent_surprises; - surprises += "\nVisit camera surprises:\n"; - surprises += c_visit_surprises; - } - } - } - return surprises; } void viskores_bounds_to_conduit_node(const viskores::Bounds &bounds, @@ -1205,41 +1060,115 @@ CreateRenders::declare_interface(Node &i) i["port_names"].append() = "scene"; i["port_names"].append() = "bounds"; i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -CreateRenders::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("image_name",params, info, false); - res &= check_string("image_prefix",params, info, false); - - std::vector valid_paths; - valid_paths.push_back("image_prefix"); - valid_paths.push_back("image_name"); - - std::vector ignore_paths; - ignore_paths.push_back("renders"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - - // parse render surprises - if(params.has_path("renders")) - { - const conduit::Node &renders_node = params["renders"]; - surprises += detail::check_renders_surprises(renders_node); - } - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; + + param_schema["properties/image_name"].set(string_schema()); + param_schema["properties/image_prefix"].set(string_schema()); + + // --- render --- + conduit::Node render_schema; + render_schema["type"] = "object"; + render_schema["additionalProperties"] = false; + render_schema["properties/image_name"].set(string_schema()); + render_schema["properties/image_prefix"].set(string_schema()); + render_schema["properties/image_width"].set(integer_schema(true, std::nullopt, std::nullopt, 0)); + render_schema["properties/image_height"].set(integer_schema(true, std::nullopt, std::nullopt, 0)); + render_schema["properties/scene_bounds"].set(ignore_schema()); + render_schema["properties/type"].set(ignore_schema()); + render_schema["properties/phi"].set(ignore_schema()); + render_schema["properties/phi_range"].set(ignore_schema()); + render_schema["properties/dphi"].set(ignore_schema()); + render_schema["properties/phi_num_angles"].set(ignore_schema()); + render_schema["properties/phi_angles"].set(ignore_schema()); + render_schema["properties/theta"].set(ignore_schema()); + render_schema["properties/theta_range"].set(ignore_schema()); + render_schema["properties/dtheta"].set(ignore_schema()); + render_schema["properties/theta_num_angles"].set(ignore_schema()); + render_schema["properties/theta_angles"].set(ignore_schema()); + render_schema["properties/phi_theta_positions"].set(ignore_schema()); + render_schema["properties/db_name"].set(ignore_schema()); + render_schema["properties/output_path"].set(ignore_schema()); + render_schema["properties/render_bg"].set(ignore_schema()); + render_schema["properties/annotations"].set(ignore_schema()); + render_schema["properties/world_annotations"].set(ignore_schema()); + render_schema["properties/screen_annotations"].set(ignore_schema()); + render_schema["properties/axis_scale_x"].set(ignore_schema()); + render_schema["properties/axis_scale_y"].set(ignore_schema()); + render_schema["properties/axis_scale_z"].set(ignore_schema()); + render_schema["properties/fg_color"].set(ignore_schema()); + render_schema["properties/bg_color"].set(ignore_schema()); + render_schema["properties/shading"].set(ignore_schema()); + render_schema["properties/use_original_bounds"].set(ignore_schema()); + render_schema["properties/dataset_bounds"].set(ignore_schema()); + render_schema["properties/color_bar_position"].set(ignore_schema()); + render_schema["properties/tiled_rendering"].set(ignore_schema()); + render_schema["properties/tiled_rendering_type"].set(ignore_schema()); + render_schema["properties/tile_width"].set(ignore_schema()); + render_schema["properties/tile_height"].set(ignore_schema()); + + conduit::Node auto_camera_schema; + auto_camera_schema["type"] = "object"; + auto_camera_schema["additionalProperties"] = false; + auto_camera_schema["properties/metric"].set(ignore_schema()); + auto_camera_schema["properties/field"].set(ignore_schema()); + auto_camera_schema["properties/samples"].set(ignore_schema()); + auto_camera_schema["properties/bins"].set(ignore_schema()); + auto_camera_schema["properties/height"].set(ignore_schema()); + auto_camera_schema["properties/width"].set(ignore_schema()); + render_schema["properties/auto_camera"].set(auto_camera_schema); + + // --- Camera --- + conduit::Node ascent_camera_schema; + ascent_camera_schema["type"] = "object"; + ascent_camera_schema["additionalProperties"] = false; + ascent_camera_schema["properties/2d"].set(ignore_schema()); + ascent_camera_schema["properties/look_at"].set(ignore_schema()); + ascent_camera_schema["properties/position"].set(ignore_schema()); + ascent_camera_schema["properties/up"].set(ignore_schema()); + ascent_camera_schema["properties/fov"].set(ignore_schema()); + ascent_camera_schema["properties/xpan"].set(ignore_schema()); + ascent_camera_schema["properties/ypan"].set(ignore_schema()); + ascent_camera_schema["properties/zoom"].set(ignore_schema()); + ascent_camera_schema["properties/near_plane"].set(ignore_schema()); + ascent_camera_schema["properties/far_plane"].set(ignore_schema()); + ascent_camera_schema["properties/azimuth"].set(ignore_schema()); + ascent_camera_schema["properties/elevation"].set(ignore_schema()); + + conduit::Node visit_camera_schema; + visit_camera_schema["type"] = "object"; + visit_camera_schema["additionalProperties"] = false; + visit_camera_schema["properties/windowCoords"].set(ignore_schema()); + visit_camera_schema["properties/view_normal"].set(ignore_schema()); + visit_camera_schema["properties/focus"].set(ignore_schema()); + visit_camera_schema["properties/view_up"].set(ignore_schema()); + visit_camera_schema["properties/view_angle"].set(ignore_schema()); + visit_camera_schema["properties/parallel_scale"].set(ignore_schema()); + visit_camera_schema["properties/near_plane"].set(ignore_schema()); + visit_camera_schema["properties/far_plane"].set(ignore_schema()); + visit_camera_schema["properties/image_pan"].set(ignore_schema()); + visit_camera_schema["properties/image_zoom"].set(ignore_schema()); + visit_camera_schema["properties/perspective"].set(ignore_schema()); + visit_camera_schema["properties/eye_angle"].set(ignore_schema()); + visit_camera_schema["properties/center_of_rotation_set"].set(ignore_schema()); + visit_camera_schema["properties/center_of_rotation"].set(ignore_schema()); + visit_camera_schema["properties/axis_3d_scale_flag"].set(ignore_schema()); + visit_camera_schema["properties/axis_3d_scale"].set(ignore_schema()); + visit_camera_schema["properties/shear"].set(ignore_schema()); + visit_camera_schema["properties/window_valid"].set(ignore_schema()); + + conduit::Node camera_schema; + camera_schema["type"] = "object"; + camera_schema["oneOf"].append().set(ascent_camera_schema); + camera_schema["oneOf"].append().set(visit_camera_schema); + render_schema["properties/camera"].set(camera_schema); + + param_schema["properties/renders"].set(array_schema(render_schema)); + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1828,69 +1757,64 @@ CreatePlot::declare_interface(Node &i) i["type_name"] = "create_plot"; i["port_names"].append() = "a"; i["output_port"] = "true"; -} - - -//----------------------------------------------------------------------------- -bool -CreatePlot::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = check_string("type",params, info, true); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - bool is_mesh = false; + param_schema["properties/type"].set(string_schema()); + param_schema["properties/pipeline"].set(ignore_schema()); + param_schema["properties/topology"].set(string_schema()); - std::vector valid_paths; - valid_paths.push_back("type"); - valid_paths.push_back("pipeline"); + conduit::Node color_table_schema; + detail::color_table_schema(color_table_schema); + param_schema["properties/color_table"].set(color_table_schema); - res &= check_string("topology",params, info, false); - valid_paths.push_back("topology"); + param_schema["required"].append() = "type"; - if(res) - { - if(params["type"].as_string() == "mesh") - { - is_mesh = true; - } - } - - if(!is_mesh) - { - res &= check_string("field", params, info, true); - valid_paths.push_back("field"); - valid_paths.push_back("points/radius"); - valid_paths.push_back("points/radius_delta"); - valid_paths.push_back("min_value"); - valid_paths.push_back("max_value"); - valid_paths.push_back("samples"); - } - else + // --- Is Mesh --- { - valid_paths.push_back("overlay"); - valid_paths.push_back("show_internal"); - } - - - std::vector ignore_paths; - ignore_paths.push_back("color_table"); - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); + // properties are still added at the root level and then limited through forbids + param_schema["properties/overlay"].set(ignore_schema()); + param_schema["properties/show_internal"].set(ignore_schema()); - if(params.has_path("color_table")) - { - surprises += detail::check_color_table_surprises(params["color_table"]); + conduit::Node mesh_schema; + mesh_schema["type"] = "object"; + mesh_schema["properties/type/constraints/const"] = "mesh"; + mesh_schema["constraints/forbid"] = "field"; + mesh_schema["constraints/forbid"] = "min_value"; + mesh_schema["constraints/forbid"] = "max_value"; + mesh_schema["constraints/forbid"] = "samples"; + mesh_schema["constraints/forbid"] = "points"; + param_schema["oneOf"].append().set(mesh_schema); } - if(surprises != "") + // --- Is not Mesh --- { - res = false; - info["errors"].append() = surprises; + // properties are still added at the root level and then limited through forbids + param_schema["properties/field"].set(ignore_schema()); + param_schema["properties/min_value"].set(ignore_schema()); + param_schema["properties/max_value"].set(ignore_schema()); + param_schema["properties/samples"].set(ignore_schema()); + + conduit::Node points_schema; + points_schema["type"] = "object"; + points_schema["additionalProperties"] = false; + points_schema["properties/radius"].set(ignore_schema()); + points_schema["properties/radius_delta"].set(ignore_schema()); + param_schema["properties/points"].set(points_schema); + + conduit::Node not_mesh_schema; + not_mesh_schema["type"] = "object"; + not_mesh_schema["constraints/not_const/type"] = "mesh"; + not_mesh_schema["constraints/forbid"] = "overlay"; + not_mesh_schema["constraints/forbid"] = "show_internal"; + not_mesh_schema["required"].append() = "field"; + param_schema["oneOf"].append().set(not_mesh_schema); } - - return res; + + i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.hpp index 4d279744c..ecfa2fbbd 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.hpp @@ -52,8 +52,6 @@ class ASCENT_API CreateRenders : public ::flow::Filter virtual ~CreateRenders(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -87,8 +85,6 @@ class ASCENT_API CreatePlot : public ::flow::Filter virtual ~CreatePlot(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; diff --git a/src/tests/ascent/t_ascent_render_3d.cpp b/src/tests/ascent/t_ascent_render_3d.cpp index c61857eea..7ba6e7eb8 100644 --- a/src/tests/ascent/t_ascent_render_3d.cpp +++ b/src/tests/ascent/t_ascent_render_3d.cpp @@ -4020,14 +4020,14 @@ TEST(ascent_render_3d, test_render_invalid_camera) } catch(conduit::Error &err) { - if (err.message().find("Cameras must follow either an ascent format or a visit format, not both.") != std::string::npos) + if (err.message().find("input did not match any supported schemas") != std::string::npos) { error_occured = true; } else { std::cout << "The error that was thrown did not match the expected " - << "'Cameras must follow either an ascent format or a visit format, not both.' error" << std::endl; + << "'input did not match any supported schemas' error" << std::endl; std::cout << err.message() << std::endl; } From 4478fdcbdce1a29a713fd65ee55a8209725cc2f6 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 16:44:11 -0700 Subject: [PATCH 26/50] Last filter conversion over to json schema!!! --- .../ascent_runtime_relay_filters.cpp | 254 ++++-------------- .../ascent_runtime_relay_filters.hpp | 6 - 2 files changed, 56 insertions(+), 204 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp index 39e2281df..f59ade68a 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp @@ -421,167 +421,52 @@ post_filter_check_for_data(const conduit::Node &output) //----------------------------------------------------------------------------- // helper shared by io save and load //----------------------------------------------------------------------------- -bool -verify_io_params(const conduit::Node ¶ms, - conduit::Node &info) +void io_param_schema(conduit::Node ¶m_schema) { - bool res = true; + // ----------- Define Param Schema ----------- + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - if( !params.has_child("path") ) - { - info["errors"].append() = "missing required entry 'path'"; - res = false; - } - else if(!params["path"].dtype().is_string()) - { - info["errors"].append() = "'path' must be a string"; - res = false; - } - else if(params["path"].as_string().empty()) - { - info["errors"].append() = "'path' is an empty string"; - res = false; - } - - if( params.has_child("protocol") ) - { - if(!params["protocol"].dtype().is_string()) - { - info["errors"].append() = "optional entry 'protocol' must be a string"; - res = false; - } - else if(params["protocol"].as_string().empty()) - { - info["errors"].append() = "'protocol' is an empty string"; - res = false; - } - else - { - info["info"].append() = "includes 'protocol'"; - } - } - - if( params.has_child("num_files") ) - { - if(!params["num_files"].dtype().is_integer()) - { - info["errors"].append() = "optional entry 'num_files' must be an integer"; - res = false; - } - else - { - info["info"].append() = "includes 'num_files'"; - } - } - - if( params.has_child("refinement_level") ) - { - if(!params["refinement_level"].dtype().is_integer()) - { - info["errors"].append() = "optional entry 'refinement_level' must be an integer"; - res = false; - } - else - { - info["info"].append() = "includes 'refinement_level'"; - } - } + param_schema["properties/path"].set(string_schema(1)); + param_schema["properties/protocol"].set(string_schema(1)); + param_schema["properties/topologies"].set(ignore_schema()); + param_schema["properties/fields"].set(ignore_schema()); + param_schema["properties/num_files"].set(integer_schema()); + param_schema["properties/refinement_level"].set(integer_schema()); #if defined(ASCENT_HDF5_ENABLED) - if( params.has_child("hdf5_options") ) + // --- HDF5 --- { - // - // HDF5 OPTIONS Example: - // - // compact_storage: - // enabled: "true" - // threshold: 1024 - // chunking: - // enabled: "true" - // threshold: 2000000 - // chunk_size: 1000000 - // compression: - // method: "gzip" - // level: 5 - - const Node ¶ms_hdf5_opts = params["hdf5_options"]; - - res &= check_object("compact_storage", - params_hdf5_opts, - info, - false); - - res &= check_bool("compact_storage/enabled", - params_hdf5_opts, - info, - false); - - res &= check_numeric("compact_storage/threshold", - params_hdf5_opts, - info, - false); - - res &= check_object("chunking", - params_hdf5_opts, - info, - false); - - res &= check_bool("chunking/enabled", - params_hdf5_opts, - info, - false); - - - res &= check_numeric("chunking/threshold", - params_hdf5_opts, - info, - false); - - res &= check_numeric("chunking/chunk_size", - params_hdf5_opts, - info, - false); - - res &= check_object("chunking/compression", - params_hdf5_opts, - info, - false); - - res &= check_string("chunking/compression/method", - params_hdf5_opts, - info, - false); - - res &= check_numeric("chunking/compression/level", - params_hdf5_opts, - info, - false); + conduit::Node hdf5_compact_storage_schema; + hdf5_compact_storage_schema["type"] = "object"; + hdf5_compact_storage_schema["additionalProperties"] = false; + hdf5_compact_storage_schema["properties/enabled"].set(bool_schema()); + hdf5_compact_storage_schema["properties/threshold"].set(number_schema()); + + conduit::Node hdf5_compression_schema; + hdf5_compression_schema["type"] = "object"; + hdf5_compression_schema["additionalProperties"] = false; + hdf5_compact_storage_schema["properties/method"].set(string_schema()); + hdf5_compact_storage_schema["properties/level"].set(number_schema()); + + conduit::Node hdf5_chunking_schema; + hdf5_chunking_schema["type"] = "object"; + hdf5_chunking_schema["additionalProperties"] = false; + hdf5_compact_storage_schema["properties/enabled"].set(bool_schema()); + hdf5_compact_storage_schema["properties/threshold"].set(number_schema()); + hdf5_compact_storage_schema["properties/chunk_size"].set(number_schema()); + hdf5_compact_storage_schema["properties/compression"].set(hdf5_compression_schema); + + conduit::Node hdf5_schema; + hdf5_schema["type"] = "object"; + hdf5_schema["additionalProperties"] = false; + hdf5_schema["properties/compact_storage"].set(hdf5_compact_storage_schema); + hdf5_schema["properties/chunking"].set(hdf5_chunking_schema); + param_schema["properties/hdf5_options"].set(hdf5_schema); } #endif - std::vector valid_paths; - std::vector ignore_paths; - valid_paths.push_back("path"); - valid_paths.push_back("protocol"); - valid_paths.push_back("topologies"); - valid_paths.push_back("fields"); - valid_paths.push_back("num_files"); - valid_paths.push_back("refinement_level"); - ignore_paths.push_back("fields"); - ignore_paths.push_back("topologies"); -#if defined(ASCENT_HDF5_ENABLED) - ignore_paths.push_back("hdf5_options"); -#endif - - std::string surprises = surprise_check(valid_paths, ignore_paths, params); - - if(surprises != "") - { - res = false; - info["errors"].append() = surprises; - } - - return res; + param_schema["required"].append() = "path"; } @@ -709,17 +594,13 @@ RelayIOSave::declare_interface(Node &i) i["type_name"] = "relay_io_save"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} -//----------------------------------------------------------------------------- -bool -RelayIOSave::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - return verify_io_params(params,info); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + io_param_schema(param_schema); + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void RelayIOSave::execute() @@ -1098,17 +979,13 @@ RelayIOLoad::declare_interface(Node &i) i["type_name"] = "relay_io_load"; i["port_names"] = DataType::empty(); i["output_port"] = "true"; -} -//----------------------------------------------------------------------------- -bool -RelayIOLoad::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - return verify_io_params(params,info); + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + io_param_schema(param_schema); + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void RelayIOLoad::execute() @@ -1156,40 +1033,21 @@ BlueprintFlatten::declare_interface(Node &i) i["type_name"] = "false"; i["port_names"].append() = "in"; i["output_port"] = "false"; -} - -//----------------------------------------------------------------------------- -bool -BlueprintFlatten::verify_params(const conduit::Node ¶ms, - conduit::Node &info) -{ - info.reset(); - bool res = true; - if(! params.has_child("path") || - ! params["path"].dtype().is_string() ) - { - info["errors"].append() = "Missing required string parameter 'path'"; - } + // ----------- Define Param Schema ----------- + conduit::Node param_schema; + param_schema["type"] = "object"; + param_schema["additionalProperties"] = false; - std::vector valid_paths; - valid_paths.push_back("path"); - valid_paths.push_back("protocol"); - valid_paths.push_back("fields"); + param_schema["properties/path"].set(string_schema()); + param_schema["properties/protocol"].set(string_schema()); + param_schema["properties/fields"].set(array_schema(string_schema())); - std::string surprises = surprise_check(valid_paths, params); - - if(surprises != "") - { - res = false; - info["error"].append() = surprises; - } - - return res; - //return verify_io_params(params,info); + param_schema["required"].append() = "path"; + + i["param_schema"].set(param_schema); } - //----------------------------------------------------------------------------- void BlueprintFlatten::execute() diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.hpp index c042d76a0..0b7bdeb2c 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.hpp @@ -58,8 +58,6 @@ class ASCENT_API RelayIOSave : public ::flow::Filter ~RelayIOSave(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; @@ -71,8 +69,6 @@ class ASCENT_API RelayIOLoad : public ::flow::Filter ~RelayIOLoad(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; //----------------------------------------------------------------------------- @@ -83,8 +79,6 @@ class ASCENT_API BlueprintFlatten : public ::flow::Filter ~BlueprintFlatten(); virtual void declare_interface(conduit::Node &i); - virtual bool verify_params(const conduit::Node ¶ms, - conduit::Node &info); virtual void execute(); }; From ce6fc1b217e47c041a10815569f506fea4a7443d Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 19 Mar 2026 17:09:52 -0700 Subject: [PATCH 27/50] cleaning up branch Signed-off-by: Emily Howell --- src/libs/blaze | 1 - 1 file changed, 1 deletion(-) delete mode 160000 src/libs/blaze diff --git a/src/libs/blaze b/src/libs/blaze deleted file mode 160000 index e4d790d56..000000000 --- a/src/libs/blaze +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e4d790d56981aa746702a4041a205cc3afdfcfb1 From 6f5f93310606d29239e8563070093c1d6387569a Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 23 Mar 2026 12:26:03 -0700 Subject: [PATCH 28/50] Had AI generate an import check for optional that will work with c++11. --- .../ascent_runtime_param_check.hpp | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 9be242b92..2975044b7 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -19,11 +19,33 @@ #include #include #include -#include #include #include +#if __cplusplus >= 201703L + #include + template + using compat_optional = std::optional; +#else + template + class compat_optional + { + public: + compat_optional() : m_has_value(false), m_value() {} + compat_optional(const T& value) : m_has_value(true), m_value(value) {} + + operator bool() const { return m_has_value; } + + const T& operator*() const { return m_value; } + T& operator*() { return m_value; } + + private: + bool m_has_value; + T m_value; + }; +#endif + //----------------------------------------------------------------------------- // -- begin ascent:: -- //----------------------------------------------------------------------------- @@ -44,24 +66,24 @@ namespace filters bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_msg); -conduit::Node ASCENT_API string_schema(std::optional minLength = std::nullopt, - std::optional maxLength = std::nullopt); +conduit::Node ASCENT_API string_schema(compat_optional minLength = compat_optional(), + compat_optional maxLength = compat_optional()); conduit::Node ASCENT_API string_enum_schema(std::vector options); conduit::Node ASCENT_API bool_schema(); conduit::Node ASCENT_API number_schema(bool supports_expressions = false, - std::optional minimum = std::nullopt, - std::optional maximum = std::nullopt, - std::optional exclusiveMinimum = std::nullopt, - std::optional exclusiveMaximum= std::nullopt); + compat_optional minimum = compat_optional(), + compat_optional maximum = compat_optional(), + compat_optional exclusiveMinimum = compat_optional(), + compat_optional exclusiveMaximum= compat_optional()); conduit::Node ASCENT_API integer_schema(bool supports_expressions = false, - std::optional minimum = std::nullopt, - std::optional maximum = std::nullopt, - std::optional exclusiveMinimum = std::nullopt, - std::optional exclusiveMaximum= std::nullopt); + compat_optional minimum = compat_optional(), + compat_optional maximum = compat_optional(), + compat_optional exclusiveMinimum = compat_optional(), + compat_optional exclusiveMaximum= compat_optional()); conduit::Node ASCENT_API vec3_schema(bool supports_expressions = false); From 81e8e99c17293854d4a5c9017cc1ab2b7343622a Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 23 Mar 2026 12:27:23 -0700 Subject: [PATCH 29/50] Whopps. need to use it everywhere --- .../ascent_runtime_param_check.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 62cd3f1fa..f8645d37a 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -61,8 +61,8 @@ bool is_valid_expression(const std::string &expr, std::string &err_msg) //----------------------------------------------------------------------------- -conduit::Node string_schema(std::optional minLength, - std::optional maxLength) +conduit::Node string_schema(compat_optional minLength, + compat_optional maxLength) { conduit::Node n; n["type"] = "string"; @@ -98,10 +98,10 @@ conduit::Node expression_schema() //----------------------------------------------------------------------------- conduit::Node number_schema(bool supports_expressions, - std::optional minimum, - std::optional maximum, - std::optional exclusiveMinimum, - std::optional exclusiveMaximum) + compat_optional minimum, + compat_optional maximum, + compat_optional exclusiveMinimum, + compat_optional exclusiveMaximum) { conduit::Node n; if (supports_expressions) @@ -123,10 +123,10 @@ conduit::Node number_schema(bool supports_expressions, } conduit::Node integer_schema(bool supports_expressions, - std::optional minimum, - std::optional maximum, - std::optional exclusiveMinimum, - std::optional exclusiveMaximum) + compat_optional minimum, + compat_optional maximum, + compat_optional exclusiveMinimum, + compat_optional exclusiveMaximum) { conduit::Node n; if (supports_expressions) From 30fb70d45542a3090b65eedf00ea15a4f56f1383 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 23 Mar 2026 12:54:36 -0700 Subject: [PATCH 30/50] Cleaning up some errors --- .../runtimes/flow_filters/ascent_runtime_adios2_filters.cpp | 1 + src/libs/flow/flow_filter.cpp | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp index 18c3929c0..e0c1c5892 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp @@ -24,6 +24,7 @@ //----------------------------------------------------------------------------- #include #include +#include #include #include diff --git a/src/libs/flow/flow_filter.cpp b/src/libs/flow/flow_filter.cpp index 9f502c767..c733fef37 100644 --- a/src/libs/flow/flow_filter.cpp +++ b/src/libs/flow/flow_filter.cpp @@ -228,12 +228,6 @@ Filter::verify_params(const Node ¶ms, if (!param_schema().dtype().is_empty() && !(param_schema().dtype().is_object() && param_schema().number_of_children() == 0)) { - // std::cout << "\nSlice Properties!!" << std::endl; - // param_schema().print(); - - // std::cout << "\nParams!!" << std::endl; - // params.print(); - return flow::schema::validate(param_schema(), params, info); } From b902ed0bf1b13e72c75740678c43f137d589a0d8 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 23 Mar 2026 14:23:15 -0700 Subject: [PATCH 31/50] Needed to add the pattern validation still --- src/libs/flow/flow_schema_validator.cpp | 32 +++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index 358990c6e..2c81f1910 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -16,6 +16,7 @@ // standard lib includes #include #include +#include //----------------------------------------------------------------------------- // -- begin flow -- @@ -92,7 +93,7 @@ bool check_type(const conduit::Node &input, return ok; } -bool validate_string_bounds(const conduit::Node &schema, +bool validate_string(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, const std::string &path) @@ -124,6 +125,29 @@ bool validate_string_bounds(const conduit::Node &schema, } } + if(schema.has_child("pattern")) + { + const std::string pattern = schema["pattern"].as_string(); + const std::string loc = path.empty() ? "" : path; + + try + { + const std::regex re(pattern); + if(!std::regex_match(s, re)) + { + add_error(info, "String at '" + loc + + "' does not match pattern '" + pattern + "'"); + ok = false; + } + } + catch(const std::regex_error &) + { + add_error(info, "Schema at '" + loc + + "' has invalid regex pattern '" + pattern + "'"); + ok = false; + } + } + return ok; } @@ -150,7 +174,7 @@ bool validate_enum(const conduit::Node &schema, return false; } -bool validate_number_bounds(const conduit::Node &schema, +bool validate_number(const conduit::Node &schema, const conduit::Node &input, conduit::Node &info, const std::string &path) @@ -708,12 +732,12 @@ bool validate_node(const conduit::Node &schema, if(schema_defined_type == "string") { - ok = validate_string_bounds(schema, input, info, path) && ok; + ok = validate_string(schema, input, info, path) && ok; } if(schema_defined_type == "number" || schema_defined_type == "integer") { - ok = validate_number_bounds(schema, input, info, path) && ok; + ok = validate_number(schema, input, info, path) && ok; } if(!ok) return false; // type mismatch stops recursion From d95f5dbd50d79c0db1d8c732206f5237bf862486 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Fri, 27 Mar 2026 12:41:09 -0700 Subject: [PATCH 32/50] Fixing adios2 error in CI --- .../runtimes/flow_filters/ascent_runtime_adios2_filters.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp index e0c1c5892..c57bd9bb2 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp @@ -119,7 +119,6 @@ ADIOS2::declare_interface(Node &i) // ----------- Define Param Schema ----------- conduit::Node param_schema; param_schema["type"] = "object"; - param_schema["additionalProperties"] = false; param_schema["properties/filename"].set(string_schema()); // Can't be a directory... need to add regex filter param_schema["properties/engine"].set(string_schema()); From be2c2d2ef4ba66f1a33876673550b787623c43e7 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Fri, 27 Mar 2026 12:48:12 -0700 Subject: [PATCH 33/50] Making sure that a compatable optional is used properly everywhere for backwards compatability to older versions of c++ --- .../ascent_runtime_param_check.cpp | 20 ++++++------- .../ascent_runtime_param_check.hpp | 28 +++++++++---------- .../ascent_runtime_rendering_filters.cpp | 4 +-- .../ascent_runtime_rover_filters.cpp | 6 ++-- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index f8645d37a..96672ff4d 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -61,8 +61,8 @@ bool is_valid_expression(const std::string &expr, std::string &err_msg) //----------------------------------------------------------------------------- -conduit::Node string_schema(compat_optional minLength, - compat_optional maxLength) +conduit::Node string_schema(optional_param minLength, + optional_param maxLength) { conduit::Node n; n["type"] = "string"; @@ -98,10 +98,10 @@ conduit::Node expression_schema() //----------------------------------------------------------------------------- conduit::Node number_schema(bool supports_expressions, - compat_optional minimum, - compat_optional maximum, - compat_optional exclusiveMinimum, - compat_optional exclusiveMaximum) + optional_param minimum, + optional_param maximum, + optional_param exclusiveMinimum, + optional_param exclusiveMaximum) { conduit::Node n; if (supports_expressions) @@ -123,10 +123,10 @@ conduit::Node number_schema(bool supports_expressions, } conduit::Node integer_schema(bool supports_expressions, - compat_optional minimum, - compat_optional maximum, - compat_optional exclusiveMinimum, - compat_optional exclusiveMaximum) + optional_param minimum, + optional_param maximum, + optional_param exclusiveMinimum, + optional_param exclusiveMaximum) { conduit::Node n; if (supports_expressions) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 2975044b7..c52c841aa 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -26,14 +26,14 @@ #if __cplusplus >= 201703L #include template - using compat_optional = std::optional; + using optional_param = std::optional; #else template - class compat_optional + class optional_param { public: - compat_optional() : m_has_value(false), m_value() {} - compat_optional(const T& value) : m_has_value(true), m_value(value) {} + optional_param() : m_has_value(false), m_value() {} + optional_param(const T& value) : m_has_value(true), m_value(value) {} operator bool() const { return m_has_value; } @@ -66,24 +66,24 @@ namespace filters bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_msg); -conduit::Node ASCENT_API string_schema(compat_optional minLength = compat_optional(), - compat_optional maxLength = compat_optional()); +conduit::Node ASCENT_API string_schema(optional_param minLength = optional_param(), + optional_param maxLength = optional_param()); conduit::Node ASCENT_API string_enum_schema(std::vector options); conduit::Node ASCENT_API bool_schema(); conduit::Node ASCENT_API number_schema(bool supports_expressions = false, - compat_optional minimum = compat_optional(), - compat_optional maximum = compat_optional(), - compat_optional exclusiveMinimum = compat_optional(), - compat_optional exclusiveMaximum= compat_optional()); + optional_param minimum = optional_param(), + optional_param maximum = optional_param(), + optional_param exclusiveMinimum = optional_param(), + optional_param exclusiveMaximum= optional_param()); conduit::Node ASCENT_API integer_schema(bool supports_expressions = false, - compat_optional minimum = compat_optional(), - compat_optional maximum = compat_optional(), - compat_optional exclusiveMinimum = compat_optional(), - compat_optional exclusiveMaximum= compat_optional()); + optional_param minimum = optional_param(), + optional_param maximum = optional_param(), + optional_param exclusiveMinimum = optional_param(), + optional_param exclusiveMaximum= optional_param()); conduit::Node ASCENT_API vec3_schema(bool supports_expressions = false); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp index 7c7a1948b..6b92884a2 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp @@ -1075,8 +1075,8 @@ CreateRenders::declare_interface(Node &i) render_schema["additionalProperties"] = false; render_schema["properties/image_name"].set(string_schema()); render_schema["properties/image_prefix"].set(string_schema()); - render_schema["properties/image_width"].set(integer_schema(true, std::nullopt, std::nullopt, 0)); - render_schema["properties/image_height"].set(integer_schema(true, std::nullopt, std::nullopt, 0)); + render_schema["properties/image_width"].set(integer_schema(true, optional_param(), optional_param(), 0)); + render_schema["properties/image_height"].set(integer_schema(true, optional_param(), optional_param(), 0)); render_schema["properties/scene_bounds"].set(ignore_schema()); render_schema["properties/type"].set(ignore_schema()); render_schema["properties/phi"].set(ignore_schema()); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp index 3552fc632..69f1a8f5a 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp @@ -117,11 +117,11 @@ RoverXRay::declare_interface(Node &i) rover_schema["properties/divide_emis_by_absorb"].set(bool_schema()); rover_schema["properties/emission"].set(string_schema(1)); rover_schema["properties/enable_rays_mesh"].set(bool_schema()); - rover_schema["properties/height"].set(integer_schema(false, std::nullopt, std::nullopt, 0)); - rover_schema["properties/width"].set(integer_schema(false, std::nullopt, std::nullopt, 0)); + rover_schema["properties/height"].set(integer_schema(false, optional_param(), optional_param(), 0)); + rover_schema["properties/width"].set(integer_schema(false, optional_param(), optional_param(), 0)); rover_schema["properties/output_type"].set(string_enum_schema({"hdf5", "yaml", "json", "png", "bov"})); rover_schema["properties/precision"].set(string_enum_schema({"single", "double"})); - rover_schema["properties/unit_scalar"].set(number_schema(false, std::nullopt, std::nullopt, 0)); + rover_schema["properties/unit_scalar"].set(number_schema(false, optional_param(), optional_param(), 0)); rover_schema["constraints/dependencies/height"].append() = "width"; rover_schema["constraints/dependencies/width"].append() = "height"; From 1d51bafa6c9b95538b8cfa63cce2adc71421eb79 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Fri, 27 Mar 2026 13:32:52 -0700 Subject: [PATCH 34/50] Fixing reflect filter --- .../runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 85f1f071e..b8ef1f1ae 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -4525,8 +4525,7 @@ VTKHTransform::declare_interface(Node &i) reflect_schema["type"] = "object"; reflect_schema["additionalProperties"] = false; reflect_schema["properties/normal"].set(vec3_schema_anyOf(true)); - reflect_schema["properties/point"].set(vec3_schema(true)); - reflect_schema["required"].append() = "point"; + reflect_schema["properties/point"].set(vec3_schema_anyOf(true)); param_schema["properties/reflect"].set(reflect_schema); // --- matrix --- From f06051b04c49e920b48f2ee23c9c96d47e35fa9a Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 13:56:26 -0700 Subject: [PATCH 35/50] Fixing spelling error --- .../runtimes/expressions/ascent_expression_jit_filters.cpp | 2 +- .../runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp index a0b93cf60..98ca2a049 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp @@ -151,7 +151,7 @@ ExprJitFilter::declare_interface(Node &i) conduit::Node inputs_schema = filters::array_schema(filters::ignore_schema()); inputs_schema["minItems"] = num_inputs; - inputs_schema["miaxItems"] = num_inputs; + inputs_schema["maxItems"] = num_inputs; param_schema["properties/inputs"].set(inputs_schema); param_schema["required"].append() = "func"; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index b8ef1f1ae..5021a5563 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -4531,7 +4531,7 @@ VTKHTransform::declare_interface(Node &i) // --- matrix --- conduit::Node matrix_schema = array_schema(number_schema(true)); matrix_schema["minItems"] = 16; - matrix_schema["miaxItems"] = 16; + matrix_schema["maxItems"] = 16; param_schema["properties/matrix"].set(matrix_schema); i["param_schema"].set(param_schema); From 1d2c3d9b5142ff04862d7c57e636ee167b9df94f Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 17:13:47 -0700 Subject: [PATCH 36/50] Using refs to nodes instead of copying seperate nodes into tree --- .../expressions/ascent_expression_filters.cpp | 42 +- .../ascent_expression_jit_filters.cpp | 11 +- .../ascent_runtime_param_check.cpp | 138 ++-- .../ascent_runtime_param_check.hpp | 36 +- .../ascent_runtime_vtkh_filters.cpp | 644 ++++++++---------- 5 files changed, 382 insertions(+), 489 deletions(-) diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp b/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp index 04cccf516..55beacd24 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_filters.cpp @@ -947,14 +947,12 @@ ExprBoolean::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/value"].set(filters::number_schema()); + filters::number_schema(param_schema["properties/value"]); param_schema["required"].append() = "value"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -992,14 +990,12 @@ ExprInteger::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/value"].set(filters::number_schema()); + filters::number_schema(param_schema["properties/value"]); param_schema["required"].append() = "value"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1038,14 +1034,12 @@ ExprDouble::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/value"].set(filters::number_schema()); + filters::number_schema(param_schema["properties/value"]); param_schema["required"].append() = "value"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1085,14 +1079,12 @@ ExprString::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/value"].set(filters::string_schema()); + filters::string_schema(param_schema["properties/value"]); param_schema["required"].append() = "value"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1202,14 +1194,12 @@ ExprIdentifier::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/value"].set(filters::string_schema()); + filters::string_schema(param_schema["properties/value"]); param_schema["required"].append() = "value"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1266,14 +1256,12 @@ ExprObjectDotAccess::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/name"].set(filters::string_schema()); + filters::string_schema(param_schema["properties/name"]); param_schema["required"].append() = "name"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1399,14 +1387,12 @@ ExprBinaryOp::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/op_string"].set(filters::string_schema()); + filters::string_schema(param_schema["properties/op_string"]); param_schema["required"].append() = "op_string"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp index 98ca2a049..82584c780 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp @@ -142,23 +142,20 @@ ExprJitFilter::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = true; - param_schema["properties/func"].set(filters::string_schema()); - param_schema["properties/filter_name"].set(filters::string_schema()); + filters::string_schema(param_schema["properties/func"]); + filters::string_schema(param_schema["properties/filter_name"]); - conduit::Node inputs_schema = filters::array_schema(filters::ignore_schema()); + conduit::Node &inputs_schema = filters::array_schema(param_schema["properties/inputs"]); inputs_schema["minItems"] = num_inputs; inputs_schema["maxItems"] = num_inputs; - param_schema["properties/inputs"].set(inputs_schema); param_schema["required"].append() = "func"; param_schema["required"].append() = "filter_name"; param_schema["required"].append() = "inputs"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index de4f10edb..e9728b39e 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -86,117 +86,125 @@ void ascent_register_flow_schema_hooks() flow::schema::set_expression_checker(&is_valid_expression); } -conduit::Node string_schema() +conduit::Node &string_schema(conduit::Node &schema_node) { - conduit::Node n; - n["type"] = "string"; - return n; + schema_node.reset(); + schema_node["type"] = "string"; + return schema_node; } -conduit::Node expression_schema() +conduit::Node &expression_schema(conduit::Node &schema_node) { - conduit::Node n = string_schema(); - n["format"] = "expression"; - return n; + string_schema(schema_node); + schema_node["format"] = "expression"; + return schema_node; } -conduit::Node number_schema(bool supports_expressions) +conduit::Node &number_schema(conduit::Node &schema_node, bool supports_expressions) { - conduit::Node n; + schema_node.reset(); if (supports_expressions) { - n["oneOf"].append().set(number_schema()); - n["oneOf"].append().set(expression_schema()); + number_schema(schema_node["oneOf"].append()); + expression_schema(schema_node["oneOf"].append()); } else { - n["type"] = "number"; + schema_node["type"] = "number"; } - return n; + return schema_node; } -conduit::Node vec3_schema(const std::string var1, - const std::string var2, - const std::string var3, - bool supports_expressions) +conduit::Node &vec3_schema(conduit::Node &schema_node, + const std::string var1, + const std::string var2, + const std::string var3, + bool supports_expressions) { - conduit::Node n; - n["type"] = "object"; - n["additionalProperties"] = false; + schema_node.reset(); + + schema_node["type"] = "object"; + schema_node["additionalProperties"] = false; - n["properties/" + var1].set(number_schema(supports_expressions)); - n["properties/" + var2].set(number_schema(supports_expressions)); - n["properties/" + var3].set(number_schema(supports_expressions)); + number_schema(schema_node["properties/" + var1], supports_expressions); + number_schema(schema_node["properties/" + var2], supports_expressions); + number_schema(schema_node["properties/" + var3], supports_expressions); - n["required"].append() = var1; - n["required"].append() = var2; - n["required"].append() = var3; + schema_node["required"].append() = var1; + schema_node["required"].append() = var2; + schema_node["required"].append() = var3; - return n; + return schema_node; } -conduit::Node vec3_schema(bool supports_expressions) +conduit::Node &vec3_schema(conduit::Node &schema_node, bool supports_expressions) { - return vec3_schema("x", "y", "z", supports_expressions); + return vec3_schema(schema_node, "x", "y", "z", supports_expressions); } -conduit::Node vec3_schema_anyOf(const std::string var1, - const std::string var2, - const std::string var3, - bool supports_expressions) +conduit::Node &vec3_schema_anyOf(conduit::Node &schema_node, + const std::string var1, + const std::string var2, + const std::string var3, + bool supports_expressions) { - conduit::Node n; - n["type"] = "object"; - n["additionalProperties"] = false; + schema_node.reset(); + + schema_node["type"] = "object"; + schema_node["additionalProperties"] = false; - n["properties/" + var1].set(number_schema(supports_expressions)); - n["properties/" + var2].set(number_schema(supports_expressions)); - n["properties/" + var3].set(number_schema(supports_expressions)); + number_schema(schema_node["properties/" + var1], supports_expressions); + number_schema(schema_node["properties/" + var2], supports_expressions); + number_schema(schema_node["properties/" + var3], supports_expressions); - conduit::Node var1_required; + conduit::Node &var1_required = schema_node["anyOf"].append(); var1_required["type"] = "object"; var1_required["required"] = var1; - n["anyOf"].append().set(var1_required); - conduit::Node var2_required; + conduit::Node &var2_required = schema_node["anyOf"].append(); var2_required["type"] = "object"; - var2_required["required"] = var1; - n["anyOf"].append().set(var2_required); + var2_required["required"] = var2; - conduit::Node var3_required; + conduit::Node &var3_required = schema_node["anyOf"].append(); var3_required["type"] = "object"; - var3_required["required"] = var1; - n["anyOf"].append().set(var3_required); + var3_required["required"] = var3; - return n; + return schema_node; } -conduit::Node vec3_schema_anyOf(bool supports_expressions) +conduit::Node &vec3_schema_anyOf(conduit::Node &schema_node, bool supports_expressions) { - return vec3_schema_anyOf("x", "y", "z", supports_expressions); + return vec3_schema_anyOf(schema_node, "x", "y", "z", supports_expressions); } -conduit::Node array_schema(const conduit::Node &item_schema) +conduit::Node &array_schema(conduit::Node &schema_node, const conduit::Node &item_schema) { - conduit::Node n; - n["type"] = "array"; - n["items"].set(item_schema); - return n; + schema_node.reset(); + + schema_node["type"] = "array"; + if (!item_schema.dtype().is_empty()) + { + schema_node["items"].set(item_schema); + } + + return schema_node; } -conduit::Node array_schema() +conduit::Node &array_schema(conduit::Node &schema_node) { - conduit::Node n; - n["type"] = "array"; - return n; + schema_node.reset(); + schema_node["type"] = "array"; + return schema_node; } -conduit::Node ignore_schema() +conduit::Node &ignore_schema(conduit::Node &schema_node) { - conduit::Node n; - n["type"] = "object"; - n["constraints/skip"] = true; - return n; + schema_node.reset(); + + schema_node["type"] = "object"; + schema_node["constraints/skip"] = true; + + return schema_node; } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index cc934cd31..0bf38555f 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -43,29 +43,35 @@ namespace filters bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_msg); -conduit::Node ASCENT_API string_schema(); +conduit::Node ASCENT_API &string_schema(conduit::Node &schema_node); -conduit::Node ASCENT_API number_schema(bool supports_expressions = false); +conduit::Node ASCENT_API &number_schema(conduit::Node &schema_node, + bool supports_expressions = false); -conduit::Node ASCENT_API vec3_schema(bool supports_expressions = false); +conduit::Node ASCENT_API &vec3_schema(conduit::Node &schema_node, + bool supports_expressions = false); -conduit::Node ASCENT_API vec3_schema(const std::string var1, - const std::string var2, - const std::string var3, - bool supports_expressions = false); +conduit::Node ASCENT_API &vec3_schema(conduit::Node &schema_node, + const std::string var1, + const std::string var2, + const std::string var3, + bool supports_expressions = false); -conduit::Node ASCENT_API vec3_schema_anyOf(bool supports_expressions = false); +conduit::Node ASCENT_API &vec3_schema_anyOf(conduit::Node &schema_node, + bool supports_expressions = false); -conduit::Node ASCENT_API vec3_schema_anyOf(const std::string var1, - const std::string var2, - const std::string var3, - bool supports_expressions = false); +conduit::Node ASCENT_API &vec3_schema_anyOf(conduit::Node &schema_node, + const std::string var1, + const std::string var2, + const std::string var3, + bool supports_expressions = false); -conduit::Node ASCENT_API array_schema(); +conduit::Node ASCENT_API &array_schema(conduit::Node &schema_node); -conduit::Node ASCENT_API array_schema(const conduit::Node &item_schema); +conduit::Node ASCENT_API &array_schema(conduit::Node &schema_node, + const conduit::Node &item_schema); -conduit::Node ASCENT_API ignore_schema(); +conduit::Node ASCENT_API &ignore_schema(conduit::Node &schema_node); bool ASCENT_API check_numeric(const std::string path, const conduit::Node ¶ms, diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 5021a5563..d14a6be8c 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -136,20 +136,18 @@ VTKHMarchingCubes::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/levels"].set(number_schema()); - param_schema["properties/iso_values"].set(number_schema()); - param_schema["properties/use_contour_tree"].set(string_schema()); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/levels"]); + number_schema(param_schema["properties/iso_values"]); + string_schema(param_schema["properties/use_contour_tree"]); param_schema["required"].append() = "field"; param_schema["anyOf"].append() = "levels"; param_schema["anyOf"].append() = "iso_values"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -249,13 +247,11 @@ VTKHExternalSurfaces::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/topology"].set(string_schema()); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/topology"]); } //----------------------------------------------------------------------------- @@ -327,16 +323,14 @@ VTKHVectorMagnitude::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -419,16 +413,14 @@ VTKH3Slice::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/topology"].set(string_schema()); - param_schema["properties/x_offset"].set(number_schema(true)); - param_schema["properties/y_offset"].set(number_schema(true)); - param_schema["properties/z_offset"].set(number_schema(true)); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/topology"]); + number_schema(param_schema["properties/x_offset"], true); + number_schema(param_schema["properties/y_offset"], true); + number_schema(param_schema["properties/z_offset"], true); } //----------------------------------------------------------------------------- @@ -550,13 +542,11 @@ VTKHTriangulate::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/topology"].set(string_schema()); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/topology"]); } //----------------------------------------------------------------------------- @@ -628,14 +618,12 @@ VTKHCleanGrid::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; // optional - param_schema["properties/topology"].set(string_schema()); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/topology"]); } //----------------------------------------------------------------------------- @@ -710,7 +698,7 @@ VTKHSlice::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; param_schema["constraints/exclusiveChildren"].append() = "sphere"; @@ -721,64 +709,60 @@ VTKHSlice::declare_interface(Node &i) param_schema["constraints/allowNoneInExclusiveGroup"] = false; // optional - param_schema["properties/topology"].set(string_schema()); + string_schema(param_schema["properties/topology"]); // --- sphere --- - conduit::Node sphere_schema; + conduit::Node &sphere_schema = param_schema["properties/sphere"]; sphere_schema["type"] = "object"; sphere_schema["additionalProperties"] = false; - sphere_schema["properties/center"].set(vec3_schema(true)); - sphere_schema["properties/radius"].set(number_schema(true)); + vec3_schema(sphere_schema["properties/center"], true); + number_schema(sphere_schema["properties/radius"], true); sphere_schema["required"].append() = "center"; sphere_schema["required"].append() = "radius"; - param_schema["properties/sphere"].set(sphere_schema); // --- cylinder --- - conduit::Node cylinder_schema; + conduit::Node &cylinder_schema = param_schema["properties/cylinder"]; cylinder_schema["type"] = "object"; cylinder_schema["additionalProperties"] = false; - cylinder_schema["properties/center"].set(vec3_schema(true)); - cylinder_schema["properties/axis"].set(vec3_schema(true)); - cylinder_schema["properties/radius"].set(number_schema(true)); + vec3_schema(cylinder_schema["properties/center"], true); + vec3_schema(cylinder_schema["properties/axis"], true); + number_schema(cylinder_schema["properties/radius"], true); cylinder_schema["required"].append() = "center"; cylinder_schema["required"].append() = "axis"; cylinder_schema["required"].append() = "radius"; - param_schema["properties/cylinder"].set(cylinder_schema); // --- box --- - conduit::Node box_schema; + conduit::Node &box_schema = param_schema["properties/box"]; box_schema["type"] = "object"; box_schema["additionalProperties"] = false; - box_schema["properties/min"].set(vec3_schema(true)); - box_schema["properties/max"].set(vec3_schema(true)); + vec3_schema(box_schema["properties/min"], true); + vec3_schema(box_schema["properties/max"], true); box_schema["required"].append() = "min"; box_schema["required"].append() = "max"; - param_schema["properties/box"].set(box_schema); // --- plane --- - conduit::Node plane_schema; + conduit::Node &plane_schema = param_schema["properties/plane"]; plane_schema["type"] = "object"; plane_schema["additionalProperties"] = false; - plane_schema["properties/point"].set(vec3_schema(true)); - plane_schema["properties/normal"].set(vec3_schema(true)); + vec3_schema(plane_schema["properties/point"], true); + vec3_schema(plane_schema["properties/normal"], true); plane_schema["required"].append() = "point"; plane_schema["required"].append() = "normal"; - param_schema["properties/plane"].set(plane_schema); // --- old point style - conduit::Node point_schema; + conduit::Node &point_schema = param_schema["properties/point"]; point_schema["type"] = "object"; point_schema["additionalProperties"] = false; - point_schema["properties/x"].set(number_schema(true)); - point_schema["properties/y"].set(number_schema(true)); - point_schema["properties/z"].set(number_schema(true)); - point_schema["properties/x_offset"].set(number_schema(true)); - point_schema["properties/y_offset"].set(number_schema(true)); - point_schema["properties/z_offset"].set(number_schema(true)); + number_schema(point_schema["properties/x"], true); + number_schema(point_schema["properties/y"], true); + number_schema(point_schema["properties/z"], true); + number_schema(point_schema["properties/x_offset"], true); + number_schema(point_schema["properties/y_offset"], true); + number_schema(point_schema["properties/z_offset"], true); // Option A: explicit - conduit::Node option_1_explicit; + conduit::Node &option_1_explicit = point_schema["oneOf"].append(); option_1_explicit["type"] = "object"; option_1_explicit["required"].append() = "x"; option_1_explicit["required"].append() = "y"; @@ -786,10 +770,9 @@ VTKHSlice::declare_interface(Node &i) option_1_explicit["constraints/forbid"].append() = "x_offset"; option_1_explicit["constraints/forbid"].append() = "y_offset"; option_1_explicit["constraints/forbid"].append() = "z_offset"; - point_schema["oneOf"].append().set(option_1_explicit); // Option B: offset - conduit::Node option_2_offset; + conduit::Node &option_2_offset = point_schema["oneOf"].append(); option_2_offset["type"] = "object"; option_2_offset["required"].append() = "x_offset"; option_2_offset["required"].append() = "y_offset"; @@ -797,13 +780,9 @@ VTKHSlice::declare_interface(Node &i) option_2_offset["constraints/forbid"].append() = "x"; option_2_offset["constraints/forbid"].append() = "y"; option_2_offset["constraints/forbid"].append() = "z"; - point_schema["oneOf"].append().set(option_2_offset); - param_schema["properties/point"].set(point_schema); - param_schema["properties/normal"].set(vec3_schema(true)); + vec3_schema(param_schema["properties/normal"], true); param_schema["constraints/dependencies/normal"].append() = "point"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -986,19 +965,19 @@ VTKHAutoSliceLevels::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/normal"].set(vec3_schema(true)); - param_schema["properties/levels"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + vec3_schema(param_schema["properties/normal"], true); + number_schema(param_schema["properties/levels"], true); param_schema["required"].append() = "field"; param_schema["required"].append() = "normal"; param_schema["required"].append() = "levels"; - i["param_schema"].set(param_schema); + } //----------------------------------------------------------------------------- @@ -1160,19 +1139,17 @@ VTKHGhostStripper::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema(true)); - param_schema["properties/max_value"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/min_value"], true); + number_schema(param_schema["properties/max_value"], true); param_schema["required"].append() = "field"; param_schema["required"].append() = "min_value"; param_schema["required"].append() = "max_value"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1261,15 +1238,13 @@ VTKHAddRanks::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; // optional - param_schema["properties/topology"].set(string_schema()); - param_schema["properties/output"].set(string_schema()); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/topology"]); + string_schema(param_schema["properties/output"]); } //----------------------------------------------------------------------------- @@ -1356,15 +1331,13 @@ VTKHAddDomains::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; // optional - param_schema["properties/topology"].set(string_schema()); - param_schema["properties/output"].set(string_schema()); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/topology"]); + string_schema(param_schema["properties/output"]); } //----------------------------------------------------------------------------- @@ -1446,7 +1419,7 @@ VTKHThreshold::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; param_schema["constraints/exclusiveChildren"].append() = "field"; @@ -1458,73 +1431,66 @@ VTKHThreshold::declare_interface(Node &i) param_schema["constraints/allowNoneInExclusiveGroup"] = false; // optional - param_schema["properties/field"].set(string_schema()); - param_schema["properties/topology"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema(true)); - param_schema["properties/max_value"].set(number_schema(true)); - param_schema["properties/invert"].set(string_schema()); - param_schema["properties/extract"].set(string_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/topology"]); + number_schema(param_schema["properties/min_value"], true); + number_schema(param_schema["properties/max_value"], true); + string_schema(param_schema["properties/invert"]); + string_schema(param_schema["properties/extract"]); param_schema["anyOf"].append() = "field"; param_schema["anyOf"].append() = "topology"; // --- sphere --- - conduit::Node sphere_schema; + conduit::Node &sphere_schema = param_schema["properties/sphere"]; sphere_schema["type"] = "object"; sphere_schema["additionalProperties"] = false; - sphere_schema["properties/center"].set(vec3_schema(true)); - sphere_schema["properties/radius"].set(number_schema(true)); + vec3_schema(sphere_schema["properties/center"], true); + number_schema(sphere_schema["properties/radius"], true); sphere_schema["required"].append() = "center"; sphere_schema["required"].append() = "radius"; - param_schema["properties/sphere"].set(sphere_schema); // --- cylinder --- - conduit::Node cylinder_schema; + conduit::Node &cylinder_schema = param_schema["properties/cylinder"]; cylinder_schema["type"] = "object"; cylinder_schema["additionalProperties"] = false; - cylinder_schema["properties/center"].set(vec3_schema(true)); - cylinder_schema["properties/axis"].set(vec3_schema(true)); - cylinder_schema["properties/radius"].set(number_schema(true)); + vec3_schema(cylinder_schema["properties/center"], true); + vec3_schema(cylinder_schema["properties/axis"], true); + number_schema(cylinder_schema["properties/radius"], true); cylinder_schema["required"].append() = "center"; cylinder_schema["required"].append() = "axis"; cylinder_schema["required"].append() = "radius"; - param_schema["properties/cylinder"].set(cylinder_schema); // --- box --- - conduit::Node box_schema; + conduit::Node &box_schema = param_schema["properties/box"]; box_schema["type"] = "object"; box_schema["additionalProperties"] = false; - box_schema["properties/min"].set(vec3_schema(true)); - box_schema["properties/max"].set(vec3_schema(true)); + vec3_schema(box_schema["properties/min"], true); + vec3_schema(box_schema["properties/max"], true); box_schema["required"].append() = "min"; box_schema["required"].append() = "max"; - param_schema["properties/box"].set(box_schema); // --- plane --- - conduit::Node plane_schema; + conduit::Node &plane_schema = param_schema["properties/plane"]; plane_schema["type"] = "object"; plane_schema["additionalProperties"] = false; - plane_schema["properties/point"].set(vec3_schema(true)); - plane_schema["properties/normal"].set(vec3_schema(true)); + vec3_schema(plane_schema["properties/point"], true); + vec3_schema(plane_schema["properties/normal"], true); plane_schema["required"].append() = "point"; plane_schema["required"].append() = "normal"; - param_schema["properties/plane"].set(plane_schema); // --- multi plane --- - conduit::Node multi_plane_schema; + conduit::Node &multi_plane_schema = param_schema["properties/multi_plane"]; multi_plane_schema["type"] = "object"; multi_plane_schema["additionalProperties"] = false; - multi_plane_schema["properties/point1"].set(vec3_schema(true)); - multi_plane_schema["properties/point2"].set(vec3_schema(true)); - multi_plane_schema["properties/normal1"].set(vec3_schema(true)); - multi_plane_schema["properties/normal2"].set(vec3_schema(true)); + vec3_schema(multi_plane_schema["properties/point1"], true); + vec3_schema(multi_plane_schema["properties/point2"], true); + vec3_schema(multi_plane_schema["properties/normal1"], true); + vec3_schema(multi_plane_schema["properties/normal2"], true); multi_plane_schema["required"].append() = "point1"; multi_plane_schema["required"].append() = "point2"; multi_plane_schema["required"].append() = "normal1"; multi_plane_schema["required"].append() = "normal2"; - param_schema["properties/multi_plane"].set(multi_plane_schema); - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1720,7 +1686,7 @@ VTKHClip::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; param_schema["constraints/exclusiveChildren"].append() = "sphere"; @@ -1731,66 +1697,59 @@ VTKHClip::declare_interface(Node &i) param_schema["constraints/allowNoneInExclusiveGroup"] = false; // optional - param_schema["properties/topology"].set(string_schema()); - param_schema["properties/invert"].set(string_schema()); + string_schema(param_schema["properties/topology"]); + string_schema(param_schema["properties/invert"]); // --- sphere --- - conduit::Node sphere_schema; + conduit::Node &sphere_schema = param_schema["properties/sphere"]; sphere_schema["type"] = "object"; sphere_schema["additionalProperties"] = false; - sphere_schema["properties/center"].set(vec3_schema(true)); - sphere_schema["properties/radius"].set(number_schema(true)); + vec3_schema(sphere_schema["properties/center"], true); + number_schema(sphere_schema["properties/radius"], true); sphere_schema["required"].append() = "center"; sphere_schema["required"].append() = "radius"; - param_schema["properties/sphere"].set(sphere_schema); // --- cylinder --- - conduit::Node cylinder_schema; + conduit::Node &cylinder_schema = param_schema["properties/cylinder"]; cylinder_schema["type"] = "object"; cylinder_schema["additionalProperties"] = false; - cylinder_schema["properties/center"].set(vec3_schema(true)); - cylinder_schema["properties/axis"].set(vec3_schema(true)); - cylinder_schema["properties/radius"].set(number_schema(true)); + vec3_schema(cylinder_schema["properties/center"], true); + vec3_schema(cylinder_schema["properties/axis"], true); + number_schema(cylinder_schema["properties/radius"], true); cylinder_schema["required"].append() = "center"; cylinder_schema["required"].append() = "axis"; cylinder_schema["required"].append() = "radius"; - param_schema["properties/cylinder"].set(cylinder_schema); // --- box --- - conduit::Node box_schema; + conduit::Node &box_schema = param_schema["properties/box"]; box_schema["type"] = "object"; box_schema["additionalProperties"] = false; - box_schema["properties/min"].set(vec3_schema(true)); - box_schema["properties/max"].set(vec3_schema(true)); + vec3_schema(box_schema["properties/min"], true); + vec3_schema(box_schema["properties/max"], true); box_schema["required"].append() = "min"; box_schema["required"].append() = "max"; - param_schema["properties/box"].set(box_schema); // --- plane --- - conduit::Node plane_schema; + conduit::Node &plane_schema = param_schema["properties/plane"]; plane_schema["type"] = "object"; plane_schema["additionalProperties"] = false; - plane_schema["properties/point"].set(vec3_schema(true)); - plane_schema["properties/normal"].set(vec3_schema(true)); + vec3_schema(plane_schema["properties/point"], true); + vec3_schema(plane_schema["properties/normal"], true); plane_schema["required"].append() = "point"; plane_schema["required"].append() = "normal"; - param_schema["properties/plane"].set(plane_schema); // --- multi plane --- - conduit::Node multi_plane_schema; + conduit::Node &multi_plane_schema = param_schema["properties/multi_plane"]; multi_plane_schema["type"] = "object"; multi_plane_schema["additionalProperties"] = false; - multi_plane_schema["properties/point1"].set(vec3_schema(true)); - multi_plane_schema["properties/point2"].set(vec3_schema(true)); - multi_plane_schema["properties/normal1"].set(vec3_schema(true)); - multi_plane_schema["properties/normal2"].set(vec3_schema(true)); + vec3_schema(multi_plane_schema["properties/point1"], true); + vec3_schema(multi_plane_schema["properties/point2"], true); + vec3_schema(multi_plane_schema["properties/normal1"], true); + vec3_schema(multi_plane_schema["properties/normal2"], true); multi_plane_schema["required"].append() = "point1"; multi_plane_schema["required"].append() = "point2"; multi_plane_schema["required"].append() = "normal1"; multi_plane_schema["required"].append() = "normal2"; - param_schema["properties/multi_plane"].set(multi_plane_schema); - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1947,18 +1906,16 @@ VTKHClipWithField::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/clip_value"].set(number_schema(true)); - param_schema["properties/field"].set(string_schema()); - param_schema["properties/invert"].set(string_schema()); + number_schema(param_schema["properties/clip_value"], true); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/invert"]); param_schema["required"].append() = "clip_value"; param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2047,19 +2004,17 @@ VTKHIsoVolume::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/min_value"].set(number_schema(true)); - param_schema["properties/max_value"].set(number_schema(true)); - param_schema["properties/field"].set(string_schema()); + number_schema(param_schema["properties/min_value"], true); + number_schema(param_schema["properties/max_value"], true); + string_schema(param_schema["properties/field"]); param_schema["required"].append() = "min_value"; param_schema["required"].append() = "max_value"; param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2141,17 +2096,17 @@ VTKHLagrangian::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/step_size"].set(number_schema()); - param_schema["properties/write_frequency"].set(number_schema()); - param_schema["properties/cust_res"].set(number_schema()); - param_schema["properties/x_res"].set(number_schema()); - param_schema["properties/y_res"].set(number_schema()); - param_schema["properties/z_res"].set(number_schema()); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/step_size"]); + number_schema(param_schema["properties/write_frequency"]); + number_schema(param_schema["properties/cust_res"]); + number_schema(param_schema["properties/x_res"]); + number_schema(param_schema["properties/y_res"]); + number_schema(param_schema["properties/z_res"]); param_schema["required"].append() = "field"; param_schema["required"].append() = "step_size"; @@ -2160,8 +2115,6 @@ VTKHLagrangian::declare_interface(Node &i) param_schema["required"].append() = "x_res"; param_schema["required"].append() = "y_res"; param_schema["required"].append() = "z_res"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2250,17 +2203,15 @@ VTKHLog::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/clamp_min_value"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); + number_schema(param_schema["properties/clamp_min_value"], true); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2346,17 +2297,15 @@ VTKHLog10::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/clamp_min_value"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); + number_schema(param_schema["properties/clamp_min_value"], true); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2442,17 +2391,15 @@ VTKHLog2::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/clamp_min_value"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); + number_schema(param_schema["properties/clamp_min_value"], true); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2538,17 +2485,15 @@ VTKHRecenter::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/association"].set(string_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/association"]); param_schema["required"].append() = "field"; param_schema["required"].append() = "association"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2640,17 +2585,15 @@ VTKHHistSampling::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/bins"].set(number_schema(true)); - param_schema["properties/sample_rate"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/bins"], true); + number_schema(param_schema["properties/sample_rate"], true); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2779,17 +2722,15 @@ VTKHQCriterion::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/use_cell_gradient"].set(string_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); + string_schema(param_schema["properties/use_cell_gradient"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2888,17 +2829,15 @@ VTKHDivergence::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/use_cell_gradient"].set(string_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); + string_schema(param_schema["properties/use_cell_gradient"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2996,17 +2935,15 @@ VTKHVorticity::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/use_cell_gradient"].set(string_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); + string_schema(param_schema["properties/use_cell_gradient"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3104,17 +3041,15 @@ VTKHGradient::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/use_cell_gradient"].set(string_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/output_name"]); + string_schema(param_schema["properties/use_cell_gradient"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3204,21 +3139,19 @@ VTKHUniformGrid::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/fields"].set(array_schema(ignore_schema())); - param_schema["properties/dims"].set(vec3_schema_anyOf("i", "j", "k")); - param_schema["properties/origin"].set(vec3_schema_anyOf()); - param_schema["properties/spacing"].set(vec3_schema_anyOf("dx", "dy", "dz")); - param_schema["properties/invalid_value"].set(number_schema()); + string_schema(param_schema["properties/field"]); + array_schema(param_schema["properties/fields"]); + vec3_schema_anyOf(param_schema["properties/dims"], "i", "j", "k"); + vec3_schema_anyOf(param_schema["properties/origin"]); + vec3_schema_anyOf(param_schema["properties/spacing"], "dx", "dy", "dz"); + number_schema(param_schema["properties/invalid_value"]); param_schema["anyOf"].append() = "field"; param_schema["anyOf"].append() = "fields"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3386,48 +3319,43 @@ VTKHSample::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/fields"].set(array_schema(ignore_schema())); - param_schema["properties/invalid_value"].set(number_schema()); + string_schema(param_schema["properties/field"]); + array_schema(param_schema["properties/fields"]); + number_schema(param_schema["properties/invalid_value"]); // --- Line --- - conduit::Node line_schema; + conduit::Node &line_schema = param_schema["properties/line"]; line_schema["type"] = "object"; line_schema["additionalProperties"] = false; - line_schema["properties/num_samples"].set(number_schema()); - line_schema["properties/start"].set(vec3_schema_anyOf()); - line_schema["properties/end"].set(vec3_schema_anyOf()); - param_schema["properties/line"].set(line_schema); + number_schema(line_schema["properties/num_samples"]); + vec3_schema_anyOf(line_schema["properties/start"]); + vec3_schema_anyOf(line_schema["properties/end"]); // --- Points --- - param_schema["properties/points"].set(vec3_schema_anyOf()); + vec3_schema_anyOf(param_schema["properties/points"]); // --- Box --- - conduit::Node box_schema; + conduit::Node &box_schema = param_schema["properties/box"]; box_schema["type"] = "object"; box_schema["additionalProperties"] = false; - box_schema["properties/dims"].set(vec3_schema_anyOf()); - box_schema["properties/min"].set(vec3_schema_anyOf()); - box_schema["properties/max"].set(vec3_schema_anyOf()); - param_schema["properties/box"].set(box_schema); + vec3_schema_anyOf(box_schema["properties/dims"]); + vec3_schema_anyOf(box_schema["properties/min"]); + vec3_schema_anyOf(box_schema["properties/max"]); // --- Uniform Grid --- - conduit::Node uniform_grid_schema; + conduit::Node &uniform_grid_schema = param_schema["properties/uniform_grid"]; uniform_grid_schema["type"] = "object"; uniform_grid_schema["additionalProperties"] = false; - uniform_grid_schema["properties/dims"].set(vec3_schema_anyOf("i", "j", "k")); - uniform_grid_schema["properties/origin"].set(vec3_schema_anyOf()); - uniform_grid_schema["properties/spacing"].set(vec3_schema_anyOf("dx", "dy", "dz")); - param_schema["properties/uniform_grid"].set(uniform_grid_schema); + vec3_schema_anyOf(uniform_grid_schema["properties/dims"], "i", "j", "k"); + vec3_schema_anyOf(uniform_grid_schema["properties/origin"]); + vec3_schema_anyOf(uniform_grid_schema["properties/spacing"], "dx", "dy", "dz"); param_schema["anyOf"].append() = "field"; param_schema["anyOf"].append() = "fields"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3794,14 +3722,12 @@ VTKHStats::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); + string_schema(param_schema["properties/field"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3875,16 +3801,14 @@ VTKHHistogram::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/bins"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/bins"], true); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -3962,18 +3886,16 @@ VTKHProject2d::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/topology"].set(string_schema()); - param_schema["properties/image_width"].set(number_schema()); - param_schema["properties/image_height"].set(number_schema()); - param_schema["properties/dataset_bounds"].set(ignore_schema()); - param_schema["properties/camera"].set(ignore_schema()); - param_schema["properties/fields"].set(array_schema(ignore_schema())); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/topology"]); + number_schema(param_schema["properties/image_width"]); + number_schema(param_schema["properties/image_height"]); + ignore_schema(param_schema["properties/dataset_bounds"]); + ignore_schema(param_schema["properties/camera"]); + array_schema(param_schema["properties/fields"]); } //----------------------------------------------------------------------------- @@ -4117,14 +4039,12 @@ VTKHNoOp::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); + string_schema(param_schema["properties/field"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -4202,19 +4122,17 @@ VTKHVectorComponent::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/component"].set(number_schema()); - param_schema["properties/output_name"].set(string_schema()); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/component"]); + string_schema(param_schema["properties/output_name"]); param_schema["required"].append() = "field"; param_schema["required"].append() = "component"; param_schema["required"].append() = "output_name"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -4296,20 +4214,18 @@ VTKHCompositeVector::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field1"].set(string_schema()); - param_schema["properties/field2"].set(string_schema()); - param_schema["properties/field3"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); + string_schema(param_schema["properties/field1"]); + string_schema(param_schema["properties/field2"]); + string_schema(param_schema["properties/field3"]); + string_schema(param_schema["properties/output_name"]); param_schema["required"].append() = "field1"; param_schema["required"].append() = "field2"; param_schema["required"].append() = "output_name"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -4421,7 +4337,7 @@ VTKHScale::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema = vec3_schema("x_scale", "y_scale", "z_scale", true); + vec3_schema(i["param_schema"], "x_scale", "y_scale", "z_scale", true); } //----------------------------------------------------------------------------- @@ -4497,7 +4413,7 @@ VTKHTransform::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; param_schema["constraints/exclusiveChildren"].append() = "scale"; @@ -4507,34 +4423,32 @@ VTKHTransform::declare_interface(Node &i) param_schema["constraints/exclusiveChildren"].append() = "matrix"; param_schema["constraints/allowNoneInExclusiveGroup"] = false; - param_schema["properties/scale"].set(vec3_schema_anyOf(true)); - param_schema["properties/translate"].set(vec3_schema_anyOf(true)); + vec3_schema_anyOf(param_schema["properties/scale"], true); + vec3_schema_anyOf(param_schema["properties/translate"], true); // --- rotate --- - conduit::Node rotate_schema; + conduit::Node &rotate_schema = param_schema["properties/rotate"]; rotate_schema["type"] = "object"; rotate_schema["additionalProperties"] = false; - rotate_schema["properties/angle"].set(number_schema(true)); - rotate_schema["properties/axis"].set(vec3_schema_anyOf(true)); + number_schema(rotate_schema["properties/angle"], true); + vec3_schema_anyOf(rotate_schema["properties/axis"], true); rotate_schema["required"].append() = "angle"; rotate_schema["required"].append() = "axis"; - param_schema["properties/rotate"].set(rotate_schema); // --- reflect --- - conduit::Node reflect_schema; + conduit::Node &reflect_schema = param_schema["properties/reflect"]; reflect_schema["type"] = "object"; reflect_schema["additionalProperties"] = false; - reflect_schema["properties/normal"].set(vec3_schema_anyOf(true)); - reflect_schema["properties/point"].set(vec3_schema_anyOf(true)); - param_schema["properties/reflect"].set(reflect_schema); + vec3_schema_anyOf(reflect_schema["properties/normal"], true); + vec3_schema_anyOf(reflect_schema["properties/point"], true); // --- matrix --- - conduit::Node matrix_schema = array_schema(number_schema(true)); + conduit::Node matrix_item_schema; + conduit::Node &matrix_schema = array_schema(param_schema["properties/matrix"], number_schema(matrix_item_schema, true)); matrix_schema["minItems"] = 16; matrix_schema["maxItems"] = 16; - param_schema["properties/matrix"].set(matrix_schema); - - i["param_schema"].set(param_schema); + + std::cout << param_schema.to_yaml() << std::endl; } //----------------------------------------------------------------------------- @@ -4818,31 +4732,31 @@ VTKHParticleAdvection::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/num_steps"].set(number_schema(true)); - param_schema["properties/step_size"].set(number_schema(true)); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/num_steps"], true); + number_schema(param_schema["properties/step_size"], true); // --- seed --- - conduit::Node seeds_schema; + conduit::Node &seeds_schema = param_schema["properties/seeds"]; seeds_schema["type"] = "object"; seeds_schema["additionalProperties"] = false; - seeds_schema["properties/type"].set(string_schema()); - seeds_schema["properties/location"].set(number_schema()); - seeds_schema["properties/start"].set(number_schema()); - seeds_schema["properties/end"].set(number_schema()); - seeds_schema["properties/num_seeds"].set(number_schema()); - seeds_schema["properties/num_seeds_x"].set(number_schema()); - seeds_schema["properties/num_seeds_y"].set(number_schema()); - seeds_schema["properties/num_seeds_z"].set(number_schema()); - seeds_schema["properties/extents_x"].set(number_schema()); - seeds_schema["properties/extents_y"].set(number_schema()); - seeds_schema["properties/extents_z"].set(number_schema()); - seeds_schema["properties/sampling_type"].set(string_schema()); - seeds_schema["properties/sampling_space"].set(string_schema()); + string_schema(seeds_schema["properties/type"]); + number_schema(seeds_schema["properties/location"]); + number_schema(seeds_schema["properties/start"]); + number_schema(seeds_schema["properties/end"]); + number_schema(seeds_schema["properties/num_seeds"]); + number_schema(seeds_schema["properties/num_seeds_x"]); + number_schema(seeds_schema["properties/num_seeds_y"]); + number_schema(seeds_schema["properties/num_seeds_z"]); + number_schema(seeds_schema["properties/extents_x"]); + number_schema(seeds_schema["properties/extents_y"]); + number_schema(seeds_schema["properties/extents_z"]); + string_schema(seeds_schema["properties/sampling_type"]); + string_schema(seeds_schema["properties/sampling_space"]); seeds_schema["required"].append() = "type"; seeds_schema["constraints/dependencies/extents_x"].append() = "extents_y"; @@ -4853,25 +4767,23 @@ VTKHParticleAdvection::declare_interface(Node &i) seeds_schema["constraints/dependencies/extents_z"].append() = "extents_y"; // type == point - conduit::Node point_option; + conduit::Node &point_option = seeds_schema["oneOf"].append(); point_option["type"] = "object"; point_option["properties/type/type"] = "string"; point_option["properties/type/constraints/const"] = "point"; point_option["required"].append() = "type"; point_option["required"].append() = "location"; - seeds_schema["oneOf"].append().set(point_option); // type == point_list - conduit::Node point_list_option; + conduit::Node &point_list_option = seeds_schema["oneOf"].append(); point_list_option["type"] = "object"; point_list_option["properties/type/type"] = "string"; point_list_option["properties/type/constraints/const"] = "point_list"; point_list_option["required"].append() = "type"; point_list_option["required"].append() = "location"; - seeds_schema["oneOf"].append().set(point_list_option); // type == line - conduit::Node line_option; + conduit::Node &line_option = seeds_schema["oneOf"].append(); line_option["type"] = "object"; line_option["properties/type/type"] = "string"; line_option["properties/type/constraints/const"] = "line"; @@ -4880,10 +4792,9 @@ VTKHParticleAdvection::declare_interface(Node &i) line_option["required"].append() = "end"; line_option["required"].append() = "num_seeds"; line_option["required"].append() = "sampling_type"; - seeds_schema["oneOf"].append().set(line_option); // type == box - conduit::Node box_option; + conduit::Node &box_option = seeds_schema["oneOf"].append(); box_option["type"] = "object"; box_option["properties/type/type"] = "string"; box_option["properties/type/constraints/const"] = "box"; @@ -4891,7 +4802,7 @@ VTKHParticleAdvection::declare_interface(Node &i) box_option["required"].append() = "sampling_space"; box_option["required"].append() = "sampling_type"; { - conduit::Node box_option_uniform; + conduit::Node &box_option_uniform = box_option["oneOf"].append(); box_option_uniform["type"] = "object"; box_option_uniform["properties/sampling_type/type"] = "string"; box_option_uniform["properties/sampling_type/constraints/const"] = "uniform"; @@ -4899,38 +4810,30 @@ VTKHParticleAdvection::declare_interface(Node &i) box_option_uniform["required"].append() = "num_seeds_x"; box_option_uniform["required"].append() = "num_seeds_y"; box_option_uniform["required"].append() = "num_seeds_z"; - box_option["oneOf"].append().set(box_option_uniform); } { - conduit::Node box_option_non_uniform; + conduit::Node &box_option_non_uniform = box_option["oneOf"].append(); box_option_non_uniform["type"] = "object"; box_option_non_uniform["required"].append() = "sampling_type"; box_option_non_uniform["required"].append() = "num_seeds"; box_option_non_uniform["constraints/not_const/sampling_type"] = "uniform"; - box_option["oneOf"].append().set(box_option_non_uniform); } - seeds_schema["oneOf"].append().set(box_option); - - param_schema["properties/seeds"].set(seeds_schema); // --- rendering --- - conduit::Node rendering_schema; + conduit::Node &rendering_schema = param_schema["properties/rendering"]; rendering_schema["type"] = "object"; rendering_schema["additionalProperties"] = false; - rendering_schema["properties/enable_tubes"].set(string_schema()); - rendering_schema["properties/tube_capping"].set(string_schema()); - rendering_schema["properties/tube_size"].set(number_schema()); - rendering_schema["properties/tube_sides"].set(number_schema()); - rendering_schema["properties/tube_value"].set(number_schema()); - rendering_schema["properties/output_field"].set(string_schema()); - param_schema["properties/rendering"].set(rendering_schema); + string_schema(rendering_schema["properties/enable_tubes"]); + string_schema(rendering_schema["properties/tube_capping"]); + number_schema(rendering_schema["properties/tube_size"]); + number_schema(rendering_schema["properties/tube_sides"]); + number_schema(rendering_schema["properties/tube_value"]); + string_schema(rendering_schema["properties/output_field"]); param_schema["required"].append() = "field"; param_schema["required"].append() = "num_steps"; param_schema["required"].append() = "step_size"; param_schema["required"].append() = "seeds"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -5466,31 +5369,28 @@ VTKHWarpXStreamline::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/b_field"].set(string_schema()); - param_schema["properties/e_field"].set(string_schema()); - param_schema["properties/num_steps"].set(number_schema(true)); - param_schema["properties/step_size"].set(number_schema(true)); + string_schema(param_schema["properties/b_field"]); + string_schema(param_schema["properties/e_field"]); + number_schema(param_schema["properties/num_steps"], true); + number_schema(param_schema["properties/step_size"], true); // --- rendering --- - conduit::Node rendering_schema; + conduit::Node &rendering_schema = param_schema["properties/rendering"]; rendering_schema["type"] = "object"; rendering_schema["additionalProperties"] = false; - rendering_schema["properties/enable_tubes"].set(string_schema()); - rendering_schema["properties/tube_capping"].set(string_schema()); - rendering_schema["properties/tube_size"].set(number_schema()); - rendering_schema["properties/tube_sides"].set(number_schema()); - rendering_schema["properties/tube_value"].set(number_schema()); - rendering_schema["properties/output_field"].set(string_schema()); - param_schema["properties/rendering"].set(rendering_schema); + string_schema(rendering_schema["properties/enable_tubes"]); + string_schema(rendering_schema["properties/tube_capping"]); + number_schema(rendering_schema["properties/tube_size"]); + number_schema(rendering_schema["properties/tube_sides"]); + number_schema(rendering_schema["properties/tube_value"]); + string_schema(rendering_schema["properties/output_field"]); param_schema["required"].append() = "num_steps"; param_schema["required"].append() = "step_size"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -5656,16 +5556,14 @@ VTKHVTKFileExtract::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/path"].set(string_schema()); - param_schema["properties/topology"].set(string_schema()); + string_schema(param_schema["properties/path"]); + string_schema(param_schema["properties/topology"]); param_schema["required"].append() = "path"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -5848,20 +5746,18 @@ VTKHMIR::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/matset"].set(string_schema()); - param_schema["properties/output_name"].set(string_schema()); - param_schema["properties/error_scaling"].set(number_schema()); - param_schema["properties/scaling_decay"].set(number_schema()); - param_schema["properties/iterations"].set(number_schema()); - param_schema["properties/max_error"].set(number_schema()); + string_schema(param_schema["properties/matset"]); + string_schema(param_schema["properties/output_name"]); + number_schema(param_schema["properties/error_scaling"]); + number_schema(param_schema["properties/scaling_decay"]); + number_schema(param_schema["properties/iterations"]); + number_schema(param_schema["properties/max_error"]); param_schema["required"].append() = "matset"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- From 1e109b9d2beb41193282615fa77c740a13d8415f Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 17:14:04 -0700 Subject: [PATCH 37/50] Generalizing the expression checking to any format checking --- src/libs/ascent/ascent.cpp | 2 +- .../ascent_runtime_param_check.cpp | 2 +- .../ascent_runtime_param_check.hpp | 2 ++ src/libs/flow/flow_schema_validator.cpp | 27 +++++++++---------- src/libs/flow/flow_schema_validator.hpp | 4 +-- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/libs/ascent/ascent.cpp b/src/libs/ascent/ascent.cpp index 156a00d14..aeeb1b63c 100644 --- a/src/libs/ascent/ascent.cpp +++ b/src/libs/ascent/ascent.cpp @@ -652,7 +652,7 @@ Ascent::open(const conduit::Node &options) m_runtime->Initialize(m_options); // Set the flow filter expression checker: - flow::schema::set_expression_checker(&runtime::filters::is_valid_expression); + runtime::filters::ascent_register_flow_schema_hooks(); // don't print info messages unless we are using verbose // Runtimes may set their own handlers in initialize, so diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index e9728b39e..f84190b5b 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -83,7 +83,7 @@ bool is_valid_expression(const std::string &expr, std::string &err_msg) void ascent_register_flow_schema_hooks() { - flow::schema::set_expression_checker(&is_valid_expression); + flow::schema::register_format_checker("expression", &is_valid_expression); } conduit::Node &string_schema(conduit::Node &schema_node) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 0bf38555f..ce4da0e77 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -43,6 +43,8 @@ namespace filters bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_msg); +void ASCENT_API ascent_register_flow_schema_hooks(); + conduit::Node ASCENT_API &string_schema(conduit::Node &schema_node); conduit::Node ASCENT_API &number_schema(conduit::Node &schema_node, diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index e4e8befa0..bba10e0e8 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -36,11 +36,7 @@ namespace detail { // ---------- General Helpers ---------- -ExpressionCheckFn &expr_checker() -{ - static ExpressionCheckFn fn = nullptr; - return fn; -} +std::map format_checker_functions; void add_error(conduit::Node &info, const std::string &msg) { @@ -472,18 +468,19 @@ bool validate_format(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_child("format")) return true; - if(!schema["format"].dtype().is_string()) return true; + if(!schema.has_child("format") || !schema["format"].dtype().is_string()) + { + return true; + } const std::string fmt = schema["format"].as_string(); - if(fmt != "expression") return true; - if(!input.dtype().is_string()) return true; - - auto expr_fn = expr_checker(); - if(expr_fn == nullptr) return true; + if (format_checker_functions.find(fmt) == format_checker_functions.end()) + { + return true; + } std::string err; - bool ok = expr_fn(input.as_string(), err); + bool ok = format_checker_functions[fmt](input.as_string(), err); if(!ok) { add_error(info, "Invalid expression at '" + (path.empty() ? std::string("") : path) + "': " + err); @@ -594,9 +591,9 @@ bool validate_node(const conduit::Node &schema, // -- end flow::schema::detail -- //----------------------------------------------------------------------------- -void set_expression_checker(ExpressionCheckFn fn) +void register_format_checker(const std::string &format_name, FormatCheckFunction callback) { - detail::expr_checker() = fn; + detail::format_checker_functions[format_name] = callback; } // ---------- Schema Validation Entry-Point ---------- diff --git a/src/libs/flow/flow_schema_validator.hpp b/src/libs/flow/flow_schema_validator.hpp index 26587ff81..9e038e567 100644 --- a/src/libs/flow/flow_schema_validator.hpp +++ b/src/libs/flow/flow_schema_validator.hpp @@ -31,9 +31,9 @@ namespace flow namespace schema { -using ExpressionCheckFn = bool (*)(const std::string &expr, std::string &err_msg); +using FormatCheckFunction = bool (*)(const std::string &expr, std::string &err_msg); -void FLOW_API set_expression_checker(ExpressionCheckFn fn); +void FLOW_API register_format_checker(const std::string &format_name, FormatCheckFunction callback); bool FLOW_API validate(const conduit::Node &schema, const conduit::Node &input, From 95cd1f138897a4a4fe87058e4ae0d91702a0cc17 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 17:27:38 -0700 Subject: [PATCH 38/50] Applied formatting fixes --- src/libs/flow/flow_filter.cpp | 6 - src/libs/flow/flow_schema_validator.cpp | 148 ++++++++++++++++++------ 2 files changed, 113 insertions(+), 41 deletions(-) diff --git a/src/libs/flow/flow_filter.cpp b/src/libs/flow/flow_filter.cpp index 9f502c767..c733fef37 100644 --- a/src/libs/flow/flow_filter.cpp +++ b/src/libs/flow/flow_filter.cpp @@ -228,12 +228,6 @@ Filter::verify_params(const Node ¶ms, if (!param_schema().dtype().is_empty() && !(param_schema().dtype().is_object() && param_schema().number_of_children() == 0)) { - // std::cout << "\nSlice Properties!!" << std::endl; - // param_schema().print(); - - // std::cout << "\nParams!!" << std::endl; - // params.print(); - return flow::schema::validate(param_schema(), params, info); } diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index bba10e0e8..26505b48d 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -62,15 +62,32 @@ bool check_type(const conduit::Node &input, const std::string &path) { const std::string schema_defined_type = get_type_string(schema); - if(schema_defined_type.empty()) return true; // schema didn't specify; treat as "accept anything" + if(schema_defined_type.empty()) + { + return true; // schema didn't specify; treat as "accept anything" + } const auto data_type = input.dtype(); bool ok = true; - if(schema_defined_type == "object") ok = data_type.is_object(); - else if(schema_defined_type == "string") ok = data_type.is_string(); - else if(schema_defined_type == "number") ok = data_type.is_number(); - else if(schema_defined_type == "array") ok = (data_type.is_list() || (data_type.is_number() && data_type.number_of_elements() >= 1) || data_type.is_object()); + if(schema_defined_type == "object") + { + ok = data_type.is_object(); + } + else if(schema_defined_type == "string") + { + ok = data_type.is_string(); + } + else if(schema_defined_type == "number") + { + ok = data_type.is_number(); + } + else if(schema_defined_type == "array") + { + ok = (data_type.is_list() || + (data_type.is_number() && data_type.number_of_elements() >= 1) || + data_type.is_object()); + } else { add_error(info, "At '" + (path.empty() ? std::string("") : path) + @@ -100,8 +117,10 @@ bool validate_required(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_child("required")) return true; - if(!input.dtype().is_object()) return true; // type error handled elsewhere + if(!schema.has_child("required") || !input.dtype().is_object()) + { + return true; // type error handled elsewhere + } bool ok = true; const conduit::Node &req = schema["required"]; @@ -110,7 +129,7 @@ bool validate_required(const conduit::Node &schema, const std::string k = req.child(i).as_string(); if(!input.has_child(k)) { - add_error(info, "Missing required field '" + conduit::utils::join_file_path(path, k) + "'"); + add_error(info, "Missing required field '" + conduit::utils::join_path(path, k) + "'"); ok = false; } } @@ -122,8 +141,10 @@ bool validate_forbid(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_path("constraints/forbid")) return true; - if(!input.dtype().is_object()) return true; + if(!schema.has_path("constraints/forbid") || !input.dtype().is_object()) + { + return true; + } bool ok = true; const conduit::Node &forbid = schema["constraints/forbid"]; @@ -144,7 +165,10 @@ bool validate_const(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_path("constraints/const")) return true; + if(!schema.has_path("constraints/const")) + { + return true; + } const conduit::Node &c = schema["constraints/const"]; // Only implement string const for now (that’s all we used above) @@ -167,8 +191,10 @@ bool validate_not_const_fields(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_path("constraints/not_const")) return true; - if(!input.dtype().is_object()) return true; + if(!schema.has_path("constraints/not_const") || !input.dtype().is_object()) + { + return true; + } bool ok = true; const conduit::Node &nc = schema["constraints/not_const"]; @@ -197,8 +223,10 @@ bool validate_properties(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_child("properties")) return true; - if(!input.dtype().is_object()) return true; + if(!schema.has_child("properties") || !input.dtype().is_object()) + { + return true; + } bool ok = true; const conduit::Node &props = schema["properties"]; @@ -218,7 +246,10 @@ bool validate_additional_properties(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!input.dtype().is_object()) return true; + if(!input.dtype().is_object()) + { + return true; + } bool allow_additional = true; if(schema.has_child("additionalProperties")) @@ -226,7 +257,10 @@ bool validate_additional_properties(const conduit::Node &schema, allow_additional = schema["additionalProperties"].to_int() != 0; } - if(allow_additional) return true; + if(allow_additional) + { + return true; + } const bool has_props = schema.has_child("properties"); const conduit::Node props_dummy; @@ -251,8 +285,10 @@ bool validate_dependencies(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_path("constraints/dependencies")) return true; - if(!input.dtype().is_object()) return true; + if(!schema.has_path("constraints/dependencies") || !input.dtype().is_object()) + { + return true; + } bool ok = true; const conduit::Node &deps = schema["constraints/dependencies"]; @@ -260,7 +296,10 @@ bool validate_dependencies(const conduit::Node &schema, for(conduit::index_t i = 0; i < deps.number_of_children(); ++i) { const std::string trigger = deps[i].name(); - if(!input.has_child(trigger)) continue; + if(!input.has_child(trigger)) + { + continue; + } const conduit::Node &reqs = deps[trigger]; for(conduit::index_t j = 0; j < reqs.number_of_children(); ++j) @@ -284,8 +323,10 @@ bool validate_exclusive_children(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_path("constraints/exclusiveChildren")) return true; - if(!input.dtype().is_object()) return true; + if(!schema.has_path("constraints/exclusiveChildren") || !input.dtype().is_object()) + { + return true; + } const conduit::Node &keys = schema["constraints/exclusiveChildren"]; const bool allow_none = schema.has_path("constraints/allowNoneInExclusiveGroup") @@ -298,13 +339,19 @@ bool validate_exclusive_children(const conduit::Node &schema, for(conduit::index_t i = 0; i < keys.number_of_children(); ++i) { const std::string k = keys.child(i).as_string(); - if(input.has_child(k)) present.push_back(k); + if(input.has_child(k)) + { + present.push_back(k); + } } const int count = (int)present.size(); const bool ok = allow_none ? (count <= 1) : (count == 1); - if(ok) return true; + if(ok) + { + return true; + } std::ostringstream oss; oss << "Exclusive-children violation at '" @@ -314,7 +361,10 @@ bool validate_exclusive_children(const conduit::Node &schema, for(conduit::index_t i = 0; i < keys.number_of_children(); ++i) { - if(i) oss << ", "; + if(i != 0) + { + oss << ", "; + } oss << keys.child(i).as_string(); } oss << "}"; @@ -324,7 +374,10 @@ bool validate_exclusive_children(const conduit::Node &schema, oss << ", but found: {"; for(size_t i = 0; i < present.size(); ++i) { - if(i) oss << ", "; + if(i != 0) + { + oss << ", "; + } oss << present[i]; } oss << "}"; @@ -343,7 +396,10 @@ bool validate_one_of(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_child("oneOf")) return true; + if(!schema.has_child("oneOf")) + { + return true; + } const conduit::Node &opts = schema["oneOf"]; int matches = 0; @@ -376,12 +432,21 @@ bool validate_one_of(const conduit::Node &schema, } } - if(matches == 1) return true; + if(matches == 1) + { + return true; + } std::ostringstream oss; oss << "oneOf violation at '" << (path.empty() ? "" : path) << "': "; - if(matches == 0) oss << "input did not match any supported schemas"; - else oss << "input matched " << matches << " options (ambiguous)"; + if(matches == 0) + { + oss << "input did not match any supported schemas"; + } + else + { + oss << "input matched " << matches << " options (ambiguous)"; + } add_error(info, oss.str()); // give a couple of hints @@ -398,7 +463,10 @@ bool validate_any_of(const conduit::Node &schema, conduit::Node &info, const std::string &path) { - if(!schema.has_child("anyOf")) return true; + if(!schema.has_child("anyOf")) + { + return true; + } const conduit::Node &opts = schema["anyOf"]; int matches = 0; @@ -423,7 +491,10 @@ bool validate_any_of(const conduit::Node &schema, } } - if(matches >= 1) return true; + if(matches >= 1) + { + return true; + } add_error(info, "anyOf violation at '" + (path.empty() ? std::string("") : path) + "': input did not match any option"); @@ -527,10 +598,14 @@ bool validate_array(const conduit::Node &schema, } } - if(!schema.has_child("items")) return true; // unconstrained items + if(!schema.has_child("items")) + { + return true; // unconstrained items + } const conduit::Node &item_schema = schema["items"]; - if(data_type.is_list()) { + if(data_type.is_list()) + { for(conduit::index_t i = 0; i < count; ++i) { ok = validate_node(item_schema, input.child(i), info, @@ -568,7 +643,10 @@ bool validate_node(const conduit::Node &schema, ok = check_type(input, schema, info, path) && ok; ok = validate_const(schema, input, info, path) && ok; - if(!ok) return false; // type mismatch stops recursion + if(!ok) + { + return false; // type mismatch stops recursion + } if(schema_defined_type == "object") { From 99ec4b785a9a02de14c5a64ccb38cfd09c148c72 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 19:53:44 -0700 Subject: [PATCH 39/50] Using refs to nodes instead of copying seperate nodes into tree for extended edition filters too --- .../ascent_runtime_adios2_filters.cpp | 22 +- .../ascent_runtime_babelflow_compose.cpp | 14 +- .../ascent_runtime_babelflow_iso.cpp | 16 +- .../ascent_runtime_babelflow_pmt.cpp | 14 +- .../ascent_runtime_blueprint_filters.cpp | 101 +++---- .../ascent_runtime_command_filters.cpp | 10 +- .../ascent_runtime_dray_filters.cpp | 257 +++++++----------- .../ascent_runtime_hola_filters.cpp | 8 +- .../ascent_runtime_htg_filters.cpp | 10 +- .../ascent_runtime_param_check.hpp | 2 +- .../ascent_runtime_query_filters.cpp | 16 +- .../ascent_runtime_relay_filters.cpp | 73 +++-- .../ascent_runtime_rendering_filters.cpp | 250 ++++++++--------- .../ascent_runtime_rover_filters.cpp | 84 +++--- .../ascent_runtime_steering_filters.cpp | 6 +- .../ascent_runtime_trigger_filters.cpp | 43 +-- 16 files changed, 405 insertions(+), 521 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp index c57bd9bb2..b9755fda1 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp @@ -117,30 +117,24 @@ ADIOS2::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; - param_schema["properties/filename"].set(string_schema()); // Can't be a directory... need to add regex filter - param_schema["properties/engine"].set(string_schema()); + string_schema(param_schema["properties/filename"]); + string_schema(param_schema["properties/engine"]); - conduit::Node bpfile_schema; + conduit::Node &bpfile_schema = param_schema["oneOf"].append(); bpfile_schema["type"] = "object"; - bpfile_schema["properties/engine"].set(string_schema()); + string_schema(bpfile_schema["properties/engine"]); bpfile_schema["properties/engine/constraints/const"] = "BPFile"; - param_schema["oneOf"].append().set(bpfile_schema); - conduit::Node sst_schema; + conduit::Node sst_schema = param_schema["oneOf"].append(); sst_schema["type"] = "object"; - sst_schema["properties/engine"].set(string_schema()); + string_schema(sst_schema["properties/engine"]); sst_schema["properties/engine/constraints/const"] = "SST"; - conduit::Node fname = string_schema(); + conduit::Node fname = string_schema(sst_schema["properties/filename"]); fname["pattern"] = "^[^/]*$"; - sst_schema["properties/filename"].set(fname); - - param_schema["oneOf"].append().set(sst_schema); - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp index 27d2243c0..5e02a763f 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp @@ -44,21 +44,19 @@ void ascent::runtime::filters::BFlowCompose::declare_interface(conduit::Node &i) i["output_port"] = "false"; // true -- means filter, false -- means extract // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; - param_schema["properties/color_field"].set(string_schema()); - param_schema["properties/depth_field"].set(string_schema()); - param_schema["properties/image_prefix"].set(string_schema()); - param_schema["properties/compositing"].set(number_schema()); - param_schema["properties/fanin"].set(number_schema()); + string_schema(param_schema["properties/color_field"]); + string_schema(param_schema["properties/depth_field"]); + string_schema(param_schema["properties/image_prefix"]); + number_schema(param_schema["properties/compositing"]); + number_schema(param_schema["properties/fanin"]); param_schema["required"].append() = "color_field"; param_schema["required"].append() = "depth_field"; param_schema["required"].append() = "image_prefix"; param_schema["required"].append() = "compositing"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp index 7533535ff..b3bf98db8 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp @@ -532,21 +532,19 @@ void ascent::runtime::filters::BFlowIso::declare_interface(conduit::Node &i) i["output_port"] = "false"; // true -- means filter, false -- means extract // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/iso_values"].set(number_schema()); - param_schema["properties/image_name"].set(string_schema()); - param_schema["properties/radices"].set(number_schema()); - param_schema["properties/width"].set(number_schema()); - param_schema["properties/height"].set(number_schema()); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/iso_values"]); + string_schema(param_schema["properties/image_name"]); + number_schema(param_schema["properties/radices"]); + number_schema(param_schema["properties/width"]); + number_schema(param_schema["properties/height"]); param_schema["required"].append() = "field"; param_schema["required"].append() = "iso_values"; param_schema["required"].append() = "image_name"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp index bb72694c2..74fe44acf 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp @@ -1466,21 +1466,19 @@ void ascent::runtime::filters::BFlowPmt::declare_interface(conduit::Node &i) i["output_port"] = "true"; // true -- means filter, false -- means extract // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/fanin"].set(number_schema()); - param_schema["properties/threshold"].set(number_schema()); - param_schema["properties/gen_segment"].set(number_schema()); - param_schema["properties/ugrid_select"].set(number_schema()); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/fanin"]); + number_schema(param_schema["properties/threshold"]); + number_schema(param_schema["properties/gen_segment"]); + number_schema(param_schema["properties/ugrid_select"]); param_schema["required"].append() = "field"; param_schema["required"].append() = "fanin"; param_schema["required"].append() = "threshold"; param_schema["required"].append() = "gen_segment"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp index 07181577a..9042a92f1 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp @@ -105,13 +105,11 @@ BlueprintVerify::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; - param_schema["properties/protocol"].set(string_schema()); + string_schema(param_schema["properties/protocol"]); param_schema["required"].append() = "protocol"; - - i["param_schema"].set(param_schema); } @@ -291,40 +289,36 @@ BlueprintPartition::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/target"].set(number_schema()); - param_schema["properties/fields"].set(array_schema(ignore_schema())); - param_schema["properties/mapping"].set(number_schema()); - param_schema["properties/merge_tolerance"].set(number_schema()); - param_schema["properties/build_adjsets"].set(number_schema()); - param_schema["properties/original_element_ids"].set(string_schema()); - param_schema["properties/original_vertex_ids"].set(string_schema()); - param_schema["properties/distributed"].set(ignore_schema()); + number_schema(param_schema["properties/target"]); + array_schema(param_schema["properties/fields"]); + number_schema(param_schema["properties/mapping"]); + number_schema(param_schema["properties/merge_tolerance"]); + number_schema(param_schema["properties/build_adjsets"]); + string_schema(param_schema["properties/original_element_ids"]); + string_schema(param_schema["properties/original_vertex_ids"]); + ignore_schema(param_schema["properties/distributed"]); // --- selections --- - conduit::Node domain_id_schema; - domain_id_schema["type"] = "object"; - domain_id_schema["oneOf"].append().set(string_schema()); - domain_id_schema["oneOf"].append().set(number_schema()); - - conduit::Node selections_schema; + conduit::Node &selections_schema = param_schema["properties/selections"]; selections_schema["type"] = "object"; selections_schema["additionalProperties"] = false; - selections_schema["properties/type"].set(string_schema()); - selections_schema["properties/domain_id"].set(domain_id_schema); - selections_schema["properties/topology"].set(string_schema()); - selections_schema["properties/field"].set(ignore_schema()); - selections_schema["properties/start"].set(ignore_schema()); - selections_schema["properties/end"].set(ignore_schema()); - selections_schema["properties/elements"].set(ignore_schema()); - selections_schema["properties/ranges"].set(ignore_schema()); + string_schema(selections_schema["properties/type"]); + string_schema(selections_schema["properties/topology"]); + ignore_schema(selections_schema["properties/field"]); + ignore_schema(selections_schema["properties/start"]); + ignore_schema(selections_schema["properties/end"]); + ignore_schema(selections_schema["properties/elements"]); + ignore_schema(selections_schema["properties/ranges"]); selections_schema["required"].append() = "type"; - param_schema["properties/selections"].set(selections_schema); - i["param_schema"].set(param_schema); + conduit::Node domain_id_schema = selections_schema["properties/domain_id"]; + domain_id_schema["type"] = "object"; + string_schema(domain_id_schema["oneOf"].append()); + number_schema(domain_id_schema["oneOf"].append()); } //----------------------------------------------------------------------------- @@ -419,19 +413,19 @@ DataBinning::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; param_schema["constraints/exclusiveChildren"].append() = "reduction_field"; param_schema["constraints/exclusiveChildren"].append() = "var"; param_schema["constraints/allowNoneInExclusiveGroup"] = false; - param_schema["properties/reduction_op"].set(ignore_schema()); - param_schema["properties/reduction_field"].set(ignore_schema()); - param_schema["properties/empty_bin_val"].set(ignore_schema()); - param_schema["properties/output_type"].set(string_schema()); - param_schema["properties/output_field"].set(ignore_schema()); - param_schema["properties/var"].set(ignore_schema()); + ignore_schema(param_schema["properties/reduction_op"]); + ignore_schema(param_schema["properties/reduction_field"]); + ignore_schema(param_schema["properties/empty_bin_val"]); + string_schema(param_schema["properties/output_type"]); + ignore_schema(param_schema["properties/output_field"]); + ignore_schema(param_schema["properties/var"]); // --- Axes --- { @@ -442,25 +436,22 @@ DataBinning::declare_interface(Node &i) single_axis_schema["constraints/exclusiveChildren"].append() = "var"; single_axis_schema["constraints/allowNoneInExclusiveGroup"] = false; - single_axis_schema["properties/min_val"].set(number_schema(true)); - single_axis_schema["properties/max_val"].set(number_schema(true)); - single_axis_schema["properties/num_bins"].set(number_schema(true)); - single_axis_schema["properties/clamp"].set(number_schema(true)); - single_axis_schema["properties/field"].set(number_schema(true)); - single_axis_schema["properties/var"].set(number_schema(true)); + number_schema(single_axis_schema["properties/min_val"], true); + number_schema(single_axis_schema["properties/max_val"], true); + number_schema(single_axis_schema["properties/num_bins"], true); + number_schema(single_axis_schema["properties/clamp"], true); + number_schema(single_axis_schema["properties/field"], true); + number_schema(single_axis_schema["properties/var"], true); single_axis_schema["required"].append() = "num_bins"; - conduit::Node axes_schema = array_schema(single_axis_schema); + conduit::Node axes_schema = array_schema(param_schema["properties/axes"], single_axis_schema); axes_schema["minItems"] = 1; axes_schema["miaxItems"] = 3; - param_schema["properties/axes"].set(axes_schema); } param_schema["required"].append() = "reduction_op"; param_schema["required"].append() = "output_field"; param_schema["required"].append() = "axes"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -684,17 +675,15 @@ AddFields::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/output_field"].set(string_schema()); - param_schema["properties/fields"].set(array_schema(ignore_schema())); + string_schema(param_schema["properties/output_field"]); + array_schema(ignore_schema(param_schema["properties/fields"])); param_schema["required"].append() = "output_field"; param_schema["required"].append() = "fields"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -761,19 +750,17 @@ PowerOfField::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/output_field"].set(string_schema()); - param_schema["properties/field"].set(string_schema()); - param_schema["properties/exponent"].set(number_schema()); + string_schema(param_schema["properties/output_field"]); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/exponent"]); param_schema["required"].append() = "output_field"; param_schema["required"].append() = "field"; param_schema["required"].append() = "exponent"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp index e128d3418..977626948 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_command_filters.cpp @@ -80,18 +80,16 @@ Command::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; param_schema["constraints/exclusiveChildren"].append() = "callback"; param_schema["constraints/exclusiveChildren"].append() = "shell_command"; param_schema["constraints/allowNoneInExclusiveGroup"] = false; - param_schema["properties/callback"].set(string_schema()); - param_schema["properties/shell_command"].set(string_schema()); - param_schema["properties/mpi_behavior"].set(string_schema()); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/callback"]); + string_schema(param_schema["properties/shell_command"]); + string_schema(param_schema["properties/mpi_behavior"]); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp index b8fdc1ebe..92d764339 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_dray_filters.cpp @@ -159,19 +159,21 @@ void dray_color_table_schema(conduit::Node ¶m_schema) { param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/name"].set(string_schema()); - param_schema["properties/reverse"].set(bool_schema()); + string_schema(param_schema["properties/name"]); + bool_schema(param_schema["properties/reverse"]); // --- Control Points --- { - conduit::Node cp_compressed_schema; + conduit::Node &control_points_schema = param_schema["properties/control_points"]; + + conduit::Node &cp_compressed_schema = control_points_schema["oneOf"].append(); cp_compressed_schema["type"] = "object"; cp_compressed_schema["additionalProperties"] = false; - cp_compressed_schema["properties/r"].set(ignore_schema()); - cp_compressed_schema["properties/g"].set(ignore_schema()); - cp_compressed_schema["properties/b"].set(ignore_schema()); - cp_compressed_schema["properties/a"].set(ignore_schema()); - cp_compressed_schema["properties/position"].set(ignore_schema()); + ignore_schema(cp_compressed_schema["properties/r"]); + ignore_schema(cp_compressed_schema["properties/g"]); + ignore_schema(cp_compressed_schema["properties/b"]); + ignore_schema(cp_compressed_schema["properties/a"]); + ignore_schema(cp_compressed_schema["properties/position"]); cp_compressed_schema["constraints/forbid"].append() = "type"; cp_compressed_schema["constraints/forbid"].append() = "alpha"; cp_compressed_schema["constraints/forbid"].append() = "color"; @@ -179,19 +181,16 @@ void dray_color_table_schema(conduit::Node ¶m_schema) { conduit::Node cp_list_item_schema; cp_list_item_schema["type"] = "object"; cp_list_item_schema["additionalProperties"] = false; - cp_list_item_schema["properties/type"].set(ignore_schema()); - cp_list_item_schema["properties/alpha"].set(ignore_schema()); - cp_list_item_schema["properties/color"].set(ignore_schema()); - cp_list_item_schema["properties/position"].set(ignore_schema()); + ignore_schema(cp_list_item_schema["properties/type"]); + ignore_schema(cp_list_item_schema["properties/alpha"]); + ignore_schema(cp_list_item_schema["properties/color"]); + ignore_schema(cp_list_item_schema["properties/position"]); cp_list_item_schema["constraints/forbid"].append() = "r"; cp_list_item_schema["constraints/forbid"].append() = "g"; cp_list_item_schema["constraints/forbid"].append() = "b"; cp_list_item_schema["constraints/forbid"].append() = "a"; - conduit::Node control_points_schema; - control_points_schema["oneOf"].append().set(cp_compressed_schema); - control_points_schema["oneOf"].append().set(array_schema(cp_list_item_schema)); - param_schema["properties/control_points"].set(control_points_schema); + array_schema(control_points_schema["oneOf"].append(), cp_list_item_schema); } } @@ -199,10 +198,10 @@ void dray_load_balance_schema(conduit::Node ¶m_schema) { param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/enabled"].set(bool_schema()); - param_schema["properties/factor"].set(number_schema()); - param_schema["properties/threshold"].set(number_schema()); - param_schema["properties/use_prefix"].set(bool_schema()); + bool_schema(param_schema["properties/enabled"]); + number_schema(param_schema["properties/factor"]); + number_schema(param_schema["properties/threshold"]); + bool_schema(param_schema["properties/use_prefix"]); } dray::Vec @@ -1229,57 +1228,47 @@ DRayPseudocolor::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/image_prefix"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema()); - param_schema["properties/max_value"].set(number_schema()); - param_schema["properties/image_width"].set(number_schema()); - param_schema["properties/image_height"].set(number_schema()); - param_schema["properties/log_scale"].set(string_schema()); - param_schema["properties/annotations"].set(string_schema()); - param_schema["properties/draw_mesh"].set(string_schema()); - param_schema["properties/line_thickness"].set(number_schema()); - param_schema["properties/line_color"].set(number_schema()); - param_schema["properties/camera"].set(ignore_schema()); - - conduit::Node color_table_schema; - detail::dray_color_table_schema(color_table_schema); - param_schema["properties/color_table"].set(color_table_schema); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/image_prefix"]); + number_schema(param_schema["properties/min_value"]); + number_schema(param_schema["properties/max_value"]); + number_schema(param_schema["properties/image_width"]); + number_schema(param_schema["properties/image_height"]); + string_schema(param_schema["properties/log_scale"]); + string_schema(param_schema["properties/annotations"]); + string_schema(param_schema["properties/draw_mesh"]); + number_schema(param_schema["properties/line_thickness"]); + number_schema(param_schema["properties/line_color"]); + ignore_schema(param_schema["properties/camera"]); + + detail::dray_color_table_schema(param_schema["properties/color_table"]); param_schema["required"].append() = "field"; // --- check image name --- { - conduit::Node db_name_schema; + conduit::Node &db_name_schema = param_schema["oneOf"].append(); db_name_schema["type"] = "object"; db_name_schema["required"].append() = "camera"; db_name_schema["constraints/forbid"].append() = "image_prefix"; - conduit::Node camera_schema_1; + conduit::Node &camera_schema_1 = db_name_schema["properties/camera"].append(); camera_schema_1["type"] = "object"; camera_schema_1["required"].append() = "db_name"; - db_name_schema["properties/camera"].append().set(camera_schema_1); - - param_schema["oneOf"].append().set(db_name_schema); } { - conduit::Node image_prefix_schema; + conduit::Node &image_prefix_schema = param_schema["oneOf"].append(); image_prefix_schema["type"] = "object"; image_prefix_schema["required"].append() = "image_prefix"; - conduit::Node camera_schema_2; + conduit::Node &camera_schema_2 = image_prefix_schema["properties/camera"].append(); camera_schema_2["type"] = "object"; camera_schema_2["constraints/forbid"].append() = "db_name"; - image_prefix_schema["properties/camera"].append().set(camera_schema_2); - - param_schema["oneOf"].append().set(image_prefix_schema); } - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1411,65 +1400,54 @@ DRay3Slice::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/image_prefix"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema()); - param_schema["properties/max_value"].set(number_schema()); - param_schema["properties/image_width"].set(number_schema()); - param_schema["properties/image_height"].set(number_schema()); - param_schema["properties/log_scale"].set(string_schema()); - param_schema["properties/annotations"].set(string_schema()); - param_schema["properties/x_offset"].set(number_schema()); - param_schema["properties/y_offset"].set(number_schema()); - param_schema["properties/z_offset"].set(number_schema()); - param_schema["properties/camera"].set(ignore_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/image_prefix"]); + number_schema(param_schema["properties/min_value"]); + number_schema(param_schema["properties/max_value"]); + number_schema(param_schema["properties/image_width"]); + number_schema(param_schema["properties/image_height"]); + string_schema(param_schema["properties/log_scale"]); + string_schema(param_schema["properties/annotations"]); + number_schema(param_schema["properties/x_offset"]); + number_schema(param_schema["properties/y_offset"]); + number_schema(param_schema["properties/z_offset"]); + ignore_schema(param_schema["properties/camera"]); - conduit::Node color_table_schema; - detail::dray_color_table_schema(color_table_schema); - param_schema["properties/color_table"].set(color_table_schema); + detail::dray_color_table_schema(param_schema["properties/color_table"]); // --- sweep --- - conduit::Node sweep_schema; + conduit::Node &sweep_schema = param_schema["properties/sweep"]; sweep_schema["type"] = "object"; sweep_schema["additionalProperties"] = false; - sweep_schema["properties/count"].set(number_schema()); - sweep_schema["properties/axis"].set(string_schema()); - param_schema["properties/sweep"].set(sweep_schema); + number_schema(sweep_schema["properties/count"]); + string_schema(sweep_schema["properties/axis"]); param_schema["required"].append() = "field"; // --- check image name --- { - conduit::Node db_name_schema; + conduit::Node &db_name_schema = param_schema["oneOf"].append(); db_name_schema["type"] = "object"; db_name_schema["required"].append() = "camera"; db_name_schema["constraints/forbid"].append() = "image_prefix"; - conduit::Node camera_schema_1; + conduit::Node &camera_schema_1 = db_name_schema["properties/camera"].append(); camera_schema_1["type"] = "object"; camera_schema_1["required"].append() = "db_name"; - db_name_schema["properties/camera"].append().set(camera_schema_1); - - param_schema["oneOf"].append().set(db_name_schema); } { - conduit::Node image_prefix_schema; + conduit::Node &image_prefix_schema = param_schema["oneOf"].append(); image_prefix_schema["type"] = "object"; image_prefix_schema["required"].append() = "image_prefix"; - conduit::Node camera_schema_2; + conduit::Node &camera_schema_2 = image_prefix_schema["properties/camera"].append(); camera_schema_2["type"] = "object"; camera_schema_2["constraints/forbid"].append() = "db_name"; - image_prefix_schema["properties/camera"].append().set(camera_schema_2); - - param_schema["oneOf"].append().set(image_prefix_schema); } - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -1803,60 +1781,47 @@ DRayVolume::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/image_prefix"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema()); - param_schema["properties/max_value"].set(number_schema()); - param_schema["properties/image_width"].set(number_schema()); - param_schema["properties/image_height"].set(number_schema()); - param_schema["properties/log_scale"].set(string_schema()); - param_schema["properties/annotations"].set(string_schema()); - param_schema["properties/samples"].set(number_schema()); - param_schema["properties/use_lighing"].set(bool_schema()); - param_schema["properties/camera"].set(ignore_schema()); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/image_prefix"]); + number_schema(param_schema["properties/min_value"]); + number_schema(param_schema["properties/max_value"]); + number_schema(param_schema["properties/image_width"]); + number_schema(param_schema["properties/image_height"]); + string_schema(param_schema["properties/log_scale"]); + string_schema(param_schema["properties/annotations"]); + number_schema(param_schema["properties/samples"]); + bool_schema(param_schema["properties/use_lighing"]); + ignore_schema(param_schema["properties/camera"]); - conduit::Node color_table_schema; - detail::dray_color_table_schema(color_table_schema); - param_schema["properties/color_table"].set(color_table_schema); - - conduit::Node load_balance_schema; - detail::dray_load_balance_schema(load_balance_schema); - param_schema["properties/load_balancing"].set(load_balance_schema); + detail::dray_color_table_schema(param_schema["properties/color_table"]); + detail::dray_load_balance_schema(param_schema["properties/load_balancing"]); param_schema["required"].append() = "field"; // --- check image name --- { - conduit::Node db_name_schema; + conduit::Node &db_name_schema = param_schema["oneOf"].append(); db_name_schema["type"] = "object"; db_name_schema["required"].append() = "camera"; db_name_schema["constraints/forbid"].append() = "image_prefix"; - conduit::Node camera_schema_1; + conduit::Node &camera_schema_1 = db_name_schema["properties/camera"].append(); camera_schema_1["type"] = "object"; camera_schema_1["required"].append() = "db_name"; - db_name_schema["properties/camera"].append().set(camera_schema_1); - - param_schema["oneOf"].append().set(db_name_schema); } { - conduit::Node image_prefix_schema; + conduit::Node &image_prefix_schema = param_schema["oneOf"].append(); image_prefix_schema["type"] = "object"; image_prefix_schema["required"].append() = "image_prefix"; - conduit::Node camera_schema_2; + conduit::Node &camera_schema_2 = image_prefix_schema["properties/camera"].append(); camera_schema_2["type"] = "object"; camera_schema_2["constraints/forbid"].append() = "db_name"; - image_prefix_schema["properties/camera"].append().set(camera_schema_2); - - param_schema["oneOf"].append().set(image_prefix_schema); } - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2012,33 +1977,29 @@ DRayReflect::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; // --- point --- - conduit::Node point_schema; + conduit::Node &point_schema = param_schema["properties/point"]; point_schema["type"] = "object"; point_schema["additionalProperties"] = false; - point_schema["properties/x"].set(number_schema()); - point_schema["properties/y"].set(number_schema()); - point_schema["properties/z"].set(number_schema()); + number_schema(point_schema["properties/x"]); + number_schema(point_schema["properties/y"]); + number_schema(point_schema["properties/z"]); point_schema["required"].append() = "x"; point_schema["required"].append() = "y"; - param_schema["properties/point"].set(point_schema); // --- normal --- - conduit::Node normal_schema; + conduit::Node &normal_schema = param_schema["properties/normal"]; normal_schema["type"] = "object"; normal_schema["additionalProperties"] = false; - normal_schema["properties/x"].set(number_schema()); - normal_schema["properties/y"].set(number_schema()); - normal_schema["properties/z"].set(number_schema()); + number_schema(normal_schema["properties/x"]); + number_schema(normal_schema["properties/y"]); + number_schema(normal_schema["properties/z"]); normal_schema["required"].append() = "x"; normal_schema["required"].append() = "y"; - param_schema["properties/normal"].set(normal_schema); - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2116,17 +2077,15 @@ DRayProject2d::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/fields"].set(ignore_schema()); - param_schema["properties/image_width"].set(number_schema()); - param_schema["properties/image_height"].set(number_schema()); - param_schema["properties/camera"].set(ignore_schema()); - param_schema["properties/plane"].set(ignore_schema()); - - i["param_schema"].set(param_schema); + ignore_schema(param_schema["properties/fields"]); + number_schema(param_schema["properties/image_width"]); + number_schema(param_schema["properties/image_height"]); + ignore_schema(param_schema["properties/camera"]); + ignore_schema(param_schema["properties/plane"]); } //----------------------------------------------------------------------------- @@ -2284,25 +2243,21 @@ DRayProjectColors2d::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/min_value"].set(number_schema()); - param_schema["properties/max_value"].set(number_schema()); - param_schema["properties/image_width"].set(number_schema()); - param_schema["properties/image_height"].set(number_schema()); - param_schema["properties/log_scale"].set(string_schema()); - param_schema["properties/camera"].set(ignore_schema()); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/min_value"]); + number_schema(param_schema["properties/max_value"]); + number_schema(param_schema["properties/image_width"]); + number_schema(param_schema["properties/image_height"]); + string_schema(param_schema["properties/log_scale"]); + ignore_schema(param_schema["properties/camera"]); - conduit::Node color_table_schema; - detail::dray_color_table_schema(color_table_schema); - param_schema["properties/color_table"].set(color_table_schema); + detail::dray_color_table_schema(param_schema["properties/color_table"]); param_schema["required"].append() = "field"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -2401,19 +2356,17 @@ DRayVectorComponent::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/component"].set(number_schema()); - param_schema["properties/output_name"].set(string_schema()); + string_schema(param_schema["properties/field"]); + number_schema(param_schema["properties/component"]); + string_schema(param_schema["properties/output_name"]); param_schema["required"].append() = "field"; param_schema["required"].append() = "component"; param_schema["required"].append() = "output_name"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp index c5f48f16d..e5100ba6b 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_hola_filters.cpp @@ -79,17 +79,15 @@ HolaMPIExtract::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/mpi_comm"].set(integer_schema()); - param_schema["properties/rank_split"].set(integer_schema()); + integer_schema(param_schema["properties/mpi_comm"]); + integer_schema(param_schema["properties/rank_split"]); param_schema["required"].append() = "mpi_comm"; param_schema["required"].append() = "rank_split"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp index 95244097b..6548d3cf6 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_htg_filters.cpp @@ -609,18 +609,16 @@ HTGIOSave::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/path"].set(string_schema(1)); - param_schema["properties/blank_value"].set(number_schema()); - param_schema["properties/fields"].set(ignore_schema()); + string_schema(param_schema["properties/path"], 1); + number_schema(param_schema["properties/blank_value"]); + ignore_schema(param_schema["properties/fields"]); param_schema["required"].append() = "path"; param_schema["required"].append() = "blank_value"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 0e7f97125..870ee14d5 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -72,7 +72,7 @@ conduit::Node ASCENT_API &string_schema(conduit::Node &schema_node, optional_param minLength = optional_param(), optional_param maxLength = optional_param()); -conduit::Node ASCENT_API &string_enum_schema(std::vector options); +conduit::Node ASCENT_API &string_enum_schema(conduit::Node &schema_node, std::vector options); conduit::Node ASCENT_API &bool_schema(conduit::Node &schema_node); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp index 1bbc03e05..6bea66538 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_query_filters.cpp @@ -83,17 +83,15 @@ BasicQuery::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/expression"].set(string_schema()); - param_schema["properties/name"].set(string_schema()); + string_schema(param_schema["properties/expression"]); + string_schema(param_schema["properties/name"]); param_schema["required"].append() = "expression"; param_schema["required"].append() = "name"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -150,17 +148,15 @@ FilterQuery::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/expression"].set(string_schema()); - param_schema["properties/name"].set(string_schema()); + string_schema(param_schema["properties/expression"]); + string_schema(param_schema["properties/name"]); param_schema["required"].append() = "expression"; param_schema["required"].append() = "name"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp index f59ade68a..364bc8b02 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp @@ -427,42 +427,37 @@ void io_param_schema(conduit::Node ¶m_schema) param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/path"].set(string_schema(1)); - param_schema["properties/protocol"].set(string_schema(1)); - param_schema["properties/topologies"].set(ignore_schema()); - param_schema["properties/fields"].set(ignore_schema()); - param_schema["properties/num_files"].set(integer_schema()); - param_schema["properties/refinement_level"].set(integer_schema()); + string_schema(param_schema["properties/path"], 1); + string_schema(param_schema["properties/protocol"], 1); + ignore_schema(param_schema["properties/topologies"]); + ignore_schema(param_schema["properties/fields"]); + integer_schema(param_schema["properties/num_files"]); + integer_schema(param_schema["properties/refinement_level"]); #if defined(ASCENT_HDF5_ENABLED) // --- HDF5 --- { - conduit::Node hdf5_compact_storage_schema; - hdf5_compact_storage_schema["type"] = "object"; - hdf5_compact_storage_schema["additionalProperties"] = false; - hdf5_compact_storage_schema["properties/enabled"].set(bool_schema()); - hdf5_compact_storage_schema["properties/threshold"].set(number_schema()); - - conduit::Node hdf5_compression_schema; - hdf5_compression_schema["type"] = "object"; - hdf5_compression_schema["additionalProperties"] = false; - hdf5_compact_storage_schema["properties/method"].set(string_schema()); - hdf5_compact_storage_schema["properties/level"].set(number_schema()); - - conduit::Node hdf5_chunking_schema; - hdf5_chunking_schema["type"] = "object"; - hdf5_chunking_schema["additionalProperties"] = false; - hdf5_compact_storage_schema["properties/enabled"].set(bool_schema()); - hdf5_compact_storage_schema["properties/threshold"].set(number_schema()); - hdf5_compact_storage_schema["properties/chunk_size"].set(number_schema()); - hdf5_compact_storage_schema["properties/compression"].set(hdf5_compression_schema); - - conduit::Node hdf5_schema; + conduit::Node &hdf5_schema = param_schema["properties/hdf5_options"]; hdf5_schema["type"] = "object"; hdf5_schema["additionalProperties"] = false; - hdf5_schema["properties/compact_storage"].set(hdf5_compact_storage_schema); - hdf5_schema["properties/chunking"].set(hdf5_chunking_schema); - param_schema["properties/hdf5_options"].set(hdf5_schema); + conduit::Node &hdf5_compact_storage_schema = hdf5_schema["properties/compact_storage"]; + hdf5_compact_storage_schema["type"] = "object"; + hdf5_compact_storage_schema["additionalProperties"] = false; + bool_schema(hdf5_compact_storage_schema["properties/enabled"]); + number_schema(hdf5_compact_storage_schema["properties/threshold"]); + + conduit::Node &hdf5_chunking_schema = hdf5_schema["properties/chunking"]; + hdf5_chunking_schema["type"] = "object"; + hdf5_chunking_schema["additionalProperties"] = false; + bool_schema(hdf5_chunking_schema["properties/enabled"]); + number_schema(hdf5_chunking_schema["properties/threshold"]); + number_schema(hdf5_chunking_schema["properties/chunk_size"]); + + conduit::Node &hdf5_compression_schema = hdf5_chunking_schema["properties/compression"]; + hdf5_compression_schema["type"] = "object"; + hdf5_compression_schema["additionalProperties"] = false; + string_schema(hdf5_compression_schema["properties/method"]); + number_schema(hdf5_compression_schema["properties/level"]); } #endif @@ -596,9 +591,7 @@ RelayIOSave::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; - io_param_schema(param_schema); - i["param_schema"].set(param_schema); + io_param_schema(i["param_schema"]); } //----------------------------------------------------------------------------- @@ -981,9 +974,7 @@ RelayIOLoad::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; - io_param_schema(param_schema); - i["param_schema"].set(param_schema); + io_param_schema(i["param_schema"]); } //----------------------------------------------------------------------------- @@ -1035,17 +1026,15 @@ BlueprintFlatten::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/path"].set(string_schema()); - param_schema["properties/protocol"].set(string_schema()); - param_schema["properties/fields"].set(array_schema(string_schema())); + string_schema(param_schema["properties/path"]); + string_schema(param_schema["properties/protocol"]); + array_schema(string_schema(param_schema["properties/fields"])); param_schema["required"].append() = "path"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp index 6b92884a2..511009b45 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp @@ -92,21 +92,23 @@ void color_table_schema(conduit::Node ¶m_schema) { param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/name"].set(string_schema()); - param_schema["properties/reverse"].set(bool_schema()); - param_schema["properties/annotation"].set(string_schema()); - param_schema["properties/discrete"].set(string_schema()); + string_schema(param_schema["properties/name"]); + bool_schema(param_schema["properties/reverse"]); + string_schema(param_schema["properties/annotation"]); + string_schema(param_schema["properties/discrete"]); // --- Control Points --- { - conduit::Node cp_compressed_schema; + conduit::Node &control_points_schema = param_schema["properties/control_points"]; + + conduit::Node &cp_compressed_schema = control_points_schema["oneOf"].append(); cp_compressed_schema["type"] = "object"; cp_compressed_schema["additionalProperties"] = false; - cp_compressed_schema["properties/r"].set(ignore_schema()); - cp_compressed_schema["properties/g"].set(ignore_schema()); - cp_compressed_schema["properties/b"].set(ignore_schema()); - cp_compressed_schema["properties/a"].set(ignore_schema()); - cp_compressed_schema["properties/position"].set(ignore_schema()); + ignore_schema(cp_compressed_schema["properties/r"]); + ignore_schema(cp_compressed_schema["properties/g"]); + ignore_schema(cp_compressed_schema["properties/b"]); + ignore_schema(cp_compressed_schema["properties/a"]); + ignore_schema(cp_compressed_schema["properties/position"]); cp_compressed_schema["constraints/forbid"].append() = "type"; cp_compressed_schema["constraints/forbid"].append() = "alpha"; cp_compressed_schema["constraints/forbid"].append() = "color"; @@ -114,19 +116,16 @@ void color_table_schema(conduit::Node ¶m_schema) { conduit::Node cp_list_item_schema; cp_list_item_schema["type"] = "object"; cp_list_item_schema["additionalProperties"] = false; - cp_list_item_schema["properties/type"].set(ignore_schema()); - cp_list_item_schema["properties/alpha"].set(ignore_schema()); - cp_list_item_schema["properties/color"].set(ignore_schema()); - cp_list_item_schema["properties/position"].set(ignore_schema()); + ignore_schema(cp_list_item_schema["properties/type"]); + ignore_schema(cp_list_item_schema["properties/alpha"]); + ignore_schema(cp_list_item_schema["properties/color"]); + ignore_schema(cp_list_item_schema["properties/position"]); cp_list_item_schema["constraints/forbid"].append() = "r"; cp_list_item_schema["constraints/forbid"].append() = "g"; cp_list_item_schema["constraints/forbid"].append() = "b"; cp_list_item_schema["constraints/forbid"].append() = "a"; - conduit::Node control_points_schema; - control_points_schema["oneOf"].append().set(cp_compressed_schema); - control_points_schema["oneOf"].append().set(array_schema(cp_list_item_schema)); - param_schema["properties/control_points"].set(control_points_schema); + array_schema(control_points_schema["oneOf"].append(), cp_list_item_schema); } } @@ -1062,113 +1061,107 @@ CreateRenders::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/image_name"].set(string_schema()); - param_schema["properties/image_prefix"].set(string_schema()); + string_schema(param_schema["properties/image_name"]); + string_schema(param_schema["properties/image_prefix"]); // --- render --- conduit::Node render_schema; render_schema["type"] = "object"; render_schema["additionalProperties"] = false; - render_schema["properties/image_name"].set(string_schema()); - render_schema["properties/image_prefix"].set(string_schema()); - render_schema["properties/image_width"].set(integer_schema(true, optional_param(), optional_param(), 0)); - render_schema["properties/image_height"].set(integer_schema(true, optional_param(), optional_param(), 0)); - render_schema["properties/scene_bounds"].set(ignore_schema()); - render_schema["properties/type"].set(ignore_schema()); - render_schema["properties/phi"].set(ignore_schema()); - render_schema["properties/phi_range"].set(ignore_schema()); - render_schema["properties/dphi"].set(ignore_schema()); - render_schema["properties/phi_num_angles"].set(ignore_schema()); - render_schema["properties/phi_angles"].set(ignore_schema()); - render_schema["properties/theta"].set(ignore_schema()); - render_schema["properties/theta_range"].set(ignore_schema()); - render_schema["properties/dtheta"].set(ignore_schema()); - render_schema["properties/theta_num_angles"].set(ignore_schema()); - render_schema["properties/theta_angles"].set(ignore_schema()); - render_schema["properties/phi_theta_positions"].set(ignore_schema()); - render_schema["properties/db_name"].set(ignore_schema()); - render_schema["properties/output_path"].set(ignore_schema()); - render_schema["properties/render_bg"].set(ignore_schema()); - render_schema["properties/annotations"].set(ignore_schema()); - render_schema["properties/world_annotations"].set(ignore_schema()); - render_schema["properties/screen_annotations"].set(ignore_schema()); - render_schema["properties/axis_scale_x"].set(ignore_schema()); - render_schema["properties/axis_scale_y"].set(ignore_schema()); - render_schema["properties/axis_scale_z"].set(ignore_schema()); - render_schema["properties/fg_color"].set(ignore_schema()); - render_schema["properties/bg_color"].set(ignore_schema()); - render_schema["properties/shading"].set(ignore_schema()); - render_schema["properties/use_original_bounds"].set(ignore_schema()); - render_schema["properties/dataset_bounds"].set(ignore_schema()); - render_schema["properties/color_bar_position"].set(ignore_schema()); - render_schema["properties/tiled_rendering"].set(ignore_schema()); - render_schema["properties/tiled_rendering_type"].set(ignore_schema()); - render_schema["properties/tile_width"].set(ignore_schema()); - render_schema["properties/tile_height"].set(ignore_schema()); - - conduit::Node auto_camera_schema; + string_schema(render_schema["properties/image_name"]); + string_schema(render_schema["properties/image_prefix"]); + integer_schema(render_schema["properties/image_width"], true, optional_param(), optional_param(), 0); + integer_schema(render_schema["properties/image_height"], true, optional_param(), optional_param(), 0); + ignore_schema(render_schema["properties/scene_bounds"]); + ignore_schema(render_schema["properties/type"]); + ignore_schema(render_schema["properties/phi"]); + ignore_schema(render_schema["properties/phi_range"]); + ignore_schema(render_schema["properties/dphi"]); + ignore_schema(render_schema["properties/phi_num_angles"]); + ignore_schema(render_schema["properties/phi_angles"]); + ignore_schema(render_schema["properties/theta"]); + ignore_schema(render_schema["properties/theta_range"]); + ignore_schema(render_schema["properties/dtheta"]); + ignore_schema(render_schema["properties/theta_num_angles"]); + ignore_schema(render_schema["properties/theta_angles"]); + ignore_schema(render_schema["properties/phi_theta_positions"]); + ignore_schema(render_schema["properties/db_name"]); + ignore_schema(render_schema["properties/output_path"]); + ignore_schema(render_schema["properties/render_bg"]); + ignore_schema(render_schema["properties/annotations"]); + ignore_schema(render_schema["properties/world_annotations"]); + ignore_schema(render_schema["properties/screen_annotations"]); + ignore_schema(render_schema["properties/axis_scale_x"]); + ignore_schema(render_schema["properties/axis_scale_y"]); + ignore_schema(render_schema["properties/axis_scale_z"]); + ignore_schema(render_schema["properties/fg_color"]); + ignore_schema(render_schema["properties/bg_color"]); + ignore_schema(render_schema["properties/shading"]); + ignore_schema(render_schema["properties/use_original_bounds"]); + ignore_schema(render_schema["properties/dataset_bounds"]); + ignore_schema(render_schema["properties/color_bar_position"]); + ignore_schema(render_schema["properties/tiled_rendering"]); + ignore_schema(render_schema["properties/tiled_rendering_type"]); + ignore_schema(render_schema["properties/tile_width"]); + ignore_schema(render_schema["properties/tile_height"]); + + conduit::Node &auto_camera_schema = render_schema["properties/auto_camera"]; auto_camera_schema["type"] = "object"; auto_camera_schema["additionalProperties"] = false; - auto_camera_schema["properties/metric"].set(ignore_schema()); - auto_camera_schema["properties/field"].set(ignore_schema()); - auto_camera_schema["properties/samples"].set(ignore_schema()); - auto_camera_schema["properties/bins"].set(ignore_schema()); - auto_camera_schema["properties/height"].set(ignore_schema()); - auto_camera_schema["properties/width"].set(ignore_schema()); - render_schema["properties/auto_camera"].set(auto_camera_schema); + ignore_schema(auto_camera_schema["properties/metric"]); + ignore_schema(auto_camera_schema["properties/field"]); + ignore_schema(auto_camera_schema["properties/samples"]); + ignore_schema(auto_camera_schema["properties/bins"]); + ignore_schema(auto_camera_schema["properties/height"]); + ignore_schema(auto_camera_schema["properties/width"]); // --- Camera --- - conduit::Node ascent_camera_schema; + conduit::Node &camera_schema = render_schema["properties/camera"]; + camera_schema["type"] = "object"; + + conduit::Node &ascent_camera_schema = camera_schema["oneOf"].append(); ascent_camera_schema["type"] = "object"; ascent_camera_schema["additionalProperties"] = false; - ascent_camera_schema["properties/2d"].set(ignore_schema()); - ascent_camera_schema["properties/look_at"].set(ignore_schema()); - ascent_camera_schema["properties/position"].set(ignore_schema()); - ascent_camera_schema["properties/up"].set(ignore_schema()); - ascent_camera_schema["properties/fov"].set(ignore_schema()); - ascent_camera_schema["properties/xpan"].set(ignore_schema()); - ascent_camera_schema["properties/ypan"].set(ignore_schema()); - ascent_camera_schema["properties/zoom"].set(ignore_schema()); - ascent_camera_schema["properties/near_plane"].set(ignore_schema()); - ascent_camera_schema["properties/far_plane"].set(ignore_schema()); - ascent_camera_schema["properties/azimuth"].set(ignore_schema()); - ascent_camera_schema["properties/elevation"].set(ignore_schema()); - - conduit::Node visit_camera_schema; + ignore_schema(ascent_camera_schema["properties/2d"]); + ignore_schema(ascent_camera_schema["properties/look_at"]); + ignore_schema(ascent_camera_schema["properties/position"]); + ignore_schema(ascent_camera_schema["properties/up"]); + ignore_schema(ascent_camera_schema["properties/fov"]); + ignore_schema(ascent_camera_schema["properties/xpan"]); + ignore_schema(ascent_camera_schema["properties/ypan"]); + ignore_schema(ascent_camera_schema["properties/zoom"]); + ignore_schema(ascent_camera_schema["properties/near_plane"]); + ignore_schema(ascent_camera_schema["properties/far_plane"]); + ignore_schema(ascent_camera_schema["properties/azimuth"]); + ignore_schema(ascent_camera_schema["properties/elevation"]); + + conduit::Node &visit_camera_schema = camera_schema["oneOf"].append(); visit_camera_schema["type"] = "object"; visit_camera_schema["additionalProperties"] = false; - visit_camera_schema["properties/windowCoords"].set(ignore_schema()); - visit_camera_schema["properties/view_normal"].set(ignore_schema()); - visit_camera_schema["properties/focus"].set(ignore_schema()); - visit_camera_schema["properties/view_up"].set(ignore_schema()); - visit_camera_schema["properties/view_angle"].set(ignore_schema()); - visit_camera_schema["properties/parallel_scale"].set(ignore_schema()); - visit_camera_schema["properties/near_plane"].set(ignore_schema()); - visit_camera_schema["properties/far_plane"].set(ignore_schema()); - visit_camera_schema["properties/image_pan"].set(ignore_schema()); - visit_camera_schema["properties/image_zoom"].set(ignore_schema()); - visit_camera_schema["properties/perspective"].set(ignore_schema()); - visit_camera_schema["properties/eye_angle"].set(ignore_schema()); - visit_camera_schema["properties/center_of_rotation_set"].set(ignore_schema()); - visit_camera_schema["properties/center_of_rotation"].set(ignore_schema()); - visit_camera_schema["properties/axis_3d_scale_flag"].set(ignore_schema()); - visit_camera_schema["properties/axis_3d_scale"].set(ignore_schema()); - visit_camera_schema["properties/shear"].set(ignore_schema()); - visit_camera_schema["properties/window_valid"].set(ignore_schema()); - - conduit::Node camera_schema; - camera_schema["type"] = "object"; - camera_schema["oneOf"].append().set(ascent_camera_schema); - camera_schema["oneOf"].append().set(visit_camera_schema); - render_schema["properties/camera"].set(camera_schema); - - param_schema["properties/renders"].set(array_schema(render_schema)); - - i["param_schema"].set(param_schema); + ignore_schema(visit_camera_schema["properties/windowCoords"]); + ignore_schema(visit_camera_schema["properties/view_normal"]); + ignore_schema(visit_camera_schema["properties/focus"]); + ignore_schema(visit_camera_schema["properties/view_up"]); + ignore_schema(visit_camera_schema["properties/view_angle"]); + ignore_schema(visit_camera_schema["properties/parallel_scale"]); + ignore_schema(visit_camera_schema["properties/near_plane"]); + ignore_schema(visit_camera_schema["properties/far_plane"]); + ignore_schema(visit_camera_schema["properties/image_pan"]); + ignore_schema(visit_camera_schema["properties/image_zoom"]); + ignore_schema(visit_camera_schema["properties/perspective"]); + ignore_schema(visit_camera_schema["properties/eye_angle"]); + ignore_schema(visit_camera_schema["properties/center_of_rotation_set"]); + ignore_schema(visit_camera_schema["properties/center_of_rotation"]); + ignore_schema(visit_camera_schema["properties/axis_3d_scale_flag"]); + ignore_schema(visit_camera_schema["properties/axis_3d_scale"]); + ignore_schema(visit_camera_schema["properties/shear"]); + ignore_schema(visit_camera_schema["properties/window_valid"]); + + array_schema(param_schema["properties/renders"], render_schema); } //----------------------------------------------------------------------------- @@ -1759,27 +1752,25 @@ CreatePlot::declare_interface(Node &i) i["output_port"] = "true"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/type"].set(string_schema()); - param_schema["properties/pipeline"].set(ignore_schema()); - param_schema["properties/topology"].set(string_schema()); + string_schema(param_schema["properties/type"]); + ignore_schema(param_schema["properties/pipeline"]); + string_schema(param_schema["properties/topology"]); - conduit::Node color_table_schema; - detail::color_table_schema(color_table_schema); - param_schema["properties/color_table"].set(color_table_schema); + detail::color_table_schema(param_schema["properties/color_table"]); param_schema["required"].append() = "type"; // --- Is Mesh --- { // properties are still added at the root level and then limited through forbids - param_schema["properties/overlay"].set(ignore_schema()); - param_schema["properties/show_internal"].set(ignore_schema()); + ignore_schema(param_schema["properties/overlay"]); + ignore_schema(param_schema["properties/show_internal"]); - conduit::Node mesh_schema; + conduit::Node &mesh_schema = param_schema["oneOf"].append(); mesh_schema["type"] = "object"; mesh_schema["properties/type/constraints/const"] = "mesh"; mesh_schema["constraints/forbid"] = "field"; @@ -1787,34 +1778,29 @@ CreatePlot::declare_interface(Node &i) mesh_schema["constraints/forbid"] = "max_value"; mesh_schema["constraints/forbid"] = "samples"; mesh_schema["constraints/forbid"] = "points"; - param_schema["oneOf"].append().set(mesh_schema); } // --- Is not Mesh --- { // properties are still added at the root level and then limited through forbids - param_schema["properties/field"].set(ignore_schema()); - param_schema["properties/min_value"].set(ignore_schema()); - param_schema["properties/max_value"].set(ignore_schema()); - param_schema["properties/samples"].set(ignore_schema()); + ignore_schema(param_schema["properties/field"]); + ignore_schema(param_schema["properties/min_value"]); + ignore_schema(param_schema["properties/max_value"]); + ignore_schema(param_schema["properties/samples"]); - conduit::Node points_schema; + conduit::Node &points_schema = param_schema["properties/points"]; points_schema["type"] = "object"; points_schema["additionalProperties"] = false; - points_schema["properties/radius"].set(ignore_schema()); - points_schema["properties/radius_delta"].set(ignore_schema()); - param_schema["properties/points"].set(points_schema); + ignore_schema(points_schema["properties/radius"]); + ignore_schema(points_schema["properties/radius_delta"]); - conduit::Node not_mesh_schema; + conduit::Node ¬_mesh_schema = param_schema["oneOf"].append(); not_mesh_schema["type"] = "object"; not_mesh_schema["constraints/not_const/type"] = "mesh"; not_mesh_schema["constraints/forbid"] = "overlay"; not_mesh_schema["constraints/forbid"] = "show_internal"; not_mesh_schema["required"].append() = "field"; - param_schema["oneOf"].append().set(not_mesh_schema); } - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp index 69f1a8f5a..6f52f7e1d 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp @@ -99,29 +99,29 @@ RoverXRay::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/condition"].set(string_schema()); - param_schema["properties/callback"].set(string_schema()); - param_schema["properties/actions_file"].set(string_schema()); - param_schema["properties/actions_files"].set(array_schema(ignore_schema())); - param_schema["properties/actions"].set(array_schema(ignore_schema())); + string_schema(param_schema["properties/condition"]); + string_schema(param_schema["properties/callback"]); + string_schema(param_schema["properties/actions_file"]); + array_schema(param_schema["properties/actions_files"]); + array_schema(param_schema["properties/actions"]); // --- Rover --- - conduit::Node rover_schema; - rover_schema["properties/absorption"].set(string_schema(1)); - rover_schema["properties/filename"].set(string_schema(1)); - rover_schema["properties/background_intensity"].set(number_schema(false, 0)); - rover_schema["properties/divide_emis_by_absorb"].set(bool_schema()); - rover_schema["properties/emission"].set(string_schema(1)); - rover_schema["properties/enable_rays_mesh"].set(bool_schema()); - rover_schema["properties/height"].set(integer_schema(false, optional_param(), optional_param(), 0)); - rover_schema["properties/width"].set(integer_schema(false, optional_param(), optional_param(), 0)); - rover_schema["properties/output_type"].set(string_enum_schema({"hdf5", "yaml", "json", "png", "bov"})); - rover_schema["properties/precision"].set(string_enum_schema({"single", "double"})); - rover_schema["properties/unit_scalar"].set(number_schema(false, optional_param(), optional_param(), 0)); + conduit::Node &rover_schema = param_schema["properties/rover"]; + string_schema(rover_schema["properties/absorption"], 1); + string_schema(rover_schema["properties/filename"], 1); + number_schema(rover_schema["properties/background_intensity"], false, 0); + bool_schema(rover_schema["properties/divide_emis_by_absorb"]); + string_schema(rover_schema["properties/emission"], 1); + bool_schema(rover_schema["properties/enable_rays_mesh"]); + integer_schema(rover_schema["properties/height"], false, optional_param(), optional_param(), 0); + integer_schema(rover_schema["properties/width"], false, optional_param(), optional_param(), 0); + string_enum_schema(rover_schema["properties/output_type"], {"hdf5", "yaml", "json", "png", "bov"}); + string_enum_schema(rover_schema["properties/precision"], {"single", "double"}); + number_schema(rover_schema["properties/unit_scalar"], false, optional_param(), optional_param(), 0); rover_schema["constraints/dependencies/height"].append() = "width"; rover_schema["constraints/dependencies/width"].append() = "height"; @@ -129,33 +129,27 @@ RoverXRay::declare_interface(Node &i) rover_schema["required"].append() = "absorption"; rover_schema["required"].append() = "filename"; - param_schema["properties/rover"].set(rover_schema); - // --- Image --- - conduit::Node image_schema; - image_schema["properties/log_scale"].set(bool_schema()); - image_schema["properties/min_value"].set(number_schema()); - image_schema["properties/max_value"].set(number_schema()); - param_schema["properties/image_params"].set(image_schema); + conduit::Node &image_schema = param_schema["properties/image_params"]; + bool_schema(image_schema["properties/log_scale"]); + number_schema(image_schema["properties/min_value"]); + number_schema(image_schema["properties/max_value"]); // --- Camera --- - conduit::Node camera_schema; - camera_schema["properties/azimuth"].set(ignore_schema()); - camera_schema["properties/elevation"].set(ignore_schema()); - camera_schema["properties/far_plane"].set(ignore_schema()); - camera_schema["properties/near_plane"].set(ignore_schema()); - camera_schema["properties/fov"].set(ignore_schema()); - camera_schema["properties/look_at"].set(ignore_schema()); - camera_schema["properties/position"].set(ignore_schema()); - camera_schema["properties/up"].set(ignore_schema()); - camera_schema["properties/xpan"].set(ignore_schema()); - camera_schema["properties/ypan"].set(ignore_schema()); - camera_schema["properties/zoom"].set(ignore_schema()); - param_schema["properties/camera"].set(camera_schema); + conduit::Node &camera_schema = param_schema["properties/camera"]; + ignore_schema(camera_schema["properties/azimuth"]); + ignore_schema(camera_schema["properties/elevation"]); + ignore_schema(camera_schema["properties/far_plane"]); + ignore_schema(camera_schema["properties/near_plane"]); + ignore_schema(camera_schema["properties/fov"]); + ignore_schema(camera_schema["properties/look_at"]); + ignore_schema(camera_schema["properties/position"]); + ignore_schema(camera_schema["properties/up"]); + ignore_schema(camera_schema["properties/xpan"]); + ignore_schema(camera_schema["properties/ypan"]); + ignore_schema(camera_schema["properties/zoom"]); param_schema["required"].append() = "rover"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- @@ -308,18 +302,16 @@ RoverVolume::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/field"].set(string_schema()); - param_schema["properties/filename"].set(string_schema()); - param_schema["properties/precision"].set(string_enum_schema({"single", "double"})); + string_schema(param_schema["properties/field"]); + string_schema(param_schema["properties/filename"]); + string_enum_schema(param_schema["properties/precision"], {"single", "double"}); param_schema["required"].append() = "field"; param_schema["required"].append() = "filename"; - - i["param_schema"].set(param_schema); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp index 76638d9cd..d40c06481 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_steering_filters.cpp @@ -75,12 +75,10 @@ Steering::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; - param_schema["properties/explicit_command"].set(string_schema()); - - i["param_schema"].set(param_schema); + string_schema(param_schema["properties/explicit_command"]); } //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp index 48e9779c1..5e8073f44 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_trigger_filters.cpp @@ -87,30 +87,31 @@ BasicTrigger::declare_interface(Node &i) i["output_port"] = "false"; // ----------- Define Param Schema ----------- - conduit::Node param_schema; + conduit::Node ¶m_schema = i["param_schema"]; param_schema["type"] = "object"; param_schema["additionalProperties"] = false; - param_schema["properties/condition"].set(string_schema()); - param_schema["properties/callback"].set(string_schema()); - param_schema["properties/actions_file"].set(string_schema()); - param_schema["properties/actions_files"].set(array_schema(string_schema())); - param_schema["properties/actions"].set(array_schema(ignore_schema())); - - conduit::Node trigger_schema; - trigger_schema["constraints/exclusiveChildren"].append() = "condition"; - trigger_schema["constraints/exclusiveChildren"].append() = "callback"; - trigger_schema["constraints/allowNoneInExclusiveGroup"] = false; - param_schema["allOf"].append().set(trigger_schema); - - conduit::Node action_schema; - action_schema["constraints/exclusiveChildren"].append() = "actions_file"; - action_schema["constraints/exclusiveChildren"].append() = "actions_files"; - action_schema["constraints/exclusiveChildren"].append() = "actions"; - action_schema["constraints/allowNoneInExclusiveGroup"] = false; - param_schema["allOf"].append().set(action_schema); - - i["param_schema"].set(param_schema); + { + string_schema(param_schema["properties/condition"]); + string_schema(param_schema["properties/callback"]); + + conduit::Node &trigger_schema = param_schema["allOf"].append(); + trigger_schema["constraints/exclusiveChildren"].append() = "condition"; + trigger_schema["constraints/exclusiveChildren"].append() = "callback"; + trigger_schema["constraints/allowNoneInExclusiveGroup"] = false; + } + { + conduit::Node actions_string_schema; + array_schema(param_schema["properties/actions_files"], string_schema(actions_string_schema)); + array_schema(param_schema["properties/actions"]); + string_schema(param_schema["properties/actions_file"]); + + conduit::Node &action_schema = param_schema["allOf"].append(); + action_schema["constraints/exclusiveChildren"].append() = "actions_file"; + action_schema["constraints/exclusiveChildren"].append() = "actions_files"; + action_schema["constraints/exclusiveChildren"].append() = "actions"; + action_schema["constraints/allowNoneInExclusiveGroup"] = false; + } } //----------------------------------------------------------------------------- From 2dc14f8f2791e6ae5ac7a16d0e04dee282acefe9 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 20:06:11 -0700 Subject: [PATCH 40/50] const string ref vector --- .../ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp | 2 +- .../ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 92444df51..041d9e0fd 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -101,7 +101,7 @@ conduit::Node &string_schema(conduit::Node &schema_node, //----------------------------------------------------------------------------- -conduit::Node &string_enum_schema(conduit::Node &schema_node, std::vector options) +conduit::Node &string_enum_schema(conduit::Node &schema_node, const std::vector &options) { string_schema(schema_node); for (const auto& value: options) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 870ee14d5..a6c89dd88 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -72,7 +72,7 @@ conduit::Node ASCENT_API &string_schema(conduit::Node &schema_node, optional_param minLength = optional_param(), optional_param maxLength = optional_param()); -conduit::Node ASCENT_API &string_enum_schema(conduit::Node &schema_node, std::vector options); +conduit::Node ASCENT_API &string_enum_schema(conduit::Node &schema_node, const std::vector &options); conduit::Node ASCENT_API &bool_schema(conduit::Node &schema_node); From 7a9ceeca2539fb1ce1454cd3da014276fc27a1ae Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 20:20:24 -0700 Subject: [PATCH 41/50] removing the optional_params --- .../ascent_runtime_param_check.cpp | 40 ++++++++--------- .../ascent_runtime_param_check.hpp | 43 +++++-------------- .../ascent_runtime_rendering_filters.cpp | 4 +- .../ascent_runtime_rover_filters.cpp | 6 +-- 4 files changed, 35 insertions(+), 58 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 041d9e0fd..82b7f3e31 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -89,13 +89,13 @@ void ascent_register_flow_schema_hooks() //----------------------------------------------------------------------------- conduit::Node &string_schema(conduit::Node &schema_node, - optional_param minLength, - optional_param maxLength) + size_t minLength, + size_t maxLength) { schema_node.reset(); schema_node["type"] = "string"; - if(minLength) schema_node["minLength"] = *minLength; - if(maxLength) schema_node["maxLength"] = *maxLength; + if(minLength != 0) schema_node["minLength"] = minLength; + if(maxLength != std::numeric_limits::max()) schema_node["maxLength"] = maxLength; return schema_node; } @@ -129,10 +129,10 @@ conduit::Node &expression_schema(conduit::Node &schema_node) conduit::Node &number_schema(conduit::Node &schema_node, bool supports_expressions, - optional_param minimum, - optional_param maximum, - optional_param exclusiveMinimum, - optional_param exclusiveMaximum) + int minimum, + int maximum, + int exclusiveMinimum, + int exclusiveMaximum) { schema_node.reset(); if (supports_expressions) @@ -144,21 +144,21 @@ conduit::Node &number_schema(conduit::Node &schema_node, { schema_node["type"] = "number"; - if(exclusiveMinimum) schema_node["exclusiveMinimum"] = *exclusiveMinimum; - else if(minimum) schema_node["minimum"] = *minimum; + if(exclusiveMinimum != std::numeric_limits::lowest()) schema_node["exclusiveMinimum"] = exclusiveMinimum; + else if(minimum != std::numeric_limits::lowest()) schema_node["minimum"] = minimum; - if(exclusiveMaximum) schema_node["exclusiveMaximum"] = *exclusiveMaximum; - else if(maximum) schema_node["maximum"] = *maximum; + if(exclusiveMaximum != std::numeric_limits::max()) schema_node["exclusiveMaximum"] = exclusiveMaximum; + else if(maximum != std::numeric_limits::max()) schema_node["maximum"] = maximum; } return schema_node; } conduit::Node &integer_schema(conduit::Node &schema_node, bool supports_expressions, - optional_param minimum, - optional_param maximum, - optional_param exclusiveMinimum, - optional_param exclusiveMaximum) + int minimum, + int maximum, + int exclusiveMinimum, + int exclusiveMaximum) { if (supports_expressions) { @@ -169,11 +169,11 @@ conduit::Node &integer_schema(conduit::Node &schema_node, { schema_node["type"] = "integer"; - if(exclusiveMinimum) schema_node["exclusiveMinimum"] = *exclusiveMinimum; - else if(minimum) schema_node["minimum"] = *minimum; + if(exclusiveMinimum != std::numeric_limits::lowest()) schema_node["exclusiveMinimum"] = exclusiveMinimum; + else if(minimum != std::numeric_limits::lowest()) schema_node["minimum"] = minimum; - if(exclusiveMaximum) schema_node["exclusiveMaximum"] = *exclusiveMaximum; - else if(maximum) schema_node["maximum"] = *maximum; + if(exclusiveMaximum != std::numeric_limits::max()) schema_node["exclusiveMaximum"] = exclusiveMaximum; + else if(maximum != std::numeric_limits::max()) schema_node["maximum"] = maximum; } return schema_node; } diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index a6c89dd88..43a7a801f 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -23,29 +23,6 @@ #include #include -#if __cplusplus >= 201703L - #include - template - using optional_param = std::optional; -#else - template - class optional_param - { - public: - optional_param() : m_has_value(false), m_value() {} - optional_param(const T& value) : m_has_value(true), m_value(value) {} - - operator bool() const { return m_has_value; } - - const T& operator*() const { return m_value; } - T& operator*() { return m_value; } - - private: - bool m_has_value; - T m_value; - }; -#endif - //----------------------------------------------------------------------------- // -- begin ascent:: -- //----------------------------------------------------------------------------- @@ -69,8 +46,8 @@ bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_ms void ASCENT_API ascent_register_flow_schema_hooks(); conduit::Node ASCENT_API &string_schema(conduit::Node &schema_node, - optional_param minLength = optional_param(), - optional_param maxLength = optional_param()); + std::size_t minLength = 0, + std::size_t maxLength = std::numeric_limits::max()); conduit::Node ASCENT_API &string_enum_schema(conduit::Node &schema_node, const std::vector &options); @@ -78,17 +55,17 @@ conduit::Node ASCENT_API &bool_schema(conduit::Node &schema_node); conduit::Node ASCENT_API &number_schema(conduit::Node &schema_node, bool supports_expressions = false, - optional_param minimum = optional_param(), - optional_param maximum = optional_param(), - optional_param exclusiveMinimum = optional_param(), - optional_param exclusiveMaximum= optional_param()); + int minimum = std::numeric_limits::lowest(), + int maximum = std::numeric_limits::max(), + int exclusiveMinimum = std::numeric_limits::lowest(), + int exclusiveMaximum = std::numeric_limits::max()); conduit::Node ASCENT_API &integer_schema(conduit::Node &schema_node, bool supports_expressions = false, - optional_param minimum = optional_param(), - optional_param maximum = optional_param(), - optional_param exclusiveMinimum = optional_param(), - optional_param exclusiveMaximum= optional_param()); + int minimum = std::numeric_limits::lowest(), + int maximum = std::numeric_limits::max(), + int exclusiveMinimum = std::numeric_limits::lowest(), + int exclusiveMaximum = std::numeric_limits::max()); conduit::Node ASCENT_API &vec3_schema(conduit::Node &schema_node, bool supports_expressions = false); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp index 511009b45..ae4b0c0e3 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rendering_filters.cpp @@ -1074,8 +1074,8 @@ CreateRenders::declare_interface(Node &i) render_schema["additionalProperties"] = false; string_schema(render_schema["properties/image_name"]); string_schema(render_schema["properties/image_prefix"]); - integer_schema(render_schema["properties/image_width"], true, optional_param(), optional_param(), 0); - integer_schema(render_schema["properties/image_height"], true, optional_param(), optional_param(), 0); + integer_schema(render_schema["properties/image_width"], true, 0, std::numeric_limits::max(), 0); + integer_schema(render_schema["properties/image_height"], true, 0, std::numeric_limits::max(), 0); ignore_schema(render_schema["properties/scene_bounds"]); ignore_schema(render_schema["properties/type"]); ignore_schema(render_schema["properties/phi"]); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp index 6f52f7e1d..07f75f73b 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_rover_filters.cpp @@ -117,11 +117,11 @@ RoverXRay::declare_interface(Node &i) bool_schema(rover_schema["properties/divide_emis_by_absorb"]); string_schema(rover_schema["properties/emission"], 1); bool_schema(rover_schema["properties/enable_rays_mesh"]); - integer_schema(rover_schema["properties/height"], false, optional_param(), optional_param(), 0); - integer_schema(rover_schema["properties/width"], false, optional_param(), optional_param(), 0); + integer_schema(rover_schema["properties/height"], false, 0, std::numeric_limits::max(), 0); + integer_schema(rover_schema["properties/width"], false, 0, std::numeric_limits::max(), 0); string_enum_schema(rover_schema["properties/output_type"], {"hdf5", "yaml", "json", "png", "bov"}); string_enum_schema(rover_schema["properties/precision"], {"single", "double"}); - number_schema(rover_schema["properties/unit_scalar"], false, optional_param(), optional_param(), 0); + number_schema(rover_schema["properties/unit_scalar"], false, 0, std::numeric_limits::max(), 0); rover_schema["constraints/dependencies/height"].append() = "width"; rover_schema["constraints/dependencies/width"].append() = "height"; From 8f34331d435721ace6e2356d2b4b16b745d93e5c Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Thu, 2 Apr 2026 20:21:57 -0700 Subject: [PATCH 42/50] Removing print statement added for debugging --- .../runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index d14a6be8c..bb884c109 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -4447,8 +4447,6 @@ VTKHTransform::declare_interface(Node &i) conduit::Node &matrix_schema = array_schema(param_schema["properties/matrix"], number_schema(matrix_item_schema, true)); matrix_schema["minItems"] = 16; matrix_schema["maxItems"] = 16; - - std::cout << param_schema.to_yaml() << std::endl; } //----------------------------------------------------------------------------- From 6ad7e203f3384b56d5baf99b14169b4dd0828ae5 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 6 Apr 2026 15:34:57 -0700 Subject: [PATCH 43/50] Fixing the refrences in adios2 schema --- .../runtimes/flow_filters/ascent_runtime_adios2_filters.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp index b9755fda1..eaed08a9e 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp @@ -128,12 +128,12 @@ ADIOS2::declare_interface(Node &i) string_schema(bpfile_schema["properties/engine"]); bpfile_schema["properties/engine/constraints/const"] = "BPFile"; - conduit::Node sst_schema = param_schema["oneOf"].append(); + conduit::Node &sst_schema = param_schema["oneOf"].append(); sst_schema["type"] = "object"; string_schema(sst_schema["properties/engine"]); sst_schema["properties/engine/constraints/const"] = "SST"; - conduit::Node fname = string_schema(sst_schema["properties/filename"]); + conduit::Node &fname = string_schema(sst_schema["properties/filename"]); fname["pattern"] = "^[^/]*$"; } From ab2bb3fc9e42800619d26603f0ee607a35fd7d46 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 6 Apr 2026 15:45:43 -0700 Subject: [PATCH 44/50] Formatting param check file --- .../ascent_runtime_param_check.cpp | 60 +++++++++++++++---- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 82b7f3e31..371c6aec9 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -94,8 +94,17 @@ conduit::Node &string_schema(conduit::Node &schema_node, { schema_node.reset(); schema_node["type"] = "string"; - if(minLength != 0) schema_node["minLength"] = minLength; - if(maxLength != std::numeric_limits::max()) schema_node["maxLength"] = maxLength; + + if(minLength != 0) + { + schema_node["minLength"] = minLength; + } + + if(maxLength != std::numeric_limits::max()) + { + schema_node["maxLength"] = maxLength; + } + return schema_node; } @@ -104,10 +113,12 @@ conduit::Node &string_schema(conduit::Node &schema_node, conduit::Node &string_enum_schema(conduit::Node &schema_node, const std::vector &options) { string_schema(schema_node); + for (const auto& value: options) { schema_node["enum"].append() = value; } + return schema_node; } @@ -135,6 +146,7 @@ conduit::Node &number_schema(conduit::Node &schema_node, int exclusiveMaximum) { schema_node.reset(); + if (supports_expressions) { number_schema(schema_node["oneOf"].append(), false, minimum, maximum, exclusiveMinimum, exclusiveMaximum); @@ -144,12 +156,25 @@ conduit::Node &number_schema(conduit::Node &schema_node, { schema_node["type"] = "number"; - if(exclusiveMinimum != std::numeric_limits::lowest()) schema_node["exclusiveMinimum"] = exclusiveMinimum; - else if(minimum != std::numeric_limits::lowest()) schema_node["minimum"] = minimum; + if(exclusiveMinimum != std::numeric_limits::lowest()) + { + schema_node["exclusiveMinimum"] = exclusiveMinimum; + } + else if(minimum != std::numeric_limits::lowest()) + { + schema_node["minimum"] = minimum; + } - if(exclusiveMaximum != std::numeric_limits::max()) schema_node["exclusiveMaximum"] = exclusiveMaximum; - else if(maximum != std::numeric_limits::max()) schema_node["maximum"] = maximum; + if(exclusiveMaximum != std::numeric_limits::max()) + { + schema_node["exclusiveMaximum"] = exclusiveMaximum; + } + else if(maximum != std::numeric_limits::max()) + { + schema_node["maximum"] = maximum; + } } + return schema_node; } @@ -160,6 +185,8 @@ conduit::Node &integer_schema(conduit::Node &schema_node, int exclusiveMinimum, int exclusiveMaximum) { + schema_node.reset(); + if (supports_expressions) { integer_schema(schema_node["oneOf"].append(), false, minimum, maximum, exclusiveMinimum, exclusiveMaximum); @@ -169,12 +196,25 @@ conduit::Node &integer_schema(conduit::Node &schema_node, { schema_node["type"] = "integer"; - if(exclusiveMinimum != std::numeric_limits::lowest()) schema_node["exclusiveMinimum"] = exclusiveMinimum; - else if(minimum != std::numeric_limits::lowest()) schema_node["minimum"] = minimum; + if(exclusiveMinimum != std::numeric_limits::lowest()) + { + schema_node["exclusiveMinimum"] = exclusiveMinimum; + } + else if(minimum != std::numeric_limits::lowest()) + { + schema_node["minimum"] = minimum; + } - if(exclusiveMaximum != std::numeric_limits::max()) schema_node["exclusiveMaximum"] = exclusiveMaximum; - else if(maximum != std::numeric_limits::max()) schema_node["maximum"] = maximum; + if(exclusiveMaximum != std::numeric_limits::max()) + { + schema_node["exclusiveMaximum"] = exclusiveMaximum; + } + else if(maximum != std::numeric_limits::max()) + { + schema_node["maximum"] = maximum; + } } + return schema_node; } From 2a860b3ffab3db794e747041df201269f96ee6cc Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 7 Apr 2026 16:00:16 -0700 Subject: [PATCH 45/50] Fixing typo --- .../runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp index 9042a92f1..f0d119b17 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp @@ -446,7 +446,7 @@ DataBinning::declare_interface(Node &i) conduit::Node axes_schema = array_schema(param_schema["properties/axes"], single_axis_schema); axes_schema["minItems"] = 1; - axes_schema["miaxItems"] = 3; + axes_schema["maxItems"] = 3; } param_schema["required"].append() = "reduction_op"; From c0eed7a182b714ae1a53cb5adb441e3f6677e035 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 7 Apr 2026 16:16:36 -0700 Subject: [PATCH 46/50] Adding the minItem and maxItem array parameters to the array_schema helper --- .../ascent_expression_jit_filters.cpp | 4 +- .../ascent_runtime_blueprint_filters.cpp | 4 +- .../ascent_runtime_param_check.cpp | 43 +++++++++++-------- .../ascent_runtime_param_check.hpp | 38 ++++++++-------- .../ascent_runtime_vtkh_filters.cpp | 4 +- 5 files changed, 47 insertions(+), 46 deletions(-) diff --git a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp index 82584c780..e7f35eae6 100644 --- a/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp +++ b/src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp @@ -149,9 +149,7 @@ ExprJitFilter::declare_interface(Node &i) filters::string_schema(param_schema["properties/func"]); filters::string_schema(param_schema["properties/filter_name"]); - conduit::Node &inputs_schema = filters::array_schema(param_schema["properties/inputs"]); - inputs_schema["minItems"] = num_inputs; - inputs_schema["maxItems"] = num_inputs; + conduit::Node &inputs_schema = filters::array_schema(param_schema["properties/inputs"], conduit::Node(), num_inputs, num_inputs); param_schema["required"].append() = "func"; param_schema["required"].append() = "filter_name"; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp index f0d119b17..a8d982c2b 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp @@ -444,9 +444,7 @@ DataBinning::declare_interface(Node &i) number_schema(single_axis_schema["properties/var"], true); single_axis_schema["required"].append() = "num_bins"; - conduit::Node axes_schema = array_schema(param_schema["properties/axes"], single_axis_schema); - axes_schema["minItems"] = 1; - axes_schema["maxItems"] = 3; + conduit::Node axes_schema = array_schema(param_schema["properties/axes"], single_axis_schema, 1, 3); } param_schema["required"].append() = "reduction_op"; diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 371c6aec9..35068da24 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -139,11 +139,11 @@ conduit::Node &expression_schema(conduit::Node &schema_node) //----------------------------------------------------------------------------- conduit::Node &number_schema(conduit::Node &schema_node, - bool supports_expressions, - int minimum, - int maximum, - int exclusiveMinimum, - int exclusiveMaximum) + const bool supports_expressions, + const int minimum, + const int maximum, + const int exclusiveMinimum, + const int exclusiveMaximum) { schema_node.reset(); @@ -179,11 +179,11 @@ conduit::Node &number_schema(conduit::Node &schema_node, } conduit::Node &integer_schema(conduit::Node &schema_node, - bool supports_expressions, - int minimum, - int maximum, - int exclusiveMinimum, - int exclusiveMaximum) + const bool supports_expressions, + const int minimum, + const int maximum, + const int exclusiveMinimum, + const int exclusiveMaximum) { schema_node.reset(); @@ -284,11 +284,25 @@ conduit::Node &vec3_schema_anyOf(conduit::Node &schema_node, bool supports_expre //----------------------------------------------------------------------------- -conduit::Node &array_schema(conduit::Node &schema_node, const conduit::Node &item_schema) +conduit::Node &array_schema(conduit::Node &schema_node, + const conduit::Node &item_schema, + const std::size_t minItems, + const std::size_t maxItems) { schema_node.reset(); schema_node["type"] = "array"; + + if(minItems != 0) + { + schema_node["minItems"] = minItems; + } + + if(maxItems != std::numeric_limits::max()) + { + schema_node["maxItems"] = maxItems; + } + if (!item_schema.dtype().is_empty()) { schema_node["items"].set(item_schema); @@ -297,13 +311,6 @@ conduit::Node &array_schema(conduit::Node &schema_node, const conduit::Node &ite return schema_node; } -conduit::Node &array_schema(conduit::Node &schema_node) -{ - schema_node.reset(); - schema_node["type"] = "array"; - return schema_node; -} - //----------------------------------------------------------------------------- conduit::Node &ignore_schema(conduit::Node &schema_node) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp index 43a7a801f..a4d03e688 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.hpp @@ -46,49 +46,49 @@ bool ASCENT_API is_valid_expression(const std::string &expr, std::string &err_ms void ASCENT_API ascent_register_flow_schema_hooks(); conduit::Node ASCENT_API &string_schema(conduit::Node &schema_node, - std::size_t minLength = 0, - std::size_t maxLength = std::numeric_limits::max()); + const std::size_t minLength = 0, + const std::size_t maxLength = std::numeric_limits::max()); conduit::Node ASCENT_API &string_enum_schema(conduit::Node &schema_node, const std::vector &options); conduit::Node ASCENT_API &bool_schema(conduit::Node &schema_node); conduit::Node ASCENT_API &number_schema(conduit::Node &schema_node, - bool supports_expressions = false, - int minimum = std::numeric_limits::lowest(), - int maximum = std::numeric_limits::max(), - int exclusiveMinimum = std::numeric_limits::lowest(), - int exclusiveMaximum = std::numeric_limits::max()); + const bool supports_expressions = false, + const int minimum = std::numeric_limits::lowest(), + const int maximum = std::numeric_limits::max(), + const int exclusiveMinimum = std::numeric_limits::lowest(), + const int exclusiveMaximum = std::numeric_limits::max()); conduit::Node ASCENT_API &integer_schema(conduit::Node &schema_node, - bool supports_expressions = false, - int minimum = std::numeric_limits::lowest(), - int maximum = std::numeric_limits::max(), - int exclusiveMinimum = std::numeric_limits::lowest(), - int exclusiveMaximum = std::numeric_limits::max()); + const bool supports_expressions = false, + const int minimum = std::numeric_limits::lowest(), + const int maximum = std::numeric_limits::max(), + const int exclusiveMinimum = std::numeric_limits::lowest(), + const int exclusiveMaximum = std::numeric_limits::max()); conduit::Node ASCENT_API &vec3_schema(conduit::Node &schema_node, - bool supports_expressions = false); + const bool supports_expressions = false); conduit::Node ASCENT_API &vec3_schema(conduit::Node &schema_node, const std::string var1, const std::string var2, const std::string var3, - bool supports_expressions = false); + const bool supports_expressions = false); conduit::Node ASCENT_API &vec3_schema_anyOf(conduit::Node &schema_node, - bool supports_expressions = false); + const bool supports_expressions = false); conduit::Node ASCENT_API &vec3_schema_anyOf(conduit::Node &schema_node, const std::string var1, const std::string var2, const std::string var3, - bool supports_expressions = false); - -conduit::Node ASCENT_API &array_schema(conduit::Node &schema_node); + const bool supports_expressions = false); conduit::Node ASCENT_API &array_schema(conduit::Node &schema_node, - const conduit::Node &item_schema); + const conduit::Node &item_schema = conduit::Node(), + const std::size_t minItems = 0, + const std::size_t maxItems = std::numeric_limits::max()); conduit::Node ASCENT_API &ignore_schema(conduit::Node &schema_node); diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index bb884c109..612efb1f5 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -4444,9 +4444,7 @@ VTKHTransform::declare_interface(Node &i) // --- matrix --- conduit::Node matrix_item_schema; - conduit::Node &matrix_schema = array_schema(param_schema["properties/matrix"], number_schema(matrix_item_schema, true)); - matrix_schema["minItems"] = 16; - matrix_schema["maxItems"] = 16; + conduit::Node &matrix_schema = array_schema(param_schema["properties/matrix"], number_schema(matrix_item_schema, true), 16, 16); } //----------------------------------------------------------------------------- From a887ee4ae3875105ca64857060016fa999624503 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 7 Apr 2026 16:20:55 -0700 Subject: [PATCH 47/50] Removing missed ignore schema in array schema conversion. By default, array schema elements are ignored unless a schema is provided. --- .../runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp index a8d982c2b..812c33223 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_blueprint_filters.cpp @@ -678,7 +678,7 @@ AddFields::declare_interface(Node &i) param_schema["additionalProperties"] = false; string_schema(param_schema["properties/output_field"]); - array_schema(ignore_schema(param_schema["properties/fields"])); + array_schema(param_schema["properties/fields"]); param_schema["required"].append() = "output_field"; param_schema["required"].append() = "fields"; From aa0636608e4c885284c3de5f2fc7dfdf000480da Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Tue, 7 Apr 2026 16:22:13 -0700 Subject: [PATCH 48/50] Adding small append fix to any of vecs. This was originally a change in the doc PR --- .../runtimes/flow_filters/ascent_runtime_param_check.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp index 35068da24..7677f6521 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_param_check.cpp @@ -264,15 +264,15 @@ conduit::Node &vec3_schema_anyOf(conduit::Node &schema_node, conduit::Node &var1_required = schema_node["anyOf"].append(); var1_required["type"] = "object"; - var1_required["required"] = var1; + var1_required["required"].append() = var1; conduit::Node &var2_required = schema_node["anyOf"].append(); var2_required["type"] = "object"; - var2_required["required"] = var2; + var2_required["required"].append() = var2; conduit::Node &var3_required = schema_node["anyOf"].append(); var3_required["type"] = "object"; - var3_required["required"] = var3; + var3_required["required"].append() = var3; return schema_node; } From 139974b1860730f8197e2877e01c1fe2656d9b3d Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 13 Apr 2026 14:56:30 -0700 Subject: [PATCH 49/50] Removing s from schema --- src/libs/flow/flow_schema_validator.cpp | 2 +- src/tests/ascent/t_ascent_render_3d.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/flow/flow_schema_validator.cpp b/src/libs/flow/flow_schema_validator.cpp index d2ffbaade..29f5c2c80 100644 --- a/src/libs/flow/flow_schema_validator.cpp +++ b/src/libs/flow/flow_schema_validator.cpp @@ -600,7 +600,7 @@ bool validate_one_of(const conduit::Node &schema, oss << "oneOf violation at '" << (path.empty() ? "" : path) << "': "; if(matches == 0) { - oss << "input did not match any supported schemas"; + oss << "input did not match any supported schema"; } else { diff --git a/src/tests/ascent/t_ascent_render_3d.cpp b/src/tests/ascent/t_ascent_render_3d.cpp index 7ba6e7eb8..4accfc69b 100644 --- a/src/tests/ascent/t_ascent_render_3d.cpp +++ b/src/tests/ascent/t_ascent_render_3d.cpp @@ -4020,14 +4020,14 @@ TEST(ascent_render_3d, test_render_invalid_camera) } catch(conduit::Error &err) { - if (err.message().find("input did not match any supported schemas") != std::string::npos) + if (err.message().find("input did not match any supported schema") != std::string::npos) { error_occured = true; } else { std::cout << "The error that was thrown did not match the expected " - << "'input did not match any supported schemas' error" << std::endl; + << "'input did not match any supported schema' error" << std::endl; std::cout << err.message() << std::endl; } From 60ecfc7ebbf0c937783ca8187a189c26011e7a41 Mon Sep 17 00:00:00 2001 From: Emily Howell Date: Mon, 13 Apr 2026 14:58:30 -0700 Subject: [PATCH 50/50] Adding HDF5 example back --- .../ascent_runtime_relay_filters.cpp | 51 ++++++++++++------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp index 364bc8b02..7cd342779 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_relay_filters.cpp @@ -437,27 +437,42 @@ void io_param_schema(conduit::Node ¶m_schema) #if defined(ASCENT_HDF5_ENABLED) // --- HDF5 --- { + // + // HDF5 OPTIONS Example: + // + // compact_storage: + // enabled: "true" + // threshold: 1024 + // chunking: + // enabled: "true" + // threshold: 2000000 + // chunk_size: 1000000 + // compression: + // method: "gzip" + // level: 5 + conduit::Node &hdf5_schema = param_schema["properties/hdf5_options"]; hdf5_schema["type"] = "object"; hdf5_schema["additionalProperties"] = false; - conduit::Node &hdf5_compact_storage_schema = hdf5_schema["properties/compact_storage"]; - hdf5_compact_storage_schema["type"] = "object"; - hdf5_compact_storage_schema["additionalProperties"] = false; - bool_schema(hdf5_compact_storage_schema["properties/enabled"]); - number_schema(hdf5_compact_storage_schema["properties/threshold"]); - - conduit::Node &hdf5_chunking_schema = hdf5_schema["properties/chunking"]; - hdf5_chunking_schema["type"] = "object"; - hdf5_chunking_schema["additionalProperties"] = false; - bool_schema(hdf5_chunking_schema["properties/enabled"]); - number_schema(hdf5_chunking_schema["properties/threshold"]); - number_schema(hdf5_chunking_schema["properties/chunk_size"]); - - conduit::Node &hdf5_compression_schema = hdf5_chunking_schema["properties/compression"]; - hdf5_compression_schema["type"] = "object"; - hdf5_compression_schema["additionalProperties"] = false; - string_schema(hdf5_compression_schema["properties/method"]); - number_schema(hdf5_compression_schema["properties/level"]); + + conduit::Node &hdf5_compact_storage_schema = hdf5_schema["properties/compact_storage"]; + hdf5_compact_storage_schema["type"] = "object"; + hdf5_compact_storage_schema["additionalProperties"] = false; + bool_schema(hdf5_compact_storage_schema["properties/enabled"]); + number_schema(hdf5_compact_storage_schema["properties/threshold"]); + + conduit::Node &hdf5_chunking_schema = hdf5_schema["properties/chunking"]; + hdf5_chunking_schema["type"] = "object"; + hdf5_chunking_schema["additionalProperties"] = false; + bool_schema(hdf5_chunking_schema["properties/enabled"]); + number_schema(hdf5_chunking_schema["properties/threshold"]); + number_schema(hdf5_chunking_schema["properties/chunk_size"]); + + conduit::Node &hdf5_compression_schema = hdf5_chunking_schema["properties/compression"]; + hdf5_compression_schema["type"] = "object"; + hdf5_compression_schema["additionalProperties"] = false; + string_schema(hdf5_compression_schema["properties/method"]); + number_schema(hdf5_compression_schema["properties/level"]); } #endif