Skip to content

Commit fe000ea

Browse files
committed
command line option --ss_locs
simply reads the input files, generates the subset locations and exits before the analysis is run
1 parent 3690621 commit fe000ea

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

src/core/DICe_Main.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,32 @@ int main(int argc, char *argv[]) {
170170
// let the schema know how many images there are in the sequence and the first frame id:
171171
schema->set_frame_range(first_frame_id,num_frames);
172172

173+
if(input_params->get<bool>(DICe::print_subset_locations_and_exit,false)){
174+
// write out the subset locations for left camera and exit
175+
Teuchos::RCP<MultiField> coords = schema->mesh()->get_field(DICe::mesh::field_enums::INITIAL_COORDINATES_FS);
176+
const int_t ss_locs_size = proc_rank==0 ?
177+
coords->get_map()->get_num_global_elements() : 0; // both x and y coords
178+
Teuchos::Array<int_t> owned_ids(ss_locs_size);
179+
for(int_t i=0;i<ss_locs_size;++i)
180+
owned_ids[i] = i;
181+
Teuchos::RCP<MultiField_Map> zero_map = Teuchos::rcp (new MultiField_Map(-1, owned_ids,0,*schema->mesh()->get_comm()));
182+
Teuchos::RCP<MultiField> all_on_zero_coords = Teuchos::rcp( new MultiField(zero_map,1,true));
183+
// all to zero gather of coordinates
184+
MultiField_Exporter exporter(*zero_map,*coords->get_map());
185+
// export the field to zero
186+
all_on_zero_coords->do_import(coords,exporter);
187+
//all_on_zero_coords->describe();
188+
if(proc_rank==0){
189+
std::FILE * ssFile = fopen("subset_locs.txt","w");
190+
for(int_t i=0;i<ss_locs_size/2;++i){
191+
fprintf(ssFile,"%i %i\n",(int_t)all_on_zero_coords->local_value(i*2+0),(int_t)all_on_zero_coords->local_value(i*2+1));
192+
}
193+
fclose(ssFile);
194+
}
195+
DICe::finalize();
196+
return 0;
197+
}
198+
173199
bool has_motion_windows = false;
174200
if(schema->analysis_type()==LOCAL_DIC){
175201
has_motion_windows = schema->motion_window_params()->size()>0;
@@ -195,6 +221,9 @@ int main(int argc, char *argv[]) {
195221
std::string stereo_file_prefix = input_params->get<std::string>(DICe::output_prefix,"DICe_solution");
196222
stereo_file_prefix += "_stereo";
197223

224+
225+
226+
198227
// if the user selects predict_resolution_error option, an error analysis is performed and the actual analysis is skipped
199228
if(correlation_params->get<bool>(DICe::estimate_resolution_error,false)){
200229
file_prefix = "DICe_error_estimation_solution";

src/core/DICe_Parser.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Teuchos::RCP<Teuchos::ParameterList> parse_command_line(int argc,
9494
("input,i",po::value<std::string>(),"XML input file name <filename>.xml")
9595
("generate,g",po::value<std::string>()->implicit_value("dice"),"Create XML input file templates")
9696
("stats,s","Print field statistics to screen")
97+
("ss_locs","Print a file (ss_locs.txt) with the subset locations and exit before analysis")
9798
;
9899

99100
// Parse the command line options
@@ -156,6 +157,11 @@ Teuchos::RCP<Teuchos::ParameterList> parse_command_line(int argc,
156157
inputParams->set(DICe::print_timing,true);
157158
}
158159

160+
// Print subset locations and exit?
161+
if(vm.count("ss_locs")){
162+
inputParams->set(DICe::print_subset_locations_and_exit,true);
163+
}
164+
159165
// Print timing statistics?
160166
if(vm.count("stats")){
161167
inputParams->set(DICe::print_stats,true);

src/core/DICe_Parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ const char* const image_edge_buffer_size = "image_edge_buffer_size";
8181
/// Input parameter
8282
const char* const print_timing = "print_timing";
8383
/// Input parameter
84+
const char* const print_subset_locations_and_exit = "print_subset_locations_and_exit";
85+
/// Input parameter
8486
const char* const print_stats = "print_stats";
8587
/// Input parameter
8688
const char* const output_stereo_files = "output_stereo_files";

0 commit comments

Comments
 (0)