|
Continuum Membrane 719025a62b1e384a6ff80e2f2a223ef4012153dc
|
Manage io of continuum membrane model, including parameter files, vertices and faces, and scaffolding structure files. More...
#include <fstream>#include <sstream>#include <iostream>#include <stdlib.h>#include <string>#include <vector>#include <stdexcept>#include <sys/stat.h>#include "mesh/Mesh.hpp"#include "model/Record.hpp"#include "model/Model.hpp"#include "mesh/Vertex.hpp"#include "Parameters.hpp"#include "linalg/Linear_algebra.hpp"#include "Dynamics.hpp"Go to the source code of this file.
Functions | |
| std::string | pop_space (std::string rawString) |
| Remove spaces from a string. | |
| std::string | trim_trailing_semicolon (std::string rawString) |
| bool | import_kv_string (std::string variableNameStr, std::string variableValueStr, Param ¶m) |
| Import key-value pairs from a string. | |
| bool | import_param_file (Param ¶m, std::string filepath) |
| Import parameters from a file. | |
| template<typename T > | |
| 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. | |
| 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< Matrix > | import_scaffolding_mesh (std::string filepath) |
| Import scaffolding mesh from a file. | |
Manage io of continuum membrane model, including parameter files, vertices and faces, and scaffolding structure files.
| bool import_kv_string | ( | std::string | variableNameStr, |
| std::string | variableValueStr, | ||
| Param & | param | ||
| ) |
Import key-value pairs from a string.
This function takes two strings, variableNameStr and variableValueStr, which are expected to contain name-value pairs separated by an "=" sign. It then parses these variables and uses them to update a Param struct object's variables, which is passed as reference. If parsing and updating are successful, returns true, else returns false.
| variableNameStr | the string containing names of the variables |
| variableValueStr | the string containing values of the variables |
| param | the Param object to be updated |
| bool import_mesh_from_vertices_faces | ( | Mesh & | mesh, |
| std::string | verticesFilepath, | ||
| std::string | facesFilepath | ||
| ) |
Import a mesh from separate files containing vertices and faces.
This function reads vertices and faces from specified files and constructs a mesh.
| mesh | The Mesh object to write vertices and faces data. |
| verticesFilepath | The file path of the vertices file. |
| facesFilepath | The file path of the faces file. |
| bool import_param_file | ( | Param & | param, |
| std::string | filepath | ||
| ) |
Import parameters from a file.
This function reads a parameter file specified by filepath and updates a Param struct object's variables using the information present in the file. The updated Param object is passed as reference. If file reading and updating are successful, returns true, else false.
| param | the Param object to be updated |
| filepath | the path of the parameter file to be read |
| std::vector< Matrix > import_scaffolding_mesh | ( | std::string | filepath | ) |
Import scaffolding mesh from a file.
This function reads a mesh file specified by filepath and returns a vector of matrices containing the vertices' coordinates of all triangular faces.
| filepath | the path of the mesh file to be read |
| std::string pop_space | ( | std::string | rawString | ) |
Remove spaces from a string.
This function takes a raw string and removes any whitespace characters present in it. The modified string with no spaces is returned.
| rawString | the original string to be processed |
| 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.
This function reads data from a CSV file, where each line represents a row of data, and each value within a line is separated by the specified character.
Generated by GPT 3.5.
| T | The data type (int, float, or double) to store in the resulting vector. |
| filepath | The file path of the CSV file. |
| separator | The character used as a separator in the CSV file (default is comma ',' for typical CSV files). |
| std::invalid_argument | If the data cannot be converted to the specified data type. |
| std::string trim_trailing_semicolon | ( | std::string | rawString | ) |