diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc index e3cada7227..d16ba7de6c 100644 --- a/src/libcode/vx_shapedata/engine.cc +++ b/src/libcode/vx_shapedata/engine.cc @@ -1033,21 +1033,32 @@ void ModeFuzzyEngine::do_matching() { void ModeFuzzyEngine::do_no_match() { int j, k, n; - ShapeData cur_shape; + ShapeData * fcst_shape = (ShapeData *) 0; + ShapeData * obs_shape = (ShapeData *) 0; do_fcst_splitting(); do_obs_splitting(); clear_colors(); + fcst_shape = new ShapeData [n_fcst]; + obs_shape = new ShapeData [n_obs]; + + if(!fcst_shape || !obs_shape) { + + mlog << Error << "\nModeFuzzyEngine::do_no_match() -> " + << "memory allocation error\n\n"; + exit(1); + } + // // Do the single features // fcst_single.set_size(n_fcst); for(j=0; jvar_info->is_precipitation()); fcst_single[j].object_number = j+1; @@ -1056,8 +1067,8 @@ void ModeFuzzyEngine::do_no_match() { obs_single.set_size(n_obs); for(j=0; jvar_info->is_precipitation()); obs_single[j].object_number = j+1; @@ -1101,6 +1112,9 @@ void ModeFuzzyEngine::do_no_match() { // Done // + delete [] fcst_shape; fcst_shape = (ShapeData *) 0; + delete [] obs_shape; obs_shape = (ShapeData *) 0; + return; } @@ -1109,21 +1123,32 @@ void ModeFuzzyEngine::do_no_match() { void ModeFuzzyEngine::do_match_merge() { int j, k, n; InterestInfo junkinfo; - ShapeData cur_shape; + ShapeData * fcst_shape = (ShapeData *) 0; + ShapeData * obs_shape = (ShapeData *) 0; do_fcst_splitting(); do_obs_splitting(); clear_colors(); + fcst_shape = new ShapeData [n_fcst]; + obs_shape = new ShapeData [n_obs]; + + if(!fcst_shape || !obs_shape) { + + mlog << Error << "\nModeFuzzyEngine::do_match_merge() -> " + << "memory allocation error\n\n"; + exit(1); + } + // // Do the single features // fcst_single.set_size(n_fcst); for(j=0; jvar_info->is_precipitation()); fcst_single[j].object_number = j+1; @@ -1132,8 +1157,8 @@ void ModeFuzzyEngine::do_match_merge() { obs_single.set_size(n_obs); for(j=0; jvar_info->is_precipitation()); obs_single[j].object_number = j+1; @@ -1252,6 +1277,9 @@ void ModeFuzzyEngine::do_match_merge() { // Done // + delete [] fcst_shape; fcst_shape = (ShapeData *) 0; + delete [] obs_shape; obs_shape = (ShapeData *) 0; + return; } @@ -1268,8 +1296,6 @@ void ModeFuzzyEngine::do_fcst_merge_thresh() { int n_fcst_merge, intersection; int count, first_k; ShapeData fcst_merge_mask, fcst_merge_split; - - // JHG, can this be fixed? ShapeData * fcst_shape = (ShapeData *) 0; ShapeData * fcst_merge_shape = (ShapeData *) 0; @@ -1393,7 +1419,6 @@ void ModeFuzzyEngine::do_obs_merge_thresh() { int n_obs_merge, intersection; int count, first_k; ShapeData obs_merge_mask, obs_merge_split; - // JHG can this be fixed? ShapeData * obs_shape = (ShapeData *) 0; ShapeData * obs_merge_shape = (ShapeData *) 0; @@ -1503,7 +1528,6 @@ void ModeFuzzyEngine::do_obs_merge_thresh() { return; } -/////////////////////////////////////////////////////////////////////// void ModeFuzzyEngine::do_fcst_merge_thresh(const ShapeData &merge_data) { int j, k, x, y; @@ -1511,7 +1535,6 @@ void ModeFuzzyEngine::do_fcst_merge_thresh(const ShapeData &merge_data) { int count, first_k; //ShapeData fcst_merge_mask; ShapeData fcst_merge_split; - // JHG can this be fixed? ShapeData * fcst_shape = (ShapeData *) 0; ShapeData * fcst_merge_shape = (ShapeData *) 0; @@ -1626,15 +1649,12 @@ void ModeFuzzyEngine::do_fcst_merge_thresh(const ShapeData &merge_data) { return; } -/////////////////////////////////////////////////////////////////////// - void ModeFuzzyEngine::do_obs_merge_thresh(const ShapeData &merge_data) { int j, k, x, y; int n_obs_merge, intersection; int count, first_k; //ShapeData obs_merge_mask; ShapeData obs_merge_split; - // JHG can this be fixed? ShapeData * obs_shape = (ShapeData *) 0; ShapeData * obs_merge_shape = (ShapeData *) 0; @@ -2094,21 +2114,31 @@ void ModeFuzzyEngine::do_obs_merge_engine(const char *default_config, void ModeFuzzyEngine::do_match_fcst_merge() { int j, k, n; InterestInfo junkinfo; - ShapeData cur_shape; + ShapeData * fcst_shape = (ShapeData *) 0; + ShapeData * obs_shape = (ShapeData *) 0; do_fcst_splitting(); do_obs_splitting(); clear_colors(); + fcst_shape = new ShapeData [n_fcst]; + obs_shape = new ShapeData [n_obs]; + + if(!fcst_shape || !obs_shape) { + mlog << Error << "\nModeFuzzyEngine::do_match_fcst_merge() -> " + << "memory allocation error\n\n"; + exit(1); + } + // // Do the single features // fcst_single.set_size(n_fcst); for(j=0; jvar_info->is_precipitation()); fcst_single[j].object_number = j+1; @@ -2117,8 +2147,8 @@ void ModeFuzzyEngine::do_match_fcst_merge() { obs_single.set_size(n_obs); for(j=0; jvar_info->is_precipitation()); obs_single[j].object_number = j+1; @@ -2245,6 +2275,9 @@ void ModeFuzzyEngine::do_match_fcst_merge() { // Done // + delete [] fcst_shape; fcst_shape = (ShapeData *) 0; + delete [] obs_shape; obs_shape = (ShapeData *) 0; + return; } @@ -2258,21 +2291,31 @@ void ModeFuzzyEngine::do_match_fcst_merge() { void ModeFuzzyEngine::do_match_only() { int j, k, n; InterestInfo junkinfo; - ShapeData cur_shape; + ShapeData * fcst_shape = (ShapeData *) 0; + ShapeData * obs_shape = (ShapeData *) 0; do_fcst_splitting(); do_obs_splitting(); clear_colors(); + fcst_shape = new ShapeData [n_fcst]; + obs_shape = new ShapeData [n_obs]; + + if(!fcst_shape || !obs_shape) { + mlog << Error << "\nModeFuzzyEngine::do_match_only() -> " + << "memory allocation error\n\n"; + exit(1); + } + // // Do the single features // fcst_single.set_size(n_fcst); for(j=0; jvar_info->is_precipitation()); fcst_single[j].object_number = j+1; @@ -2281,8 +2324,8 @@ void ModeFuzzyEngine::do_match_only() { obs_single.set_size(n_obs); for(j=0; jvar_info->is_precipitation()); obs_single[j].object_number = j+1; @@ -2403,6 +2446,9 @@ void ModeFuzzyEngine::do_match_only() { // Done // + delete [] fcst_shape; fcst_shape = (ShapeData *) 0; + delete [] obs_shape; obs_shape = (ShapeData *) 0; + return; } @@ -2491,7 +2537,8 @@ void ModeFuzzyEngine::do_obs_clus_splitting() { void ModeFuzzyEngine::do_cluster_features() { int j; - ShapeData cur_shape; + ShapeData * fcst_clus_shape = (ShapeData *) 0; + ShapeData * obs_clus_shape = (ShapeData *) 0; if(need_fcst_clus_split) do_fcst_clus_splitting(); if(need_obs_clus_split) do_obs_clus_splitting(); @@ -2501,6 +2548,16 @@ void ModeFuzzyEngine::do_cluster_features() { // n_clus = collection.n_sets; + fcst_clus_shape = new ShapeData [n_clus]; + obs_clus_shape = new ShapeData [n_clus]; + + if(!fcst_clus_shape || !obs_clus_shape) { + + mlog << Error << "\nModeFuzzyEngine::do_cluster_features() -> " + << "memory allocation error\n\n"; + exit(1); + } + // // Do the single features for clusters // @@ -2508,14 +2565,14 @@ void ModeFuzzyEngine::do_cluster_features() { obs_cluster.set_size(n_clus); for(j=0; jvar_info->is_precipitation()); fcst_cluster[j].object_number = j+1; - cur_shape = select(*obs_clus_split, j+1); - obs_cluster[j].set(*obs_raw, *obs_thresh, cur_shape, + obs_clus_shape[j] = select(*obs_clus_split, j+1); + obs_cluster[j].set(*obs_raw, *obs_thresh, obs_clus_shape[j], conf_info.inten_perc_value, conf_info.Obs->var_info->is_precipitation()); obs_cluster[j].object_number = j+1; @@ -2550,6 +2607,9 @@ void ModeFuzzyEngine::do_cluster_features() { // Done // + delete [] fcst_clus_shape; fcst_clus_shape = (ShapeData *) 0; + delete [] obs_clus_shape; obs_clus_shape = (ShapeData *) 0; + return; }