@@ -272,46 +272,36 @@ void ProcessFieldsSAR::DumpFDData()
272272 SAR_Calc.SetCellDensities (&cell_density);
273273 SAR_Calc.SetCellWidth (cellWidth);
274274 SAR_Calc.SetCellVolumes (&cell_volume);
275- SAR_Calc.SetCellCondictivity (&cell_kappa); // cell_kappa will be NULL if m_UseCellKappa is false
276- double mass = SAR_Calc.CalcTotalMass ();
277275
278276 for (size_t n = 0 ; n<m_FD_Samples.size (); ++n)
279277 {
280- SAR_Calc.SetEField (m_E_FD_Fields.at (n));
281278 if (!m_UseCellKappa)
282- SAR_Calc.SetJField ( m_J_FD_Fields.at (n));
283- power = SAR_Calc. CalcSARPower ();
284- SAR_Calc.SetCellVolumes (&cell_volume );
285- power = SAR_Calc. CalcSARPower ();
286- SAR_Calc.CalcSAR (SAR );
279+ SAR_Calc.AddEFieldAndJField (m_FD_Samples. at (n), m_E_FD_Fields. at (n), m_J_FD_Fields.at (n));
280+ else
281+ SAR_Calc.AddEFieldAndCondictivity (m_FD_Samples. at (n), m_E_FD_Fields. at (n), &cell_kappa );
282+ }
283+ SAR_Calc.CalcSAR ();
287284
288- if (m_fileType==VTK_FILETYPE)
285+ if (m_fileType==VTK_FILETYPE)
286+ {
287+ for (size_t n = 0 ; n<m_FD_Samples.size (); ++n)
289288 {
290289 stringstream ss;
291290 ss << m_filename << fixed << " _f=" << m_FD_Samples.at (n);
292-
293291 m_Vtk_Dump_File->SetFilename (ss.str ());
294292 m_Vtk_Dump_File->ClearAllFields ();
295- m_Vtk_Dump_File->AddScalarField (GetFieldNameByType (m_DumpType),SAR );
293+ m_Vtk_Dump_File->AddScalarField (GetFieldNameByType (m_DumpType), *SAR_Calc. GetSAR (n) );
296294 if (m_Vtk_Dump_File->Write ()==false )
297295 cerr << " ProcessFieldsSAR::DumpFDData: can't dump to file...! " << endl;
298296 }
299- else if (m_fileType==HDF5_FILETYPE)
300- {
301- stringstream ss;
302- ss << " f" << n;
303- if (m_HDF5_Dump_File->WriteScalarField <float >(ss.str (), SAR, g_settings.GetLegacyHFD5Dumps ())==false )
304- cerr << " ProcessFieldsSAR::DumpFDData: can't dump to file...! " << endl;
305- if (m_HDF5_Dump_File->WriteAtrribute (" /FieldData/FD/" +ss.str ()," frequency" ,(float )m_FD_Samples.at (n))==false )
306- cerr << " ProcessFieldsSAR::DumpFDData: can't dump to file...! " << endl;
307- if (m_HDF5_Dump_File->WriteAtrribute (" /FieldData/FD/" +ss.str ()," mass" ,mass)==false )
308- cerr << " ProcessFieldsSAR::DumpFDData: can't dump mass to file...! " << endl;
309- if (m_HDF5_Dump_File->WriteAtrribute (" /FieldData/FD/" +ss.str ()," power" ,power)==false )
310- cerr << " ProcessFieldsSAR::DumpFDData: can't dump power to file...! " << endl;
311- }
312- else
313- cerr << " ProcessFieldsSAR::DumpFDData: unknown File-Type" << endl;
314297 }
298+ else if (m_fileType==HDF5_FILETYPE)
299+ {
300+ if (SAR_Calc.WriteToHDF5 (*m_HDF5_Dump_File, g_settings.GetLegacyHFD5Dumps ())==false )
301+ cerr << " ProcessFieldsSAR::DumpFDData: can't dump to file...! " << endl;
302+ }
303+ else
304+ cerr << " ProcessFieldsSAR::DumpFDData: unknown File-Type" << endl;
315305 }
316306 for (int n=0 ;n<3 ;++n)
317307 delete[] cellWidth[n];
0 commit comments