Debian Codegraph @

packages/seacas/libraries/ioss/src/visualization/catalyst/parser/phactoriParser.ypp

raw
1 /*
2 * Copyright(C) 1999-2020 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8
9 %{
10 #include <stdio.h>
11 #include <string.h>
12 #include <iostream>
13 #include <algorithm>
14
15 #include <sstream>
16 #include <vector>
17 #include <cmath>
18 #include "PhactoriParserInterface.h"
19 #include "vtk_jsoncpp.h"
20
21 namespace {
22
23 class ParseData
24 {
25 public:
26 ParseData()
27 {
28 this->root = Json::Value(Json::objectValue);
29 this->ims_shortcut = Json::Value(Json::objectValue);
30 this->separator = "_";
31 this->checkNodeIDRange = false;
32 this->checkElementIDRange = false;
33 }
34
35 ~ParseData()
36 {
37 this->root.clear();
38 this->ims_shortcut.clear();
39 this->separator.clear();
40 this->cbn.clear();
41 this->d.clear();
42 }
43
44 Json::Value root;
45 Json::Value ims_shortcut;
46 int cb;
47 std::string cbn;
48 std::vector<double> d;
49 std::vector<int> intValues;
50 std::vector<std::string> s;
51 int count;
52 Iovs::PhactoriParserInterface::varMap nodeVars;
53 Iovs::PhactoriParserInterface::varMap elementVars;
54 Iovs::PhactoriParserInterface::varMap globalVars;
55 bool checkNodeIDRange;
56 Iovs::PhactoriParserInterface::idRange nodeIDRange;
57 bool checkElementIDRange;
58 Iovs::PhactoriParserInterface::idRange elementIDRange;
59 std::string separator;
60 };
61
62 ParseData& c(void* pd) {
63 return *(static_cast<ParseData*>(pd));
64 }
65
66 std::vector<std::string> getTokensBeforeEqualsAsLowerCase(
67 const std::string & line);
68 std::string getStringAfterEquals(const std::string & line);
69 std::string getStringBeforeEquals(const std::string & line);
70 void toLowerCase(std::string & s);
71 bool stringStartsAndEndsWithQuotes(const std::string & s);
72 bool containsPhactoriCommandThatNeedsQuotes(std::vector<std::string>& tl);
73 void addQuotesToString(std::string & s);
74 std::string trim(const std::string& s);
75
76 std::string preProcessPhactoriInput(const std::string & input) {
77 std::istringstream iss(input);
78
79 std::string result;
80 for (std::string line; std::getline(iss, line); ) {
81 std::vector<std::string> tl = getTokensBeforeEqualsAsLowerCase(line);
82 std::string ae = getStringAfterEquals(line);
83 if(containsPhactoriCommandThatNeedsQuotes(tl) &&
84 !stringStartsAndEndsWithQuotes(ae)) {
85 addQuotesToString(ae);
86 result += (getStringBeforeEquals(line) + "=" + ae + "\n");
87 }
88 else {
89 result += line + "\n";
90 }
91 }
92 return result;
93 }
94
95 std::vector<std::string> getTokensBeforeEqualsAsLowerCase(
96 const std::string & line) {
97
98 std::vector<std::string> tl;
99 std::istringstream iss(line);
100 std::string token;
101 while(iss >> token) {
102 if (token == "=") {
103 break;
104 }
105 else {
106 toLowerCase(token);
107 tl.push_back(token);
108 }
109 }
110 return tl;
111 }
112
113 std::string getStringAfterEquals(const std::string & line) {
114 return line.substr(line.find("=") + 1);
115 }
116
117 std::string getStringBeforeEquals(const std::string & line) {
118 return line.substr(0, line.find("="));
119 }
120
121 void toLowerCase(std::string & s) {
122 std::transform(s.begin(), s.end(), s.begin(), ::tolower);
123 }
124
125 bool stringStartsAndEndsWithQuotes(const std::string & s) {
126 size_t first = s.find_first_not_of(' ');
127 bool startWithQuote = s.rfind("\"", first) == first;
128 size_t last = s.find_last_not_of(' ');
129 bool endsWithQuote = s.rfind("\"", last) == last;
130 return startWithQuote && endsWithQuote;
131 }
132
133 void addQuotesToString(std::string & s) {
134 s = "\"" + trim(s) + "\"";
135 }
136
137 std::string trim(const std::string& s) {
138 size_t first = s.find_first_not_of(' ');
139 if (std::string::npos == first) {
140 return s;
141 }
142 size_t last = s.find_last_not_of(' ');
143 return s.substr(first, (last - first + 1));
144 }
145
146 bool containsPhactoriCommandThatNeedsQuotes(std::vector<std::string>& tl) {
147 if (tl.size() == 1 && tl[0] == "function") {
148 return true;
149 }
150 else if (tl.size() == 2 && (tl[0] == "plot" || tl[0] == "image") &&
151 tl[1] == "basename") {
152 return true;
153 }
154 else if (tl.size() == 2 && (tl[0] == "plot" || tl[0] == "image") &&
155 tl[1] == "basedirectory") {
156 return true;
157 }
158 else if (tl.size() == 3 && tl[0] == "image" && tl[1] == "name" &&
159 tl[2] == "addon") {
160 return true;
161 }
162 else if (tl.size() == 4 && (tl[0] == "x" || tl[0] == "y" ||
163 tl[0] == "z") && tl[1] == "axis" && tl[2] == "label" &&
164 tl[3] == "name") {
165 return true;
166 }
167 return false;
168 }
169
170 } // End anonymous namespace
171
172 typedef struct yy_buffer_state * YY_BUFFER_STATE;
173 typedef void* yyscan_t;
174 int yyparse(yyscan_t scanner, void* pd);
175
176 #include "phactoriParser.tab.hpp"
177
178 extern "C"
179 {
180 YY_BUFFER_STATE catalyst_scan_string(const char * str, yyscan_t yyscanner);
181 void catalyst_delete_buffer(YY_BUFFER_STATE buffer, yyscan_t yyscanner);
182 int yylex(YYSTYPE *yylval_param, YYLTYPE * llocp, yyscan_t yyscanner);
183 int catalystlex_init ( yyscan_t * ptr_yy_globals ) ;
184 int catalystlex_destroy ( yyscan_t yyscanner ) ;
185 void catalystset_in( FILE * in_str , yyscan_t scanner );
186
187 int catalystwrap()
188 {
189 return 1;
190 }
191 }
192
193 namespace {
194
195 void yyerror (YYLTYPE * llocp, yyscan_t yyscanner, void* pd, char const *msg);
196 bool check_variable_name(YYLTYPE * llocp,
197 yyscan_t yyscanner,
198 ParseData& pd,
199 const std::string& name,
200 Iovs::PhactoriParserInterface::VarType vt);
201
202
203 bool follow_chain(ParseData& pd,
204 std::string& n,
205 Json::Value& nl)
206 {
207 nl[n] = true;
208 while(1)
209 {
210 if(pd.root["operation blocks"][n].isMember("input"))
211 {
212 n = pd.root["operation blocks"][n]["input"].asString();
213 if(nl.isMember(n))
214 return true;
215 else
216 nl[n] = true;
217 }
218 else if(pd.root["operation blocks"][n].isMember("operation group list"))
219 {
220 Json::Value op_names = pd.root["operation blocks"][n]["operation group list"];
221 for( Json::ValueIterator nitr = op_names.begin() ;
222 nitr != op_names.end() ; nitr++)
223 {
224 n = (*nitr).asString();
225 if(nl.isMember(n))
226 return true;
227 else
228 nl[n] = true;
229 }
230 }
231 else
232 break;
233 }
234 return false;
235 }
236
237 bool has_cycle(ParseData& pd,
238 Json::ValueIterator itr,
239 const std::string& key)
240 {
241 if((*itr).isMember(key))
242 {
243 if((*itr).isMember("operation group list"))
244 {
245 Json::Value op_names = (*itr)["operation group list"];
246 for( Json::ValueIterator nitr = op_names.begin() ;
247 nitr != op_names.end() ; nitr++)
248 {
249 Json::Value nl(Json::objectValue);
250 std::string n = (*nitr).asString();
251 if(follow_chain(pd, n, nl))
252 return true;
253 }
254 }
255 else
256 {
257 Json::Value nl(Json::objectValue);
258 std::string n = (*itr)[key].asString();
259 if(follow_chain(pd, n, nl))
260 return true;
261 }
262 }
263 return false;
264 }
265
266 bool check_cycles(YYLTYPE * llocp, yyscan_t yyscanner, ParseData& pd)
267 {
268 for(Json::ValueIterator itr = pd.root["operation blocks"].begin() ;
269 itr != pd.root["operation blocks"].end() ; itr++)
270 {
271 if(has_cycle(pd, itr, "input") ||
272 has_cycle(pd, itr, "operation group list"))
273 {
274 std::string s = "Error: operation (" + itr.key().asString() + ") contains an operation cycle";
275 yyerror(llocp, yyscanner, &pd, s.c_str());
276 return false;
277 }
278 }
279
280 for(Json::ValueIterator itr = pd.root["imageset blocks"].begin() ;
281 itr != pd.root["imageset blocks"].end() ; itr++)
282 {
283 if(has_cycle(pd, itr, "operation"))
284 {
285 std::string s = "Error: imageset (" + itr.key().asString() + ") contains an operation cycle";
286 yyerror(llocp, yyscanner, &pd, s.c_str());
287 return false;
288 }
289 }
290
291 for(Json::ValueIterator itr = pd.root["scatter plot blocks"].begin() ;
292 itr != pd.root["scatter plot blocks"].end() ; itr++)
293 {
294 if(has_cycle(pd, itr, "operation"))
295 {
296 std::string s = "Error: scatter plot (" + itr.key().asString() + ") contains an operation cycle";
297 yyerror(llocp, yyscanner, &pd, s.c_str());
298 return false;
299 }
300 }
301
302 for(Json::ValueIterator itr = pd.root["plot over time blocks"].begin() ;
303 itr != pd.root["plot over time blocks"].end() ; itr++)
304 {
305 if(has_cycle(pd, itr, "operation"))
306 {
307 std::string s = "Error: plot over time (" + itr.key().asString() + ") contains an operation cycle";
308 yyerror(llocp, yyscanner, &pd, s.c_str());
309 return false;
310 }
311 }
312
313 return true;
314 }
315
316 bool check_names(YYLTYPE * llocp, yyscan_t yyscanner, ParseData& pd)
317 {
318 if(pd.ims_shortcut.size())
319 return true;
320
321
322 /* CHECK IMAGESETS */
323
324 for(Json::ValueIterator itr = pd.root["imageset blocks"].begin() ;
325 itr != pd.root["imageset blocks"].end() ; itr++)
326 {
327 if((*itr).isMember("camera"))
328 {
329 std::string n = (*itr)["camera"].asString();
330 if(!pd.root["camera blocks"].isMember(n))
331 {
332 std::string s = "Error: imageset (" + itr.key().asString() + ") references camera ("
333 + n + ") which does not exist";
334 yyerror(llocp, yyscanner, &pd, s.c_str());
335 return false;
336 }
337 }
338
339 if((*itr).isMember("representation"))
340 {
341 std::string n = (*itr)["representation"].asString();
342 if(!pd.root["representation blocks"].isMember(n))
343 {
344 std::string s = "Error: imageset (" + itr.key().asString() + ") references representation ("
345 + n + ") which does not exist";
346 yyerror(llocp, yyscanner, &pd, s.c_str());
347 return false;
348 }
349 }
350
351 if((*itr).isMember("operation"))
352 {
353 std::string n = (*itr)["operation"].asString();
354 if(!pd.root["operation blocks"].isMember(n))
355 {
356 std::string s = "Error: imageset (" + itr.key().asString() + ") references operation ("
357 + n + ") which does not exist";
358 yyerror(llocp, yyscanner, &pd, s.c_str());
359 return false;
360 }
361 }
362 }
363
364 /* CHECK OPERATIONS */
365
366 for(Json::ValueIterator itr = pd.root["operation blocks"].begin() ;
367 itr != pd.root["operation blocks"].end() ; itr++)
368 {
369 std::string n;
370 bool error = false;
371 if((*itr).isMember("input"))
372 {
373 n = (*itr)["input"].asString();
374 if(!pd.root["operation blocks"].isMember(n))
375 error = true;
376 }
377 else if((*itr).isMember("operation group list"))
378 {
379 Json::Value op_names = (*itr)["operation group list"];
380 for( Json::ValueIterator nitr = op_names.begin() ;
381 nitr != op_names.end() ; nitr++ )
382 {
383 n = (*nitr).asString();
384 if(!pd.root["operation blocks"].isMember(n))
385 {
386 error = true;
387 break;
388 }
389 }
390 }
391 if(error)
392 {
393 std::string s = "Error: operation (" + itr.key().asString() + ") references operation ("
394 + n + ") which does not exist";
395 yyerror(llocp, yyscanner, &pd, s.c_str());
396 return false;
397 }
398 }
399
400 /* CHECK SCATTER PLOTS */
401
402 for(Json::ValueIterator itr = pd.root["scatter plot blocks"].begin() ;
403 itr != pd.root["scatter plot blocks"].end() ; itr++)
404 {
405 if((*itr).isMember("operation"))
406 {
407 std::string n = (*itr)["operation"].asString();
408 if(!pd.root["operation blocks"].isMember(n))
409 {
410 std::string s = "Error: scatter plot (" + itr.key().asString() + ") references operation ("
411 + n + ") which does not exist";
412 yyerror(llocp, yyscanner, &pd, s.c_str());
413 return false;
414 }
415 }
416 }
417
418 /* CHECK PLOT OVER TIME */
419
420 for(Json::ValueIterator itr = pd.root["plot over time blocks"].begin() ;
421 itr != pd.root["plot over time blocks"].end() ; itr++)
422 {
423 if((*itr).isMember("operation"))
424 {
425 std::string n = (*itr)["operation"].asString();
426 if(!pd.root["operation blocks"].isMember(n))
427 {
428 std::string s = "Error: plot over time (" + itr.key().asString() + ") references operation ("
429 + n + ") which does not exist";
430 yyerror(llocp, yyscanner, &pd, s.c_str());
431 return false;
432 }
433 }
434 }
435
436 return true;
437 }
438
439 bool check_color_name(YYLTYPE * llocp, yyscan_t yyscanner, ParseData& pd, const std::string& cn)
440 {
441 std::string bn = cn;
442 std::transform(bn.begin(), bn.end(), bn.begin(), ::tolower);
443 if(bn == "default" ||
444 bn == "cool_to_warm" ||
445 bn == "blue_to_red_rainbow" ||
446 bn == "blue_to_blue_rainbow" ||
447 bn == "grayscale" ||
448 bn == "x_ray" ||
449 bn == "blue_to_yellow" ||
450 bn == "black_body_radiation" ||
451 bn == "cielab_blue_to_red_black" ||
452 bn == "blue_and_white" ||
453 bn == "black" ||
454 bn == "orange_and_white" ||
455 bn == "cold_and_hot" ||
456 bn == "rainbow_desaturated" ||
457 bn == "rainbow_blended_white" ||
458 bn == "rainbow_blended_grey")
459 {
460 return true;
461 }
462 yyerror(llocp, yyscanner, &pd, ("Error: invalid preset color name " + cn).c_str());
463 return false;
464 }
465
466 bool check_plot_axes(YYLTYPE * llocp,
467 yyscan_t yyscanner,
468 ParseData& pd,
469 const Json::Value& c,
470 const std::string& axis)
471 {
472 if(c.isMember(axis + " axis range") && (c.isMember(axis + " axis use current data range") ||
473 c.isMember(axis + " axis use cumulative data range") ||
474 c.isMember(axis + " axis minimum range") ||
475 c.isMember(axis + " axis maximum range")) )
476 {
477 std::string s = "Plot block contains '" + axis + " axis range' and additional commands\n"
478 "to specify the axis. '" + axis + " axis range' must be used\n"
479 "without other axis commands\n";
480 yyerror(llocp, yyscanner, &pd, s.c_str());
481 return false;
482 }
483
484 if(c[axis + " axis use current data range"].asBool() &&
485 c[axis + " axis use cumulative data range"].asBool() )
486 {
487 std::string s = "Plot block contains '" + axis + " axis use current data range' and\n"
488 "'" + axis + " axis use cumulative data range'. Can only specify one\n"
489 "of these commands.\n";
490 yyerror(llocp, yyscanner, &pd, s.c_str());
491 return false;
492 }
493
494 if(c.isMember(axis + " axis minimum range") &&
495 c.isMember(axis + " axis maximum range") )
496 {
497 if(c[axis + " axis minimum range"][1] >
498 c[axis + " axis maximum range"][0] )
499 {
500 yyerror(llocp, yyscanner, &pd, ("Error: plot block contains invalid minimum and maximum " + axis + " axis ranges").c_str());
501 return false;
502 }
503 }
504
505 return true;
506 }
507
508 bool check_calculator_function_variable_names(YYLTYPE * llocp,
509 yyscan_t yyscanner,
510 ParseData& pd,
511 const Json::Value& c,
512 Iovs::PhactoriParserInterface::varMap& vm)
513 {
514
515 for(Iovs::PhactoriParserInterface::varMap::iterator it=vm.begin();
516 it != vm.end();
517 ++it)
518 {
519 std::size_t found = c["function"][0].asString().find(it->first);
520 if(found != std::string::npos)
521 if(!check_variable_name(llocp, yyscanner, pd, it->first, it->second))
522 return false;
523 }
524
525 return true;
526 }
527
528 bool check_calculator_block(YYLTYPE * llocp,
529 yyscan_t yyscanner,
530 ParseData& pd,
531 const Json::Value& c)
532 {
533 if(!c.isMember("function"))
534 {
535 yyerror(llocp, yyscanner, &pd, "Error: calculator block does not contain a 'function' statement");
536 return false;
537 }
538
539 if(!c.isMember("output variable name"))
540 {
541 yyerror(llocp, yyscanner, &pd, "Error: calculator block does not contain a 'output variable name' statement");
542 return false;
543 }
544
545 if(!c.isMember("element or node data"))
546 {
547 yyerror(llocp, yyscanner, &pd, "Error: calculator block does not contain a 'element or node data' statement");
548 return false;
549 }
550
551 if(c["element or node data"].asString() == "node" && !pd.nodeVars.empty())
552 {
553 pd.nodeVars[c["output variable name"].asString()] = Iovs::PhactoriParserInterface::ALLTYPE;
554 if(!check_calculator_function_variable_names(llocp, yyscanner, pd, c, pd.nodeVars))
555 {
556 yyerror(llocp, yyscanner, &pd, "Error: calculator function contains unknown variable name.");
557 return false;
558 }
559 }
560 else if(c["element or node data"].asString() == "element" && !pd.elementVars.empty())
561 {
562 pd.elementVars[c["output variable name"].asString()] = Iovs::PhactoriParserInterface::ALLTYPE;
563 if(!check_calculator_function_variable_names(llocp, yyscanner, pd, c, pd.elementVars))
564 {
565 yyerror(llocp, yyscanner, &pd, "Error: calculator function contains unknown variable name.");
566 return false;
567 }
568 }
569
570 return true;
571 }
572
573 bool check_plot_over_time_block(YYLTYPE * llocp,
574 yyscan_t yyscanner,
575 ParseData& pd,
576 const Json::Value& c)
577 {
578 int count = 0;
579 if(c.isMember("all variables")) count++;
580 if(c.isMember("variable scalar")) count++;
581 if(c.isMember("variable vector magnitude")) count++;
582 if(c.isMember("variable vector component")) count++;
583 if(c.isMember("variable tensor component")) count++;
584
585 if(count > 1)
586 {
587 yyerror(llocp, yyscanner, &pd, "Error: plot over time block contains multiple 'variable ...' commands, only one allowed");
588 return false;
589 }
590
591 if(!count)
592 {
593 yyerror(llocp, yyscanner, &pd, "Error: plot over time block contains variable to plot, at least one variable required");
594 return false;
595 }
596
597 bool ret = true;
598 ret = ret && check_plot_axes(llocp, yyscanner, pd, c, "y");
599
600 return ret;
601 }
602
603 bool check_scatter_plot_block(YYLTYPE * llocp,
604 yyscan_t yyscanner,
605 ParseData& pd,
606 const Json::Value& c)
607 {
608 int all_variables_count = 0;
609 int x_axis_variable_count = 0;
610 int y_axis_variable_count = 0;
611 if(c.isMember("all variables")) all_variables_count++;
612 if(c.isMember("x axis variable scalar")) x_axis_variable_count++;
613 if(c.isMember("y axis variable scalar")) y_axis_variable_count++;
614 if(c.isMember("x axis variable vector magnitude")) x_axis_variable_count++;
615 if(c.isMember("y axis variable vector magnitude")) y_axis_variable_count++;
616 if(c.isMember("x axis variable vector component")) x_axis_variable_count++;
617 if(c.isMember("y axis variable vector component")) y_axis_variable_count++;
618 if(c.isMember("x axis variable tensor component")) x_axis_variable_count++;
619 if(c.isMember("y axis variable tensor component")) y_axis_variable_count++;
620
621 if( all_variables_count &&
622 (x_axis_variable_count || y_axis_variable_count) )
623 {
624 std::string s = "Scatter Plot block contains the 'all variables' command with \n"
625 "other '<x|y> axis variable ...' commands. Only one allowed.";
626 yyerror(llocp, yyscanner, &pd, s.c_str());
627 return false;
628 }
629 else if(x_axis_variable_count > 1)
630 {
631 std::string s = "Scatter Plot block contains more than one 'x axis variable ...' \n"
632 "command. Only one allowed.";
633 yyerror(llocp, yyscanner, &pd, s.c_str());
634 return false;
635 }
636 else if(y_axis_variable_count > 1)
637 {
638 std::string s = "Scatter Plot block contains more than one 'y axis variable ...' \n"
639 "command. Only one allowed.";
640 yyerror(llocp, yyscanner, &pd, s.c_str());
641 return false;
642 }
643
644 if(all_variables_count == 0 &&
645 y_axis_variable_count == 0)
646 {
647 yyerror(llocp, yyscanner, &pd, "Scatter Plot block contains no y data to plot.");
648 return false;
649 }
650
651 bool ret = true;
652 ret = ret && check_plot_axes(llocp, yyscanner, pd, c, "x");
653 ret = ret && check_plot_axes(llocp, yyscanner, pd, c, "y");
654
655 return ret;
656 }
657
658 bool check_contour(YYLTYPE * llocp,
659 yyscan_t yyscanner,
660 ParseData& pd,
661 const Json::Value& c)
662 {
663 int count = 0;
664 if(c.isMember("contour value")) count++;
665 if(c.isMember("contour value sequence")) count++;
666
667 if(!count)
668 {
669 yyerror(llocp, yyscanner, &pd, "Error: contour operation contains no 'contour value ...' commands, one required");
670 return false;
671 }
672
673 count = 0;
674 if(c.isMember("variable scalar")) count++;
675 if(c.isMember("variable vector magnitude")) count++;
676 if(c.isMember("variable vector component")) count++;
677 if(c.isMember("variable tensor component")) count++;
678
679 if(count > 1)
680 {
681 yyerror(llocp, yyscanner, &pd, "Error: contour operation contains multiple 'variable ...' commands, only one allowed");
682 return false;
683 }
684
685 if(!count)
686 {
687 yyerror(llocp, yyscanner, &pd, "Error: contour operation contains no 'variable ...' commands, one is required");
688 return false;
689 }
690
691 return true;
692 }
693
694 bool check_threshold(YYLTYPE * llocp,
695 yyscan_t yyscanner,
696 ParseData& pd,
697 const Json::Value& c)
698 {
699 int count = 0;
700 if(c.isMember("keep between")) count++;
701 if(c.isMember("keep above")) count++;
702 if(c.isMember("keep below")) count++;
703
704 if(count > 1)
705 {
706 yyerror(llocp, yyscanner, &pd, "Error: threshold operation contains multiple 'keep ...' commands, only one allowed");
707 return false;
708 }
709
710 if(!count)
711 {
712 yyerror(llocp, yyscanner, &pd, "Error: threshold operation contains no 'keep ...' commands, one is required");
713 return false;
714 }
715
716 count = 0;
717 if(c.isMember("variable scalar")) count++;
718 if(c.isMember("variable vector magnitude")) count++;
719 if(c.isMember("variable vector component")) count++;
720 if(c.isMember("variable tensor component")) count++;
721
722 if(count > 1)
723 {
724 yyerror(llocp, yyscanner, &pd, "Error: threshold operation contains multiple 'variable ...' commands, only one allowed");
725 return false;
726 }
727
728 if(!count)
729 {
730 yyerror(llocp, yyscanner, &pd, "Error: threshold operation contains no 'variable ...' commands, one is required");
731 return false;
732 }
733
734 return true;
735 }
736
737 bool check_box_clip(YYLTYPE * llocp,
738 yyscan_t yyscanner,
739 ParseData& pd,
740 const Json::Value& c)
741 {
742 int count = 0;
743 if(c.isMember("center at absolute point")) count++;
744 if(c.isMember("center at relative point")) count++;
745 if(c.isMember("center at node")) count++;
746 if(c.isMember("center at element")) count++;
747
748 if(count > 1)
749 {
750 yyerror(llocp, yyscanner, &pd, "Error: box clip operation contains multiple 'center at ...' commands, only one allowed");
751 return false;
752 }
753
754 count = 0;
755 if(c.isMember("absolute extents")) count++;
756 if(c.isMember("relative extents")) count++;
757
758 if(count > 1)
759 {
760 yyerror(llocp, yyscanner, &pd, "Error: box clip operation contains both 'absolute extents' and 'relative extents' commands, only one allowed");
761 return false;
762 }
763
764 return true;
765 }
766
767 bool check_clip_or_slice(YYLTYPE * llocp,
768 yyscan_t yyscanner,
769 ParseData& pd,
770 const Json::Value& c)
771 {
772 int count = 0;
773 if(c.isMember("absolute point on plane")) count++;
774 if(c.isMember("relative point on plane")) count++;
775 if(c.isMember("node on plane")) count++;
776 if(c.isMember("element on plane")) count++;
777
778 if(count > 1)
779 {
780 if(pd.cb == TOKCLIP)
781 yyerror(llocp, yyscanner, &pd, "Error: clip operation contains multiple '... point on plane' commands, only one allowed");
782 else if(pd.cb == TOKSLICE)
783 yyerror(llocp, yyscanner, &pd, "Error: slice operation contains multiple '... point on plane' commands, only one allowed");
784 return false;
785 }
786 return true;
787 }
788
789 bool check_camera(YYLTYPE * llocp,
790 yyscan_t yyscanner,
791 ParseData& pd,
792 const Json::Value& c)
793 {
794 if(c.isMember("look at relative distance") &&
795 c.isMember("look at absolute distance"))
796 {
797 yyerror(llocp, yyscanner, &pd, "Error: camera block contains both 'look at relative distance' and 'look at absolute distance'");
798 return false;
799 }
800
801 int look_at_count = 0;
802 if(c.isMember("look at absolute point")) look_at_count++;
803 if(c.isMember("look at relative point")) look_at_count++;
804 if(c.isMember("look at element")) look_at_count++;
805 if(c.isMember("look at node")) look_at_count++;
806
807 if(look_at_count > 1)
808 {
809 yyerror(llocp, yyscanner, &pd, "Error: camera block contains multiple 'look at .. ' operations, only one allowed");
810 return false;
811 }
812
813 if(!c.isMember("camera type") ||
814 c["camera type"].asString() == "multicamera8")
815 return true;
816
817 int camera_at_count = 0;
818 if(c.isMember("camera at relative point")) camera_at_count++;
819 if(c.isMember("camera at absolute point")) camera_at_count++;
820 if(c.isMember("camera at element")) camera_at_count++;
821 if(c.isMember("camera at node")) camera_at_count++;
822 if(c.isMember("camera at element displaced")) camera_at_count++;
823 if(c.isMember("camera at node displaced")) camera_at_count++;
824
825 if(camera_at_count > 1)
826 {
827 yyerror(llocp, yyscanner, &pd, "Error: camera block contains multiple 'camera at ... ' operations, only one allowed");
828 return false;
829 }
830
831 bool has_look_direction = c.isMember("look direction");
832 bool has_camera_position = camera_at_count >= 1;
833 bool has_look_at_point = look_at_count >= 1;
834 bool has_camera_distance = c.isMember("look at relative distance") ||
835 c.isMember("look at absolute distance");
836
837 if(has_camera_position &&
838 has_look_at_point &&
839 has_look_direction)
840 {
841 std::string s = "Block contains an invalid camera specification. \n"
842 "Cameras may not have a 'camera at ...' command and \n"
843 "a 'look at ...' command and a 'look direction' command";
844 yyerror(llocp, yyscanner, &pd, s.c_str());
845 return false;
846 }
847
848 if(has_camera_position &&
849 has_look_at_point &&
850 has_camera_distance)
851 {
852 std::string s = "Block contains an invalid camera specification. \n"
853 "Cameras may not have a 'camera at ...' command and \n"
854 "a 'look at ...' command and a 'look at relative|absolute distance' command";
855 yyerror(llocp, yyscanner, &pd, s.c_str());
856 return false;
857 }
858
859 if(has_camera_position &&
860 has_look_direction &&
861 has_camera_distance)
862 {
863 std::string s = "Block contains an invalid camera specification. \n"
864 "Cameras may not have a 'camera at ...' command and \n"
865 "a 'look direction' command and a 'look at relative|absolute distance' command";
866 yyerror(llocp, yyscanner, &pd, s.c_str());
867 return false;
868 }
869
870 return true;
871 }
872
873 bool check_imageset(YYLTYPE * llocp,
874 yyscan_t yyscanner,
875 ParseData& pd,
876 const Json::Value& r)
877 {
878 if(r.isMember("representation") &&
879 (r.isMember("show surfaces") ||
880 r.isMember("show edges") ||
881 r.isMember("show bounding box") ||
882 r.isMember("color by scalar") ||
883 r.isMember("color by vector magnitude") ||
884 r.isMember("color by vector component") ||
885 r.isMember("color by tensor component") ||
886 r.isMember("color by solid color") ||
887 r.isMember("color by blockid") ||
888 r.isMember("show color legend") ||
889 r.isMember("color legend range") ||
890 r.isMember("color legend use current data range") ||
891 r.isMember("color legend use cumulative data range") ||
892 r.isMember("color legend minimum range") ||
893 r.isMember("color legend maximum range") ||
894 r.isMember("color legend position") ||
895 r.isMember("invert color scale") ||
896 r.isMember("show time annotation") ||
897 r.isMember("time annotation position") ||
898 r.isMember("show axes") ||
899 r.isMember("show x axis label") ||
900 r.isMember("show y axis label") ||
901 r.isMember("show z axis label") ||
902 r.isMember("x axis label name") ||
903 r.isMember("y axis label name") ||
904 r.isMember("z axis label name") ||
905 r.isMember("show x axis tic marks") ||
906 r.isMember("show y axis tic marks") ||
907 r.isMember("show z axis tic marks") ||
908 r.isMember("show x axis minor tic marks") ||
909 r.isMember("show y axis minor tic marks") ||
910 r.isMember("show z axis minor tic marks") ||
911 r.isMember("show x axis tic mark labels") ||
912 r.isMember("show y axis tic mark labels") ||
913 r.isMember("show z axis tic mark labels") ||
914 r.isMember("show orientation axes") ))
915 {
916 yyerror(llocp, yyscanner, &pd, "Error: imageset block contains both representation shortcuts and a representation block reference");
917 return false;
918 }
919
920 if(r.isMember("camera") &&
921 (r.isMember("look at absolute point") ||
922 r.isMember("look at relative point") ||
923 r.isMember("look at element") ||
924 r.isMember("look at node") ||
925 r.isMember("look at absolute distance") ||
926 r.isMember("look at relative distance") ||
927 r.isMember("up vector") ||
928 r.isMember("camera fov") ))
929 {
930 yyerror(llocp, yyscanner, &pd, "Error: imageset block contains both camera shortcuts and a camera block reference");
931 return false;
932 }
933
934 return true;
935 }
936
937 bool check_representation(YYLTYPE * llocp,
938 yyscan_t yyscanner,
939 ParseData& pd,
940 const Json::Value& r)
941 {
942 int count = 0;
943 if(r.isMember("color by scalar")) count++;
944 if(r.isMember("color by vector magnitude")) count++;
945 if(r.isMember("color by vector component")) count++;
946 if(r.isMember("color by tensor component")) count++;
947 if(r.isMember("color by solid color")) count++;
948 if(r.isMember("color by blockid")) count++;
949
950 if(count > 1)
951 {
952 yyerror(llocp, yyscanner, &pd, "Error: representation block contains multiple color by operations");
953 return false;
954 }
955
956 if(r["show bounding box"].asBool() &&
957 r["show surfaces"].asBool())
958 {
959 yyerror(llocp, yyscanner, &pd, "Error: representation block contains both 'show bounding box = true' and 'show surfaces = true'");
960 return false;
961 }
962
963 if(r["show bounding box"].asBool() &&
964 r["show edges"].asBool())
965 {
966 yyerror(llocp, yyscanner, &pd, "Error: representation block contains both 'show bounding box = true' and 'show edges = true'");
967 return false;
968 }
969
970 if(r.isMember("color legend range") &&
971 (r.isMember("color legend use cumulative data range") ||
972 r.isMember("color legend use current data range") ||
973 r.isMember("color legend minimum range") ||
974 r.isMember("color legend maximum range") ))
975 {
976 yyerror(llocp, yyscanner, &pd, "Error: representation block contains color legend range and additional color legend commands");
977 return false;
978 }
979
980 if(r.isMember("color legend use cumulative data range") &&
981 r.isMember("color legend use current data range") )
982 {
983 yyerror(llocp, yyscanner, &pd, "Error: representation block contains both color legend cumulative and current data range commands");
984 return false;
985 }
986
987 if(r.isMember("color legend minimum range") &&
988 r.isMember("color legend maximum range") )
989 {
990 if(r["color legend minimum range"][1] >
991 r["color legend maximum range"][0] )
992 {
993 yyerror(llocp, yyscanner, &pd, "Error: representation block contains invalid minimum and maximum color legend ranges");
994 return false;
995 }
996 }
997
998 return true;
999 }
1000
1001 bool check_nodeID(YYLTYPE * llocp,
1002 yyscan_t yyscanner,
1003 ParseData& pd,
1004 int id)
1005 {
1006 if(pd.checkNodeIDRange)
1007 {
1008 if(id < pd.nodeIDRange.first || id > pd.nodeIDRange.second)
1009 {
1010 std::stringstream ss;
1011 ss << id;
1012 yyerror(llocp, yyscanner, &pd, ("Error: node id out of range " + ss.str()).c_str());
1013 return false;
1014 }
1015 }
1016 return true;
1017 }
1018
1019 bool check_elementID(YYLTYPE * llocp,
1020 yyscan_t yyscanner,
1021 ParseData& pd,
1022 int id)
1023 {
1024 if(pd.checkElementIDRange)
1025 {
1026 if(id < pd.elementIDRange.first || id > pd.elementIDRange.second)
1027 {
1028 std::stringstream ss;
1029 ss << id;
1030 yyerror(llocp, yyscanner, &pd, ("Error: element id out of range " + ss.str()).c_str());
1031 return false;
1032 }
1033 }
1034 return true;
1035 }
1036
1037 void switch_variable_to_used(const std::string& name,
1038 Iovs::PhactoriParserInterface::varMap& v)
1039 {
1040 if(v.find(name) != v.end())
1041 {
1042 if( v[name] == Iovs::PhactoriParserInterface::ALLTYPE )
1043 v[name] = Iovs::PhactoriParserInterface::ALLTYPE_USED;
1044 else if( v[name] == Iovs::PhactoriParserInterface::TENSOR )
1045 v[name] = Iovs::PhactoriParserInterface::TENSOR_USED;
1046 else if( v[name] == Iovs::PhactoriParserInterface::SCALAR )
1047 v[name] = Iovs::PhactoriParserInterface::SCALAR_USED;
1048 else if( v[name] == Iovs::PhactoriParserInterface::VECTOR )
1049 v[name] = Iovs::PhactoriParserInterface::VECTOR_USED;
1050 }
1051 }
1052
1053 bool compare_variable_type(const std::string& name,
1054 Iovs::PhactoriParserInterface::varMap& v,
1055 Iovs::PhactoriParserInterface::VarType vt)
1056 {
1057 if(v.find(name) != v.end())
1058 {
1059 if( v[name] == vt ||
1060 v[name] == Iovs::PhactoriParserInterface::ALLTYPE ||
1061 v[name] == Iovs::PhactoriParserInterface::ALLTYPE_USED )
1062 return true;
1063 else if( v[name] == Iovs::PhactoriParserInterface::SCALAR_USED &&
1064 vt == Iovs::PhactoriParserInterface::SCALAR )
1065 return true;
1066 else if( v[name] == Iovs::PhactoriParserInterface::VECTOR_USED &&
1067 vt == Iovs::PhactoriParserInterface::VECTOR )
1068 return true;
1069 else if( v[name] == Iovs::PhactoriParserInterface::TENSOR_USED &&
1070 vt == Iovs::PhactoriParserInterface::TENSOR )
1071 return true;
1072 }
1073 return false;
1074 }
1075
1076 bool check_variable_name(YYLTYPE * llocp,
1077 yyscan_t yyscanner,
1078 ParseData& pd,
1079 const std::string& name,
1080 Iovs::PhactoriParserInterface::VarType vt)
1081 {
1082 if (!pd.nodeVars.empty() && !pd.elementVars.empty() && !pd.globalVars.empty())
1083 {
1084 bool is_node_var = (pd.nodeVars.find(name) != pd.nodeVars.end());
1085 bool is_element_var = (pd.elementVars.find(name) != pd.elementVars.end());
1086 bool is_global_var = (pd.globalVars.find(name) != pd.globalVars.end());
1087
1088 if( !is_node_var &&
1089 !is_global_var &&
1090 !is_element_var )
1091 {
1092 yyerror(llocp, yyscanner, &pd, ("Error: variable name not found: " + name).c_str());
1093 return false;
1094 }
1095
1096 bool found_match = false;
1097
1098 if(is_node_var)
1099 {
1100 if( compare_variable_type(name, pd.nodeVars, vt) )
1101 {
1102 switch_variable_to_used(name, pd.nodeVars);
1103 found_match = true;
1104 }
1105 }
1106
1107 if(is_global_var)
1108 {
1109 if( compare_variable_type(name, pd.globalVars, vt) )
1110 {
1111 switch_variable_to_used(name, pd.globalVars);
1112 found_match = true;
1113 }
1114 }
1115
1116 if(is_element_var)
1117 {
1118 if( compare_variable_type(name, pd.elementVars, vt) )
1119 {
1120 switch_variable_to_used(name, pd.elementVars);
1121 found_match = true;
1122 }
1123 }
1124
1125 if(!found_match)
1126 {
1127 std::string t = "scalar";
1128 if(vt == Iovs::PhactoriParserInterface::VECTOR)
1129 t = "vector";
1130 else if(vt == Iovs::PhactoriParserInterface::TENSOR)
1131 t = "tensor";
1132 yyerror(llocp, yyscanner, &pd, ("Error: variable is not " + t + " type: " + name).c_str());
1133 return false;
1134 }
1135
1136 }
1137
1138 return true;
1139 }
1140
1141 bool check_vector_component(YYLTYPE * llocp,
1142 yyscan_t yyscanner,
1143 ParseData& pd,
1144 const std::string& name)
1145 {
1146 std::string sep = pd.separator;
1147 unsigned int offset = sep.size() + 1;
1148 if(name.size() > offset)
1149 {
1150 std::string term = name.substr(name.size() - offset);
1151 if(term == sep + "X" || term == sep + "Y" || term == sep + "Z" ||
1152 term == sep + "x" || term == sep + "y" || term == sep + "z")
1153 return check_variable_name(llocp, yyscanner, pd, name.substr(0,name.size() - offset),
1154 Iovs::PhactoriParserInterface::VECTOR);
1155 }
1156
1157 yyerror(llocp, yyscanner, &pd, ("Error: invalid vector name component (must be x, y, or z) " + name).c_str());
1158 return false;
1159 }
1160
1161 bool check_tensor_component(YYLTYPE * llocp,
1162 yyscan_t yyscanner,
1163 ParseData& pd,
1164 const std::string& name)
1165 {
1166 std::string sep = pd.separator;
1167 unsigned int offset = sep.size() + 2;
1168 if(name.size() > offset)
1169 {
1170 std::string term = name.substr(name.size() - offset);
1171 if(term == sep + "XX" || term == sep + "XY" || term == sep + "XZ" ||
1172 term == sep + "YX" || term == sep + "YY" || term == sep + "YZ" ||
1173 term == sep + "ZX" || term == sep + "ZY" || term == sep + "ZZ" ||
1174 term == sep + "xx" || term == sep + "xy" || term == sep + "xz" ||
1175 term == sep + "yx" || term == sep + "yy" || term == sep + "yz" ||
1176 term == sep + "zx" || term == sep + "zy" || term == sep + "zz")
1177 return check_variable_name(llocp, yyscanner, pd, name.substr(0,name.size() - offset),
1178 Iovs::PhactoriParserInterface::TENSOR);
1179 }
1180
1181 yyerror(llocp, yyscanner, &pd, ("Error: invalid tensor name component (must be xx, yy, zz, zx, zy, xy, or yz) " + name).c_str());
1182 return false;
1183 }
1184
1185 bool check_catalyst_shortcuts(YYLTYPE * llocp,
1186 yyscan_t yyscanner,
1187 ParseData& pd)
1188 {
1189 if( pd.ims_shortcut.size() &&
1190 (pd.root["representation blocks"].size() ||
1191 pd.root["imageset blocks"].size() ||
1192 pd.root["camera blocks"].size() ||
1193 pd.root["operation blocks"].size() ||
1194 pd.root["scatter plot blocks"].size() ||
1195 pd.root["plot over time blocks"].size()) )
1196 {
1197 yyerror(llocp, yyscanner, &pd, "Error: catalyst block shortcuts used with declared blocks.");
1198 return false;
1199 }
1200
1201 bool ret = true;
1202 if(pd.ims_shortcut.size())
1203 {
1204 pd.root["imageset blocks"]["\\#ImageSet\\$ Shortcut"] = pd.ims_shortcut;
1205 ret = ret && check_representation(llocp, yyscanner, pd, pd.ims_shortcut);
1206 ret = ret && check_camera(llocp, yyscanner, pd, pd.ims_shortcut);
1207 }
1208 return ret;
1209 }
1210
1211 bool initialize_block(YYLTYPE * llocp,
1212 yyscan_t yyscanner,
1213 ParseData& pd)
1214 {
1215 if(pd.ims_shortcut.size())
1216 {
1217 yyerror(llocp, yyscanner, &pd, "Error: catalyst block shortcuts used with declared blocks.");
1218 return false;
1219 }
1220
1221 if(pd.cb == TOKREPRESENTATION &&
1222 !pd.root["representation blocks"][pd.cbn])
1223 {
1224 pd.root["representation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1225 }
1226 else if(pd.cb == TOKMULTICAMERA8 &&
1227 !pd.root["camera blocks"][pd.cbn])
1228 {
1229 pd.root["camera blocks"][pd.cbn] = Json::Value(Json::objectValue);
1230 pd.root["camera blocks"][pd.cbn]["camera type"] = "multicamera8";
1231 }
1232 else if(pd.cb == TOKCAMERA &&
1233 !pd.root["camera blocks"][pd.cbn])
1234 {
1235 pd.root["camera blocks"][pd.cbn] = Json::Value(Json::objectValue);
1236 pd.root["camera blocks"][pd.cbn]["camera type"] = "camera";
1237 }
1238 else if(pd.cb == TOKIMAGESET &&
1239 !pd.root["imageset blocks"][pd.cbn])
1240 {
1241 pd.root["imageset blocks"][pd.cbn] = Json::Value(Json::objectValue);
1242 }
1243 else if(pd.cb == TOKCLIP &&
1244 !pd.root["operation blocks"][pd.cbn])
1245 {
1246 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1247 pd.root["operation blocks"][pd.cbn]["type"] = "clip";
1248 }
1249 else if(pd.cb == TOKSLICE &&
1250 !pd.root["operation blocks"][pd.cbn])
1251 {
1252 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1253 pd.root["operation blocks"][pd.cbn]["type"] = "slice";
1254 }
1255 else if(pd.cb == TOKBOXCLIP &&
1256 !pd.root["operation blocks"][pd.cbn])
1257 {
1258 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1259 pd.root["operation blocks"][pd.cbn]["type"] = "boxclip";
1260 }
1261 else if(pd.cb == TOKTHRESHOLD &&
1262 !pd.root["operation blocks"][pd.cbn])
1263 {
1264 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1265 pd.root["operation blocks"][pd.cbn]["type"] = "threshold";
1266 }
1267 else if(pd.cb == TOKCONTOUR &&
1268 !pd.root["operation blocks"][pd.cbn])
1269 {
1270 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1271 pd.root["operation blocks"][pd.cbn]["type"] = "contour";
1272 }
1273 else if(pd.cb == TOKSCATTERPLOT &&
1274 !pd.root["scatter plot blocks"][pd.cbn])
1275 {
1276 pd.root["scatter plot blocks"][pd.cbn] = Json::Value(Json::objectValue);
1277 }
1278 else if(pd.cb == TOKPLOTOVERTIME &&
1279 !pd.root["plot over time blocks"][pd.cbn])
1280 {
1281 pd.root["plot over time blocks"][pd.cbn] = Json::Value(Json::objectValue);
1282 }
1283 else if(pd.cb == TOKGROUP &&
1284 !pd.root["operation blocks"][pd.cbn])
1285 {
1286 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1287 pd.root["operation blocks"][pd.cbn]["type"] = "group";
1288 }
1289 else if(pd.cb == TOKEXTRACTBLOCK &&
1290 !pd.root["operation blocks"][pd.cbn])
1291 {
1292 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1293 pd.root["operation blocks"][pd.cbn]["type"] = "extractblock";
1294 }
1295 else if(pd.cb == TOKTRANSFORM &&
1296 !pd.root["operation blocks"][pd.cbn])
1297 {
1298 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1299 pd.root["operation blocks"][pd.cbn]["type"] = "transform";
1300 }
1301 else if(pd.cb == TOKWARPBYVECTOR &&
1302 !pd.root["operation blocks"][pd.cbn])
1303 {
1304 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1305 pd.root["operation blocks"][pd.cbn]["type"] = "warpbyvector";
1306 }
1307 else if(pd.cb == TOKCALCULATOR &&
1308 !pd.root["operation blocks"][pd.cbn])
1309 {
1310 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1311 pd.root["operation blocks"][pd.cbn]["type"] = "calculator";
1312 }
1313 else if(pd.cb == TOKEXPERIMENTALOPERATION &&
1314 !pd.root["operation blocks"][pd.cbn])
1315 {
1316 pd.root["operation blocks"][pd.cbn] = Json::Value(Json::objectValue);
1317 pd.root["operation blocks"][pd.cbn]["type"] = "experimentaloperation";
1318 }
1319 else if(pd.cb == TOKVISUALMARKER &&
1320 !pd.root["visual marker blocks"][pd.cbn])
1321 {
1322 pd.root["visual marker blocks"][pd.cbn] = Json::Value(Json::objectValue);
1323 pd.root["visual marker blocks"][pd.cbn]["type"] = "visualmarker";
1324 }
1325 else if(pd.cb == TOKEXPERIMENTALBLOCK &&
1326 !pd.root["experimental blocks"][pd.cbn])
1327 {
1328 pd.root["experimental blocks"][pd.cbn] = Json::Value(Json::objectValue);
1329 pd.root["experimental blocks"][pd.cbn]["type"] = "experimentalblock";
1330 }
1331 else if(pd.cb == TOKONOFFCRITERIABLOCK &&
1332 !pd.root["onoff criteria blocks"][pd.cbn])
1333 {
1334 pd.root["onoff criteria blocks"][pd.cbn] = Json::Value(Json::objectValue);
1335 pd.root["onoff criteria blocks"][pd.cbn]["type"] = "onoffcriteriablock";
1336 }
1337 else
1338 {
1339 yyerror(llocp, yyscanner, &pd, ("Error: duplicate block name " + pd.cbn).c_str());
1340 return false;
1341 }
1342
1343 return true;
1344 }
1345
1346 void clip_or_boxclip_or_slice_shortcut_command(ParseData& pd,
1347 const std::string& command,
1348 const std::string& boxclip_type,
1349 std::vector<double>& values)
1350 {
1351 Json::Value a(Json::arrayValue);
1352 Json::Value p(Json::arrayValue);
1353 Json::Value n(Json::arrayValue);
1354 p[0] = values[0];
1355 p[1] = values[1];
1356 p[2] = values[2];
1357 n[0] = values[3];
1358 n[1] = values[4];
1359 n[2] = values[5];
1360
1361 a[0] = p;
1362 a[1] = n;
1363
1364 if(command == "boxclip")
1365 {
1366 std::string r = boxclip_type;
1367 std::transform(r.begin(), r.end(), r.begin(), ::tolower);
1368 a[2] = r;
1369 }
1370
1371 if (pd.cb == TOKCATALYST)
1372 pd.ims_shortcut[command] = a;
1373 else if(pd.cb == TOKIMAGESET)
1374 pd.root["imageset blocks"][pd.cbn][command] = a;
1375 }
1376
1377 void data_point_command(ParseData& pd,
1378 const std::string& command,
1379 const std::string& min_max_center,
1380 const std::string& variable_type,
1381 const std::string& variable,
1382 const std::string& operation)
1383 {
1384 std::string mmc = min_max_center;
1385 std::string vt = variable_type;
1386 Json::Value a(Json::arrayValue);
1387 a[0] = mmc;
1388 a[1] = vt;
1389 a[2] = variable;
1390 a[3] = operation;
1391 if(pd.cb == TOKVISUALMARKER)
1392 pd.root["visual marker blocks"][pd.cbn][command] = a;
1393 else if(pd.cb == TOKCLIP ||
1394 pd.cb == TOKBOXCLIP ||
1395 pd.cb == TOKSLICE ||
1396 pd.cb == TOKCAMERA)
1397 pd.root["operation blocks"][pd.cbn][command] = a;
1398 }
1399
1400 void data_point_command(ParseData& pd,
1401 const std::string& command,
1402 const std::string& min_max_center,
1403 const std::string& variable_type,
1404 const std::string& variable,
1405 const std::string& operation,
1406 double x,
1407 double y,
1408 double z)
1409 {
1410 std::string mmc = min_max_center;
1411 std::string vt = variable_type;
1412 Json::Value a(Json::arrayValue);
1413 a[0] = mmc;
1414 a[1] = vt;
1415 a[2] = variable;
1416 a[3] = operation;
1417 a[4] = x;
1418 a[5] = y;
1419 a[6] = z;
1420 if(pd.cb == TOKVISUALMARKER)
1421 pd.root["visual marker blocks"][pd.cbn][command] = a;
1422 else if(pd.cb == TOKCLIP ||
1423 pd.cb == TOKBOXCLIP ||
1424 pd.cb == TOKSLICE ||
1425 pd.cb == TOKCAMERA)
1426 pd.root["operation blocks"][pd.cbn][command] = a;
1427 }
1428
1429 void threshold_or_contour_shortcut_command(ParseData& pd,
1430 const std::string& command,
1431 const std::string& data_type,
1432 const std::string& variable_name,
1433 const std::string& range,
1434 std::vector<double>& values)
1435 {
1436 std::string dt = data_type;
1437 std::string r = range;
1438 std::transform(dt.begin(), dt.end(), dt.begin(), ::tolower);
1439 std::transform(r.begin(), r.end(), r.begin(), ::tolower);
1440 Json::Value a(Json::arrayValue);
1441
1442 a[0] = dt;
1443 a[1] = variable_name;
1444 a[2] = r;
1445 Json::Value d(Json::arrayValue);
1446 for(int i=0;i<values.size();i++)
1447 d[i] = values[i];
1448 a[3] = d;
1449
1450 if (pd.cb == TOKCATALYST)
1451 pd.ims_shortcut[command] = a;
1452 else if(pd.cb == TOKIMAGESET)
1453 pd.root["imageset blocks"][pd.cbn][command] = a;
1454 }
1455
1456 void four_argument_command(ParseData& pd,
1457 const std::string& command,
1458 int id,
1459 double x,
1460 double y,
1461 double z)
1462 {
1463 Json::Value a(Json::arrayValue);
1464 a[0] = id;
1465 a[1] = x;
1466 a[2] = y;
1467 a[3] = z;
1468 pd.root["camera blocks"][pd.cbn][command] = a;
1469 }
1470
1471 bool check_two_argument_command(YYLTYPE * llocp,
1472 yyscan_t yyscanner,
1473 ParseData& pd,
1474 const std::string& command,
1475 const std::string& position,
1476 double value)
1477 {
1478 if(value < 0 || value > 1)
1479 {
1480 yyerror(llocp, yyscanner, &pd, ("Error: " + command + " <size> must be between 0 and 1, inclusive").c_str());
1481 return false;
1482 }
1483
1484 std::string r = position;
1485 std::transform(r.begin(), r.end(), r.begin(), ::tolower);
1486
1487 Json::Value a(Json::arrayValue);
1488 a[0] = r;
1489 a[1] = value;
1490 if (pd.cb == TOKCATALYST)
1491 pd.ims_shortcut[command] = a;
1492 else if(pd.cb == TOKREPRESENTATION)
1493 pd.root["representation blocks"][pd.cbn][command] = a;
1494 else if(pd.cb == TOKIMAGESET)
1495 pd.root["imageset blocks"][pd.cbn][command] = a;
1496 return true;
1497 }
1498
1499 void remove_quotes(std::string& s)
1500 {
1501 if ( s.size() > 1 && s[0] == '"' )
1502 {
1503 s.erase( 0, 1 );
1504 s.erase( s.size() - 1 );
1505 }
1506 }
1507
1508 void no_argument_command(ParseData& pd,
1509 const std::string& command)
1510 {
1511 if (pd.cb == TOKCATALYST)
1512 pd.ims_shortcut[command] = true;
1513 else if(pd.cb == TOKREPRESENTATION)
1514 pd.root["representation blocks"][pd.cbn][command] = true;
1515 else if(pd.cb == TOKMULTICAMERA8 || pd.cb == TOKCAMERA)
1516 pd.root["camera blocks"][pd.cbn][command] = true;
1517 else if(pd.cb == TOKIMAGESET)
1518 pd.root["imageset blocks"][pd.cbn][command] = true;
1519 else if(pd.cb == TOKCLIP ||
1520 pd.cb == TOKBOXCLIP ||
1521 pd.cb == TOKTHRESHOLD ||
1522 pd.cb == TOKCONTOUR ||
1523 pd.cb == TOKSLICE)
1524 pd.root["operation blocks"][pd.cbn][command] = true;
1525 else if(pd.cb == TOKSCATTERPLOT)
1526 pd.root["scatter plot blocks"][pd.cbn][command] = true;
1527 else if(pd.cb == TOKPLOTOVERTIME)
1528 pd.root["plot over time blocks"][pd.cbn][command] = true;
1529 }
1530
1531 template<class T>
1532 void vector_command(ParseData& pd,
1533 const std::string& command,
1534 std::vector<T>& values)
1535 {
1536 Json::Value a(Json::arrayValue);
1537 for(int i=0;i<values.size();i++)
1538 a[i] = values[i];
1539
1540 if (pd.cb == TOKCATALYST)
1541 pd.ims_shortcut[command] = a;
1542 else if(pd.cb == TOKREPRESENTATION)
1543 pd.root["representation blocks"][pd.cbn][command] = a;
1544 else if(pd.cb == TOKMULTICAMERA8 || pd.cb == TOKCAMERA)
1545 pd.root["camera blocks"][pd.cbn][command] = a;
1546 else if(pd.cb == TOKIMAGESET)
1547 pd.root["imageset blocks"][pd.cbn][command] = a;
1548 else if(pd.cb == TOKCLIP ||
1549 pd.cb == TOKBOXCLIP ||
1550 pd.cb == TOKTHRESHOLD ||
1551 pd.cb == TOKCONTOUR ||
1552 pd.cb == TOKSLICE ||
1553 pd.cb == TOKTRANSFORM ||
1554 pd.cb == TOKEXPERIMENTALOPERATION)
1555 pd.root["operation blocks"][pd.cbn][command] = a;
1556 else if(pd.cb == TOKSCATTERPLOT)
1557 pd.root["scatter plot blocks"][pd.cbn][command] = a;
1558 else if(pd.cb == TOKPLOTOVERTIME)
1559 pd.root["plot over time blocks"][pd.cbn][command] = a;
1560 else if(pd.cb == TOKVISUALMARKER)
1561 pd.root["visual marker blocks"][pd.cbn][command] = a;
1562 else if(pd.cb == TOKEXPERIMENTALBLOCK)
1563 pd.root["experimental blocks"][pd.cbn][command] = a;
1564 else if(pd.cb == TOKONOFFCRITERIABLOCK)
1565 pd.root["onoff criteria blocks"][pd.cbn][command] = a;
1566 }
1567
1568 void string_vector_command(ParseData& pd,
1569 const std::string& command,
1570 std::vector<std::string>& values)
1571 {
1572 Json::Value a(Json::arrayValue);
1573 for(int i=0;i<values.size();i++)
1574 a[i] = values[i];
1575
1576 if (pd.cb == TOKGROUP ||
1577 pd.cb == TOKEXTRACTBLOCK ||
1578 pd.cb == TOKCALCULATOR)
1579 pd.root["operation blocks"][pd.cbn][command] = a;
1580 else if(pd.cb == TOKIMAGESET)
1581 pd.root["imageset blocks"][pd.cbn][command] = a;
1582 else if(pd.cb == TOKONOFFCRITERIABLOCK)
1583 pd.root["onoff criteria blocks"][pd.cbn][command] = a;
1584 }
1585
1586 void identifier_command(ParseData& pd,
1587 const std::string& command,
1588 const std::string& identifier)
1589 {
1590 if (pd.cb == TOKCATALYST)
1591 pd.ims_shortcut[command] = identifier;
1592 else if(pd.cb == TOKREPRESENTATION)
1593 pd.root["representation blocks"][pd.cbn][command] = identifier;
1594 else if(pd.cb == TOKMULTICAMERA8 || pd.cb == TOKCAMERA)
1595 pd.root["camera blocks"][pd.cbn][command] = identifier;
1596 else if(pd.cb == TOKIMAGESET)
1597 pd.root["imageset blocks"][pd.cbn][command] = identifier;
1598 else if(pd.cb == TOKCLIP ||
1599 pd.cb == TOKBOXCLIP ||
1600 pd.cb == TOKTHRESHOLD ||
1601 pd.cb == TOKCONTOUR ||
1602 pd.cb == TOKSLICE ||
1603 pd.cb == TOKEXTRACTBLOCK ||
1604 pd.cb == TOKTRANSFORM ||
1605 pd.cb == TOKWARPBYVECTOR ||
1606 pd.cb == TOKCALCULATOR ||
1607 pd.cb == TOKEXPERIMENTALOPERATION)
1608 pd.root["operation blocks"][pd.cbn][command] = identifier;
1609 else if(pd.cb == TOKSCATTERPLOT)
1610 pd.root["scatter plot blocks"][pd.cbn][command] = identifier;
1611 else if(pd.cb == TOKPLOTOVERTIME)
1612 pd.root["plot over time blocks"][pd.cbn][command] = identifier;
1613 else if(pd.cb == TOKVISUALMARKER)
1614 pd.root["visual marker blocks"][pd.cbn][command] = identifier;
1615 else if(pd.cb == TOKEXPERIMENTALBLOCK)
1616 pd.root["experimental blocks"][pd.cbn][command] = identifier;
1617 else if(pd.cb == TOKONOFFCRITERIABLOCK)
1618 pd.root["onoff criteria blocks"][pd.cbn][command] = identifier;
1619 }
1620
1621 void boolean_command(ParseData& pd,
1622 const std::string& command,
1623 bool value)
1624 {
1625 if (pd.cb == TOKCATALYST)
1626 pd.ims_shortcut[command] = value;
1627 else if(pd.cb == TOKREPRESENTATION)
1628 pd.root["representation blocks"][pd.cbn][command] = value;
1629 else if(pd.cb == TOKMULTICAMERA8 || pd.cb == TOKCAMERA)
1630 pd.root["camera blocks"][pd.cbn][command] = value;
1631 else if(pd.cb == TOKIMAGESET)
1632 pd.root["imageset blocks"][pd.cbn][command] = value;
1633 else if(pd.cb == TOKCLIP ||
1634 pd.cb == TOKBOXCLIP ||
1635 pd.cb == TOKTHRESHOLD ||
1636 pd.cb == TOKCONTOUR ||
1637 pd.cb == TOKSLICE)
1638 pd.root["operation blocks"][pd.cbn][command] = value;
1639 else if(pd.cb == TOKSCATTERPLOT)
1640 pd.root["scatter plot blocks"][pd.cbn][command] = value;
1641 else if(pd.cb == TOKPLOTOVERTIME)
1642 pd.root["plot over time blocks"][pd.cbn][command] = value;
1643 }
1644
1645 void integer_command(ParseData& pd,
1646 const std::string& command,
1647 int value)
1648 {
1649 if (pd.cb == TOKCATALYST)
1650 pd.ims_shortcut[command] = value;
1651 else if(pd.cb == TOKREPRESENTATION)
1652 pd.root["representation blocks"][pd.cbn][command] = value;
1653 else if(pd.cb == TOKMULTICAMERA8 || pd.cb == TOKCAMERA)
1654 pd.root["camera blocks"][pd.cbn][command] = value;
1655 else if(pd.cb == TOKIMAGESET)
1656 pd.root["imageset blocks"][pd.cbn][command] = value;
1657 else if(pd.cb == TOKCLIP ||
1658 pd.cb == TOKBOXCLIP ||
1659 pd.cb == TOKTHRESHOLD ||
1660 pd.cb == TOKCONTOUR ||
1661 pd.cb == TOKSLICE ||
1662 pd.cb == TOKEXPERIMENTALOPERATION)
1663 pd.root["operation blocks"][pd.cbn][command] = value;
1664 else if(pd.cb == TOKSCATTERPLOT)
1665 pd.root["scatter plot blocks"][pd.cbn][command] = value;
1666 else if(pd.cb == TOKPLOTOVERTIME)
1667 pd.root["plot over time blocks"][pd.cbn][command] = value;
1668 else if(pd.cb == TOKVISUALMARKER)
1669 pd.root["visual marker blocks"][pd.cbn][command] = value;
1670 else if(pd.cb == TOKEXPERIMENTALBLOCK)
1671 pd.root["experimental blocks"][pd.cbn][command] = value;
1672 else if(pd.cb == TOKONOFFCRITERIABLOCK)
1673 pd.root["onoff criteria blocks"][pd.cbn][command] = value;
1674 }
1675
1676 void double_command(ParseData& pd,
1677 const std::string& command,
1678 double value)
1679 {
1680 if (pd.cb == TOKCATALYST)
1681 pd.ims_shortcut[command] = value;
1682 else if(pd.cb == TOKREPRESENTATION)
1683 pd.root["representation blocks"][pd.cbn][command] = value;
1684 else if(pd.cb == TOKMULTICAMERA8 || pd.cb == TOKCAMERA)
1685 pd.root["camera blocks"][pd.cbn][command] = value;
1686 else if(pd.cb == TOKIMAGESET)
1687 pd.root["imageset blocks"][pd.cbn][command] = value;
1688 else if(pd.cb == TOKCLIP ||
1689 pd.cb == TOKBOXCLIP ||
1690 pd.cb == TOKTHRESHOLD ||
1691 pd.cb == TOKCONTOUR ||
1692 pd.cb == TOKSLICE ||
1693 pd.cb == TOKWARPBYVECTOR ||
1694 pd.cb == TOKEXPERIMENTALOPERATION)
1695 pd.root["operation blocks"][pd.cbn][command] = value;
1696 else if(pd.cb == TOKSCATTERPLOT)
1697 pd.root["scatter plot blocks"][pd.cbn][command] = value;
1698 else if(pd.cb == TOKPLOTOVERTIME)
1699 pd.root["plot over time blocks"][pd.cbn][command] = value;
1700 else if(pd.cb == TOKVISUALMARKER)
1701 pd.root["visual marker blocks"][pd.cbn][command] = value;
1702 else if(pd.cb == TOKEXPERIMENTALBLOCK)
1703 pd.root["experimental blocks"][pd.cbn][command] = value;
1704 }
1705
1706
1707 void initialize_json(ParseData& pd)
1708 {
1709 pd.root.clear();
1710 pd.ims_shortcut.clear();
1711 pd.root["camera blocks"] = Json::Value(Json::objectValue);
1712 pd.root["representation blocks"] = Json::Value(Json::objectValue);
1713 pd.root["imageset blocks"] = Json::Value(Json::objectValue);
1714 pd.root["operation blocks"] = Json::Value(Json::objectValue);
1715 pd.root["scatter plot blocks"] = Json::Value(Json::objectValue);
1716 pd.root["plot over time blocks"] = Json::Value(Json::objectValue);
1717 pd.root["visual marker blocks"] = Json::Value(Json::objectValue);
1718 pd.root["experimental blocks"] = Json::Value(Json::objectValue);
1719 pd.root["onoff criteria blocks"] = Json::Value(Json::objectValue);
1720 }
1721
1722 void yyerror (YYLTYPE * llocp, yyscan_t yyscanner, void* pd, char const *msg)
1723 {
1724 fflush(stdout);
1725 printf("%s, line = %d, column = %d\n", msg, llocp->first_line, llocp->first_column);
1726 }
1727
1728 } // End anonymous namespace
1729
1730 namespace Iovs {
1731
1732 void parsePhactoriString(const std::string & s,
1733 Iovs::PhactoriParserInterface::ParseInfo & pinfo)
1734 {
1735 ParseData pd;
1736 pd.nodeVars = pinfo.nodeVars;
1737 pd.elementVars = pinfo.elementVars;
1738 pd.globalVars = pinfo.globalVars;
1739 pd.checkNodeIDRange = pinfo.checkNodeIDRange;
1740 pd.nodeIDRange = pinfo.nodeIDRange;
1741 pd.checkElementIDRange = pinfo.checkElementIDRange;
1742 pd.elementIDRange = pinfo.elementIDRange;
1743 pd.separator = pinfo.separator;
1744
1745 std::string pps = preProcessPhactoriInput(s);
1746
1747 yyscan_t myscanner;
1748 catalystlex_init(&myscanner);
1749 YY_BUFFER_STATE buffer = catalyst_scan_string(pps.c_str(), myscanner);
1750 int ret = yyparse(myscanner, &pd);
1751 catalyst_delete_buffer(buffer, myscanner);
1752 catalystlex_destroy(myscanner);
1753 Json::StreamWriterBuilder builder;
1754 builder["indentation"] = "";
1755 pinfo.jsonParseResult = Json::writeString(builder, pd.root);
1756 pinfo.parseFailed = ret;
1757 }
1758
1759 } // end namespace Iovs
1760
1761 %}
1762
1763 %union
1764 {
1765 int integer;
1766 double floating;
1767 char *string;
1768 }
1769
1770 /* On Off Criteria Block */
1771
1772 %token TOKONOFFCRITERIABLOCK
1773 %token <string> TOKTRIGGERTHRESHOLDS
1774 %token <string> TOKEXPERIMENTAL
1775 %token TOKEXPERIMENTALTYPE
1776 %token TOKTHRESHOLDVARIABLEFUNCTION
1777 %token <string> TOKMINIMUM
1778 %token <string> TOKMAXIMUM
1779 %token <string> TOKMEAN
1780 %token <string> TOKSUM
1781 %token <string> TOKCOUNT
1782 %token TOKTHRESHOLDVALUES
1783 %token TOKFRAMESAFTERTRIGGER
1784 %token TOKMAXIMUMTRIGGERSPERTHRESHOLD
1785
1786 /* On Off Criteria Block */
1787
1788 /* Experimental Block */
1789
1790 %token TOKEXPERIMENTALBLOCK
1791
1792 /* Experimental Block */
1793
1794 /* Visual Marker */
1795
1796 %token TOKVISUALMARKER
1797 %token TOKSHAPE
1798 %token TOKCOLOR
1799 %token TOKABSOLUTESIZE
1800 %token TOKRELATIVESIZE
1801 %token TOKORIENTATION
1802 %token TOKRESOLUTION
1803 %token TOKMARKERATRELATIVEPOINT
1804 %token TOKMARKERATABSOLUTEPOINT
1805 %token TOKMARKERATNODE
1806 %token TOKMARKERATELEMENT
1807 %token TOKMARKERATDATAPOINT
1808 %token TOKVECTORPARAMETER
1809 %token TOKSCALARPARAMETER
1810 %token TOKINTEGERPARAMETER
1811 %token TOKSTRINGPARAMETER
1812 %token <string> TOKMIN
1813 %token <string> TOKMAX
1814 %token <string> TOKNONE
1815
1816 /* Visual Marker */
1817
1818
1819 /* Experimental Operation */
1820
1821 %token TOKEXPERIMENTALOPERATION
1822 %token TOKTYPE
1823 %token TOKVECTOROPPARAM
1824 %token TOKSCALAROPPARAM
1825 %token TOKINTEGEROPPARAM
1826 %token TOKSTRINGOPPARAM
1827
1828 /* Experimental Operation */
1829
1830 /* Calculator */
1831
1832 %token TOKCALCULATOR
1833 %token TOKOUTPUTVARIABLENAME
1834 %token TOKFUNCTION
1835 %token TOKELEMENTORNODEDATA
1836 %token TOKCOORDINATERESULTFLAG
1837 %token TOKRESULTNORMALSFLAG
1838 %token TOKPYTHONCALCULATORFLAG
1839 %token <string> TOKNODE
1840 %token <string> TOKELEMENT
1841
1842 /* Calculator */
1843
1844 /* Warp By Vector */
1845
1846 %token TOKWARPBYVECTOR
1847 %token TOKVARIABLEVECTOR
1848
1849 /* Warp By Vector */
1850
1851 /* Transform */
1852
1853 %token TOKTRANSFORM
1854 %token TOKSCALE
1855 %token TOKROTATE
1856 %token TOKTRANSLATE
1857
1858 /* Transform */
1859
1860 /* Extract Block */
1861
1862 %token TOKEXTRACTBLOCK
1863 %token TOKINCLUDEBLOCKS
1864 %token TOKEXCLUDEBLOCKS
1865
1866 /* Extract Block */
1867
1868 /* Group */
1869
1870 %token TOKOPERATIONGROUPLIST
1871 %token TOKGROUP
1872
1873 /* Group */
1874
1875 /* Plot Over Time */
1876
1877 %token TOKPLOTID
1878 %token TOKPLOTMEAN
1879 %token TOKPLOTMAXIMUM
1880 %token TOKPLOTMINIMUM
1881 %token TOKPLOTOVERTIME
1882
1883 /* Plot Over Time */
1884
1885 /* Scatter Plot */
1886
1887 %token TOKPLOTBASEDIRECTORY
1888 %token TOKPLOTBASENAME
1889 %token TOKYAXISMAXIMUMRANGE
1890 %token TOKXAXISMAXIMUMRANGE
1891 %token TOKYAXISMINIMUMRANGE
1892 %token TOKXAXISMINIMUMRANGE
1893 %token TOKYAXISUSECUMULATIVEDATARANGE
1894 %token TOKXAXISUSECUMULATIVEDATARANGE
1895 %token TOKYAXISUSECURRENTDATARANGE
1896 %token TOKXAXISUSECURRENTDATARANGE
1897 %token TOKYAXISRANGE
1898 %token TOKXAXISRANGE
1899 %token TOKYAXISVARIABLETENSORCOMPONENT
1900 %token TOKXAXISVARIABLETENSORCOMPONENT
1901 %token TOKYAXISVARIABLEVECTORCOMPONENT
1902 %token TOKXAXISVARIABLEVECTORCOMPONENT
1903 %token TOKYAXISVARIABLEVECTORMAGNITUDE
1904 %token TOKXAXISVARIABLEVECTORMAGNITUDE
1905 %token TOKYAXISVARIABLESCALAR
1906 %token TOKXAXISVARIABLESCALAR
1907 %token TOKALLVARIABLES
1908 %token TOKSCATTERPLOT
1909
1910 /* Scatter Plot */
1911
1912 /* Contour */
1913
1914 %token TOKCONTOURVALUESEQUENCE
1915 %token TOKCONTOURVALUE
1916 %token TOKENDCONTOUR
1917
1918 /* Contour */
1919
1920 /* Threshold */
1921
1922 %token TOKVARIABLETENSORCOMPONENT
1923 %token TOKVARIABLEVECTORCOMPONENT
1924 %token TOKVARIABLEVECTORMAGNITUDE
1925 %token TOKVARIABLESCALAR
1926 %token TOKENDTHRESHOLD
1927
1928 /* Threshold */
1929
1930 /* BoxClip */
1931
1932 %token TOKKEEPINSIDEBOX
1933 %token TOKROTATIONS
1934 %token TOKRELATIVEEXTENTS
1935 %token TOKABSOLUTEEXTENTS
1936 %token TOKCENTERATELEMENT
1937 %token TOKCENTERATNODE
1938 %token TOKCENTERATRELATIVEPOINT
1939 %token TOKCENTERATABSOLUTEPOINT
1940 %token TOKENDBOXCLIP
1941 %token TOKCENTERATDATAPOINT
1942
1943 /* BoxClip */
1944
1945 /* Slice */
1946
1947 %token TOKENDSLICE
1948
1949 /* Slice */
1950
1951 /* Clip */
1952
1953 %token <string> TOKNEGATIVE
1954 %token <string> TOKPOSITIVE
1955 %token <string> TOKSMOOTH
1956 %token <string> TOKCRINKLE
1957 %token TOKSIDETOKEEP
1958 %token TOKCUTTYPE
1959 %token TOKPLANENORMAL
1960 %token TOKELEMENTONPLANE
1961 %token TOKNODEONPLANE
1962 %token TOKABSOLUTEPOINTONPLANE
1963 %token TOKRELATIVEPOINTONPLANE
1964 %token TOKINPUT
1965 %token TOKENDCLIP
1966 %token TOKDATAPOINTONPLANE
1967 %token TOKPLANESPECIFICATION
1968 %token TOKTHREEPOINTS
1969 %token TOKPOINTANDNORMAL
1970 %token <string> TOKA
1971 %token <string> TOKB
1972 %token <string> TOKC
1973
1974 /* Clip */
1975
1976 /* ImageSet */
1977
1978 %token <string> TOKCENTER
1979 %token TOKPOINT
1980 %token <string> TOKKEEPINSIDE
1981 %token <string> TOKKEEPOUTSIDE
1982 %token TOKSLICE
1983 %token TOKBOXCLIP
1984 %token TOKEXTENTS
1985 %token TOKNORMAL
1986 %token TOKCLIP
1987 %token <string> TOKVALUESEQUENCE
1988 %token <string> TOKVALUELIST
1989 %token TOKCONTOUR
1990 %token <string> TOKKEEPBELOW
1991 %token <string> TOKKEEPABOVE
1992 %token <string> TOKKEEPBETWEEN
1993 %token <string> TOKTENSORCOMPONENT
1994 %token <string> TOKVECTORCOMPONENT
1995 %token <string> TOKVECTORMAGNITUDE
1996 %token <string> TOKSCALAR
1997 %token TOKTHRESHOLD
1998 %token TOKAXESCOLOR
1999 %token TOKTEXTCOLOR
2000 %token TOKEDGECOLOR
2001 %token TOKSURFACECOLOR
2002 %token TOKBACKGROUNDCOLOR
2003 %token TOKIMAGESIZE
2004 %token TOKIMAGEDIGITCOUNT
2005 %token TOKJPG
2006 %token TOKPNG
2007 %token TOKIMAGEFORMAT
2008 %token TOKIMAGEBASEDIRECTORY
2009 %token TOKIMAGEBASENAME
2010 %token TOKOPERATION
2011 %token TOKOPERATION2
2012 %token TOKOPERATION3
2013 %token TOKIMAGESET
2014 %token TOKONOFFCRITERIA
2015 %token TOKMARKERS
2016
2017 /* ImageSet */
2018
2019 /* Camera */
2020
2021 %token TOKCAMERAATDATAPOINTDISPLACED
2022 %token TOKCAMERAATDATAPOINT
2023 %token TOKCAMERAATNODEDISPLACED
2024 %token TOKCAMERAATELEMENTDISPLACED
2025 %token TOKCAMERAATNODE
2026 %token TOKCAMERAATELEMENT
2027 %token TOKCAMERAATRELATIVEPOINT
2028 %token TOKCAMERAATABSOLUTEPOINT
2029 %token TOKLOOKDIRECTION
2030 %token TOKCAMERA
2031
2032 /* Camera */
2033
2034 /* MultiCamera8 */
2035
2036 %token TOKCAMERAFOV
2037 %token TOKUPVECTOR
2038 %token TOKLOOKATABSOLUTEDISTANCE
2039 %token TOKLOOKATRELATIVEDISTANCE
2040 %token TOKLOOKATNODE
2041 %token TOKLOOKATELEMENT
2042 %token TOKLOOKATRELATIVEPOINT
2043 %token TOKLOOKATABSOLUTEPOINT
2044 %token TOKMULTICAMERA8
2045
2046 /* MultiCamera8 */
2047
2048 /* Representation */
2049
2050 %token TOKHIGHLIGHTSUBRANGE
2051 %token TOKCOLORLEGENDSUBRANGE
2052 %token TOKIMAGENAMEADDON
2053 %token TOKSHOWORIENTATIONAXES
2054 %token TOKSHOWZAXISTICMARKLABELS
2055 %token TOKSHOWYAXISTICMARKLABELS
2056 %token TOKSHOWXAXISTICMARKLABELS
2057 %token TOKSHOWZAXISMINORTICMARKS
2058 %token TOKSHOWYAXISMINORTICMARKS
2059 %token TOKSHOWXAXISMINORTICMARKS
2060 %token TOKSHOWZAXISTICMARKS
2061 %token TOKSHOWYAXISTICMARKS
2062 %token TOKSHOWXAXISTICMARKS
2063 %token TOKZAXISLABELNAME
2064 %token TOKYAXISLABELNAME
2065 %token TOKXAXISLABELNAME
2066 %token TOKSHOWZAXISLABEL
2067 %token TOKSHOWYAXISLABEL
2068 %token TOKSHOWXAXISLABEL
2069 %token TOKSHOWAXES
2070 %token TOKTIMEANNOTATIONPOSITION
2071 %token TOKSHOWTIMEANNOTATION
2072 %token TOKINVERTCOLORSCALE
2073 %token TOKPRESETCOLORSCALE
2074 %token TOKCOLORLEGENDPOSITION
2075 %token TOKCOLORLEGENDMAXIMUMRANGE
2076 %token TOKCOLORLEGENDMINIMUMRANGE
2077 %token TOKCOLORLEGENDUSECUMULATIVEDATARANGE
2078 %token TOKCOLORLEGENDUSECURRENTDATARANGE
2079 %token TOKCOLORLEGENDRANGE
2080 %token TOKSHOWCOLORLEGEND
2081 %token TOKCOLORBYBLOCKID
2082 %token TOKCOLORBYSOLIDCOLOR
2083 %token TOKSHOWEDGES
2084 %token TOKCOLORBYSCALAR
2085 %token TOKSHOWBOUNDINGBOX
2086 %token TOKCOLORBYVECTORMAGNITUDE
2087 %token TOKCOLORBYVECTORCOMPONENT
2088 %token TOKCOLORBYTENSORCOMPONENT
2089 %token TOKREPRESENTATION
2090 %token TOKREPRESENTATION2
2091 %token TOKREPRESENTATION3
2092 %token TOKEQUAL
2093 %token TOKSHOWSURFACES
2094 %token <string> TOKTOP
2095 %token <string> TOKLEFT
2096 %token <string> TOKBOTTOM
2097 %token <string> TOKRIGHT
2098 %token <string> TOKTOPLEFT
2099 %token <string> TOKTOPRIGHT
2100 %token <string> TOKBOTTOMLEFT
2101 %token <string> TOKBOTTOMRIGHT
2102
2103 /* Representation */
2104
2105 /* Catalyst */
2106
2107 %token TOKBEGIN
2108 %token TOKCATALYST
2109 %token TOKEND
2110
2111 /* Catalyst */
2112
2113 %token <integer> TOKFALSE
2114 %token <integer> TOKTRUE
2115 %token <floating> TOKVALUE
2116 %token <string> TOKIDENTIFIER
2117 %token <string> TOKSTRING
2118
2119 %error-verbose
2120 %define api.pure
2121 %locations
2122
2123 %lex-param {yyscan_t scanner}
2124
2125 %parse-param {yyscan_t scanner}
2126 %parse-param {void* pd}
2127
2128 %type <string> element_or_node_data_flag
2129 %type <string> operation_data_type
2130 %type <string> threshold_value
2131 %type <integer> boolean
2132 %type <string> position
2133 %type <string> box_clip_type
2134 %type <string> cut_type_string
2135 %type <string> side_type
2136 %type <string> min_max_center
2137 %type <string> variable_type
2138 %type <string> on_off_type
2139 %type <string> threshold_variable
2140 %type <string> point_location
2141
2142 %%
2143
2144 /* START CATALYST BLOCK */
2145
2146 commands
2147 :
2148 | start_catalyst_block statements catalyst_end
2149 {
2150 if(!check_catalyst_shortcuts(&yylloc, scanner, c(pd)))
2151 YYABORT;
2152 if(!check_names(&yylloc, scanner, c(pd)))
2153 YYABORT;
2154 if(!check_cycles(&yylloc, scanner, c(pd)))
2155 YYABORT;
2156 }
2157 ;
2158
2159 catalyst_end
2160 : TOKEND
2161 | TOKEND TOKCATALYST
2162 ;
2163
2164 start_catalyst_block
2165 : TOKBEGIN TOKCATALYST { initialize_json(c(pd)); c(pd).cb = TOKCATALYST; }
2166 ;
2167
2168 statements
2169 :
2170 | statements statement
2171 ;
2172
2173 statement
2174 : show_surfaces
2175 | show_edges
2176 | show_bouding_box
2177 | color_by_scalar
2178 | color_by_vector_magnitude
2179 | color_by_vector_component
2180 | color_by_tensor_component
2181 | color_by_solid_color
2182 | color_by_blockid
2183 | show_color_legend
2184 | color_legend_range
2185 | color_legend_use_current_data_range
2186 | color_legend_use_cumulative_data_range
2187 | color_legend_minimum_range
2188 | color_legend_maximum_range
2189 | color_legend_position
2190 | preset_color_scale
2191 | invert_color_scale
2192 | show_time_annotation
2193 | time_annotation_position
2194 | show_axes
2195 | show_x_axis_label
2196 | show_y_axis_label
2197 | show_z_axis_label
2198 | x_axis_label_name
2199 | y_axis_label_name
2200 | z_axis_label_name
2201 | show_x_axis_tic_marks
2202 | show_y_axis_tic_marks
2203 | show_z_axis_tic_marks
2204 | show_x_axis_minor_tic_marks
2205 | show_y_axis_minor_tic_marks
2206 | show_z_axis_minor_tic_marks
2207 | show_x_axis_tic_mark_labels
2208 | show_y_axis_tic_mark_labels
2209 | show_z_axis_tic_mark_labels
2210 | show_orientation_axes
2211 | image_name_addon
2212 | look_at_absolute_point
2213 | look_at_relative_point
2214 | look_at_element
2215 | look_at_node
2216 | look_at_absolute_distance
2217 | look_at_relative_distance
2218 | up_vector
2219 | camera_fov
2220 | image_basename
2221 | image_basedirectory
2222 | image_format
2223 | image_digit_count
2224 | image_size
2225 | background_color
2226 | surface_color
2227 | edge_color
2228 | text_color
2229 | axes_color
2230 | threshold_shortcut
2231 | contour_shortcut
2232 | clip_shortcut
2233 | box_clip_shortcut
2234 | slice_shortcut
2235 | representation_block
2236 | multicamera8_block
2237 | camera_block
2238 | imageset_block
2239 | clip_block
2240 | slice_block
2241 | box_clip_block
2242 | threshold_block
2243 | contour_block
2244 | scatter_plot_block
2245 | plot_over_time_block
2246 | group_block
2247 | extract_block
2248 | transform_block
2249 | warp_by_vector
2250 | calculator
2251 | experimental_operation
2252 | visual_marker_block
2253 | experimental_block
2254 | on_off_criteria_block
2255 ;
2256
2257 /* END CATALYST BLOCK */
2258
2259 /* START REPRESENTATION BLOCK */
2260
2261 representation_block
2262 : start_representation_block representation_statements representation_end
2263 {
2264 if(!check_representation(&yylloc, scanner, c(pd), c(pd).root["representation blocks"][c(pd).cbn]))
2265 YYABORT;
2266 c(pd).cb = TOKCATALYST;
2267 }
2268 ;
2269
2270 representation_end
2271 : TOKEND
2272 | TOKEND TOKREPRESENTATION
2273 ;
2274
2275 start_representation_block
2276 : TOKBEGIN TOKREPRESENTATION TOKIDENTIFIER
2277 {
2278 c(pd).cb = TOKREPRESENTATION;
2279 c(pd).cbn = $3;
2280 c(pd).count = 1;
2281 if(!initialize_block(&yylloc, scanner, c(pd)))
2282 YYABORT;
2283 }
2284 ;
2285
2286 representation_statements
2287 :
2288 | representation_statements representation_statement
2289 ;
2290
2291 representation_statement
2292 : show_surfaces
2293 | show_edges
2294 | show_bouding_box
2295 | color_by_vector_magnitude
2296 | color_by_scalar
2297 | color_by_vector_component
2298 | color_by_tensor_component
2299 | color_by_solid_color
2300 | color_by_blockid
2301 | color_legend_range
2302 | show_color_legend
2303 | color_legend_use_current_data_range
2304 | color_legend_use_cumulative_data_range
2305 | color_legend_minimum_range
2306 | color_legend_maximum_range
2307 | color_legend_position
2308 | preset_color_scale
2309 | invert_color_scale
2310 | show_time_annotation
2311 | time_annotation_position
2312 | show_axes
2313 | show_x_axis_label
2314 | show_y_axis_label
2315 | show_z_axis_label
2316 | x_axis_label_name
2317 | y_axis_label_name
2318 | z_axis_label_name
2319 | show_x_axis_tic_marks
2320 | show_y_axis_tic_marks
2321 | show_z_axis_tic_marks
2322 | show_x_axis_minor_tic_marks
2323 | show_y_axis_minor_tic_marks
2324 | show_z_axis_minor_tic_marks
2325 | show_x_axis_tic_mark_labels
2326 | show_y_axis_tic_mark_labels
2327 | show_z_axis_tic_mark_labels
2328 | show_orientation_axes
2329 | image_name_addon
2330 | color_legend_subrange
2331 | highlight_subrange
2332 ;
2333
2334 boolean
2335 : TOKFALSE
2336 | TOKTRUE
2337 ;
2338
2339 show_surfaces
2340 : TOKSHOWSURFACES TOKEQUAL boolean { boolean_command(c(pd), "show surfaces", $3 == 1); }
2341 ;
2342
2343 show_edges
2344 : TOKSHOWEDGES TOKEQUAL boolean { boolean_command(c(pd), "show edges", $3 == 1); }
2345 ;
2346
2347 show_bouding_box
2348 : TOKSHOWBOUNDINGBOX TOKEQUAL boolean { boolean_command(c(pd), "show bounding box", $3 == 1); }
2349 ;
2350
2351 color_by_scalar
2352 : TOKCOLORBYSCALAR TOKEQUAL TOKIDENTIFIER
2353 {
2354 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::SCALAR))
2355 YYABORT;
2356 identifier_command(c(pd), "color by scalar", $3);
2357 }
2358 ;
2359
2360 color_by_vector_magnitude
2361 : TOKCOLORBYVECTORMAGNITUDE TOKEQUAL TOKIDENTIFIER
2362 {
2363 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::VECTOR))
2364 YYABORT;
2365 identifier_command(c(pd), "color by vector magnitude", $3);
2366 }
2367 ;
2368
2369 color_by_vector_component
2370 : TOKCOLORBYVECTORCOMPONENT TOKEQUAL TOKIDENTIFIER
2371 {
2372 if(!check_vector_component(&yylloc, scanner, c(pd), $3))
2373 YYABORT;
2374 identifier_command(c(pd), "color by vector component", $3);
2375 }
2376 ;
2377
2378 color_by_tensor_component
2379 : TOKCOLORBYTENSORCOMPONENT TOKEQUAL TOKIDENTIFIER
2380 {
2381 if(!check_tensor_component(&yylloc, scanner, c(pd), $3))
2382 YYABORT;
2383 identifier_command(c(pd), "color by tensor component", $3);
2384 }
2385 ;
2386
2387 color_by_solid_color
2388 : TOKCOLORBYSOLIDCOLOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
2389 {
2390 if($3 < 0 || $3 > 1 ||
2391 $4 < 0 || $4 > 1 ||
2392 $5 < 0 || $5 > 1)
2393 {
2394 yyerror(&yylloc, scanner, pd, "Error: color by solid color arguments must be between 0 and 1, inclusive.");
2395 YYABORT;
2396 }
2397 c(pd).d.clear();
2398 c(pd).d.push_back($3);
2399 c(pd).d.push_back($4);
2400 c(pd).d.push_back($5);
2401 vector_command(c(pd), "color by solid color", c(pd).d);
2402 }
2403 ;
2404
2405 color_by_blockid
2406 : TOKCOLORBYBLOCKID { no_argument_command(c(pd), "color by blockid"); }
2407 ;
2408
2409 show_color_legend
2410 : TOKSHOWCOLORLEGEND TOKEQUAL boolean { boolean_command(c(pd), "show color legend", $3 == 1); }
2411 ;
2412
2413 color_legend_range
2414 : TOKCOLORLEGENDRANGE TOKEQUAL TOKVALUE TOKVALUE
2415 {
2416 if($3 > $4)
2417 {
2418 yyerror(&yylloc, scanner, pd, "Error: color legend range argument <min> must be less than argument <max>.");
2419 YYABORT;
2420 }
2421 c(pd).d.clear();
2422 c(pd).d.push_back($3);
2423 c(pd).d.push_back($4);
2424 vector_command(c(pd), "color legend range", c(pd).d);
2425 }
2426 ;
2427
2428 color_legend_use_current_data_range
2429 : TOKCOLORLEGENDUSECURRENTDATARANGE { no_argument_command(c(pd), "color legend use current data range"); }
2430 ;
2431
2432 color_legend_use_cumulative_data_range
2433 : TOKCOLORLEGENDUSECUMULATIVEDATARANGE { no_argument_command(c(pd), "color legend use cumulative data range"); }
2434 ;
2435
2436 color_legend_minimum_range
2437 : TOKCOLORLEGENDMINIMUMRANGE TOKEQUAL TOKVALUE TOKVALUE
2438 {
2439 if($3 > $4)
2440 {
2441 yyerror(&yylloc, scanner, pd, "Error: color legend minimum range argument <min> must be less than argument <max>.");
2442 YYABORT;
2443 }
2444 c(pd).d.clear();
2445 c(pd).d.push_back($3);
2446 c(pd).d.push_back($4);
2447 vector_command(c(pd), "color legend minimum range", c(pd).d);
2448 }
2449 ;
2450
2451 color_legend_maximum_range
2452 : TOKCOLORLEGENDMAXIMUMRANGE TOKEQUAL TOKVALUE TOKVALUE
2453 {
2454 if($3 > $4)
2455 {
2456 yyerror(&yylloc, scanner, pd, "Error: color legend maximum range argument <min> must be less than argument <max>.");
2457 YYABORT;
2458 }
2459 c(pd).d.clear();
2460 c(pd).d.push_back($3);
2461 c(pd).d.push_back($4);
2462 vector_command(c(pd), "color legend maximum range", c(pd).d);
2463 }
2464 ;
2465
2466 position
2467 : TOKTOP
2468 | TOKLEFT
2469 | TOKBOTTOM
2470 | TOKRIGHT
2471 | TOKTOPLEFT
2472 | TOKTOPRIGHT
2473 | TOKBOTTOMRIGHT
2474 | TOKBOTTOMLEFT
2475 ;
2476
2477 color_legend_position
2478 : TOKCOLORLEGENDPOSITION TOKEQUAL position TOKVALUE
2479 { if(!check_two_argument_command(&yylloc, scanner, c(pd), "color legend position", $3, $4)) YYABORT; }
2480 ;
2481
2482 preset_color_scale
2483 : TOKPRESETCOLORSCALE TOKEQUAL TOKIDENTIFIER
2484 {
2485 std::string cn($3);
2486 if(!check_color_name(&yylloc, scanner, c(pd), cn))
2487 YYABORT;
2488 identifier_command(c(pd), "preset color scale", $3);
2489 }
2490 ;
2491
2492 invert_color_scale
2493 : TOKINVERTCOLORSCALE TOKEQUAL boolean { boolean_command(c(pd), "invert color scale", $3 == 1); }
2494 ;
2495
2496 show_time_annotation
2497 : TOKSHOWTIMEANNOTATION TOKEQUAL boolean { boolean_command(c(pd), "show time annotation", $3 == 1); }
2498 ;
2499
2500 time_annotation_position
2501 : TOKTIMEANNOTATIONPOSITION TOKEQUAL position TOKVALUE
2502 { if(!check_two_argument_command(&yylloc, scanner, c(pd), "time annotation position", $3, $4)) YYABORT; }
2503 ;
2504
2505 show_axes
2506 : TOKSHOWAXES TOKEQUAL boolean { boolean_command(c(pd), "show axes", $3 == 1); }
2507 ;
2508
2509 show_x_axis_label
2510 : TOKSHOWXAXISLABEL TOKEQUAL boolean { boolean_command(c(pd), "show x axis label", $3 == 1); }
2511 ;
2512
2513 show_y_axis_label
2514 : TOKSHOWYAXISLABEL TOKEQUAL boolean { boolean_command(c(pd), "show y axis label", $3 == 1); }
2515 ;
2516
2517 show_z_axis_label
2518 : TOKSHOWZAXISLABEL TOKEQUAL boolean { boolean_command(c(pd), "show z axis label", $3 == 1); }
2519 ;
2520
2521 x_axis_label_name
2522 : TOKXAXISLABELNAME TOKEQUAL TOKSTRING
2523 {
2524 std::string s($3);
2525 remove_quotes(s);
2526 identifier_command(c(pd), "x axis label name", s);
2527 }
2528 ;
2529
2530 y_axis_label_name
2531 : TOKYAXISLABELNAME TOKEQUAL TOKSTRING
2532 {
2533 std::string s($3);
2534 remove_quotes(s);
2535 identifier_command(c(pd), "y axis label name", s);
2536 }
2537 ;
2538
2539 z_axis_label_name
2540 : TOKZAXISLABELNAME TOKEQUAL TOKSTRING
2541 {
2542 std::string s($3);
2543 remove_quotes(s);
2544 identifier_command(c(pd), "z axis label name", s);
2545 }
2546 ;
2547
2548 show_x_axis_tic_marks
2549 : TOKSHOWXAXISTICMARKS TOKEQUAL boolean { boolean_command(c(pd), "show x axis tic marks", $3 == 1); }
2550 ;
2551
2552 show_y_axis_tic_marks
2553 : TOKSHOWYAXISTICMARKS TOKEQUAL boolean { boolean_command(c(pd), "show y axis tic marks", $3 == 1); }
2554 ;
2555
2556 show_z_axis_tic_marks
2557 : TOKSHOWZAXISTICMARKS TOKEQUAL boolean { boolean_command(c(pd), "show z axis tic marks", $3 == 1); }
2558 ;
2559
2560 show_x_axis_minor_tic_marks
2561 : TOKSHOWXAXISMINORTICMARKS TOKEQUAL boolean { boolean_command(c(pd), "show x axis minor tic marks", $3 == 1); }
2562 ;
2563
2564 show_y_axis_minor_tic_marks
2565 : TOKSHOWYAXISMINORTICMARKS TOKEQUAL boolean { boolean_command(c(pd), "show y axis minor tic marks", $3 == 1); }
2566 ;
2567
2568 show_z_axis_minor_tic_marks
2569 : TOKSHOWZAXISMINORTICMARKS TOKEQUAL boolean { boolean_command(c(pd), "show z axis minor tic marks", $3 == 1); }
2570 ;
2571
2572 show_x_axis_tic_mark_labels
2573 : TOKSHOWXAXISTICMARKLABELS TOKEQUAL boolean { boolean_command(c(pd), "show x axis tic mark labels", $3 == 1); }
2574 ;
2575
2576 show_y_axis_tic_mark_labels
2577 : TOKSHOWYAXISTICMARKLABELS TOKEQUAL boolean { boolean_command(c(pd), "show y axis tic mark labels", $3 == 1); }
2578 ;
2579
2580 show_z_axis_tic_mark_labels
2581 : TOKSHOWZAXISTICMARKLABELS TOKEQUAL boolean { boolean_command(c(pd), "show z axis tic mark labels", $3 == 1); }
2582 ;
2583
2584 show_orientation_axes
2585 : TOKSHOWORIENTATIONAXES TOKEQUAL boolean { boolean_command(c(pd), "show orientation axes", $3 == 1); }
2586 ;
2587
2588 image_name_addon
2589 : TOKIMAGENAMEADDON TOKEQUAL TOKSTRING
2590 {
2591 std::string s($3);
2592 remove_quotes(s);
2593 identifier_command(c(pd), "image name addon", s);
2594 }
2595 ;
2596
2597 color_legend_subrange
2598 : TOKCOLORLEGENDSUBRANGE TOKEQUAL TOKVALUE TOKVALUE
2599 {
2600 if($3 > $4)
2601 {
2602 yyerror(&yylloc, scanner, pd, "Error: color legend subrange argument <min> must be less than argument <max>.");
2603 YYABORT;
2604 }
2605 c(pd).d.clear();
2606 c(pd).d.push_back($3);
2607 c(pd).d.push_back($4);
2608 vector_command(c(pd), "color legend subrange", c(pd).d);
2609 }
2610
2611 highlight_subrange
2612 : TOKHIGHLIGHTSUBRANGE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE TOKVALUE TOKVALUE
2613 {
2614 if($3 > $4)
2615 {
2616 yyerror(&yylloc, scanner, pd, "Error: highlight subrange argument <min> must be less than argument <max>.");
2617 YYABORT;
2618 }
2619 if($5 < 0 || $5 > 1 ||
2620 $6 < 0 || $6 > 1 ||
2621 $7 < 0 || $7 > 1)
2622 {
2623 yyerror(&yylloc, scanner, pd, "Error: highlight subrange <color> arguments must be between 0 and 1, inclusive.");
2624 YYABORT;
2625 }
2626 c(pd).d.clear();
2627 c(pd).d.push_back($3);
2628 c(pd).d.push_back($4);
2629 c(pd).d.push_back($5);
2630 c(pd).d.push_back($6);
2631 c(pd).d.push_back($7);
2632 std::ostringstream convert;
2633 convert << c(pd).count;
2634 vector_command(c(pd), "highlight subrange " + convert.str(), c(pd).d);
2635 c(pd).count++;
2636 }
2637 ;
2638
2639 /* END REPRESENTATION BLOCK */
2640
2641 /* START MULTICAMERA8 BLOCK */
2642
2643 multicamera8_block
2644 : start_multicamera8_block multicamera8_statements multicamera8_end
2645 {
2646 if(!check_camera(&yylloc, scanner, c(pd), c(pd).root["camera blocks"][c(pd).cbn]))
2647 YYABORT;
2648 c(pd).cb = TOKCATALYST;
2649 }
2650 ;
2651
2652 multicamera8_end
2653 : TOKEND
2654 | TOKEND TOKMULTICAMERA8
2655 ;
2656
2657 start_multicamera8_block
2658 : TOKBEGIN TOKMULTICAMERA8 TOKIDENTIFIER
2659 {
2660 c(pd).cb = TOKMULTICAMERA8;
2661 c(pd).cbn = $3;
2662 if(!initialize_block(&yylloc, scanner, c(pd)))
2663 YYABORT;
2664 }
2665 ;
2666
2667 multicamera8_statements
2668 :
2669 | multicamera8_statements multicamera8_statement
2670 ;
2671
2672 multicamera8_statement
2673 : look_at_absolute_point
2674 | look_at_relative_point
2675 | look_at_element
2676 | look_at_node
2677 | look_at_absolute_distance
2678 | look_at_relative_distance
2679 | up_vector
2680 | camera_fov
2681 | image_name_addon
2682 ;
2683
2684 look_at_absolute_point
2685 : TOKLOOKATABSOLUTEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
2686 {
2687 c(pd).d.clear();
2688 c(pd).d.push_back($3);
2689 c(pd).d.push_back($4);
2690 c(pd).d.push_back($5);
2691 vector_command(c(pd), "look at absolute point", c(pd).d);
2692 }
2693 ;
2694
2695 look_at_relative_point
2696 : TOKLOOKATRELATIVEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
2697 {
2698 c(pd).d.clear();
2699 c(pd).d.push_back($3);
2700 c(pd).d.push_back($4);
2701 c(pd).d.push_back($5);
2702 vector_command(c(pd), "look at relative point", c(pd).d);
2703 }
2704 ;
2705
2706 look_at_element
2707 : TOKLOOKATELEMENT TOKEQUAL TOKVALUE
2708 {
2709 if( (std::floor($3) != $3) ||
2710 ($3 < 1) )
2711 {
2712 yyerror(&yylloc, scanner, pd, "Error: look at element <id> must be an integer greater than 0");
2713 YYABORT;
2714 }
2715 check_elementID(&yylloc, scanner, c(pd), (int) $3);
2716 integer_command(c(pd), "look at element", (int) $3);
2717 }
2718 ;
2719
2720 look_at_node
2721 : TOKLOOKATNODE TOKEQUAL TOKVALUE
2722 {
2723 if( (std::floor($3) != $3) ||
2724 ($3 < 1) )
2725 {
2726 yyerror(&yylloc, scanner, pd, "Error: look at node <id> must be an integer greater than 0");
2727 YYABORT;
2728 }
2729 check_nodeID(&yylloc, scanner, c(pd), (int) $3);
2730 integer_command(c(pd), "look at node", (int) $3);
2731 }
2732 ;
2733
2734 look_at_absolute_distance
2735 : TOKLOOKATABSOLUTEDISTANCE TOKEQUAL TOKVALUE
2736 {
2737 if( $3 <= 0.0 )
2738 {
2739 yyerror(&yylloc, scanner, pd, "Error: look at absolute distance <value> must be greater than 0");
2740 YYABORT;
2741 }
2742 double_command(c(pd), "look at absolute distance", $3);
2743 }
2744 ;
2745
2746 look_at_relative_distance
2747 : TOKLOOKATRELATIVEDISTANCE TOKEQUAL TOKVALUE
2748 {
2749 if( $3 <= 0.0 )
2750 {
2751 yyerror(&yylloc, scanner, pd, "Error: look at relative distance <value> must be greater than 0");
2752 YYABORT;
2753 }
2754 double_command(c(pd), "look at relative distance", $3);
2755 }
2756 ;
2757
2758 up_vector
2759 : TOKUPVECTOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
2760 {
2761 if( $3 == 0.0 && $4 == 0.0 && $5 == 0.0 )
2762 {
2763 yyerror(&yylloc, scanner, pd, "Error: up vector cannot be all zeros");
2764 YYABORT;
2765 }
2766 c(pd).d.clear();
2767 c(pd).d.push_back($3);
2768 c(pd).d.push_back($4);
2769 c(pd).d.push_back($5);
2770 vector_command(c(pd), "up vector", c(pd).d);
2771 }
2772 ;
2773
2774 camera_fov
2775 : TOKCAMERAFOV TOKEQUAL TOKVALUE
2776 {
2777 if( $3 <= 0.0 || $3 > 180.0 )
2778 {
2779 yyerror(&yylloc, scanner, pd, "Error: camera fov <value> must be greater than 0 and less than or equal 180");
2780 YYABORT;
2781 }
2782 double_command(c(pd), "camera fov", $3);
2783 }
2784 ;
2785
2786 /* END MULTICAMERA8 BLOCK */
2787
2788 /* START CAMERA BLOCK */
2789
2790 camera_block
2791 : start_camera_block camera_statements camera_end
2792 {
2793 if(!check_camera(&yylloc, scanner, c(pd), c(pd).root["camera blocks"][c(pd).cbn]))
2794 YYABORT;
2795 c(pd).cb = TOKCATALYST;
2796 }
2797 ;
2798
2799 camera_end
2800 : TOKEND
2801 | TOKEND TOKCAMERA
2802 ;
2803
2804 start_camera_block
2805 : TOKBEGIN TOKCAMERA TOKIDENTIFIER
2806 {
2807 c(pd).cb = TOKCAMERA;
2808 c(pd).cbn = $3;
2809 if(!initialize_block(&yylloc, scanner, c(pd)))
2810 YYABORT;
2811 }
2812 ;
2813
2814 camera_statements
2815 :
2816 | camera_statements camera_statement
2817 ;
2818
2819 camera_statement
2820 : look_at_absolute_point
2821 | look_at_relative_point
2822 | look_at_element
2823 | look_at_node
2824 | look_at_absolute_distance
2825 | look_at_relative_distance
2826 | up_vector
2827 | camera_fov
2828 | image_name_addon
2829 | look_direction
2830 | camera_at_absolute_point
2831 | camera_at_relative_point
2832 | camera_at_element
2833 | camera_at_node
2834 | camera_at_element_displaced
2835 | camera_at_node_displaced
2836 | camera_at_data_point
2837 | camera_at_data_point_displaced
2838 ;
2839
2840 look_direction
2841 : TOKLOOKDIRECTION TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
2842 {
2843 if( $3 == 0.0 && $4 == 0.0 && $5 == 0.0 )
2844 {
2845 yyerror(&yylloc, scanner, pd, "Error: look direction vector cannot be all zeros");
2846 YYABORT;
2847 }
2848 c(pd).d.clear();
2849 c(pd).d.push_back($3);
2850 c(pd).d.push_back($4);
2851 c(pd).d.push_back($5);
2852 vector_command(c(pd), "look direction", c(pd).d);
2853 }
2854 ;
2855
2856 camera_at_absolute_point
2857 : TOKCAMERAATABSOLUTEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
2858 {
2859 c(pd).d.clear();
2860 c(pd).d.push_back($3);
2861 c(pd).d.push_back($4);
2862 c(pd).d.push_back($5);
2863 vector_command(c(pd), "camera at absolute point", c(pd).d);
2864 }
2865 ;
2866
2867 camera_at_relative_point
2868 : TOKCAMERAATRELATIVEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
2869 {
2870 c(pd).d.clear();
2871 c(pd).d.push_back($3);
2872 c(pd).d.push_back($4);
2873 c(pd).d.push_back($5);
2874 vector_command(c(pd), "camera at relative point", c(pd).d);
2875 }
2876 ;
2877
2878 camera_at_element
2879 : TOKCAMERAATELEMENT TOKEQUAL TOKVALUE
2880 {
2881 if( (std::floor($3) != $3) ||
2882 ($3 < 1) )
2883 {
2884 yyerror(&yylloc, scanner, pd, "Error: camera at element <id> must be an integer greater than 0");
2885 YYABORT;
2886 }
2887 check_elementID(&yylloc, scanner, c(pd), (int) $3);
2888 integer_command(c(pd), "camera at element", (int) $3);
2889 }
2890 ;
2891
2892 camera_at_node
2893 : TOKCAMERAATNODE TOKEQUAL TOKVALUE
2894 {
2895 if( (std::floor($3) != $3) ||
2896 ($3 < 1) )
2897 {
2898 yyerror(&yylloc, scanner, pd, "Error: camera at node <id> must be an integer greater than 0");
2899 YYABORT;
2900 }
2901 check_nodeID(&yylloc, scanner, c(pd), (int) $3);
2902 integer_command(c(pd), "camera at node", (int) $3);
2903 }
2904 ;
2905
2906 camera_at_element_displaced
2907 : TOKCAMERAATELEMENTDISPLACED TOKEQUAL TOKVALUE TOKVALUE TOKVALUE TOKVALUE
2908 {
2909 if( (std::floor($3) != $3) ||
2910 ($3 < 1) )
2911 {
2912 yyerror(&yylloc, scanner, pd, "Error: camera at element displaced <id> must be an integer greater than 0");
2913 YYABORT;
2914 }
2915 check_elementID(&yylloc, scanner, c(pd), (int) $3);
2916 four_argument_command(c(pd), "camera at element displaced", (int) $3, $4, $5, $6);
2917 }
2918 ;
2919
2920 camera_at_node_displaced
2921 : TOKCAMERAATNODEDISPLACED TOKEQUAL TOKVALUE TOKVALUE TOKVALUE TOKVALUE
2922 {
2923 if( (std::floor($3) != $3) ||
2924 ($3 < 1) )
2925 {
2926 yyerror(&yylloc, scanner, pd, "Error: camera at node displaced <id> must be an integer greater than 0");
2927 YYABORT;
2928 }
2929 check_nodeID(&yylloc, scanner, c(pd), (int) $3);
2930 four_argument_command(c(pd), "camera at node displaced", (int) $3, $4, $5, $6);
2931 }
2932 ;
2933
2934 camera_at_data_point
2935 : TOKCAMERAATDATAPOINT TOKEQUAL min_max_center variable_type TOKIDENTIFIER TOKIDENTIFIER
2936 {
2937 data_point_command(c(pd), "camera at data point", $3, $4, $5, $6);
2938 }
2939 ;
2940
2941 camera_at_data_point_displaced
2942 : TOKCAMERAATDATAPOINTDISPLACED TOKEQUAL min_max_center variable_type TOKIDENTIFIER TOKIDENTIFIER TOKVALUE TOKVALUE TOKVALUE
2943 {
2944 data_point_command(c(pd), "camera at data point displaced", $3, $4, $5, $6, $7, $8, $9);
2945 }
2946 ;
2947
2948 /* END CAMERA BLOCK */
2949
2950 /* START IMAGESET BLOCK */
2951
2952 imageset_block
2953 : start_imageset_block imageset_statements imageset_end
2954 {
2955 bool ret = true;
2956 ret = ret && check_imageset(&yylloc, scanner, c(pd), c(pd).root["imageset blocks"][c(pd).cbn]);
2957 ret = ret && check_representation(&yylloc, scanner, c(pd), c(pd).root["imageset blocks"][c(pd).cbn]);
2958 ret = ret && check_camera(&yylloc, scanner, c(pd), c(pd).root["imageset blocks"][c(pd).cbn]);
2959 if(!ret)
2960 YYABORT;
2961 c(pd).cb = TOKCATALYST;
2962 }
2963 ;
2964
2965 imageset_end
2966 : TOKEND
2967 | TOKEND TOKIMAGESET
2968 ;
2969
2970 start_imageset_block
2971 : TOKBEGIN TOKIMAGESET TOKIDENTIFIER
2972 {
2973 c(pd).cb = TOKIMAGESET;
2974 c(pd).cbn = $3;
2975 if(!initialize_block(&yylloc, scanner, c(pd)))
2976 YYABORT;
2977 }
2978 ;
2979
2980 imageset_statements
2981 :
2982 | imageset_statements imageset_statement
2983 ;
2984
2985 imageset_statement
2986 : camera
2987 | representation
2988 | representation2
2989 | representation3
2990 | operation
2991 | operation2
2992 | operation3
2993 | image_basename
2994 | image_basedirectory
2995 | image_format
2996 | image_digit_count
2997 | image_size
2998 | background_color
2999 | surface_color
3000 | edge_color
3001 | text_color
3002 | axes_color
3003 | threshold_shortcut
3004 | contour_shortcut
3005 | clip_shortcut
3006 | box_clip_shortcut
3007 | slice_shortcut
3008 | on_off_criteria
3009 | markers
3010
3011 /* Representation and MultiCamera8 Shortcuts */
3012
3013 | show_surfaces
3014 | show_edges
3015 | show_bouding_box
3016 | color_by_scalar
3017 | color_by_vector_magnitude
3018 | color_by_vector_component
3019 | color_by_tensor_component
3020 | color_by_solid_color
3021 | color_by_blockid
3022 | show_color_legend
3023 | color_legend_range
3024 | color_legend_use_current_data_range
3025 | color_legend_use_cumulative_data_range
3026 | color_legend_minimum_range
3027 | color_legend_maximum_range
3028 | color_legend_position
3029 | preset_color_scale
3030 | invert_color_scale
3031 | show_time_annotation
3032 | time_annotation_position
3033 | show_axes
3034 | show_x_axis_label
3035 | show_y_axis_label
3036 | show_z_axis_label
3037 | x_axis_label_name
3038 | y_axis_label_name
3039 | z_axis_label_name
3040 | show_x_axis_tic_marks
3041 | show_y_axis_tic_marks
3042 | show_z_axis_tic_marks
3043 | show_x_axis_minor_tic_marks
3044 | show_y_axis_minor_tic_marks
3045 | show_z_axis_minor_tic_marks
3046 | show_x_axis_tic_mark_labels
3047 | show_y_axis_tic_mark_labels
3048 | show_z_axis_tic_mark_labels
3049 | show_orientation_axes
3050 | look_at_absolute_point
3051 | look_at_relative_point
3052 | look_at_element
3053 | look_at_node
3054 | look_at_absolute_distance
3055 | look_at_relative_distance
3056 | up_vector
3057 | camera_fov
3058
3059 /* Representation and MultiCamera8 Shortcuts */
3060
3061 ;
3062
3063 camera
3064 : TOKCAMERA TOKEQUAL TOKIDENTIFIER
3065 {
3066 identifier_command(c(pd), "camera", $3);
3067 }
3068 ;
3069
3070 representation
3071 : TOKREPRESENTATION TOKEQUAL TOKIDENTIFIER
3072 {
3073 identifier_command(c(pd), "representation", $3);
3074 }
3075 ;
3076
3077 representation2
3078 : TOKREPRESENTATION2 TOKEQUAL TOKIDENTIFIER
3079 {
3080 identifier_command(c(pd), "representation2", $3);
3081 }
3082 ;
3083
3084 representation3
3085 : TOKREPRESENTATION3 TOKEQUAL TOKIDENTIFIER
3086 {
3087 identifier_command(c(pd), "representation3", $3);
3088 }
3089 ;
3090
3091 operation
3092 : TOKOPERATION TOKEQUAL TOKIDENTIFIER
3093 {
3094 identifier_command(c(pd), "operation", $3);
3095 }
3096 ;
3097
3098 operation2
3099 : TOKOPERATION2 TOKEQUAL TOKIDENTIFIER
3100 {
3101 identifier_command(c(pd), "operation2", $3);
3102 }
3103 ;
3104
3105 operation3
3106 : TOKOPERATION3 TOKEQUAL TOKIDENTIFIER
3107 {
3108 identifier_command(c(pd), "operation3", $3);
3109 }
3110 ;
3111
3112 image_basename
3113 : TOKIMAGEBASENAME TOKEQUAL TOKSTRING
3114 {
3115 std::string s($3);
3116 remove_quotes(s);
3117 identifier_command(c(pd), "image basename", s);
3118 }
3119 ;
3120
3121 image_basedirectory
3122 : TOKIMAGEBASEDIRECTORY TOKEQUAL TOKSTRING
3123 {
3124 std::string s($3);
3125 remove_quotes(s);
3126 identifier_command(c(pd), "image basedirectory", s);
3127 }
3128 ;
3129
3130 image_format
3131 : TOKIMAGEFORMAT TOKEQUAL TOKJPG { identifier_command(c(pd), "image format", "jpg"); }
3132 | TOKIMAGEFORMAT TOKEQUAL TOKPNG { identifier_command(c(pd), "image format", "png"); }
3133 ;
3134
3135 image_digit_count
3136 : TOKIMAGEDIGITCOUNT TOKEQUAL TOKVALUE
3137 {
3138 if( (std::floor($3) != $3) ||
3139 ($3 < 0) )
3140 {
3141 yyerror(&yylloc, scanner, pd, "Error: image digit count <count> must be an integer greater than or equal to 0");
3142 YYABORT;
3143 }
3144 integer_command(c(pd), "image digit count", (int) $3);
3145 }
3146 ;
3147
3148 image_size
3149 : TOKIMAGESIZE TOKEQUAL TOKVALUE TOKVALUE
3150 {
3151 if( (std::floor($3) != $3) ||
3152 ($3 < 1) ||
3153 ($3 > 4096) ||
3154 (std::floor($4) != $4) ||
3155 ($4 < 1) ||
3156 ($4 > 4096) )
3157 {
3158 yyerror(&yylloc, scanner, pd, "Error: image size <width> <height> must be integers greater than or equal to 1, and less than or equal to 4096");
3159 YYABORT;
3160 }
3161 c(pd).intValues.clear();
3162 c(pd).intValues.push_back($3);
3163 c(pd).intValues.push_back($4);
3164 vector_command(c(pd), "image size", c(pd).intValues);
3165 }
3166 ;
3167
3168 background_color
3169 : TOKBACKGROUNDCOLOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3170 {
3171 if($3 < 0 || $3 > 1 ||
3172 $4 < 0 || $4 > 1 ||
3173 $5 < 0 || $5 > 1)
3174 {
3175 yyerror(&yylloc, scanner, pd, "Error: background color <color> arguments must be between 0 and 1, inclusive.");
3176 YYABORT;
3177 }
3178 c(pd).d.clear();
3179 c(pd).d.push_back($3);
3180 c(pd).d.push_back($4);
3181 c(pd).d.push_back($5);
3182 vector_command(c(pd), "background color", c(pd).d);
3183 }
3184 ;
3185
3186 surface_color
3187 : TOKSURFACECOLOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3188 {
3189 if($3 < 0 || $3 > 1 ||
3190 $4 < 0 || $4 > 1 ||
3191 $5 < 0 || $5 > 1)
3192 {
3193 yyerror(&yylloc, scanner, pd, "Error: surface color <color> arguments must be between 0 and 1, inclusive.");
3194 YYABORT;
3195 }
3196 c(pd).d.clear();
3197 c(pd).d.push_back($3);
3198 c(pd).d.push_back($4);
3199 c(pd).d.push_back($5);
3200 vector_command(c(pd), "surface color", c(pd).d);
3201 }
3202 ;
3203
3204 edge_color
3205 : TOKEDGECOLOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3206 {
3207 if($3 < 0 || $3 > 1 ||
3208 $4 < 0 || $4 > 1 ||
3209 $5 < 0 || $5 > 1)
3210 {
3211 yyerror(&yylloc, scanner, pd, "Error: edge color <color> arguments must be between 0 and 1, inclusive.");
3212 YYABORT;
3213 }
3214 c(pd).d.clear();
3215 c(pd).d.push_back($3);
3216 c(pd).d.push_back($4);
3217 c(pd).d.push_back($5);
3218 vector_command(c(pd), "edge color", c(pd).d);
3219 }
3220 ;
3221
3222 text_color
3223 : TOKTEXTCOLOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3224 {
3225 if($3 < 0 || $3 > 1 ||
3226 $4 < 0 || $4 > 1 ||
3227 $5 < 0 || $5 > 1)
3228 {
3229 yyerror(&yylloc, scanner, pd, "Error: text color <color> arguments must be between 0 and 1, inclusive.");
3230 YYABORT;
3231 }
3232 c(pd).d.clear();
3233 c(pd).d.push_back($3);
3234 c(pd).d.push_back($4);
3235 c(pd).d.push_back($5);
3236 vector_command(c(pd), "text color", c(pd).d);
3237 }
3238 ;
3239
3240 axes_color
3241 : TOKAXESCOLOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3242 {
3243 if($3 < 0 || $3 > 1 ||
3244 $4 < 0 || $4 > 1 ||
3245 $5 < 0 || $5 > 1)
3246 {
3247 yyerror(&yylloc, scanner, pd, "Error: axes color <color> arguments must be between 0 and 1, inclusive.");
3248 YYABORT;
3249 }
3250 c(pd).d.clear();
3251 c(pd).d.push_back($3);
3252 c(pd).d.push_back($4);
3253 c(pd).d.push_back($5);
3254 vector_command(c(pd), "axes color", c(pd).d);
3255 }
3256 ;
3257
3258 threshold_shortcut
3259 : TOKTHRESHOLD TOKEQUAL operation_data_type TOKIDENTIFIER TOKKEEPBETWEEN TOKVALUE TOKVALUE
3260 {
3261 c(pd).d.clear();
3262 c(pd).d.push_back($6);
3263 c(pd).d.push_back($7);
3264 threshold_or_contour_shortcut_command(c(pd), "threshold", $3, $4, $5, c(pd).d);
3265 }
3266 | TOKTHRESHOLD TOKEQUAL operation_data_type TOKIDENTIFIER threshold_value TOKVALUE
3267 {
3268 c(pd).d.clear();
3269 c(pd).d.push_back($6);
3270 threshold_or_contour_shortcut_command(c(pd), "threshold", $3, $4, $5, c(pd).d);
3271 }
3272 ;
3273
3274 operation_data_type
3275 : TOKSCALAR
3276 | TOKVECTORMAGNITUDE
3277 | TOKVECTORCOMPONENT
3278 | TOKTENSORCOMPONENT
3279 ;
3280
3281 threshold_value
3282 : TOKKEEPABOVE
3283 | TOKKEEPBELOW
3284 ;
3285
3286 contour_shortcut
3287 : TOKCONTOUR TOKEQUAL operation_data_type TOKIDENTIFIER TOKVALUESEQUENCE TOKVALUE TOKVALUE TOKVALUE
3288 {
3289 if($6 >= $8)
3290 {
3291 yyerror(&yylloc, scanner, pd, "Error: contour shortcut contains 'value sequence' with start greater than or equal to stop");
3292 YYABORT;
3293 }
3294 if($7 <= 0)
3295 {
3296 yyerror(&yylloc, scanner, pd, "Error: contour shortcut contains 'value sequence' with a negative or zero step");
3297 YYABORT;
3298 }
3299 c(pd).d.clear();
3300 c(pd).d.push_back($6);
3301 c(pd).d.push_back($7);
3302 c(pd).d.push_back($8);
3303 threshold_or_contour_shortcut_command(c(pd), "contour", $3, $4, $5, c(pd).d);
3304 }
3305 | TOKCONTOUR TOKEQUAL operation_data_type TOKIDENTIFIER TOKVALUELIST { c(pd).d.clear(); } contour_value_list
3306 {
3307 threshold_or_contour_shortcut_command(c(pd), "contour", $3, $4, $5, c(pd).d);
3308 }
3309 ;
3310
3311 contour_value_list
3312 : contour_value_member
3313 | contour_value_list contour_value_member
3314 ;
3315
3316 contour_value_member
3317 : TOKVALUE { c(pd).d.push_back($1); }
3318 ;
3319
3320 clip_shortcut
3321 : TOKCLIP TOKEQUAL TOKPOINT TOKVALUE TOKVALUE TOKVALUE TOKNORMAL TOKVALUE TOKVALUE TOKVALUE
3322 {
3323 if( $8 == 0.0 && $9 == 0.0 && $10 == 0.0 )
3324 {
3325 yyerror(&yylloc, scanner, pd, "Error: clip shortcut vector cannot be all zeros");
3326 YYABORT;
3327 }
3328 c(pd).d.clear();
3329 c(pd).d.push_back($4);
3330 c(pd).d.push_back($5);
3331 c(pd).d.push_back($6);
3332 c(pd).d.push_back($8);
3333 c(pd).d.push_back($9);
3334 c(pd).d.push_back($10);
3335 clip_or_boxclip_or_slice_shortcut_command(c(pd), "clip", "", c(pd).d);
3336 }
3337 ;
3338
3339 box_clip_shortcut
3340 : TOKBOXCLIP TOKEQUAL TOKCENTER TOKVALUE TOKVALUE TOKVALUE TOKEXTENTS TOKVALUE TOKVALUE TOKVALUE box_clip_type
3341 {
3342 if( $8 == 0.0 && $9 == 0.0 && $10 == 0.0 )
3343 {
3344 yyerror(&yylloc, scanner, pd, "Error: box clip shortcut extents cannot be all zeros");
3345 YYABORT;
3346 }
3347 c(pd).d.clear();
3348 c(pd).d.push_back($4);
3349 c(pd).d.push_back($5);
3350 c(pd).d.push_back($6);
3351 c(pd).d.push_back($8);
3352 c(pd).d.push_back($9);
3353 c(pd).d.push_back($10);
3354 clip_or_boxclip_or_slice_shortcut_command(c(pd), "boxclip", $11, c(pd).d);
3355 }
3356 ;
3357
3358 box_clip_type
3359 : TOKKEEPINSIDE
3360 | TOKKEEPOUTSIDE
3361 ;
3362
3363 slice_shortcut
3364 : TOKSLICE TOKEQUAL TOKPOINT TOKVALUE TOKVALUE TOKVALUE TOKNORMAL TOKVALUE TOKVALUE TOKVALUE
3365 {
3366 if( $8 == 0.0 && $9 == 0.0 && $10 == 0.0 )
3367 {
3368 yyerror(&yylloc, scanner, pd, "Error: slice shortcut vector cannot be all zeros");
3369 YYABORT;
3370 }
3371 c(pd).d.clear();
3372 c(pd).d.push_back($4);
3373 c(pd).d.push_back($5);
3374 c(pd).d.push_back($6);
3375 c(pd).d.push_back($8);
3376 c(pd).d.push_back($9);
3377 c(pd).d.push_back($10);
3378 clip_or_boxclip_or_slice_shortcut_command(c(pd), "slice", "", c(pd).d);
3379 }
3380 ;
3381
3382 on_off_criteria
3383 : TOKONOFFCRITERIA TOKEQUAL { c(pd).s.clear(); } identifier_list
3384 {
3385 string_vector_command(c(pd), "onoff criteria", c(pd).s);
3386 }
3387 ;
3388
3389 identifier_list
3390 : identifier_list_member
3391 | identifier_list identifier_list_member
3392 ;
3393
3394 identifier_list_member
3395 : TOKIDENTIFIER { c(pd).s.push_back($1); }
3396 ;
3397
3398 markers
3399 : TOKMARKERS TOKEQUAL { c(pd).s.clear(); } identifier_list
3400 {
3401 string_vector_command(c(pd), "markers", c(pd).s);
3402 }
3403 ;
3404
3405 /* END IMAGESET BLOCK */
3406
3407 /* START CLIP BLOCK */
3408
3409 clip_block
3410 : start_clip_block clip_statements clip_end
3411 {
3412 if(!check_clip_or_slice(&yylloc, scanner, c(pd), c(pd).root["operation blocks"][c(pd).cbn]))
3413 YYABORT;
3414 c(pd).cb = TOKCATALYST;
3415 }
3416 ;
3417
3418 clip_end
3419 : TOKEND
3420 | TOKENDCLIP
3421 ;
3422
3423 start_clip_block
3424 : TOKBEGIN TOKCLIP TOKIDENTIFIER
3425 {
3426 c(pd).cb = TOKCLIP;
3427 c(pd).cbn = $3;
3428 if(!initialize_block(&yylloc, scanner, c(pd)))
3429 YYABORT;
3430 }
3431 ;
3432
3433 clip_statements
3434 :
3435 | clip_statements clip_statement
3436 ;
3437
3438 clip_statement
3439 : input
3440 | absolute_point_on_plane
3441 | relative_point_on_plane
3442 | node_on_plane
3443 | element_on_plane
3444 | plane_normal
3445 | cut_type
3446 | side_to_keep
3447 | data_point_on_plane
3448 | plane_specification
3449 ;
3450
3451 input
3452 : TOKINPUT TOKEQUAL TOKIDENTIFIER
3453 {
3454 std::string s($3);
3455 if(s == c(pd).cbn)
3456 {
3457 yyerror(&yylloc, scanner, pd, "Error: operation <input> cannot match operation name");
3458 YYABORT;
3459 }
3460
3461 identifier_command(c(pd), "input", $3);
3462 }
3463 ;
3464
3465 point_location
3466 : TOKA
3467 | TOKB
3468 | TOKC
3469 ;
3470
3471 absolute_point_on_plane
3472 : TOKABSOLUTEPOINTONPLANE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3473 {
3474 c(pd).d.clear();
3475 c(pd).d.push_back($3);
3476 c(pd).d.push_back($4);
3477 c(pd).d.push_back($5);
3478 vector_command(c(pd), "absolute point on plane", c(pd).d);
3479 }
3480 | TOKABSOLUTEPOINTONPLANE point_location TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3481 {
3482 std::string ct($2);
3483 std::transform(ct.begin(), ct.end(), ct.begin(), ::toupper);
3484 c(pd).d.clear();
3485 c(pd).d.push_back($4);
3486 c(pd).d.push_back($5);
3487 c(pd).d.push_back($6);
3488 vector_command(c(pd), "absolute point on plane " + ct, c(pd).d);
3489 }
3490 ;
3491
3492 relative_point_on_plane
3493 : TOKRELATIVEPOINTONPLANE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3494 {
3495 c(pd).d.clear();
3496 c(pd).d.push_back($3);
3497 c(pd).d.push_back($4);
3498 c(pd).d.push_back($5);
3499 vector_command(c(pd), "relative point on plane", c(pd).d);
3500 }
3501 | TOKRELATIVEPOINTONPLANE point_location TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3502 {
3503 std::string ct($2);
3504 std::transform(ct.begin(), ct.end(), ct.begin(), ::toupper);
3505 c(pd).d.clear();
3506 c(pd).d.push_back($4);
3507 c(pd).d.push_back($5);
3508 c(pd).d.push_back($6);
3509 vector_command(c(pd), "relative point on plane " + ct, c(pd).d);
3510 }
3511 ;
3512
3513 node_on_plane
3514 : TOKNODEONPLANE TOKEQUAL TOKVALUE
3515 {
3516 if( (std::floor($3) != $3) ||
3517 ($3 < 1) )
3518 {
3519 yyerror(&yylloc, scanner, pd, "Error: node on plane <id> must be an integer greater than 0");
3520 YYABORT;
3521 }
3522 check_nodeID(&yylloc, scanner, c(pd), (int) $3);
3523 integer_command(c(pd), "node on plane", (int) $3);
3524 }
3525 | TOKNODEONPLANE point_location TOKEQUAL TOKVALUE
3526 {
3527 if( (std::floor($4) != $4) ||
3528 ($4 < 1) )
3529 {
3530 yyerror(&yylloc, scanner, pd, "Error: node on plane <id> must be an integer greater than 0");
3531 YYABORT;
3532 }
3533 check_nodeID(&yylloc, scanner, c(pd), (int) $4);
3534 std::string ct($2);
3535 std::transform(ct.begin(), ct.end(), ct.begin(), ::toupper);
3536 integer_command(c(pd), "node on plane " + ct, (int) $4);
3537 }
3538 ;
3539
3540 element_on_plane
3541 : TOKELEMENTONPLANE TOKEQUAL TOKVALUE
3542 {
3543 if( (std::floor($3) != $3) ||
3544 ($3 < 1) )
3545 {
3546 yyerror(&yylloc, scanner, pd, "Error: element on plane <id> must be an integer greater than 0");
3547 YYABORT;
3548 }
3549 check_elementID(&yylloc, scanner, c(pd), (int) $3);
3550 integer_command(c(pd), "element on plane", (int) $3);
3551 }
3552 | TOKELEMENTONPLANE point_location TOKEQUAL TOKVALUE
3553 {
3554 if( (std::floor($4) != $4) ||
3555 ($4 < 1) )
3556 {
3557 yyerror(&yylloc, scanner, pd, "Error: element on plane <id> must be an integer greater than 0");
3558 YYABORT;
3559 }
3560 check_elementID(&yylloc, scanner, c(pd), (int) $4);
3561 std::string ct($2);
3562 std::transform(ct.begin(), ct.end(), ct.begin(), ::toupper);
3563 integer_command(c(pd), "element on plane " + ct, (int) $4);
3564 }
3565 ;
3566
3567 plane_normal
3568 : TOKPLANENORMAL TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3569 {
3570 if( $3 == 0.0 && $4 == 0.0 && $5 == 0.0 )
3571 {
3572 yyerror(&yylloc, scanner, pd, "Error: plane normal cannot be all zeros");
3573 YYABORT;
3574 }
3575 c(pd).d.clear();
3576 c(pd).d.push_back($3);
3577 c(pd).d.push_back($4);
3578 c(pd).d.push_back($5);
3579 vector_command(c(pd), "plane normal", c(pd).d);
3580 }
3581
3582 cut_type
3583 : TOKCUTTYPE TOKEQUAL cut_type_string
3584 {
3585 std::string ct($3);
3586 std::transform(ct.begin(), ct.end(), ct.begin(), ::tolower);
3587 identifier_command(c(pd), "cut type", ct);
3588 }
3589 ;
3590
3591 cut_type_string
3592 : TOKCRINKLE
3593 | TOKSMOOTH
3594 ;
3595
3596 side_to_keep
3597 : TOKSIDETOKEEP TOKEQUAL side_type
3598 {
3599 std::string ct($3);
3600 std::transform(ct.begin(), ct.end(), ct.begin(), ::tolower);
3601 identifier_command(c(pd), "side to keep", ct);
3602 }
3603 ;
3604
3605 side_type
3606 : TOKPOSITIVE
3607 | TOKNEGATIVE
3608 ;
3609
3610 data_point_on_plane
3611 : TOKDATAPOINTONPLANE TOKEQUAL min_max_center variable_type TOKIDENTIFIER TOKIDENTIFIER
3612 {
3613 data_point_command(c(pd), "data point on plane", $3, $4, $5, $6);
3614 }
3615 | TOKDATAPOINTONPLANE point_location TOKEQUAL min_max_center variable_type TOKIDENTIFIER TOKIDENTIFIER
3616 {
3617 std::string ct($2);
3618 std::transform(ct.begin(), ct.end(), ct.begin(), ::toupper);
3619 data_point_command(c(pd), "data point on plane " + ct, $4, $5, $6, $7);
3620 }
3621 ;
3622
3623 plane_specification
3624 : TOKPLANESPECIFICATION TOKEQUAL TOKTHREEPOINTS { identifier_command(c(pd), "plane specification", "three points"); }
3625 | TOKPLANESPECIFICATION TOKEQUAL TOKPOINTANDNORMAL { identifier_command(c(pd), "plane specification", "point and normal"); }
3626 ;
3627
3628
3629 /* END CLIP BLOCK */
3630
3631 /* START SLICE BLOCK */
3632
3633 slice_block
3634 : start_slice_block slice_statements slice_end
3635 {
3636 if(!check_clip_or_slice(&yylloc, scanner, c(pd), c(pd).root["operation blocks"][c(pd).cbn]))
3637 YYABORT;
3638 c(pd).cb = TOKCATALYST;
3639 }
3640 ;
3641
3642 slice_end
3643 : TOKEND
3644 | TOKENDSLICE
3645 ;
3646
3647 start_slice_block
3648 : TOKBEGIN TOKSLICE TOKIDENTIFIER
3649 {
3650 c(pd).cb = TOKSLICE;
3651 c(pd).cbn = $3;
3652 if(!initialize_block(&yylloc, scanner, c(pd)))
3653 YYABORT;
3654 }
3655 ;
3656
3657 slice_statements
3658 :
3659 | slice_statements slice_statement
3660 ;
3661
3662 slice_statement
3663 : input
3664 | absolute_point_on_plane
3665 | relative_point_on_plane
3666 | node_on_plane
3667 | element_on_plane
3668 | plane_normal
3669 | cut_type
3670 | data_point_on_plane
3671 | plane_specification
3672 ;
3673
3674 /* END SLICE BLOCK */
3675
3676 /* START BOXCLIP BLOCK */
3677
3678 box_clip_block
3679 : start_box_clip_block box_clip_statements box_clip_end
3680 {
3681 if(!check_box_clip(&yylloc, scanner, c(pd), c(pd).root["operation blocks"][c(pd).cbn]))
3682 YYABORT;
3683 c(pd).cb = TOKCATALYST;
3684 }
3685 ;
3686
3687 box_clip_end
3688 : TOKEND
3689 | TOKENDBOXCLIP
3690 ;
3691
3692 start_box_clip_block
3693 : TOKBEGIN TOKBOXCLIP TOKIDENTIFIER
3694 {
3695 c(pd).cb = TOKBOXCLIP;
3696 c(pd).cbn = $3;
3697 if(!initialize_block(&yylloc, scanner, c(pd)))
3698 YYABORT;
3699 }
3700 ;
3701
3702 box_clip_statements
3703 :
3704 | box_clip_statements box_clip_statement
3705 ;
3706
3707 box_clip_statement
3708 : input
3709 | center_at_absolute_point
3710 | center_at_relative_point
3711 | center_at_node
3712 | center_at_element
3713 | absolute_extents
3714 | relative_extents
3715 | rotations
3716 | keep_inside_box
3717 | cut_type
3718 | center_at_data_point
3719 ;
3720
3721 center_at_absolute_point
3722 : TOKCENTERATABSOLUTEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3723 {
3724 c(pd).d.clear();
3725 c(pd).d.push_back($3);
3726 c(pd).d.push_back($4);
3727 c(pd).d.push_back($5);
3728 vector_command(c(pd), "center at absolute point", c(pd).d);
3729 }
3730 ;
3731
3732 center_at_relative_point
3733 : TOKCENTERATRELATIVEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3734 {
3735 c(pd).d.clear();
3736 c(pd).d.push_back($3);
3737 c(pd).d.push_back($4);
3738 c(pd).d.push_back($5);
3739 vector_command(c(pd), "center at relative point", c(pd).d);
3740 }
3741 ;
3742
3743 center_at_node
3744 : TOKCENTERATNODE TOKEQUAL TOKVALUE
3745 {
3746 if( (std::floor($3) != $3) ||
3747 ($3 < 1) )
3748 {
3749 yyerror(&yylloc, scanner, pd, "Error: center at node <id> must be an integer greater than 0");
3750 YYABORT;
3751 }
3752 check_nodeID(&yylloc, scanner, c(pd), (int) $3);
3753 integer_command(c(pd), "center at node", (int) $3);
3754 }
3755 ;
3756
3757 center_at_element
3758 : TOKCENTERATELEMENT TOKEQUAL TOKVALUE
3759 {
3760 if( (std::floor($3) != $3) ||
3761 ($3 < 1) )
3762 {
3763 yyerror(&yylloc, scanner, pd, "Error: center at element <id> must be an integer greater than 0");
3764 YYABORT;
3765 }
3766 check_elementID(&yylloc, scanner, c(pd), (int) $3);
3767 integer_command(c(pd), "center at element", (int) $3);
3768 }
3769 ;
3770
3771 absolute_extents
3772 : TOKABSOLUTEEXTENTS TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3773 {
3774 if( $3 < 0.0 || $4 < 0.0 || $5 < 0.0 )
3775 {
3776 yyerror(&yylloc, scanner, pd, "Error: absolute extents cannot be less than zero");
3777 YYABORT;
3778 }
3779 c(pd).d.clear();
3780 c(pd).d.push_back($3);
3781 c(pd).d.push_back($4);
3782 c(pd).d.push_back($5);
3783 vector_command(c(pd), "absolute extents", c(pd).d);
3784 }
3785
3786 relative_extents
3787 : TOKRELATIVEEXTENTS TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3788 {
3789 if( $3 < 0.0 || $4 < 0.0 || $5 < 0.0 )
3790 {
3791 yyerror(&yylloc, scanner, pd, "Error: relative extents cannot be less than zero");
3792 YYABORT;
3793 }
3794 c(pd).d.clear();
3795 c(pd).d.push_back($3);
3796 c(pd).d.push_back($4);
3797 c(pd).d.push_back($5);
3798 vector_command(c(pd), "relative extents", c(pd).d);
3799 }
3800
3801 rotations
3802 : TOKROTATIONS TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3803 {
3804 c(pd).d.clear();
3805 c(pd).d.push_back($3);
3806 c(pd).d.push_back($4);
3807 c(pd).d.push_back($5);
3808 vector_command(c(pd), "rotations", c(pd).d);
3809 }
3810
3811 keep_inside_box
3812 : TOKKEEPINSIDEBOX TOKEQUAL boolean { boolean_command(c(pd), "keep inside box", $3 == 1); }
3813 ;
3814
3815 center_at_data_point
3816 : TOKCENTERATDATAPOINT TOKEQUAL min_max_center variable_type TOKIDENTIFIER TOKIDENTIFIER
3817 {
3818 data_point_command(c(pd), "center at data point", $3, $4, $5, $6);
3819 }
3820 ;
3821
3822 /* END BOXCLIP BLOCK */
3823
3824 /* START THRESHOLD BLOCK */
3825
3826 threshold_block
3827 : start_threshold_block threshold_statements threshold_end
3828 {
3829 if(!check_threshold(&yylloc, scanner, c(pd), c(pd).root["operation blocks"][c(pd).cbn]))
3830 YYABORT;
3831 c(pd).cb = TOKCATALYST;
3832 }
3833 ;
3834
3835 threshold_end
3836 : TOKEND
3837 | TOKENDTHRESHOLD
3838 ;
3839
3840 start_threshold_block
3841 : TOKBEGIN TOKTHRESHOLD TOKIDENTIFIER
3842 {
3843 c(pd).cb = TOKTHRESHOLD;
3844 c(pd).cbn = $3;
3845 if(!initialize_block(&yylloc, scanner, c(pd)))
3846 YYABORT;
3847 }
3848 ;
3849
3850 threshold_statements
3851 :
3852 | threshold_statements threshold_statement
3853 ;
3854
3855 threshold_statement
3856 : input
3857 | variable_scalar
3858 | variable_vector_magnitude
3859 | variable_vector_component
3860 | variable_tensor_component
3861 | keep_between
3862 | keep_above
3863 | keep_below
3864 ;
3865
3866 variable_scalar
3867 : TOKVARIABLESCALAR TOKEQUAL TOKIDENTIFIER
3868 {
3869 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::SCALAR))
3870 YYABORT;
3871 identifier_command(c(pd), "variable scalar", $3);
3872 }
3873 ;
3874
3875 variable_vector_magnitude
3876 : TOKVARIABLEVECTORMAGNITUDE TOKEQUAL TOKIDENTIFIER
3877 {
3878 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::VECTOR))
3879 YYABORT;
3880 identifier_command(c(pd), "variable vector magnitude", $3);
3881 }
3882 ;
3883
3884 variable_vector_component
3885 : TOKVARIABLEVECTORCOMPONENT TOKEQUAL TOKIDENTIFIER
3886 {
3887 if(!check_vector_component(&yylloc, scanner, c(pd), $3))
3888 YYABORT;
3889 identifier_command(c(pd), "variable vector component", $3);
3890 }
3891 ;
3892
3893 variable_tensor_component
3894 : TOKVARIABLETENSORCOMPONENT TOKEQUAL TOKIDENTIFIER
3895 {
3896 if(!check_tensor_component(&yylloc, scanner, c(pd), $3))
3897 YYABORT;
3898 identifier_command(c(pd), "variable tensor component", $3);
3899 }
3900 ;
3901
3902 keep_between
3903 : TOKKEEPBETWEEN TOKEQUAL TOKVALUE TOKVALUE
3904 {
3905 if($3 > $4)
3906 {
3907 yyerror(&yylloc, scanner, pd, "Error: keep between argument <min> must be less than argument <max>.");
3908 YYABORT;
3909 }
3910 c(pd).d.clear();
3911 c(pd).d.push_back($3);
3912 c(pd).d.push_back($4);
3913 vector_command(c(pd), "keep between", c(pd).d);
3914 }
3915 ;
3916
3917 keep_above
3918 : TOKKEEPABOVE TOKEQUAL TOKVALUE
3919 {
3920 double_command(c(pd), "keep above", $3);
3921 }
3922 ;
3923
3924 keep_below
3925 : TOKKEEPBELOW TOKEQUAL TOKVALUE
3926 {
3927 double_command(c(pd), "keep below", $3);
3928 }
3929 ;
3930
3931
3932 /* END THRESHOLD BLOCK */
3933
3934 /* START CONTOUR BLOCK */
3935
3936 contour_block
3937 : start_contour_block contour_statements contour_end
3938 {
3939 if(!check_contour(&yylloc, scanner, c(pd), c(pd).root["operation blocks"][c(pd).cbn]))
3940 YYABORT;
3941 c(pd).cb = TOKCATALYST;
3942 }
3943 ;
3944
3945 contour_end
3946 : TOKEND
3947 | TOKENDCONTOUR
3948 ;
3949
3950 start_contour_block
3951 : TOKBEGIN TOKCONTOUR TOKIDENTIFIER
3952 {
3953 c(pd).cb = TOKCONTOUR;
3954 c(pd).cbn = $3;
3955 if(!initialize_block(&yylloc, scanner, c(pd)))
3956 YYABORT;
3957 }
3958 ;
3959
3960 contour_statements
3961 :
3962 | contour_statements contour_statement
3963 ;
3964
3965 contour_statement
3966 : input
3967 | variable_scalar
3968 | variable_vector_magnitude
3969 | variable_vector_component
3970 | variable_tensor_component
3971 | contour_value
3972 | contour_value_sequence
3973 ;
3974
3975 contour_value
3976 : TOKCONTOURVALUE TOKEQUAL { c(pd).d.clear(); } contour_value_list
3977 {
3978 vector_command(c(pd), "contour value", c(pd).d);
3979 }
3980 ;
3981
3982 contour_value_sequence
3983 : TOKCONTOURVALUESEQUENCE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
3984 {
3985 if($3 >= $5)
3986 {
3987 yyerror(&yylloc, scanner, pd, "Error: contour value sequence has start greater than or equal to stop");
3988 YYABORT;
3989 }
3990 if($4 <= 0)
3991 {
3992 yyerror(&yylloc, scanner, pd, "Error: contour value sequence has a negative or zero step");
3993 YYABORT;
3994 }
3995 c(pd).d.clear();
3996 c(pd).d.push_back($3);
3997 c(pd).d.push_back($4);
3998 c(pd).d.push_back($5);
3999 vector_command(c(pd), "contour value sequence", c(pd).d);
4000 }
4001 ;
4002
4003 /* END CONTOUR BLOCK */
4004
4005 /* START SCATTER PLOT BLOCK */
4006
4007 scatter_plot_block
4008 : start_scatter_plot_block scatter_plot_statements scatter_plot_end
4009 {
4010 if(!check_scatter_plot_block(&yylloc, scanner, c(pd), c(pd).root["scatter plot blocks"][c(pd).cbn]))
4011 YYABORT;
4012 c(pd).cb = TOKCATALYST;
4013 }
4014 ;
4015
4016 scatter_plot_end
4017 : TOKEND
4018 | TOKEND TOKSCATTERPLOT
4019 ;
4020
4021 start_scatter_plot_block
4022 : TOKBEGIN TOKSCATTERPLOT TOKIDENTIFIER
4023 {
4024 c(pd).cb = TOKSCATTERPLOT;
4025 c(pd).cbn = $3;
4026 if(!initialize_block(&yylloc, scanner, c(pd)))
4027 YYABORT;
4028 }
4029 ;
4030
4031 scatter_plot_statements
4032 :
4033 | scatter_plot_statements scatter_plot_statement
4034 ;
4035
4036 scatter_plot_statement
4037 : operation
4038 | all_variables
4039 | x_axis_variable_scalar
4040 | y_axis_variable_scalar
4041 | x_axis_variable_vector_magnitude
4042 | y_axis_variable_vector_magnitude
4043 | x_axis_variable_vector_component
4044 | y_axis_variable_vector_component
4045 | x_axis_variable_tensor_component
4046 | y_axis_variable_tensor_component
4047 | x_axis_range
4048 | y_axis_range
4049 | x_axis_use_current_data_range
4050 | y_axis_use_current_data_range
4051 | x_axis_use_cumulative_data_range
4052 | y_axis_use_cumulative_data_range
4053 | x_axis_minimum_range
4054 | y_axis_minimum_range
4055 | x_axis_maximum_range
4056 | y_axis_maximum_range
4057 | plot_base_name
4058 | plot_base_directory
4059 | image_format
4060 | image_digit_count
4061 | image_size
4062 ;
4063
4064 all_variables
4065 : TOKALLVARIABLES { no_argument_command(c(pd), "all variables"); }
4066 ;
4067
4068 x_axis_variable_scalar
4069 : TOKXAXISVARIABLESCALAR TOKEQUAL TOKIDENTIFIER
4070 {
4071 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::SCALAR))
4072 YYABORT;
4073 identifier_command(c(pd), "x axis variable scalar", $3);
4074 }
4075 ;
4076
4077 y_axis_variable_scalar
4078 : TOKYAXISVARIABLESCALAR TOKEQUAL TOKIDENTIFIER
4079 {
4080 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::SCALAR))
4081 YYABORT;
4082 identifier_command(c(pd), "y axis variable scalar", $3);
4083 }
4084 ;
4085
4086 x_axis_variable_vector_magnitude
4087 : TOKXAXISVARIABLEVECTORMAGNITUDE TOKEQUAL TOKIDENTIFIER
4088 {
4089 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::VECTOR))
4090 YYABORT;
4091 identifier_command(c(pd), "x axis variable vector magnitude", $3);
4092 }
4093 ;
4094
4095 y_axis_variable_vector_magnitude
4096 : TOKYAXISVARIABLEVECTORMAGNITUDE TOKEQUAL TOKIDENTIFIER
4097 {
4098 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::VECTOR))
4099 YYABORT;
4100 identifier_command(c(pd), "y axis variable vector magnitude", $3);
4101 }
4102 ;
4103
4104 x_axis_variable_vector_component
4105 : TOKXAXISVARIABLEVECTORCOMPONENT TOKEQUAL TOKIDENTIFIER
4106 {
4107 if(!check_vector_component(&yylloc, scanner, c(pd), $3))
4108 YYABORT;
4109 identifier_command(c(pd), "x axis variable vector component", $3);
4110 }
4111 ;
4112
4113 y_axis_variable_vector_component
4114 : TOKYAXISVARIABLEVECTORCOMPONENT TOKEQUAL TOKIDENTIFIER
4115 {
4116 if(!check_vector_component(&yylloc, scanner, c(pd), $3))
4117 YYABORT;
4118 identifier_command(c(pd), "y axis variable vector component", $3);
4119 }
4120 ;
4121
4122 x_axis_variable_tensor_component
4123 : TOKXAXISVARIABLETENSORCOMPONENT TOKEQUAL TOKIDENTIFIER
4124 {
4125 if(!check_tensor_component(&yylloc, scanner, c(pd), $3))
4126 YYABORT;
4127 identifier_command(c(pd), "x axis variable tensor component", $3);
4128 }
4129 ;
4130
4131 y_axis_variable_tensor_component
4132 : TOKYAXISVARIABLETENSORCOMPONENT TOKEQUAL TOKIDENTIFIER
4133 {
4134 if(!check_tensor_component(&yylloc, scanner, c(pd), $3))
4135 YYABORT;
4136 identifier_command(c(pd), "y axis variable tensor component", $3);
4137 }
4138 ;
4139
4140 x_axis_range
4141 : TOKXAXISRANGE TOKEQUAL TOKVALUE TOKVALUE
4142 {
4143 if($3 > $4)
4144 {
4145 yyerror(&yylloc, scanner, pd, "Error: x axis range argument <min> must be less than argument <max>.");
4146 YYABORT;
4147 }
4148 c(pd).d.clear();
4149 c(pd).d.push_back($3);
4150 c(pd).d.push_back($4);
4151 vector_command(c(pd), "x axis range", c(pd).d);
4152 }
4153 ;
4154
4155 y_axis_range
4156 : TOKYAXISRANGE TOKEQUAL TOKVALUE TOKVALUE
4157 {
4158 if($3 > $4)
4159 {
4160 yyerror(&yylloc, scanner, pd, "Error: y axis range argument <min> must be less than argument <max>.");
4161 YYABORT;
4162 }
4163 c(pd).d.clear();
4164 c(pd).d.push_back($3);
4165 c(pd).d.push_back($4);
4166 vector_command(c(pd), "y axis range", c(pd).d);
4167 }
4168 ;
4169
4170 x_axis_use_current_data_range
4171 : TOKXAXISUSECURRENTDATARANGE { no_argument_command(c(pd), "x axis use current data range"); }
4172 ;
4173
4174 y_axis_use_current_data_range
4175 : TOKYAXISUSECURRENTDATARANGE { no_argument_command(c(pd), "y axis use current data range"); }
4176 ;
4177
4178 x_axis_use_cumulative_data_range
4179 : TOKXAXISUSECUMULATIVEDATARANGE { no_argument_command(c(pd), "x axis use cumulative data range"); }
4180 ;
4181
4182 y_axis_use_cumulative_data_range
4183 : TOKYAXISUSECUMULATIVEDATARANGE { no_argument_command(c(pd), "y axis use cumulative data range"); }
4184 ;
4185
4186
4187 x_axis_minimum_range
4188 : TOKXAXISMINIMUMRANGE TOKEQUAL TOKVALUE TOKVALUE
4189 {
4190 if($3 > $4)
4191 {
4192 yyerror(&yylloc, scanner, pd, "Error: x axis minimum range argument <min> must be less than argument <max>.");
4193 YYABORT;
4194 }
4195 c(pd).d.clear();
4196 c(pd).d.push_back($3);
4197 c(pd).d.push_back($4);
4198 vector_command(c(pd), "x axis minimum range", c(pd).d);
4199 }
4200 ;
4201
4202 y_axis_minimum_range
4203 : TOKYAXISMINIMUMRANGE TOKEQUAL TOKVALUE TOKVALUE
4204 {
4205 if($3 > $4)
4206 {
4207 yyerror(&yylloc, scanner, pd, "Error: y axis minimum range argument <min> must be less than argument <max>.");
4208 YYABORT;
4209 }
4210 c(pd).d.clear();
4211 c(pd).d.push_back($3);
4212 c(pd).d.push_back($4);
4213 vector_command(c(pd), "y axis minimum range", c(pd).d);
4214 }
4215 ;
4216
4217 x_axis_maximum_range
4218 : TOKXAXISMAXIMUMRANGE TOKEQUAL TOKVALUE TOKVALUE
4219 {
4220 if($3 > $4)
4221 {
4222 yyerror(&yylloc, scanner, pd, "Error: x axis maximum range argument <min> must be less than argument <max>.");
4223 YYABORT;
4224 }
4225 c(pd).d.clear();
4226 c(pd).d.push_back($3);
4227 c(pd).d.push_back($4);
4228 vector_command(c(pd), "x axis maximum range", c(pd).d);
4229 }
4230 ;
4231
4232 y_axis_maximum_range
4233 : TOKYAXISMAXIMUMRANGE TOKEQUAL TOKVALUE TOKVALUE
4234 {
4235 if($3 > $4)
4236 {
4237 yyerror(&yylloc, scanner, pd, "Error: y axis maximum range argument <min> must be less than argument <max>.");
4238 YYABORT;
4239 }
4240 c(pd).d.clear();
4241 c(pd).d.push_back($3);
4242 c(pd).d.push_back($4);
4243 vector_command(c(pd), "y axis maximum range", c(pd).d);
4244 }
4245 ;
4246
4247 plot_base_name
4248 : TOKPLOTBASENAME TOKEQUAL TOKSTRING
4249 {
4250 std::string s($3);
4251 remove_quotes(s);
4252 identifier_command(c(pd), "plot basename", s);
4253 }
4254 ;
4255
4256 plot_base_directory
4257 : TOKPLOTBASEDIRECTORY TOKEQUAL TOKSTRING
4258 {
4259 std::string s($3);
4260 remove_quotes(s);
4261 identifier_command(c(pd), "plot basedirectory", s);
4262 }
4263 ;
4264
4265
4266 /* END SCATTER PLOT BLOCK */
4267
4268 /* START PLOT OVER TIME BLOCK */
4269
4270 plot_over_time_block
4271 : start_plot_over_time_block plot_over_time_statements plot_over_time_end
4272 {
4273 if(!check_plot_over_time_block(&yylloc, scanner, c(pd), c(pd).root["plot over time blocks"][c(pd).cbn]))
4274 YYABORT;
4275 c(pd).cb = TOKCATALYST;
4276 }
4277 ;
4278
4279 plot_over_time_end
4280 : TOKEND
4281 | TOKEND TOKPLOTOVERTIME
4282 ;
4283
4284 start_plot_over_time_block
4285 : TOKBEGIN TOKPLOTOVERTIME TOKIDENTIFIER
4286 {
4287 c(pd).cb = TOKPLOTOVERTIME;
4288 c(pd).cbn = $3;
4289 if(!initialize_block(&yylloc, scanner, c(pd)))
4290 YYABORT;
4291 }
4292 ;
4293
4294 plot_over_time_statements
4295 :
4296 | plot_over_time_statements plot_over_time_statement
4297 ;
4298
4299 plot_over_time_statement
4300 : operation
4301 | all_variables
4302 | variable_scalar
4303 | variable_vector_magnitude
4304 | variable_vector_component
4305 | variable_tensor_component
4306 | y_axis_range
4307 | y_axis_use_current_data_range
4308 | y_axis_use_cumulative_data_range
4309 | y_axis_minimum_range
4310 | y_axis_maximum_range
4311 | plot_minimum
4312 | plot_maximum
4313 | plot_mean
4314 | plot_id
4315 | plot_base_name
4316 | plot_base_directory
4317 | image_format
4318 | image_digit_count
4319 | image_size
4320 ;
4321
4322 plot_minimum
4323 : TOKPLOTMINIMUM TOKEQUAL boolean { boolean_command(c(pd), "plot minimum", $3 == 1); }
4324 ;
4325
4326 plot_maximum
4327 : TOKPLOTMAXIMUM TOKEQUAL boolean { boolean_command(c(pd), "plot maximum", $3 == 1); }
4328 ;
4329
4330 plot_mean
4331 : TOKPLOTMEAN TOKEQUAL boolean { boolean_command(c(pd), "plot mean", $3 == 1); }
4332 ;
4333
4334 plot_id
4335 : TOKPLOTID TOKEQUAL { c(pd).d.clear(); } plot_value_list
4336 {
4337 vector_command(c(pd), "plot id", c(pd).d);
4338 }
4339 ;
4340
4341 plot_value_list
4342 : plot_value_member
4343 | plot_value_list plot_value_member
4344 ;
4345
4346 plot_value_member
4347 : TOKVALUE
4348 {
4349 if( (std::floor($1) != $1) ||
4350 ($1 < 1) )
4351 {
4352 yyerror(&yylloc, scanner, pd, "Error: plot id <id> must be an integer greater than 0");
4353 YYABORT;
4354 }
4355 c(pd).d.push_back($1);
4356 }
4357 ;
4358
4359 /* END PLOT OVER TIME BLOCK */
4360
4361 /* START GROUP BLOCK */
4362
4363 group_block
4364 : start_group_block group_statement group_end
4365 {
4366 string_vector_command(c(pd), "operation group list", c(pd).s);
4367 c(pd).cb = TOKCATALYST;
4368 }
4369 ;
4370
4371 group_end
4372 : TOKEND
4373 | TOKEND TOKGROUP
4374 ;
4375
4376 start_group_block
4377 : TOKBEGIN TOKGROUP TOKIDENTIFIER
4378 {
4379 c(pd).cb = TOKGROUP;
4380 c(pd).cbn = $3;
4381 if(!initialize_block(&yylloc, scanner, c(pd)))
4382 YYABORT;
4383 }
4384 ;
4385
4386 group_statement
4387 : TOKOPERATIONGROUPLIST TOKEQUAL { c(pd).s.clear(); } group_id_list
4388 ;
4389
4390 group_id_list
4391 : group_id_member
4392 | group_id_list group_id_member
4393 ;
4394
4395 group_id_member
4396 : TOKIDENTIFIER { c(pd).s.push_back($1); }
4397 ;
4398
4399 /* END GROUP BLOCK */
4400
4401 /* BEGIN EXTRACT BLOCK */
4402
4403 extract_block
4404 : start_extract_block exclude_block_statement end_extract_block
4405 | start_extract_block include_block_statement end_extract_block
4406 {
4407 c(pd).cb = TOKCATALYST;
4408 }
4409 ;
4410
4411 end_extract_block
4412 : TOKEND
4413 | TOKEND TOKEXTRACTBLOCK
4414 ;
4415
4416 start_extract_block
4417 : TOKBEGIN TOKEXTRACTBLOCK TOKIDENTIFIER
4418 {
4419 c(pd).cb = TOKEXTRACTBLOCK;
4420 c(pd).cbn = $3;
4421 if(!initialize_block(&yylloc, scanner, c(pd)))
4422 YYABORT;
4423 }
4424 ;
4425
4426 exclude_block_statement
4427 : input exclude_block
4428 | exclude_block input
4429 | exclude_block
4430 ;
4431
4432 include_block_statement
4433 : input include_block
4434 | include_block input
4435 | include_block
4436 ;
4437
4438 exclude_block
4439 : TOKEXCLUDEBLOCKS TOKEQUAL { c(pd).s.clear(); } group_id_list
4440 {
4441 string_vector_command(c(pd), "exclude blocks", c(pd).s);
4442 }
4443 ;
4444
4445 include_block
4446 : TOKINCLUDEBLOCKS TOKEQUAL { c(pd).s.clear(); } group_id_list
4447 {
4448 string_vector_command(c(pd), "include blocks", c(pd).s);
4449 }
4450 ;
4451
4452 /* END EXTRACT BLOCK */
4453
4454 /* BEGIN TRANSFORM BLOCK */
4455
4456 transform_block
4457 : start_transform_block transform_block_statements end_transform_block
4458 {
4459 c(pd).cb = TOKCATALYST;
4460 }
4461 ;
4462
4463 end_transform_block
4464 : TOKEND
4465 | TOKEND TOKTRANSFORM
4466 ;
4467
4468 start_transform_block
4469 : TOKBEGIN TOKTRANSFORM TOKIDENTIFIER
4470 {
4471 c(pd).cb = TOKTRANSFORM;
4472 c(pd).cbn = $3;
4473 if(!initialize_block(&yylloc, scanner, c(pd)))
4474 YYABORT;
4475 }
4476 ;
4477
4478 transform_block_statements
4479 :
4480 | transform_block_statement transform_block_statements
4481 ;
4482
4483 transform_block_statement
4484 : input
4485 | rotate
4486 | scale
4487 | translate
4488 ;
4489
4490 rotate
4491 : TOKROTATE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4492 {
4493 c(pd).d.clear();
4494 c(pd).d.push_back($3);
4495 c(pd).d.push_back($4);
4496 c(pd).d.push_back($5);
4497 vector_command(c(pd), "rotate", c(pd).d);
4498 }
4499 ;
4500
4501 scale
4502 : TOKSCALE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4503 {
4504 c(pd).d.clear();
4505 c(pd).d.push_back($3);
4506 c(pd).d.push_back($4);
4507 c(pd).d.push_back($5);
4508 vector_command(c(pd), "scale", c(pd).d);
4509 }
4510 ;
4511
4512 translate
4513 : TOKTRANSLATE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4514 {
4515 c(pd).d.clear();
4516 c(pd).d.push_back($3);
4517 c(pd).d.push_back($4);
4518 c(pd).d.push_back($5);
4519 vector_command(c(pd), "translate", c(pd).d);
4520 }
4521 ;
4522
4523 /* END TRANSFORM BLOCK */
4524
4525 /* BEGIN WARP BY VECTOR */
4526
4527 warp_by_vector
4528 : start_warp_by_vector warp_by_vector_statements end_warp_by_vector
4529 {
4530 c(pd).cb = TOKCATALYST;
4531 }
4532 ;
4533
4534 end_warp_by_vector
4535 : TOKEND
4536 | TOKEND TOKWARPBYVECTOR
4537 ;
4538
4539 start_warp_by_vector
4540 : TOKBEGIN TOKWARPBYVECTOR TOKIDENTIFIER
4541 {
4542 c(pd).cb = TOKWARPBYVECTOR;
4543 c(pd).cbn = $3;
4544 if(!initialize_block(&yylloc, scanner, c(pd)))
4545 YYABORT;
4546 }
4547 ;
4548
4549 warp_by_vector_statements
4550 :
4551 | warp_by_vector_statement warp_by_vector_statements
4552 ;
4553
4554 warp_by_vector_statement
4555 : input
4556 | warp_scale
4557 | warp_variable_vector
4558 ;
4559
4560 warp_scale
4561 : TOKSCALE TOKEQUAL TOKVALUE
4562 {
4563 double_command(c(pd), "scale", $3);
4564 }
4565 ;
4566
4567 warp_variable_vector
4568 : TOKVARIABLEVECTOR TOKEQUAL TOKIDENTIFIER
4569 {
4570 if(!check_variable_name(&yylloc, scanner, c(pd), $3, Iovs::PhactoriParserInterface::VECTOR))
4571 YYABORT;
4572 identifier_command(c(pd), "variable vector", $3);
4573 }
4574 ;
4575
4576 /* END WARP BY VECTOR */
4577
4578 /* START CALCULATOR */
4579
4580 calculator
4581 : start_calculator calculator_statements end_calculator
4582 {
4583 if(!check_calculator_block(&yylloc, scanner, c(pd), c(pd).root["operation blocks"][c(pd).cbn]))
4584 YYABORT;
4585 c(pd).cb = TOKCATALYST;
4586 }
4587 ;
4588
4589 end_calculator
4590 : TOKEND
4591 | TOKEND TOKCALCULATOR
4592 ;
4593
4594 start_calculator
4595 : TOKBEGIN TOKCALCULATOR TOKIDENTIFIER
4596 {
4597 c(pd).cb = TOKCALCULATOR;
4598 c(pd).cbn = $3;
4599 if(!initialize_block(&yylloc, scanner, c(pd)))
4600 YYABORT;
4601 }
4602 ;
4603
4604 calculator_statements
4605 :
4606 | calculator_statement calculator_statements
4607 ;
4608
4609 calculator_statement
4610 : input
4611 | output_variable_name
4612 | function
4613 | element_or_node_data
4614 ;
4615
4616 output_variable_name
4617 : TOKOUTPUTVARIABLENAME TOKEQUAL TOKIDENTIFIER
4618 {
4619 std::string s = $3;
4620 /* if (s.find("sctlyst") != 0)
4621 {
4622 yyerror(&yylloc, scanner, pd, "Error: calculator output variable name must begin with sctlyst");
4623 YYABORT;
4624 }*/
4625 identifier_command(c(pd), "output variable name", $3);
4626 }
4627 ;
4628
4629 function
4630 : TOKFUNCTION TOKEQUAL { c(pd).s.clear(); } TOKSTRING
4631 {
4632 std::string s($4);
4633 remove_quotes(s);
4634 c(pd).s.push_back(s);
4635 string_vector_command(c(pd), "function", c(pd).s);
4636 }
4637 ;
4638
4639 element_or_node_data_flag
4640 : TOKELEMENT
4641 | TOKNODE
4642 ;
4643
4644 element_or_node_data
4645 : TOKELEMENTORNODEDATA TOKEQUAL element_or_node_data_flag
4646 {
4647 std::string s($3);
4648 remove_quotes(s);
4649 identifier_command(c(pd), "element or node data", $3);
4650 }
4651 ;
4652
4653 /* END CALCULATOR */
4654
4655 /* START EXPERIMENTAL OPERATION */
4656
4657 experimental_operation
4658 : start_experimental_operation experimental_operation_statements end_experimental_operation
4659 {
4660 c(pd).cb = TOKCATALYST;
4661 }
4662 ;
4663
4664 end_experimental_operation
4665 : TOKEND
4666 | TOKEND TOKEXPERIMENTALOPERATION
4667 ;
4668
4669 start_experimental_operation
4670 : TOKBEGIN TOKEXPERIMENTALOPERATION TOKIDENTIFIER
4671 {
4672 c(pd).cb = TOKEXPERIMENTALOPERATION;
4673 c(pd).cbn = $3;
4674 if(!initialize_block(&yylloc, scanner, c(pd)))
4675 YYABORT;
4676 }
4677 ;
4678
4679 experimental_operation_statements
4680 :
4681 | experimental_operation_statement experimental_operation_statements
4682 ;
4683
4684 experimental_operation_statement
4685 : input
4686 | type
4687 | scalar_opparam
4688 | vector_opparam
4689 | integer_opparam
4690 | string_opparam
4691 ;
4692
4693 type
4694 : TOKTYPE TOKEQUAL TOKIDENTIFIER
4695 {
4696 identifier_command(c(pd), "type", $3);
4697 }
4698 ;
4699
4700 scalar_opparam
4701 : TOKSCALAROPPARAM TOKEQUAL TOKIDENTIFIER TOKVALUE
4702 {
4703 double_command(c(pd), $3, $4);
4704 }
4705 ;
4706
4707 vector_opparam
4708 : TOKVECTOROPPARAM TOKEQUAL TOKIDENTIFIER TOKVALUE TOKVALUE TOKVALUE
4709 {
4710 c(pd).d.clear();
4711 c(pd).d.push_back($4);
4712 c(pd).d.push_back($5);
4713 c(pd).d.push_back($6);
4714 vector_command(c(pd), $3, c(pd).d);
4715 }
4716 ;
4717
4718 integer_opparam
4719 : TOKINTEGEROPPARAM TOKEQUAL TOKIDENTIFIER TOKVALUE
4720 {
4721 if( std::floor($4) != $4 )
4722 {
4723 yyerror(&yylloc, scanner, pd, "Error: integer opparam must be an integer");
4724 YYABORT;
4725 }
4726 std::string s($3);
4727 remove_quotes(s);
4728 integer_command(c(pd), $3, (int) $4);
4729 }
4730 ;
4731
4732 string_opparam
4733 : TOKSTRINGOPPARAM TOKEQUAL TOKIDENTIFIER TOKSTRING
4734 {
4735 std::string s($4);
4736 remove_quotes(s);
4737 identifier_command(c(pd), $3, s);
4738 }
4739 ;
4740
4741 /* END EXPERIMENTAL OPERATION */
4742
4743 /* START VISUAL MARKER */
4744
4745 visual_marker_block
4746 : start_visual_marker_block visual_marker_block_statements end_visual_marker_block
4747 {
4748 c(pd).cb = TOKCATALYST;
4749 }
4750 ;
4751
4752 end_visual_marker_block
4753 : TOKEND
4754 | TOKEND TOKVISUALMARKER
4755 ;
4756
4757 start_visual_marker_block
4758 : TOKBEGIN TOKVISUALMARKER TOKIDENTIFIER
4759 {
4760 c(pd).cb = TOKVISUALMARKER;
4761 c(pd).cbn = $3;
4762 if(!initialize_block(&yylloc, scanner, c(pd)))
4763 YYABORT;
4764 }
4765 ;
4766
4767 visual_marker_block_statements
4768 :
4769 | visual_marker_block_statement visual_marker_block_statements
4770 ;
4771
4772 visual_marker_block_statement
4773 : input
4774 | type
4775 | shape
4776 | color
4777 | absolute_size
4778 | relative_size
4779 | orientation
4780 | resolution
4781 | marker_at_relative_point
4782 | marker_at_absolute_point
4783 | marker_at_node
4784 | marker_at_element
4785 | marker_at_data_point
4786 | vector_parameter
4787 | scalar_parameter
4788 | integer_parameter
4789 | string_parameter
4790 ;
4791
4792 shape
4793 : TOKSHAPE TOKEQUAL TOKIDENTIFIER
4794 {
4795 identifier_command(c(pd), "shape", $3);
4796 }
4797 ;
4798
4799 color
4800 : TOKCOLOR TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4801 {
4802 if($3 < 0 || $3 > 1 ||
4803 $4 < 0 || $4 > 1 ||
4804 $5 < 0 || $5 > 1)
4805 {
4806 yyerror(&yylloc, scanner, pd, "Error: color <color> arguments must be between 0 and 1, inclusive.");
4807 YYABORT;
4808 }
4809 c(pd).d.clear();
4810 c(pd).d.push_back($3);
4811 c(pd).d.push_back($4);
4812 c(pd).d.push_back($5);
4813 vector_command(c(pd), "color", c(pd).d);
4814 }
4815 ;
4816
4817 absolute_size
4818 : TOKABSOLUTESIZE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4819 {
4820 c(pd).d.clear();
4821 c(pd).d.push_back($3);
4822 c(pd).d.push_back($4);
4823 c(pd).d.push_back($5);
4824 vector_command(c(pd), "absolute size", c(pd).d);
4825 }
4826 ;
4827
4828 relative_size
4829 : TOKRELATIVESIZE TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4830 {
4831 c(pd).d.clear();
4832 c(pd).d.push_back($3);
4833 c(pd).d.push_back($4);
4834 c(pd).d.push_back($5);
4835 vector_command(c(pd), "relative size", c(pd).d);
4836 }
4837 ;
4838
4839 orientation
4840 : TOKORIENTATION TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4841 {
4842 c(pd).d.clear();
4843 c(pd).d.push_back($3);
4844 c(pd).d.push_back($4);
4845 c(pd).d.push_back($5);
4846 vector_command(c(pd), "orientation", c(pd).d);
4847 }
4848 ;
4849
4850 resolution
4851 : TOKRESOLUTION TOKEQUAL TOKVALUE
4852 {
4853 if( ( std::floor($3) != $3 ) ||
4854 ( $3 < 4) )
4855 {
4856 yyerror(&yylloc, scanner, pd, "Error: resolution must be an integer greater than or equal to 4");
4857 YYABORT;
4858 }
4859 integer_command(c(pd), "resolution", (int) $3);
4860 }
4861 ;
4862
4863 marker_at_relative_point
4864 : TOKMARKERATRELATIVEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4865 {
4866 c(pd).d.clear();
4867 c(pd).d.push_back($3);
4868 c(pd).d.push_back($4);
4869 c(pd).d.push_back($5);
4870 vector_command(c(pd), "marker at relative point", c(pd).d);
4871 }
4872 ;
4873
4874 marker_at_absolute_point
4875 : TOKMARKERATABSOLUTEPOINT TOKEQUAL TOKVALUE TOKVALUE TOKVALUE
4876 {
4877 c(pd).d.clear();
4878 c(pd).d.push_back($3);
4879 c(pd).d.push_back($4);
4880 c(pd).d.push_back($5);
4881 vector_command(c(pd), "marker at absolute point", c(pd).d);
4882 }
4883 ;
4884
4885 marker_at_element
4886 : TOKMARKERATELEMENT TOKEQUAL TOKVALUE
4887 {
4888 if( (std::floor($3) != $3) ||
4889 ($3 < 1) )
4890 {
4891 yyerror(&yylloc, scanner, pd, "Error: marker at element <id> must be an integer greater than 0");
4892 YYABORT;
4893 }
4894 check_nodeID(&yylloc, scanner, c(pd), (int) $3);
4895 integer_command(c(pd), "marker at element", (int) $3);
4896 }
4897 ;
4898
4899 marker_at_node
4900 : TOKMARKERATNODE TOKEQUAL TOKVALUE
4901 {
4902 if( (std::floor($3) != $3) ||
4903 ($3 < 1) )
4904 {
4905 yyerror(&yylloc, scanner, pd, "Error: marker at node <id> must be an integer greater than 0");
4906 YYABORT;
4907 }
4908 check_nodeID(&yylloc, scanner, c(pd), (int) $3);
4909 integer_command(c(pd), "marker at node", (int) $3);
4910 }
4911 ;
4912
4913 min_max_center
4914 : TOKMIN
4915 | TOKMAX
4916 | TOKCENTER
4917 ;
4918
4919 variable_type
4920 : TOKSCALAR
4921 | TOKVECTORCOMPONENT
4922 | TOKVECTORMAGNITUDE
4923 | TOKTENSORCOMPONENT
4924 | TOKNONE
4925 ;
4926
4927 marker_at_data_point
4928 : TOKMARKERATDATAPOINT TOKEQUAL min_max_center variable_type TOKIDENTIFIER TOKIDENTIFIER
4929 {
4930 data_point_command(c(pd), "marker at data point", $3, $4, $5, $6);
4931 }
4932 ;
4933
4934 vector_parameter
4935 : TOKVECTORPARAMETER TOKEQUAL TOKIDENTIFIER TOKVALUE TOKVALUE TOKVALUE
4936 {
4937 c(pd).d.clear();
4938 c(pd).d.push_back($4);
4939 c(pd).d.push_back($5);
4940 c(pd).d.push_back($6);
4941 vector_command(c(pd), $3, c(pd).d);
4942 }
4943 ;
4944
4945 scalar_parameter
4946 : TOKSCALARPARAMETER TOKEQUAL TOKIDENTIFIER TOKVALUE
4947 {
4948 double_command(c(pd), $3, $4);
4949 }
4950 ;
4951
4952 integer_parameter
4953 : TOKINTEGERPARAMETER TOKEQUAL TOKIDENTIFIER TOKVALUE
4954 {
4955 if( std::floor($4) != $4 )
4956 {
4957 yyerror(&yylloc, scanner, pd, "Error: integer parameter must be an integer");
4958 YYABORT;
4959 }
4960 integer_command(c(pd), $3, (int) $4);
4961 }
4962 ;
4963
4964 string_parameter
4965 : TOKSTRINGPARAMETER TOKEQUAL TOKIDENTIFIER TOKSTRING
4966 {
4967 std::string s($4);
4968 remove_quotes(s);
4969 identifier_command(c(pd), $3, s);
4970 }
4971 ;
4972
4973 /* END VISUAL MARKER */
4974
4975 /* START EXPERIMENTAL BLOCK */
4976
4977 experimental_block
4978 : start_experimental_block experimental_block_statements end_experimental_block
4979 {
4980 c(pd).cb = TOKCATALYST;
4981 }
4982 ;
4983
4984 end_experimental_block
4985 : TOKEND
4986 | TOKEND TOKEXPERIMENTALBLOCK
4987 ;
4988
4989 start_experimental_block
4990 : TOKBEGIN TOKEXPERIMENTALBLOCK TOKIDENTIFIER
4991 {
4992 c(pd).cb = TOKEXPERIMENTALBLOCK;
4993 c(pd).cbn = $3;
4994 if(!initialize_block(&yylloc, scanner, c(pd)))
4995 YYABORT;
4996 }
4997 ;
4998
4999 experimental_block_statements
5000 :
5001 | experimental_block_statement experimental_block_statements
5002 ;
5003
5004 experimental_block_statement
5005 : input
5006 | type
5007 | scalar_parameter
5008 | vector_parameter
5009 | integer_parameter
5010 | string_parameter
5011 ;
5012
5013 /* END EXPERIMENTAL BLOCK */
5014
5015 /* START ON OFF CRITERIA BLOCK */
5016
5017 on_off_criteria_block
5018 : start_on_off_criteria_block on_off_criteria_block_statements end_on_off_criteria_block
5019 {
5020 c(pd).cb = TOKCATALYST;
5021 }
5022 ;
5023
5024 end_on_off_criteria_block
5025 : TOKEND
5026 | TOKEND TOKONOFFCRITERIABLOCK
5027 ;
5028
5029 start_on_off_criteria_block
5030 : TOKBEGIN TOKONOFFCRITERIABLOCK TOKIDENTIFIER
5031 {
5032 c(pd).cb = TOKONOFFCRITERIABLOCK;
5033 c(pd).cbn = $3;
5034 if(!initialize_block(&yylloc, scanner, c(pd)))
5035 YYABORT;
5036 }
5037 ;
5038
5039 on_off_criteria_block_statements
5040 :
5041 | on_off_criteria_block_statement on_off_criteria_block_statements
5042 ;
5043
5044 on_off_criteria_block_statement
5045 : input
5046 | criteria_type
5047 | experimental_type
5048 | threshold_variable_function
5049 | threshold_values
5050 | variable_scalar
5051 | variable_vector_magnitude
5052 | variable_vector_component
5053 | variable_tensor_component
5054 | frames_after_trigger
5055 | maximum_trigger_per_threshold
5056 | scalar_parameter
5057 | vector_parameter
5058 | integer_parameter
5059 | string_parameter
5060 ;
5061
5062 on_off_type
5063 : TOKTRIGGERTHRESHOLDS
5064 | TOKEXPERIMENTAL
5065 ;
5066
5067 criteria_type
5068 : TOKTYPE TOKEQUAL on_off_type
5069 {
5070 identifier_command(c(pd), "type", $3);
5071 }
5072 ;
5073
5074 experimental_type
5075 : TOKEXPERIMENTALTYPE TOKEQUAL TOKIDENTIFIER
5076 {
5077 identifier_command(c(pd), "experimental type", $3);
5078 }
5079 ;
5080
5081 threshold_variable
5082 : TOKMINIMUM
5083 | TOKMAXIMUM
5084 | TOKMEAN
5085 | TOKSUM
5086 | TOKCOUNT
5087 ;
5088
5089 threshold_variable_function
5090 : TOKTHRESHOLDVARIABLEFUNCTION TOKEQUAL threshold_variable
5091 {
5092 identifier_command(c(pd), "threshold variable function", $3);
5093 }
5094 ;
5095
5096 threshold_values
5097 : TOKTHRESHOLDVALUES TOKEQUAL { c(pd).d.clear(); } threshold_value_list
5098 {
5099 vector_command(c(pd), "threshold values", c(pd).d);
5100 }
5101 ;
5102
5103 threshold_value_list
5104 : threshold_value_member
5105 | threshold_value_list threshold_value_member
5106 ;
5107
5108 threshold_value_member
5109 : TOKVALUE
5110 {
5111 c(pd).d.push_back($1);
5112 }
5113 ;
5114
5115 frames_after_trigger
5116 : TOKFRAMESAFTERTRIGGER TOKEQUAL TOKVALUE
5117 {
5118 if( (std::floor($3) != $3) )
5119 {
5120 yyerror(&yylloc, scanner, pd, "Error: frames after trigger <frames> must be an integer");
5121 YYABORT;
5122 }
5123 integer_command(c(pd), "frames after trigger", (int) $3);
5124 }
5125 ;
5126
5127 maximum_trigger_per_threshold
5128 : TOKMAXIMUMTRIGGERSPERTHRESHOLD TOKEQUAL TOKVALUE
5129 {
5130 if( (std::floor($3) != $3) )
5131 {
5132 yyerror(&yylloc, scanner, pd, "Error: maximum triggers per threshold <triggers> must be an integer");
5133 YYABORT;
5134 }
5135 integer_command(c(pd), "maximum triggers per threshold", (int) $3);
5136 }
5137 ;
5138
5139 /* END ON OFF CRITERIA BLOCK */
5140
5141 %%