-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature 2708 mvmode merge flag default #2713
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d612a3b
mods to use the multivar mode default config (when in multivar mode),…
davidalbo 9bb3cc0
added more meaningful error and debug messages
davidalbo 46d9b5a
Modified documentation to better describe multivariate mode including…
davidalbo db9ca5b
Bug fix for unit test
davidalbo aafb2f0
cleanup and fix a bug in which the default output path was not set in…
davidalbo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ | |||||
|
||||||
//////////////////////////////////////////////////////////////////////// | ||||||
|
||||||
#include <string.h> | ||||||
|
||||||
#include "vx_config.h" | ||||||
#include "vx_data2d.h" | ||||||
|
@@ -20,6 +21,7 @@ | |||||
|
||||||
#include "mode_field_info.h" | ||||||
|
||||||
using std::string; | ||||||
|
||||||
//////////////////////////////////////////////////////////////////////// | ||||||
|
||||||
|
@@ -219,32 +221,87 @@ if ( dict->lookup(conf_key_conv_thresh) ) { | |||||
|
||||||
} | ||||||
|
||||||
if ( dict->lookup(conf_key_merge_thresh) ) { | ||||||
|
||||||
merge_thresh_array = dict->lookup_thresh_array(conf_key_merge_thresh); | ||||||
|
||||||
} | ||||||
|
||||||
if ( dict->lookup(conf_key_vld_thresh) ) { | ||||||
|
||||||
vld_thresh = dict->lookup_double(conf_key_vld_thresh); | ||||||
|
||||||
} | ||||||
|
||||||
// for the multivar case, go without parent, and error out if merge flag is | ||||||
// not set for the individual field | ||||||
// For the multivar case, more complex logic regarding merge_flag and merge_thresh | ||||||
// If individual entry has a merge_flag, it must have a merge_thresh (unless merge_flag=NONE) | ||||||
// If individual entry has no merge_flag, check the parent and go with that flag and thresh | ||||||
// If individual entry has no merge_flag, but individual entry has a merge_thresh, it's an error | ||||||
|
||||||
if ( _multivar ) { | ||||||
// set defaults to no merging | ||||||
merge_thresh.clear(); | ||||||
merge_flag = MergeType_None; | ||||||
|
||||||
// pull out the name | ||||||
string name = var_info->name(); | ||||||
|
||||||
if ( dict->lookup(conf_key_merge_flag, false)) { | ||||||
merge_flag = int_to_mergetype(dict->lookup_int(conf_key_merge_flag)); | ||||||
// this individual entry has merge_flag | ||||||
merge_flag = int_to_mergetype(dict->lookup_int(conf_key_merge_flag, | ||||||
default_dictionary_error_out, | ||||||
default_dictionary_print_warning, | ||||||
false)); | ||||||
string merge_name = mergetype_to_string(merge_flag); | ||||||
if (dict->lookup(conf_key_merge_thresh, false)) { | ||||||
// the individual entry also has a merge_thresh, this is good | ||||||
merge_thresh_array = dict->lookup_thresh_array(conf_key_merge_thresh, | ||||||
default_dictionary_error_out, | ||||||
default_dictionary_print_warning, | ||||||
false); | ||||||
} else { | ||||||
// get the parent's merge_thresh, just to have something. Error out if the merge_flag is not none | ||||||
// becAuse that is inconsistent | ||||||
merge_thresh_array = dict->lookup_thresh_array(conf_key_merge_thresh); | ||||||
|
||||||
if (merge_flag != MergeType_None) { | ||||||
mlog << Error << "\nMode_Field_Info::set() -> " | ||||||
<< "Field:" << name << ". " | ||||||
<< " When 'merge_flag' is explicitly set, 'merge_thresh' must be explicitly set for multivariate mode\n\n"; | ||||||
exit ( 1 ); | ||||||
} | ||||||
|
||||||
} | ||||||
} else { | ||||||
mlog << Error << "\nMode_Field_Info::set() -> " | ||||||
<< "'merge_flag' must be explicitly set for all fields with multivariate mode\n\n"; | ||||||
exit ( 1 ); | ||||||
// individual entry does not have a merge_flag, try parent | ||||||
if ( dict->lookup(conf_key_merge_flag, true)) { | ||||||
// the parent does have a merge flag | ||||||
merge_flag = int_to_mergetype(dict->lookup_int(conf_key_merge_flag)); | ||||||
string merge_name = mergetype_to_string(merge_flag); | ||||||
if (dict->lookup(conf_key_merge_thresh, false)) { | ||||||
// individual entry has a merge_thresh but no merge_flag, this is not good | ||||||
mlog << Error << "\nMode_Field_Info::set() -> " | ||||||
<< "Field:" << name << ". " | ||||||
<< "When 'merge_flag' is not explicitly set, 'merge_thresh' cannot explicitly set for multivariate mode\n\n"; | ||||||
exit ( 1 ); | ||||||
} else { | ||||||
// individual entry doesn't have a merge_thresh, parent has a merge_flag | ||||||
// expect parent to have a merge_thresh | ||||||
merge_thresh_array = dict->lookup_thresh_array(conf_key_merge_thresh); | ||||||
if (merge_thresh_array.n() == 0 && merge_flag != MergeType_None) { | ||||||
// parent has a merge_flag but no merge_thresh | ||||||
mlog << Error << "\nMode_Field_Info::set() -> " | ||||||
<< "Field:" << name << ". using parent merge_flag: " << merge_name | ||||||
<< " Parent has no 'merge_thresh', not allowed in multivariate mode\n\n"; | ||||||
exit ( 1 ); | ||||||
} else { | ||||||
string thresh_str = merge_thresh_array.thresh()->get_str(); | ||||||
mlog << Debug(2) << "Field:" << name << ". Using parent merge_flag: " | ||||||
<< merge_name << " and parent merge_thresh:" << thresh_str | ||||||
<< "\n"; | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
} else { | ||||||
} else { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Minor point. Just aligning braces. |
||||||
if ( dict->lookup(conf_key_merge_flag, true)) { | ||||||
merge_flag = int_to_mergetype(dict->lookup_int(conf_key_merge_flag)); | ||||||
} | ||||||
merge_thresh_array = dict->lookup_thresh_array(conf_key_merge_thresh); | ||||||
} | ||||||
|
||||||
filter_attr_map = parse_conf_filter_attr_map(dict); | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.