Skip to content

Commit 2341c7e

Browse files
authored
Task/3 19 2026 json schema for filters extended edition (#1676)
* Save state post resolving conpilation bug :( * Removing slide verify_params * Adding some more json schema examples * Adding a schema validator for flow filters * Translating all filters in ascent_runtime_vtkh_filters to json schema format. Also adding additional validator constructs needed to complete this. * Removing temporary helpers and cleaning up files * Seed should be seeds * adding a detail namespace to validator * Converting over the expression filters * converting another file * Trying to add some support for expressions again * Adding a way to pass our expression validator into the flow filter * We have a valid expression checker! * Integrating the expression checking into the vtkh number schemas :) * Taking a pass at trying to get the JIT tests to pass * Require that either field or topology be given for a threshold filter * Converting more filters to new schema - tested * Adding new template schemas to make further filter conversion possible * Updating the param check and flow schema validator with additional capabilities * Forgot to also add a type for integers * Converting more filters to new schema - tested * Converting more filters to new schema - tested * rover filter schemas * Adding dray filter schemas * Adding schemas for rendering filters (Also fixing a bug in the dray rendering filter :( ) * Last filter conversion over to json schema!!! * cleaning up branch Signed-off-by: Emily Howell <howell31@llnl.gov> * Had AI generate an import check for optional that will work with c++11. * Whopps. need to use it everywhere * Cleaning up some errors * Needed to add the pattern validation still * Fixing adios2 error in CI * Making sure that a compatable optional is used properly everywhere for backwards compatability to older versions of c++ * Fixing reflect filter * Fixing spelling error * Using refs to nodes instead of copying seperate nodes into tree * Generalizing the expression checking to any format checking * Applied formatting fixes * Using refs to nodes instead of copying seperate nodes into tree for extended edition filters too * const string ref vector * removing the optional_params * Removing print statement added for debugging * Fixing the refrences in adios2 schema * Formatting param check file * Fixing typo * Adding the minItem and maxItem array parameters to the array_schema helper * Removing missed ignore schema in array schema conversion. By default, array schema elements are ignored unless a schema is provided. * Adding small append fix to any of vecs. This was originally a change in the doc PR * Removing s from schema * Adding HDF5 example back --------- Signed-off-by: Emily Howell <howell31@llnl.gov>
1 parent acf42d2 commit 2341c7e

36 files changed

Lines changed: 1067 additions & 1934 deletions

src/libs/ascent/runtimes/expressions/ascent_expression_jit_filters.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ ExprJitFilter::declare_interface(Node &i)
149149
filters::string_schema(param_schema["properties/func"]);
150150
filters::string_schema(param_schema["properties/filter_name"]);
151151

152-
conduit::Node &inputs_schema = filters::array_schema(param_schema["properties/inputs"]);
153-
inputs_schema["minItems"] = num_inputs;
154-
inputs_schema["maxItems"] = num_inputs;
152+
conduit::Node &inputs_schema = filters::array_schema(param_schema["properties/inputs"], conduit::Node(), num_inputs, num_inputs);
155153

156154
param_schema["required"].append() = "func";
157155
param_schema["required"].append() = "filter_name";

src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.cpp

Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
//-----------------------------------------------------------------------------
2525
#include <ascent_runtime_utils.hpp>
2626
#include <ascent_string_utils.hpp>
27+
#include <ascent_runtime_param_check.hpp>
2728
#include <ascent_logging.hpp>
2829
#include <ascent_data_object.hpp>
2930

@@ -114,43 +115,26 @@ ADIOS2::declare_interface(Node &i)
114115
i["type_name"] = "adios2";
115116
i["port_names"].append() = "in";
116117
i["output_port"] = "false";
117-
}
118118

119-
//-----------------------------------------------------------------------------
120-
bool
121-
ADIOS2::verify_params(const conduit::Node &params,
122-
conduit::Node &info)
123-
{
124-
bool res = true;
125-
if (!params.has_child("filename") ||
126-
!params["filename"].dtype().is_string())
127-
{
128-
info["errors"].append() = "missing required entry 'filename'";
129-
res = false;
130-
}
119+
// ----------- Define Param Schema -----------
120+
conduit::Node &param_schema = i["param_schema"];
121+
param_schema["type"] = "object";
131122

132-
if (!params.has_child("engine") ||
133-
!params["engine"].dtype().is_string())
134-
{
135-
info["errors"].append() = "missing required entry 'engine'";
136-
res = false;
137-
}
123+
string_schema(param_schema["properties/filename"]);
124+
string_schema(param_schema["properties/engine"]);
138125

139-
std::string engineType = params["engine"].as_string();
140-
if (engineType != "BPFile" && engineType != "SST")
141-
{
142-
info["errors"].append() = "unsupported engine type: " + engineType;
143-
res = false;
144-
}
126+
conduit::Node &bpfile_schema = param_schema["oneOf"].append();
127+
bpfile_schema["type"] = "object";
128+
string_schema(bpfile_schema["properties/engine"]);
129+
bpfile_schema["properties/engine/constraints/const"] = "BPFile";
145130

146-
std::string fileName = params["filename"].as_string();
147-
if (engineType == "SST" && fileName.find("/") != std::string::npos )
148-
{
149-
info["errors"].append() = "filename with directory not supported for SST engine";
150-
res = false;
151-
}
131+
conduit::Node &sst_schema = param_schema["oneOf"].append();
132+
sst_schema["type"] = "object";
133+
string_schema(sst_schema["properties/engine"]);
134+
sst_schema["properties/engine/constraints/const"] = "SST";
152135

153-
return res;
136+
conduit::Node &fname = string_schema(sst_schema["properties/filename"]);
137+
fname["pattern"] = "^[^/]*$";
154138
}
155139

156140
//-----------------------------------------------------------------------------

src/libs/ascent/runtimes/flow_filters/ascent_runtime_adios2_filters.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ class ADIOS2 : public ::flow::Filter
5252
~ADIOS2();
5353

5454
virtual void declare_interface(conduit::Node &i);
55-
virtual bool verify_params(const conduit::Node &params,
56-
conduit::Node &info);
5755
virtual void execute();
5856

5957
private:

src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_compose.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,21 @@ void ascent::runtime::filters::BFlowCompose::declare_interface(conduit::Node &i)
4242
i["type_name"] = "bflow_comp";
4343
i["port_names"].append() = "in";
4444
i["output_port"] = "false"; // true -- means filter, false -- means extract
45-
}
46-
47-
//-----------------------------------------------------------------------------
48-
49-
bool ascent::runtime::filters::BFlowCompose::verify_params(const conduit::Node &params, conduit::Node &info)
50-
{
51-
info.reset();
5245

53-
bool res = true;
46+
// ----------- Define Param Schema -----------
47+
conduit::Node &param_schema = i["param_schema"];
48+
param_schema["type"] = "object";
5449

55-
res &= check_string("color_field", params, info, true);
56-
res &= check_string("depth_field", params, info, true);
57-
res &= check_string("image_prefix", params, info, true);
58-
res &= check_numeric("compositing", params, info, true);
59-
res &= check_numeric("fanin", params, info, false);
50+
string_schema(param_schema["properties/color_field"]);
51+
string_schema(param_schema["properties/depth_field"]);
52+
string_schema(param_schema["properties/image_prefix"]);
53+
number_schema(param_schema["properties/compositing"]);
54+
number_schema(param_schema["properties/fanin"]);
6055

61-
return res;
56+
param_schema["required"].append() = "color_field";
57+
param_schema["required"].append() = "depth_field";
58+
param_schema["required"].append() = "image_prefix";
59+
param_schema["required"].append() = "compositing";
6260
}
6361

6462
//-----------------------------------------------------------------------------

src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_filters.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ class BFlowPmt : public ::flow::Filter
3737
virtual ~BFlowPmt() {}
3838

3939
virtual void declare_interface(conduit::Node &i) override;
40-
virtual bool verify_params(const conduit::Node &params,
41-
conduit::Node &info) override;
4240
virtual void execute() override;
4341
};
4442

@@ -53,8 +51,6 @@ class BFlowCompose : public ::flow::Filter
5351
virtual ~BFlowCompose() {}
5452

5553
virtual void declare_interface(conduit::Node &i) override;
56-
virtual bool verify_params(const conduit::Node &params,
57-
conduit::Node &info) override;
5854
virtual void execute() override;
5955
};
6056

@@ -67,8 +63,6 @@ class BFlowIso : public ::flow::Filter
6763
virtual ~BFlowIso() {}
6864

6965
virtual void declare_interface(conduit::Node &i) override;
70-
virtual bool verify_params(const conduit::Node &params,
71-
conduit::Node &info) override;
7266
virtual void execute() override;
7367
};
7468

src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_iso.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -530,25 +530,21 @@ void ascent::runtime::filters::BFlowIso::declare_interface(conduit::Node &i)
530530
i["type_name"] = "bflow_iso";
531531
i["port_names"].append() = "in";
532532
i["output_port"] = "false"; // true -- means filter, false -- means extract
533-
}
534533

535-
//-----------------------------------------------------------------------------
534+
// ----------- Define Param Schema -----------
535+
conduit::Node &param_schema = i["param_schema"];
536+
param_schema["type"] = "object";
536537

537-
bool ascent::runtime::filters::BFlowIso::verify_params(const conduit::Node &params, conduit::Node &info)
538-
{
539-
info.reset();
538+
string_schema(param_schema["properties/field"]);
539+
number_schema(param_schema["properties/iso_values"]);
540+
string_schema(param_schema["properties/image_name"]);
541+
number_schema(param_schema["properties/radices"]);
542+
number_schema(param_schema["properties/width"]);
543+
number_schema(param_schema["properties/height"]);
540544

541-
bool res = true;
542-
543-
res &= check_string("field", params, info, true);
544-
res &= check_numeric("iso_values", params, info, true);
545-
res &= check_string("image_name", params, info, true);
546-
res &= check_numeric("radices", params, info, false);
547-
res &= check_numeric("width", params, info, false);
548-
res &= check_numeric("height", params, info, false);
549-
// res &= check_string("col_field", params, info, true);
550-
551-
return res;
545+
param_schema["required"].append() = "field";
546+
param_schema["required"].append() = "iso_values";
547+
param_schema["required"].append() = "image_name";
552548
}
553549

554550
//-----------------------------------------------------------------------------

src/libs/ascent/runtimes/flow_filters/ascent_runtime_babelflow_pmt.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,21 @@ void ascent::runtime::filters::BFlowPmt::declare_interface(conduit::Node &i)
14641464
i["type_name"] = "bflow_pmt";
14651465
i["port_names"].append() = "in";
14661466
i["output_port"] = "true"; // true -- means filter, false -- means extract
1467+
1468+
// ----------- Define Param Schema -----------
1469+
conduit::Node &param_schema = i["param_schema"];
1470+
param_schema["type"] = "object";
1471+
1472+
string_schema(param_schema["properties/field"]);
1473+
number_schema(param_schema["properties/fanin"]);
1474+
number_schema(param_schema["properties/threshold"]);
1475+
number_schema(param_schema["properties/gen_segment"]);
1476+
number_schema(param_schema["properties/ugrid_select"]);
1477+
1478+
param_schema["required"].append() = "field";
1479+
param_schema["required"].append() = "fanin";
1480+
param_schema["required"].append() = "threshold";
1481+
param_schema["required"].append() = "gen_segment";
14671482
}
14681483

14691484
//-----------------------------------------------------------------------------
@@ -1847,20 +1862,3 @@ void ascent::runtime::filters::BFlowPmt::execute()
18471862

18481863
set_output<DataObject>(d_input);
18491864
}
1850-
1851-
//-----------------------------------------------------------------------------
1852-
1853-
bool ascent::runtime::filters::BFlowPmt::verify_params(const conduit::Node &params, conduit::Node &info)
1854-
{
1855-
info.reset();
1856-
1857-
bool res = true;
1858-
1859-
res &= check_string("field", params, info, true);
1860-
res &= check_numeric("fanin", params, info, true);
1861-
res &= check_numeric("threshold", params, info, true);
1862-
res &= check_numeric("gen_segment", params, info, true);
1863-
res &= check_numeric("ugrid_select", params, info, false);
1864-
1865-
return res;
1866-
}

0 commit comments

Comments
 (0)