PolyFEM
Loading...
Searching...
No Matches
polyfem::io Namespace Reference

Classes

class  EnergyCSVWriter
 
class  Evaluator
 
class  MshReader
 
class  MshWriter
 
class  OBJReader
 
class  OBJWriter
 
class  OutGeometryData
 Utilies related to export of geometry. More...
 
class  OutRuntimeData
 stores all runtime data More...
 
class  OutStatsData
 all stats from polyfem More...
 
class  RuntimeStatsCSVWriter
 
class  SolutionFrame
 class used to save the solution of time dependent problems in code instead of saving it to the disc More...
 

Functions

template<typename T >
bool read_matrix (const std::string &path, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat)
 Reads a matrix from a file. Determines the file format based on the path's extension.
 
template<typename Mat >
bool write_matrix (const std::string &path, const Mat &mat)
 Writes a matrix to a file. Determines the file format based on the path's extension.
 
template<typename Mat >
bool write_matrix (const std::string &path, const std::string &key, const Mat &mat, const bool replace=true)
 Writes a matrix to a hdf5 file using key as name.
 
template<typename Mat >
bool read_matrix (const std::string &path, const std::string &key, Mat &mat)
 Reads a matrix to a hdf5 file using key as name.
 
template<typename T >
bool read_matrix_ascii (const std::string &path, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat)
 
template<typename Mat >
bool write_matrix_ascii (const std::string &path, const Mat &mat)
 
template<typename T >
bool read_matrix_binary (const std::string &path, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat)
 
template<typename Mat >
bool write_matrix_binary (const std::string &path, const Mat &mat)
 
bool write_sparse_matrix_csv (const std::string &path, const Eigen::SparseMatrix< double > &mat)
 
template<typename T >
bool import_matrix (const std::string &path, const json &import, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat)
 
template bool read_matrix< int > (const std::string &, Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > &)
 
template bool read_matrix< double > (const std::string &, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &)
 
template bool read_matrix< Eigen::MatrixXi > (const std::string &, const std::string &, Eigen::MatrixXi &)
 
template bool read_matrix< Eigen::MatrixXd > (const std::string &, const std::string &, Eigen::MatrixXd &)
 
template bool write_matrix< Eigen::MatrixXd > (const std::string &, const Eigen::MatrixXd &)
 
template bool write_matrix< Eigen::MatrixXf > (const std::string &, const Eigen::MatrixXf &)
 
template bool write_matrix< Eigen::VectorXd > (const std::string &, const Eigen::VectorXd &)
 
template bool write_matrix< Eigen::VectorXf > (const std::string &, const Eigen::VectorXf &)
 
template bool write_matrix< Eigen::MatrixXd > (const std::string &, const std::string &, const Eigen::MatrixXd &, const bool)
 
template bool write_matrix< Eigen::MatrixXf > (const std::string &, const std::string &, const Eigen::MatrixXf &, const bool)
 
template bool write_matrix< Eigen::VectorXd > (const std::string &, const std::string &, const Eigen::VectorXd &, const bool)
 
template bool write_matrix< Eigen::VectorXf > (const std::string &, const std::string &, const Eigen::VectorXf &, const bool)
 
template bool read_matrix_ascii< int > (const std::string &, Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > &)
 
template bool read_matrix_ascii< double > (const std::string &, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &)
 
template bool write_matrix_ascii< Eigen::MatrixXd > (const std::string &, const Eigen::MatrixXd &)
 
template bool write_matrix_ascii< Eigen::MatrixXf > (const std::string &, const Eigen::MatrixXf &)
 
template bool write_matrix_ascii< Eigen::VectorXd > (const std::string &, const Eigen::VectorXd &)
 
template bool write_matrix_ascii< Eigen::VectorXf > (const std::string &, const Eigen::VectorXf &)
 
template bool read_matrix_binary< int > (const std::string &, Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > &)
 
template bool read_matrix_binary< double > (const std::string &, Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &)
 
template bool write_matrix_binary< Eigen::MatrixXd > (const std::string &, const Eigen::MatrixXd &)
 
template bool write_matrix_binary< Eigen::MatrixXf > (const std::string &, const Eigen::MatrixXf &)
 
template bool write_matrix_binary< Eigen::VectorXd > (const std::string &, const Eigen::VectorXd &)
 
template bool write_matrix_binary< Eigen::VectorXf > (const std::string &, const Eigen::VectorXf &)
 
template bool import_matrix< int > (const std::string &path, const json &import, Eigen::MatrixXi &mat)
 
template bool import_matrix< double > (const std::string &path, const json &import, Eigen::MatrixXd &mat)
 
template<typename Entity >
void map_entity_tag_to_physical_tag (const std::vector< Entity > &entities, std::unordered_map< int, int > &entity_tag_to_physical_tag)
 
json yaml_string_to_json (const std::string &yaml_str)
 Convert YAML string to JSON.
 
json yaml_file_to_json (const std::string &yaml_filepath)
 Load a YAML file to JSON.
 

Function Documentation

◆ import_matrix()

template<typename T >
bool polyfem::io::import_matrix ( const std::string &  path,
const json import,
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  mat 
)

Definition at line 223 of file MatrixIO.cpp.

References read_matrix().

Here is the call graph for this function:

◆ import_matrix< double >()

template bool polyfem::io::import_matrix< double > ( const std::string &  path,
const json import,
Eigen::MatrixXd &  mat 
)

◆ import_matrix< int >()

template bool polyfem::io::import_matrix< int > ( const std::string &  path,
const json import,
Eigen::MatrixXi &  mat 
)

◆ map_entity_tag_to_physical_tag()

template<typename Entity >
void polyfem::io::map_entity_tag_to_physical_tag ( const std::vector< Entity > &  entities,
std::unordered_map< int, int > &  entity_tag_to_physical_tag 
)

Definition at line 18 of file MshReader.cpp.

Referenced by polyfem::io::MshReader::load().

Here is the caller graph for this function:

◆ read_matrix() [1/2]

template<typename Mat >
bool polyfem::io::read_matrix ( const std::string &  path,
const std::string &  key,
Mat &  mat 
)

Reads a matrix to a hdf5 file using key as name.

Definition at line 73 of file MatrixIO.cpp.

◆ read_matrix() [2/2]

template<typename T >
bool polyfem::io::read_matrix ( const std::string &  path,
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  mat 
)

Reads a matrix from a file. Determines the file format based on the path's extension.

Definition at line 18 of file MatrixIO.cpp.

References read_matrix_ascii(), and read_matrix_binary().

Referenced by polyfem::State::build_basis(), polyfem::utils::FileSelection::FileSelection(), import_matrix(), polyfem::problem::PointBasedTensorProblem::BCValue::init(), polyfem::utils::ExpressionValue::init(), polyfem::solver::NodeTargetForm::NodeTargetForm(), polyfem::solver::VariableToSimulation::set_output_indexing(), polyfem::assembler::GenericTensorProblem::set_parameters(), and polyfem::assembler::GenericScalarProblem::set_parameters().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_matrix< double >()

template bool polyfem::io::read_matrix< double > ( const std::string &  ,
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &   
)

◆ read_matrix< Eigen::MatrixXd >()

template bool polyfem::io::read_matrix< Eigen::MatrixXd > ( const std::string &  ,
const std::string &  ,
Eigen::MatrixXd &   
)

◆ read_matrix< Eigen::MatrixXi >()

template bool polyfem::io::read_matrix< Eigen::MatrixXi > ( const std::string &  ,
const std::string &  ,
Eigen::MatrixXi &   
)

◆ read_matrix< int >()

template bool polyfem::io::read_matrix< int > ( const std::string &  ,
Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > &   
)

◆ read_matrix_ascii()

template<typename T >
bool polyfem::io::read_matrix_ascii ( const std::string &  path,
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  mat 
)

Definition at line 83 of file MatrixIO.cpp.

References polyfem::logger().

Referenced by read_matrix().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_matrix_ascii< double >()

template bool polyfem::io::read_matrix_ascii< double > ( const std::string &  ,
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &   
)

◆ read_matrix_ascii< int >()

template bool polyfem::io::read_matrix_ascii< int > ( const std::string &  ,
Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > &   
)

◆ read_matrix_binary()

template<typename T >
bool polyfem::io::read_matrix_binary ( const std::string &  path,
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &  mat 
)

Definition at line 144 of file MatrixIO.cpp.

References polyfem::logger().

Referenced by read_matrix().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_matrix_binary< double >()

template bool polyfem::io::read_matrix_binary< double > ( const std::string &  ,
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &   
)

◆ read_matrix_binary< int >()

template bool polyfem::io::read_matrix_binary< int > ( const std::string &  ,
Eigen::Matrix< int, Eigen::Dynamic, Eigen::Dynamic > &   
)

◆ write_matrix() [1/2]

template<typename Mat >
bool polyfem::io::write_matrix ( const std::string &  path,
const Mat &  mat 
)

Writes a matrix to a file. Determines the file format based on the path's extension.

Definition at line 42 of file MatrixIO.cpp.

References polyfem::logger(), write_matrix_ascii(), and write_matrix_binary().

Referenced by polyfem::time_integrator::ImplicitTimeIntegrator::save_state(), and polyfem::State::solve_problem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_matrix() [2/2]

template<typename Mat >
bool polyfem::io::write_matrix ( const std::string &  path,
const std::string &  key,
const Mat &  mat,
const bool  replace 
)

Writes a matrix to a hdf5 file using key as name.

Definition at line 64 of file MatrixIO.cpp.

◆ write_matrix< Eigen::MatrixXd >() [1/2]

template bool polyfem::io::write_matrix< Eigen::MatrixXd > ( const std::string &  ,
const Eigen::MatrixXd &   
)

◆ write_matrix< Eigen::MatrixXd >() [2/2]

template bool polyfem::io::write_matrix< Eigen::MatrixXd > ( const std::string &  ,
const std::string &  ,
const Eigen::MatrixXd &  ,
const bool   
)

◆ write_matrix< Eigen::MatrixXf >() [1/2]

template bool polyfem::io::write_matrix< Eigen::MatrixXf > ( const std::string &  ,
const Eigen::MatrixXf &   
)

◆ write_matrix< Eigen::MatrixXf >() [2/2]

template bool polyfem::io::write_matrix< Eigen::MatrixXf > ( const std::string &  ,
const std::string &  ,
const Eigen::MatrixXf &  ,
const bool   
)

◆ write_matrix< Eigen::VectorXd >() [1/2]

template bool polyfem::io::write_matrix< Eigen::VectorXd > ( const std::string &  ,
const Eigen::VectorXd &   
)

◆ write_matrix< Eigen::VectorXd >() [2/2]

template bool polyfem::io::write_matrix< Eigen::VectorXd > ( const std::string &  ,
const std::string &  ,
const Eigen::VectorXd &  ,
const bool   
)

◆ write_matrix< Eigen::VectorXf >() [1/2]

template bool polyfem::io::write_matrix< Eigen::VectorXf > ( const std::string &  ,
const Eigen::VectorXf &   
)

◆ write_matrix< Eigen::VectorXf >() [2/2]

template bool polyfem::io::write_matrix< Eigen::VectorXf > ( const std::string &  ,
const std::string &  ,
const Eigen::VectorXf &  ,
const bool   
)

◆ write_matrix_ascii()

template<typename Mat >
bool polyfem::io::write_matrix_ascii ( const std::string &  path,
const Mat &  mat 
)

Definition at line 125 of file MatrixIO.cpp.

References polyfem::logger().

Referenced by write_matrix().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_matrix_ascii< Eigen::MatrixXd >()

template bool polyfem::io::write_matrix_ascii< Eigen::MatrixXd > ( const std::string &  ,
const Eigen::MatrixXd &   
)

◆ write_matrix_ascii< Eigen::MatrixXf >()

template bool polyfem::io::write_matrix_ascii< Eigen::MatrixXf > ( const std::string &  ,
const Eigen::MatrixXf &   
)

◆ write_matrix_ascii< Eigen::VectorXd >()

template bool polyfem::io::write_matrix_ascii< Eigen::VectorXd > ( const std::string &  ,
const Eigen::VectorXd &   
)

◆ write_matrix_ascii< Eigen::VectorXf >()

template bool polyfem::io::write_matrix_ascii< Eigen::VectorXf > ( const std::string &  ,
const Eigen::VectorXf &   
)

◆ write_matrix_binary()

template<typename Mat >
bool polyfem::io::write_matrix_binary ( const std::string &  path,
const Mat &  mat 
)

Definition at line 169 of file MatrixIO.cpp.

References polyfem::logger().

Referenced by write_matrix().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_matrix_binary< Eigen::MatrixXd >()

template bool polyfem::io::write_matrix_binary< Eigen::MatrixXd > ( const std::string &  ,
const Eigen::MatrixXd &   
)

◆ write_matrix_binary< Eigen::MatrixXf >()

template bool polyfem::io::write_matrix_binary< Eigen::MatrixXf > ( const std::string &  ,
const Eigen::MatrixXf &   
)

◆ write_matrix_binary< Eigen::VectorXd >()

template bool polyfem::io::write_matrix_binary< Eigen::VectorXd > ( const std::string &  ,
const Eigen::VectorXd &   
)

◆ write_matrix_binary< Eigen::VectorXf >()

template bool polyfem::io::write_matrix_binary< Eigen::VectorXf > ( const std::string &  ,
const Eigen::VectorXf &   
)

◆ write_sparse_matrix_csv()

bool polyfem::io::write_sparse_matrix_csv ( const std::string &  path,
const Eigen::SparseMatrix< double > &  mat 
)

Definition at line 192 of file MatrixIO.cpp.

References polyfem::logger().

Here is the call graph for this function:

◆ yaml_file_to_json()

json polyfem::io::yaml_file_to_json ( const std::string &  yaml_filepath)

Load a YAML file to JSON.

Definition at line 68 of file YamlToJson.cpp.

Referenced by load_yaml().

Here is the caller graph for this function:

◆ yaml_string_to_json()

json polyfem::io::yaml_string_to_json ( const std::string &  yaml_str)

Convert YAML string to JSON.

Definition at line 62 of file YamlToJson.cpp.