29 std::ofstream m_global_ini_file_content;
30 std::vector<std::string> m_save_fields{
"Temperature"};
31 void gatherIniFileContent(
69 if (sim->m_simulation_config.getStringParameters(
"snapshot_save_file") ==
"None")
74 if (sim->my_rank == 0)
76 m_global_ini_file_content.open(
77 sim->m_simulation_config.getStringParameters(
"snapshot_save_file"),
78 std::ios::binary | std::ios::out | std::ios::trunc);
82 if (sim->my_rank == 0)
84 m_global_ini_file_content <<
"INIFILEDATA:\n";
88 numerical_layers = sim->m_simulation_config.getIntParameters(
"numerical_layers");
91 sim->m_simulation_config.getIntParameters(
"global_number_of_facets");
105 if (sim->my_rank == 0)
108 sim->m_simulation_config.data()};
111 m_global_ini_file_content <<
"SimulationConfig" <<
"$" <<
key <<
" = "
112 << std::any_cast<std::string>(
map_content) <<
"\n";
116 m_global_ini_file_content.close();
117 std::cout <<
"\033[32m[SnapshotCreator] Successfully created snapshot file!\033[0m\n";
135 m_global_ini_file_content <<
"FIELDDATA:\n";
138 m_global_ini_file_content <<
field_name <<
"," << sim->elapsed_time <<
",";
142 m_global_ini_file_content <<
field[
i] << std::setprecision(15) <<
",";
144 m_global_ini_file_content <<
field[
field.
size() - 1] << std::setprecision(15) <<
"\n";
146 m_global_ini_file_content <<
"INIFILEDATA:\n";
162 module->writeToGlobalIniContent(m_global_ini_file_content);
167 submodule->writeToGlobalIniContent(m_global_ini_file_content);
186 std::cerr <<
"Trying to access an unopened file. Please also use init and output chains "
187 "when using MPI I/O.\n";
188 throw std::runtime_error(
189 "Trying to access an unopened file. Please also use init and output chains when using "
218 + std::to_string(
field.
size() * sim->world_size) +
",";
244 if (sim->my_rank < sim->number_of_larger_procs)
254 + (sim->my_rank - sim->number_of_larger_procs) *
field.
size())
262 if (sim->my_rank < sim->number_of_larger_procs)
272 + (sim->my_rank - sim->number_of_larger_procs) *
field.
size())
280 <<
"[SnapshotCreator]: Field in SnapshotCreator is of irregular size! Currently only "
281 "supporting sizes of numerical_layers * numbers_of_facets or numbers_of_facets.\n";
282 throw std::runtime_error(
283 "[SnapshotCreator]: Field in SnapshotCreator is of irregular size! Currently only "
284 "supporting sizes of numerical_layers * numbers_of_facets or numbers_of_facets.\n");
303 if (sim->my_rank == 0)
324 field_file = sim->m_simulation_config.getStringParameters(
"snapshot_save_file");
328 std::cerr <<
"Could not find file type separator '.' in supplied snapshot file path. "
329 "Please specify the full path with file type.";
330 throw std::runtime_error(
331 "Could not find file type separator '.' in supplied snapshot file path. "
332 "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:27
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:62