30 std::ofstream m_global_ini_file_content;
31 std::vector<std::string> m_save_fields{
"Temperature"};
32 void gatherIniFileContent(
70 if (sim->m_simulation_config.getStringParameters(
"snapshot_save_file") ==
"None")
75 if (sim->my_rank == 0)
77 m_global_ini_file_content.open(
78 sim->m_simulation_config.getStringParameters(
"snapshot_save_file"),
79 std::ios::binary | std::ios::out | std::ios::trunc);
83 if (sim->my_rank == 0)
85 m_global_ini_file_content <<
"INIFILEDATA:\n";
89 numerical_layers = sim->m_simulation_config.getIntParameters(
"numerical_layers");
92 sim->m_simulation_config.getIntParameters(
"global_number_of_facets");
106 if (sim->my_rank == 0)
109 sim->m_simulation_config.data()};
112 m_global_ini_file_content <<
"SimulationConfig" <<
"$" <<
key <<
" = "
113 << std::any_cast<std::string>(
map_content) <<
"\n";
117 m_global_ini_file_content.close();
118 std::cout <<
"\033[32m[SnapshotCreator] Successfully created snapshot file!\033[0m\n";
136 m_global_ini_file_content <<
"FIELDDATA:\n";
139 m_global_ini_file_content <<
field_name <<
"," << sim->elapsed_time <<
",";
143 m_global_ini_file_content <<
field[
i] << std::setprecision(15) <<
",";
145 m_global_ini_file_content <<
field[
field.
size() - 1] << std::setprecision(15) <<
"\n";
147 m_global_ini_file_content <<
"INIFILEDATA:\n";
163 module->writeToGlobalIniContent(m_global_ini_file_content);
168 submodule->writeToGlobalIniContent(m_global_ini_file_content);
187 std::cerr <<
"Trying to access an unopened file. Please also use init and output chains "
188 "when using MPI I/O.\n";
189 throw std::runtime_error(
190 "Trying to access an unopened file. Please also use init and output chains when using "
219 + std::to_string(
field.
size() * sim->world_size) +
",";
245 if (sim->my_rank < sim->number_of_larger_procs)
255 + (sim->my_rank - sim->number_of_larger_procs) *
field.
size())
263 if (sim->my_rank < sim->number_of_larger_procs)
273 + (sim->my_rank - sim->number_of_larger_procs) *
field.
size())
281 <<
"[SnapshotCreator]: Field in SnapshotCreator is of irregular size! Currently only "
282 "supporting sizes of numerical_layers * numbers_of_facets or numbers_of_facets.\n";
283 throw std::runtime_error(
284 "[SnapshotCreator]: Field in SnapshotCreator is of irregular size! Currently only "
285 "supporting sizes of numerical_layers * numbers_of_facets or numbers_of_facets.\n");
304 if (sim->my_rank == 0)
325 field_file = sim->m_simulation_config.getStringParameters(
"snapshot_save_file");
329 std::cerr <<
"Could not find file type separator '.' in supplied snapshot file path. "
330 "Please specify the full path with file type.";
331 throw std::runtime_error(
332 "Could not find file type separator '.' in supplied snapshot file path. "
333 "Please specify the full path with file type.");
Concrete implementation of a matrix class representing a Compressed Sparse Rows (CSR) matrix....
Definition CsrMatrix.h:37
CsrSparseMatrix()
Constructor for an empty CsrSparseMatrix object. Leaves all storage arrays empty but sets the flag to...
Definition CsrMatrix.h:94
std::pair< int, int > size() const
Function that returns the size of the matrix as a pair in (rows, columns) format.
Definition GenericMatrix.h:120
Class which creates MoCSI snapshot files. Saves all the specified fields from m_save_fields and all t...
Definition SnapshotCreator.h:28
SnapshotCreator(SimulationClassBase< T > *sim, std::vector< std::shared_ptr< GenericManagingModule< double > > > &all_modules, std::vector< std::shared_ptr< GenericSubmodule< double > > > &all_submodules)
Constructor of the Snapshot Creator.
Definition SnapshotCreator.h:63