MCPcopy Create free account
hub / github.com/GollyGang/ready / CreateFromFile

Method CreateFromFile

src/readybase/SystemFactory.cpp:62–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60// -------------------------------------------------------------------------------------------------------------
61
62unique_ptr<AbstractRD> SystemFactory::CreateFromFile(
63 const char *filename,
64 bool is_opencl_available,
65 int opencl_platform,
66 int opencl_device,
67 Properties &render_settings,
68 bool &warn_to_update)
69{
70 // temporarily turn off internationalisation, to avoid string-to-float conversion issues
71 char *old_locale = setlocale(LC_NUMERIC,"C");
72
73 vtkSmartPointer<vtkXMLGenericDataObjectReader> generic_reader = vtkSmartPointer<vtkXMLGenericDataObjectReader>::New();
74 bool parallel;
75 int data_structure_type = generic_reader->ReadOutputType(filename,parallel);
76 unique_ptr<AbstractRD> system;
77 switch(data_structure_type)
78 {
79 case VTK_IMAGE_DATA:
80 system = CreateFromImageDataFile(filename,is_opencl_available,opencl_platform,opencl_device,
81 render_settings,warn_to_update);
82 break;
83 case VTK_UNSTRUCTURED_GRID:
84 system = CreateFromUnstructuredGridFile(filename,is_opencl_available,opencl_platform,opencl_device,
85 render_settings,warn_to_update);
86 break;
87 default:
88 throw runtime_error("Unsupported data type or file read error");
89 }
90
91 // restore the old locale
92 setlocale(LC_NUMERIC,old_locale);
93
94 system->SetFilename(filename);
95 system->SetModified(false);
96 return system;
97}
98
99// -------------------------------------------------------------------------------------------------------------
100

Callers

nothing calls this directly

Calls 4

CreateFromImageDataFileFunction · 0.85
SetFilenameMethod · 0.80
SetModifiedMethod · 0.80

Tested by

no test coverage detected