|
PolyFEM
|
VarForm-only simulation state. More...
#include <State.hpp>
Public Member Functions | |
| State () | |
| ~State ()=default | |
| void | init (const json &args, const bool strict_validation) |
| initialize the polyfem solver with a json settings | |
| void | set_max_threads (const int max_threads=std::numeric_limits< int >::max()) |
| void | init_logger (const std::string &log_file, const spdlog::level::level_enum log_level, const spdlog::level::level_enum file_log_level, const bool is_quiet) |
| initializing the logger | |
| void | init_logger (std::ostream &os, const spdlog::level::level_enum log_level) |
| initializing the logger writes to an output stream | |
| void | set_log_level (const spdlog::level::level_enum log_level) |
| change log level | |
| void | solve (Eigen::MatrixXd &sol) |
| solves the problem, call other methods | |
| void | load_mesh (bool non_conforming=false, const std::vector< std::string > &names=std::vector< std::string >(), const std::vector< Eigen::MatrixXi > &cells=std::vector< Eigen::MatrixXi >(), const std::vector< Eigen::MatrixXd > &vertices=std::vector< Eigen::MatrixXd >()) |
| loads the mesh from the json arguments | |
| void | load_mesh (GEO::Mesh &meshin, const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &, bool)> &boundary_marker, bool non_conforming=false, bool skip_boundary_sideset=false) |
| loads the mesh from a geogram mesh | |
| void | load_mesh (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F, bool non_conforming=false) |
| loads the mesh from V and F, | |
Public Attributes | |
| json | args |
| main input arguments containing all defaults | |
| std::shared_ptr< varform::VarForm > | variational_formulation |
| active variational formulation | |
| std::function< void(int, int, double, double)> | time_callback = nullptr |
| Optional UI progress callback. | |
Private Member Functions | |
| void | init_logger (const std::vector< spdlog::sink_ptr > &sinks, const spdlog::level::level_enum log_level) |
| initializing the logger meant for internal usage | |
Private Attributes | |
| spdlog::sink_ptr | console_sink_ = nullptr |
| logger sink to stdout | |
| spdlog::sink_ptr | file_sink_ = nullptr |
| polyfem::State::State | ( | ) |
Definition at line 170 of file State.cpp.
References polyfem::utils::GeogramUtils::initialize(), and polyfem::utils::GeogramUtils::instance().
|
default |
| void polyfem::State::init | ( | const json & | args, |
| const bool | strict_validation | ||
| ) |
initialize the polyfem solver with a json settings
| [in] | args | input arguments |
| [in] | strict_validation | strict validation of input |
Definition at line 243 of file State.cpp.
References polyfem::utils::apply_common_params(), args, polyfem::varform::VarFormFactory::create(), polyfem::varform::formulation_from_args(), polyfem::Units::init(), init_logger(), polyfem::logger(), set_max_threads(), and variational_formulation.
Referenced by forward_simulation_with_varform_state().
| void polyfem::State::init_logger | ( | const std::string & | log_file, |
| const spdlog::level::level_enum | log_level, | ||
| const spdlog::level::level_enum | file_log_level, | ||
| const bool | is_quiet | ||
| ) |
initializing the logger
| [in] | log_file | is to write it to a file (use log_file="") to output to stdout |
| [in] | log_level | 0 all message, 6 no message. 2 is info, 1 is debug |
| [in] | file_log_level | 0 all message, 6 no message. 2 is info, 1 is debug |
| [in] | is_quit | quiets the log |
Definition at line 175 of file State.cpp.
References console_sink_, file_sink_, and init_logger().
Referenced by init(), init_logger(), and init_logger().
|
private |
initializing the logger meant for internal usage
Definition at line 207 of file State.cpp.
References polyfem::utils::GeogramUtils::instance(), polyfem::logger(), set_log_level(), polyfem::utils::GeogramUtils::set_logger(), and polyfem::set_logger().
| void polyfem::State::init_logger | ( | std::ostream & | os, |
| const spdlog::level::level_enum | log_level | ||
| ) |
initializing the logger writes to an output stream
| [in] | os | output stream |
| [in] | log_level | 0 all message, 6 no message. 2 is info, 1 is debug |
Definition at line 200 of file State.cpp.
References init_logger().
| void polyfem::State::load_mesh | ( | bool | non_conforming = false, |
| const std::vector< std::string > & | names = std::vector<std::string>(), |
||
| const std::vector< Eigen::MatrixXi > & | cells = std::vector<Eigen::MatrixXi>(), |
||
| const std::vector< Eigen::MatrixXd > & | vertices = std::vector<Eigen::MatrixXd>() |
||
| ) |
loads the mesh from the json arguments
| [in] | non_conforming | creates a conforming/non conforming mesh |
| [in] | names | keys in the hdf5 |
| [in] | cells | list of cells from hdf5 |
| [in] | vertices | list of vertices from hdf5 |
Definition at line 402 of file State.cpp.
References args, polyfem::Units::init(), polyfem::utils::is_param_valid(), polyfem::log_and_throw_error(), polyfem::logger(), polyfem::mesh::read_fem_geometry(), and variational_formulation.
Referenced by forward_simulation_with_varform_state().
| void polyfem::State::load_mesh | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F, | ||
| bool | non_conforming = false |
||
| ) |
loads the mesh from V and F,
| [in] | V | is #vertices x dim |
| [in] | F | is #elements x size (size = 3 for triangle mesh, size=4 for a quad mesh if dim is 2) |
| [in] | non_conforming | creates a conforming/non conforming mesh |
Definition at line 462 of file State.cpp.
References polyfem::mesh::Mesh::create(), polyfem::F, V, and variational_formulation.
| void polyfem::State::load_mesh | ( | GEO::Mesh & | meshin, |
| const std::function< int(const size_t, const std::vector< int > &, const RowVectorNd &, bool)> & | boundary_marker, | ||
| bool | non_conforming = false, |
||
| bool | skip_boundary_sideset = false |
||
| ) |
loads the mesh from a geogram mesh
| [in] | meshin | geo mesh |
| [in] | boundary_marker | the input of the lambda is the face barycenter, the output is the sideset id |
| [in] | non_conforming | creates a conforming/non conforming mesh |
| [in] | skip_boundary_sideset | skip_boundary_sideset = false it uses the lambda boundary_marker to assign the sideset |
Definition at line 370 of file State.cpp.
References polyfem::mesh::Mesh::create(), polyfem::logger(), and variational_formulation.
| void polyfem::State::set_log_level | ( | const spdlog::level::level_enum | log_level | ) |
change log level
| [in] | log_level | 0 all message, 6 no message. 2 is info, 1 is debug |
Definition at line 229 of file State.cpp.
References console_sink_, and polyfem::logger().
Referenced by init_logger().
| void polyfem::State::set_max_threads | ( | const int | max_threads = std::numeric_limits<int>::max() | ) |
| [in] | max_threads | max number of threads |
Definition at line 365 of file State.cpp.
References polyfem::utils::NThread::get(), and polyfem::utils::NThread::set_num_threads().
Referenced by init().
| void polyfem::State::solve | ( | Eigen::MatrixXd & | sol | ) |
solves the problem, call other methods
Definition at line 454 of file State.cpp.
References time_callback, and variational_formulation.
Referenced by forward_simulation_with_varform_state().
| json polyfem::State::args |
main input arguments containing all defaults
Definition at line 44 of file State.hpp.
Referenced by init(), and load_mesh().
|
private |
logger sink to stdout
Definition at line 81 of file State.hpp.
Referenced by init_logger(), and set_log_level().
|
private |
Definition at line 82 of file State.hpp.
Referenced by init_logger().
| std::function<void(int, int, double, double)> polyfem::State::time_callback = nullptr |
| std::shared_ptr<varform::VarForm> polyfem::State::variational_formulation |
active variational formulation
Definition at line 47 of file State.hpp.
Referenced by forward_simulation_with_varform_state(), init(), load_mesh(), load_mesh(), load_mesh(), and solve().