87std::vector<std::vector<T>>
read_data_from_csv(
const std::string& filepath,
char separator =
',') {
89 std::ifstream csvFile(filepath);
90 if (!csvFile.is_open()) {
92 throw std::invalid_argument(
"Unable to open CSV file.");
96 std::vector<std::vector<T>> data;
100 while (std::getline(csvFile, line)) {
102 std::istringstream iss(line);
106 while (std::getline(iss, value, separator)) {
108 T typedValue =
static_cast<T
>(std::stod(value));
109 row.push_back(typedValue);
110 }
catch (
const std::invalid_argument& e) {
113 throw std::invalid_argument(
"Unable to convert data to the specified data type.");
170void write_vertex_data_to_csv(
const Mesh &mesh,
const int iteration)
171__attribute__((deprecated(
"Use Mesh::write_vertex_data_to_csv instead.")));
185void write_energy_force_data_to_csv(
const Model &model);
194bool write_model_restart_checkpoint(
const Model &model,
195 const std::string &filepath,
196 const int nextIteration);
201bool load_model_restart_checkpoint(
Model &model,
const std::string &filepath);
217void write_element_face_energy_to_csv(
const Model &model);
235void write_final_vertex_data_to_csv(
const Mesh &mesh);
244void dynamics_create_trajectory_files(
DynamicMesh &mesh,
const std::string &filename);
252void output_trajectory_files(
Mesh &mesh,
const std::string &input_filename);
263void dynamics_output_trajectory_files(
DynamicMesh &mesh,
const std::string &filename);
This file defines dynamic mesh class that inherits mesh with support of time-resolved dynamics.
This file defines mesh class containing a vector of vertices and a vector of faces that are required ...
Contains the Model class, which encapsulates a mesh and a record object.
This file defines essential parameters used in continuum membrane as well as membrane dynamics code....
This file defines the Vertex class which includes information of coordinate and forces exerted at a v...
A class representing a dynamic mesh.
Definition Dynamics.hpp:44
A class representing a triangular mesh that defines a limit surface.
Definition Mesh.hpp:54
The Model class encapsulates a Mesh and a Record object.
Definition Model.hpp:94
bool import_param_file(Param ¶m, std::string filepath)
Import parameters from a file.
bool import_kv_string(std::string variableNameStr, std::string variableValueStr, Param ¶m)
Import key-value pairs from a string.
std::string pop_space(std::string rawString)
Remove spaces from a string.
std::string trim_trailing_semicolon(std::string rawString)
bool import_mesh_from_vertices_faces(Mesh &mesh, std::string verticesFilepath, std::string facesFilepath)
Import a mesh from separate files containing vertices and faces.
std::vector< std::vector< T > > read_data_from_csv(const std::string &filepath, char separator=',')
Read data from a CSV file and store it in a vector of vectors with the specified data type.
Definition io.hpp:87
std::vector< Matrix > import_scaffolding_mesh(std::string filepath)
Import scaffolding mesh from a file.
Contains simulation parameters and physical constants.
Definition Parameters.hpp:117