|
PolyFEM
|
Namespaces | |
| namespace | StringUtils |
Functions | |
| bool | python_gil_held () |
| Whether the caller holds Python's interpreter lock. | |
| double | triangle_area_2D (const Eigen::Vector2d &a, const Eigen::Vector2d &b, const Eigen::Vector2d &c) |
| Compute the signed area of a 2D triangle defined by three points. | |
| double | triangle_area_3D (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c) |
| Compute the area of a 3D triangle defined by three points. | |
| double | triangle_area (const Eigen::MatrixXd V) |
| Compute the signed area of a triangle defined by three points. | |
| double | tetrahedron_volume (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c, const Eigen::Vector3d &d) |
| Compute the signed volume of a tetrahedron defined by four points. | |
| double | tetrahedron_volume (const Eigen::MatrixXd V) |
| Compute the signed volume of a tetrahedron defined by four points. | |
| Eigen::MatrixXd | triangle_to_clockwise_order (const Eigen::MatrixXd &triangle) |
| Reorder the vertices of a triangle so they are in clockwise order. | |
| std::vector< Eigen::MatrixXd > | triangle_fan (const Eigen::MatrixXd &convex_polygon) |
| Convert a convex polygon to a list of triangles fanned around the first vertex. | |
| Eigen::VectorXd | barycentric_coordinates (const Eigen::VectorXd &p, const Eigen::MatrixXd &V) |
| Compute barycentric coordinates for point p with respect to a simplex. | |
| bool | triangle_intersects_disk (const Eigen::Vector2d &t0, const Eigen::Vector2d &t1, const Eigen::Vector2d &t2, const Eigen::Vector2d ¢er, const double radius) |
| Determine if a 2D triangle intersects a 2D disk. | |
| bool | tetrahedron_intersects_ball (const Eigen::Vector3d &t0, const Eigen::Vector3d &t1, const Eigen::Vector3d &t2, const Eigen::Vector3d &t3, const Eigen::Vector3d ¢er, const double radius) |
| Determine if a 3D tetrahedron intersects a 3D ball. | |
| bool | are_edges_collinear (const VectorNd &ea0, const VectorNd &ea1, const VectorNd &eb0, const VectorNd &eb1, const double tol=1e-10) |
| Determine if two edges are collinear. | |
| bool | are_triangles_coplanar (const Eigen::Vector3d &t00, const Eigen::Vector3d &t01, const Eigen::Vector3d &t02, const Eigen::Vector3d &t10, const Eigen::Vector3d &t11, const Eigen::Vector3d &t12, const double tol=1e-10) |
| Determine if two triangles are coplanar. | |
| bool | are_aabbs_intersecting (const VectorNd &aabb0_min, const VectorNd &aabb0_max, const VectorNd &aabb1_min, const VectorNd &aabb1_max) |
| Determine if two axis-aligned bounding boxes intersect. | |
| void | triangle_area_2D_gradient (double ax, double ay, double bx, double by, double cx, double cy, double g[6]) |
| Compute the gradient of the signed area of a 2D triangle defined by three points. | |
| void | triangle_area_2D_hessian (double ax, double ay, double bx, double by, double cx, double cy, double H[36]) |
| Compute the Hessian of the signed area of a 2D triangle defined by three points. | |
| void | tetrahedron_volume_gradient (double ax, double ay, double az, double bx, double by, double bz, double cx, double cy, double cz, double dx, double dy, double dz, double g[12]) |
| Compute the gradient of the signed volume of a tetrahedron defined by four points. | |
| void | tetrahedron_volume_hessian (double ax, double ay, double az, double bx, double by, double bz, double cx, double cy, double cz, double dx, double dy, double dz, double H[144]) |
| Compute the gradient of the signed area of a 2D triangle defined by three points. | |
| bool | is_flipped (const Eigen::MatrixXd &V, const Eigen::MatrixXi &F) |
| Determine if any simplex is inverted or collapses. | |
| NLOHMANN_JSON_SERIALIZE_ENUM (PiecewiseInterpolation::Extend, {{PiecewiseInterpolation::Extend::CONSTANT, "constant"}, {PiecewiseInterpolation::Extend::EXTRAPOLATE, "extrapolate"}, {PiecewiseInterpolation::Extend::REPEAT, "repeat"}, {PiecewiseInterpolation::Extend::REPEAT_OFFSET, "repeat_offset"}}) | |
| Eigen::MatrixXd | extract_nodes (const int dim, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXd &u, int order, int n_elem) |
| Eigen::MatrixXd | extract_nodes (const int dim, const basis::ElementBases &basis, const basis::ElementBases &gbasis, const Eigen::VectorXd &u, int order) |
| Eigen::VectorXd | robust_evaluate_jacobian (const int order, const Eigen::MatrixXd &cp, const Eigen::MatrixXd &uv) |
| std::vector< int > | count_invalid (const int dim, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXd &u, const unsigned max_iter) |
| std::tuple< bool, int, Tree > | is_valid (const int dim, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXd &u, const double threshold, const unsigned max_iter) |
| std::tuple< double, int, double, Tree > | max_time_step (const int dim, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXd &u1, const Eigen::VectorXd &u2, double precision, double threshold, const unsigned max_iter) |
| std::unique_ptr< const io::ResourceIO > | apply_common_params (json &args, const io::ResourceIO &resources) |
| void | apply_common_params (json &args) |
| void | expand_bc_sidecars (json &args, const json &rules) |
| Expand string entries in dirichlet_boundary that point to .json files. | |
| void | expand_bc_sidecars (json &args, const json &rules, const io::ResourceIO &resources) |
| Eigen::Matrix3d | to_rotation_matrix (const json &jr, std::string mode) |
| bool | is_param_valid (const json ¶ms, const std::string &key) |
| Determine if a key exists and is non-null in a json object. | |
| template<typename T > | |
| T | deg2rad (T deg) |
| template<typename T = json> | |
| std::vector< T > | json_as_array (const json &j) |
| Return the value of a json object as an array. | |
| template<typename T > | |
| T | json_value (const json ¶ms, const std::string &key, const T &default_value) |
| Get a parameter from a json object or return a default value if the parameter invalid. | |
| void | show_matrix_stats (const Eigen::MatrixXd &M) |
| template<typename T > | |
| T | matrix_inner_product (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &A, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &B) |
| template<typename T , int rows, int cols, int option, int maxRow, int maxCol> | |
| T | determinant (const Eigen::Matrix< T, rows, cols, option, maxRow, maxCol > &mat) |
| template<typename T > | |
| Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > | inverse (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > &mat) |
| Eigen::SparseMatrix< double > | sparse_identity (int rows, int cols) |
| Eigen::VectorXd | flatten (const Eigen::MatrixXd &X) |
| Flatten rowwises. | |
| Eigen::MatrixXd | unflatten (const Eigen::VectorXd &x, int dim) |
| Unflatten rowwises, so every dim elements in x become a row. | |
| void | vector2matrix (const Eigen::VectorXd &vec, Eigen::MatrixXd &mat) |
| Eigen::SparseMatrix< double > | lump_matrix (const Eigen::SparseMatrix< double > &M) |
| Lump each row of a matrix into the diagonal. | |
| Eigen::SparseMatrix< double > | lump_matrix_hrz (const Eigen::SparseMatrix< double > &M) |
| Lump a (mass) matrix HRZ-style: keep the diagonal, scaled by a common factor so the total (sum of all entries) is preserved. | |
| void | full_to_reduced_matrix (const int full_size, const int reduced_size, const std::vector< int > &removed_vars, const StiffnessMatrix &full, StiffnessMatrix &reduced) |
| Map a full size matrix to a reduced one by dropping rows and columns. | |
| Eigen::MatrixXd | reorder_matrix (const Eigen::MatrixXd &in, const Eigen::VectorXi &in_to_out, int out_blocks=-1, const int block_size=1) |
| Reorder row blocks in a matrix. | |
| Eigen::MatrixXd | unreorder_matrix (const Eigen::MatrixXd &out, const Eigen::VectorXi &in_to_out, int in_blocks=-1, const int block_size=1) |
| Undo the reordering of row blocks in a matrix. | |
| Eigen::MatrixXi | map_index_matrix (const Eigen::MatrixXi &in, const Eigen::VectorXi &index_mapping) |
| Map the entrys of an index matrix to new indices. | |
| template<typename DstMat , typename SrcMat > | |
| void | append_rows (DstMat &dst, const SrcMat &src) |
| template<typename DstMat > | |
| void | append_rows_of_zeros (DstMat &dst, const size_t n_zero_rows) |
| void | scatter_matrix (const int n_dofs, const int dim, const Eigen::MatrixXd &A, const Eigen::MatrixXd &b, const std::vector< int > &local_to_global, StiffnessMatrix &Aout, Eigen::MatrixXd &bout) |
| void | scatter_matrix_col (const int n_dofs, const int dim, const Eigen::MatrixXd &A, const Eigen::MatrixXd &b, const std::vector< int > &local_to_global, StiffnessMatrix &Aout, Eigen::MatrixXd &bout) |
| void | scatter_matrix (const int n_dofs, const int dim, const std::vector< long > &shape, const std::vector< int > &rows, const std::vector< int > &cols, const std::vector< double > &vals, const Eigen::MatrixXd &b, const std::vector< int > &local_to_global, StiffnessMatrix &Aout, Eigen::MatrixXd &bout) |
| void | scatter_matrix_col (const int n_dofs, const int dim, const std::vector< long > &shape, const std::vector< int > &rows, const std::vector< int > &cols, const std::vector< double > &vals, const Eigen::MatrixXd &b, const std::vector< int > &local_to_global, StiffnessMatrix &Aout, Eigen::MatrixXd &bout) |
| void | maybe_parallel_for (int size, const std::function< void(int, int, int)> &partial_for) |
| void | maybe_parallel_for (int size, const std::function< void(int)> &body) |
| template<typename LocalStorage > | |
| auto | create_thread_storage (const LocalStorage &initial_local_storage) |
| template<typename Storages > | |
| auto & | get_local_thread_storage (Storages &storage, int thread_id) |
| void | par_for (const int size, const std::function< void(int, int, int)> &func) |
| size_t | get_n_threads () |
| void | regular_2d_grid (const int n, bool tri, Eigen::MatrixXd &V, Eigen::MatrixXi &F) |
| Generate a canonical triangle/quad subdivided from a regular grid. | |
| void | regular_3d_grid (const int nn, bool tet, bool prism, bool pyramid, Eigen::MatrixXd &V, Eigen::MatrixXi &F, Eigen::MatrixXi &T) |
| Generate a canonical tet/hex subdivided from a regular grid. | |
| std::string | resolve_path (const std::string &path, const std::string &input_file_path, const bool only_if_exists=false) |
| template<int dim> | |
| Eigen::Vector< double, dim > | singular_values (const Eigen::Matrix< double, dim, dim > &A) |
| void polyfem::utils::append_rows | ( | DstMat & | dst, |
| const SrcMat & | src | ||
| ) |
Definition at line 155 of file MatrixUtils.hpp.
Referenced by polyfem::mesh::Mesh::append(), and polyfem::varform::NonlinearElasticVarForm::build_collision_mesh().
| void polyfem::utils::append_rows_of_zeros | ( | DstMat & | dst, |
| const size_t | n_zero_rows | ||
| ) |
Definition at line 167 of file MatrixUtils.hpp.
| void polyfem::utils::apply_common_params | ( | json & | args | ) |
Definition at line 62 of file JSONUtils.cpp.
References apply_common_params(), polyfem::io::ResourceIO::read_string(), and resolve_path().
| std::unique_ptr< const io::ResourceIO > polyfem::utils::apply_common_params | ( | json & | args, |
| const io::ResourceIO & | resources | ||
| ) |
Definition at line 24 of file JSONUtils.cpp.
References apply_common_params(), polyfem::io::ResourceIO::read_string(), and polyfem::io::ResourceIO::with_root().
Referenced by apply_common_params(), apply_common_params(), and polyfem::State::init().
| bool polyfem::utils::are_aabbs_intersecting | ( | const VectorNd & | aabb0_min, |
| const VectorNd & | aabb0_max, | ||
| const VectorNd & | aabb1_min, | ||
| const VectorNd & | aabb1_max | ||
| ) |
Determine if two axis-aligned bounding boxes intersect.
| aabb0_min | Minimum corner of the first AABB. |
| aabb0_max | Maximum corner of the first AABB. |
| aabb1_min | Minimum corner of the second AABB. |
| aabb1_max | Maximum corner of the second AABB. |
Definition at line 207 of file GeometryUtils.cpp.
| bool polyfem::utils::are_edges_collinear | ( | const VectorNd & | ea0, |
| const VectorNd & | ea1, | ||
| const VectorNd & | eb0, | ||
| const VectorNd & | eb1, | ||
| const double | tol = 1e-10 |
||
| ) |
Determine if two edges are collinear.
| ea0 | First vertex of the first edge. |
| ea1 | Second vertex of the first edge. |
| eb0 | First vertex of the second edge. |
| eb1 | Second vertex of the second edge. |
| tol | Tolerance for collinearity. |
Definition at line 180 of file GeometryUtils.cpp.
| bool polyfem::utils::are_triangles_coplanar | ( | const Eigen::Vector3d & | t00, |
| const Eigen::Vector3d & | t01, | ||
| const Eigen::Vector3d & | t02, | ||
| const Eigen::Vector3d & | t10, | ||
| const Eigen::Vector3d & | t11, | ||
| const Eigen::Vector3d & | t12, | ||
| const double | tol = 1e-10 |
||
| ) |
Determine if two triangles are coplanar.
| t00 | First vertex of the first triangle. |
| t01 | Second vertex of the first triangle. |
| t02 | Third vertex of the first triangle. |
| t10 | First vertex of the second triangle. |
| t11 | Second vertex of the second triangle. |
| t12 | Third vertex of the second triangle. |
| tol | Tolerance for coplanarity. |
Definition at line 193 of file GeometryUtils.cpp.
References polyfem::assembler::cross().
| Eigen::VectorXd polyfem::utils::barycentric_coordinates | ( | const Eigen::VectorXd & | p, |
| const Eigen::MatrixXd & | V | ||
| ) |
Compute barycentric coordinates for point p with respect to a simplex.
| p | Query point. |
| V | Verties of the simplex as rows of a matrix. |
Definition at line 99 of file GeometryUtils.cpp.
References V.
Referenced by polyfem::assembler::MassMatrixAssembler::assemble_cross().
| std::vector< int > polyfem::utils::count_invalid | ( | const int | dim, |
| const std::vector< basis::ElementBases > & | bases, | ||
| const std::vector< basis::ElementBases > & | gbases, | ||
| const Eigen::VectorXd & | u, | ||
| const unsigned | max_iter | ||
| ) |
Definition at line 122 of file Jacobian.cpp.
References extract_nodes(), polyfem::log_and_throw_error(), and polyfem::logger().
Referenced by polyfem::io::Evaluator::mark_flipped_cells(), polyfem::varform::BilaplacianVarForm::output_fields(), polyfem::varform::ScalarVarForm::output_fields(), polyfem::varform::NonlinearElasticVarForm::solve_tensor_nonlinear(), and polyfem::varform::DifferentiableNonlinearElasticVarForm::solve_tensor_nonlinear().
|
inline |
Referenced by polyfem::assembler::MixedNLAssembler::assemble_energy(), polyfem::assembler::NLAssembler::assemble_energy(), polyfem::assembler::MixedNLAssembler::assemble_energy_per_element(), polyfem::assembler::NLAssembler::assemble_energy_per_element(), polyfem::assembler::MixedNLAssembler::assemble_gradient(), polyfem::assembler::MixedNLAssembler::assemble_hessian(), polyfem::assembler::RhsAssembler::compute_energy(), polyfem::assembler::PressureAssembler::compute_grad_volume(), polyfem::assembler::PressureAssembler::compute_grad_volume_id(), polyfem::assembler::PressureAssembler::compute_hess_volume_2d(), polyfem::assembler::PressureAssembler::compute_hess_volume_3d(), polyfem::assembler::PressureAssembler::compute_volume(), polyfem::solver::ElasticForceDerivative::force_material_derivative(), polyfem::solver::BodyForceDerivative::force_shape_derivative(), polyfem::solver::InertiaForceDerivative::force_shape_derivative(), polyfem::solver::ElasticForceDerivative::force_shape_derivative(), polyfem::solver::AdjointTools::integrate_objective(), polyfem::assembler::PressureAssembler::is_closed_or_boundary_fixed(), polyfem::solver::InversionBarrierForm::second_derivative_unweighted(), polyfem::solver::SDFTargetForm::solution_changed_step(), and polyfem::solver::MeshTargetForm::solution_changed_step().
|
inline |
Definition at line 29 of file JSONUtils.hpp.
References deg2rad().
Referenced by polyfem::mesh::GeometryLoader::construct_affine_transformation(), deg2rad(), and to_rotation_matrix().
| T polyfem::utils::determinant | ( | const Eigen::Matrix< T, rows, cols, option, maxRow, maxCol > & | mat | ) |
Definition at line 22 of file MatrixUtils.hpp.
Referenced by polyfem::assembler::InversionBarrier::compute_output_stress(), polyfem::assembler::NeoHookeanElasticity::compute_output_stress(), polyfem::assembler::ElasticityAssembler::OutputStress::determinant(), polyfem::assembler::IsochoricNeoHookean::elastic_energy(), polyfem::assembler::MooneyRivlin3ParamElasticity::elastic_energy(), polyfem::assembler::MooneyRivlinElasticity::elastic_energy(), polyfem::assembler::NeoHookeanAutodiff::elastic_energy(), polyfem::assembler::VolumePenalty::elastic_energy(), polyfem::assembler::AMIPSEnergy::elastic_energy(), polyfem::assembler::MooneyRivlin3ParamSymbolic::elastic_energy(), polyfem::assembler::NeoHookeanElasticity::elastic_energy_density(), polyfem::utils::AutoFlipSVD< MatrixType >::flip2d(), polyfem::assembler::AMIPSEnergy::gradient(), polyfem::assembler::AMIPSEnergy::hessian(), polyfem::assembler::GenericFiber< FiberModel >::I4Bar_generic(), inverse(), polyfem::assembler::ElasticityAssembler::OutputStress::tensor(), and polyfem::third_invariant().
Expand string entries in dirichlet_boundary that point to .json files.
Definition at line 105 of file JSONUtils.cpp.
References polyfem::log_and_throw_error(), and resolve_path().
Referenced by polyfem::State::init().
| void polyfem::utils::expand_bc_sidecars | ( | json & | args, |
| const json & | rules, | ||
| const io::ResourceIO & | resources | ||
| ) |
Definition at line 156 of file JSONUtils.cpp.
References polyfem::log_and_throw_error(), and polyfem::io::ResourceIO::read_string().
| Eigen::MatrixXd polyfem::utils::extract_nodes | ( | const int | dim, |
| const basis::ElementBases & | basis, | ||
| const basis::ElementBases & | gbasis, | ||
| const Eigen::VectorXd & | u, | ||
| int | order | ||
| ) |
Definition at line 47 of file Jacobian.cpp.
References polyfem::assembler::ElementAssemblyValues::basis_values, polyfem::assembler::ElementAssemblyValues::compute(), polyfem::basis::ElementBases::eval_geom_mapping(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), and vals.
| Eigen::MatrixXd polyfem::utils::extract_nodes | ( | const int | dim, |
| const std::vector< basis::ElementBases > & | bases, | ||
| const std::vector< basis::ElementBases > & | gbases, | ||
| const Eigen::VectorXd & | u, | ||
| int | order, | ||
| int | n_elem | ||
| ) |
Definition at line 20 of file Jacobian.cpp.
References polyfem::assembler::ElementAssemblyValues::basis_values, polyfem::assembler::ElementAssemblyValues::compute(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), and vals.
Referenced by count_invalid(), polyfem::assembler::ElementAssemblyValues::eval_deformed_jacobian_determinant(), is_valid(), and max_time_step().
| Eigen::VectorXd polyfem::utils::flatten | ( | const Eigen::MatrixXd & | X | ) |
Flatten rowwises.
Definition at line 34 of file MatrixUtils.cpp.
References x.
Referenced by polyfem::solver::AMIPSForm::AMIPSForm(), polyfem::solver::PeriodicMeshToMesh::apply_jacobian(), polyfem::io::Evaluator::average_grad_based_function(), polyfem::solver::CollisionBarrierForm::CollisionBarrierForm(), polyfem::solver::BoundarySmoothingForm::compute_partial_gradient(), polyfem::solver::SpatialIntegralForm::compute_partial_gradient_step(), polyfem::assembler::NeoHookeanElasticity::compute_stiffness_value(), polyfem::solver::DeformedCollisionBarrierForm::DeformedCollisionBarrierForm(), polyfem::solver::BSplineParametrization1DTo2D::eval(), polyfem::solver::PeriodicContactForceDerivative::force_shape_derivative(), polyfem::solver::ElasticForceDerivative::force_shape_derivative(), polyfem::solver::NLHomoProblem::full_to_reduced(), polyfem::io::Evaluator::generate_linear_field(), polyfem::solver::ElasticEnergyForm::get_integral_functional(), polyfem::solver::ComplianceForm::get_integral_functional(), polyfem::solver::StressForm::get_integral_functional(), polyfem::varform::NonlinearElasticVarForm::init_homogenization_solve(), polyfem::solver::PeriodicShapeVariableToSimulation::inverse_eval(), polyfem::solver::BSplineParametrization1DTo2D::inverse_eval(), polyfem::solver::NLHomoProblem::macro_reduced_to_full(), polyfem::varform::GrowthElasticVarForm::replace_stress_fields(), polyfem::varform::NonlinearElasticVarForm::solve_homogenization_step(), polyfem::solver::InflatedPeriodicShapeVariableToSimulation::update(), and polyfem::solver::MacroStrainLagrangianForm::update_quantities().
| void polyfem::utils::full_to_reduced_matrix | ( | const int | full_size, |
| const int | reduced_size, | ||
| const std::vector< int > & | removed_vars, | ||
| const StiffnessMatrix & | full, | ||
| StiffnessMatrix & | reduced | ||
| ) |
Map a full size matrix to a reduced one by dropping rows and columns.
| [in] | full_size | Number of variables in the full system. |
| [in] | reduced_size | Number of variables in the reduced system. |
| [in] | removed_vars | Indices of the variables (rows and columns of full) to remove. |
| [in] | full | Full size matrix. |
| [out] | reduced | Output reduced size matrix. |
Definition at line 130 of file MatrixUtils.cpp.
References entries, and POLYFEM_SCOPED_TIMER.
|
inline |
Referenced by polyfem::assembler::MixedNLAssembler::assemble_energy(), polyfem::assembler::NLAssembler::assemble_energy(), polyfem::assembler::MixedNLAssembler::assemble_energy_per_element(), polyfem::assembler::NLAssembler::assemble_energy_per_element(), polyfem::assembler::MixedNLAssembler::assemble_gradient(), polyfem::assembler::MixedNLAssembler::assemble_hessian(), polyfem::assembler::RhsAssembler::compute_energy(), polyfem::solver::ElasticForceDerivative::force_material_derivative(), polyfem::solver::BodyForceDerivative::force_shape_derivative(), polyfem::solver::InertiaForceDerivative::force_shape_derivative(), polyfem::solver::ElasticForceDerivative::force_shape_derivative(), and polyfem::solver::AdjointTools::integrate_objective().
|
inline |
Definition at line 71 of file par_for.hpp.
References polyfem::utils::ScopedThreadLimit::current(), and polyfem::utils::NThread::get().
Referenced by polyfem::io::OutputWriter::Impl::execute(), par_for(), and polyfem::io::OutStatsData::save_json().
| Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > polyfem::utils::inverse | ( | const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, 0, 3, 3 > & | mat | ) |
Definition at line 38 of file MatrixUtils.hpp.
References determinant().
Referenced by polyfem::solver::NLProblem::grad_norm(), polyfem::mesh::stitch_mesh(), and polyfem::assembler::ElasticityAssembler::OutputStress::tensor().
| bool polyfem::utils::is_flipped | ( | const Eigen::MatrixXd & | V, |
| const Eigen::MatrixXi & | F | ||
| ) |
Determine if any simplex is inverted or collapses.
| V | Vertex positions as a V-by-dim matrix (one vertex per row). |
| F | Simplex indices as a F-by-(dim+1) matrix (one simplex per row). |
Definition at line 514 of file GeometryUtils.cpp.
References polyfem::F, tetrahedron_volume(), and V.
Referenced by polyfem::mesh::apply_slim(), polyfem::solver::AMIPSForm::is_step_valid(), and polyfem::solver::AdjointNLProblem::is_step_valid().
| bool polyfem::utils::is_param_valid | ( | const json & | params, |
| const std::string & | key | ||
| ) |
Determine if a key exists and is non-null in a json object.
| params | JSON of parameters |
| key | Key to check |
Definition at line 274 of file JSONUtils.cpp.
Referenced by polyfem::assembler::MacroStrainValue::init(), polyfem::OptState::init(), polyfem::State::init(), json_value(), polyfem::mesh::GeometryLoader::load_fem_entry(), polyfem::State::load_mesh(), polyfem::mesh::GeometryLoader::load_obstacles(), polyfem::mesh::GeometryLoader::load_surface(), polyfem::OptState::run(), polyfem::varform::VarForm::set_materials(), polyfem::assembler::GenericTensorProblem::set_parameters(), and polyfem::assembler::GenericScalarProblem::set_parameters().
| std::tuple< bool, int, Tree > polyfem::utils::is_valid | ( | const int | dim, |
| const std::vector< basis::ElementBases > & | bases, | ||
| const std::vector< basis::ElementBases > & | gbases, | ||
| const Eigen::VectorXd & | u, | ||
| const double | threshold, | ||
| const unsigned | max_iter | ||
| ) |
Definition at line 201 of file Jacobian.cpp.
References extract_nodes(), polyfem::log_and_throw_error(), and polyfem::logger().
Referenced by polyfem::solver::CollisionBarrierForm::is_step_collision_free(), polyfem::solver::ContactForm::is_step_collision_free(), polyfem::mesh::NCMesh2D::refine(), and polyfem::mesh::NCMesh3D::refine().
| std::vector< T > polyfem::utils::json_as_array | ( | const json & | j | ) |
Return the value of a json object as an array.
If the value is an array return it directly otherwise return a vector with the value.
| j | JSON object |
Definition at line 49 of file JSONUtils.hpp.
Referenced by polyfem::assembler::GenericMatParams::add_multimaterial(), polyfem::varform::DifferentiableVarForm::boundary_conditions_ids(), polyfem::varform::NonlinearElasticVarForm::build_collision_mesh(), polyfem::solver::SolveData::init_forms(), polyfem::OptState::init_variables(), polyfem::solver::DirichletBoundaryVariableToSimulation::inverse_eval(), polyfem::solver::PressureBoundaryVariableToSimulation::inverse_eval(), polyfem::mesh::GeometryLoader::load_fem(), polyfem::State::load_mesh(), polyfem::mesh::GeometryLoader::load_obstacles(), polyfem::solver::PressureBoundaryVariableToSimulation::PressureBoundaryVariableToSimulation(), polyfem::varform::GrowthElasticVarForm::read_growth_law(), and polyfem::problem::NodeProblem::set_parameters().
| T polyfem::utils::json_value | ( | const json & | params, |
| const std::string & | key, | ||
| const T & | default_value | ||
| ) |
Get a parameter from a json object or return a default value if the parameter invalid.
Similar to json::value() but return default value if the parameter is null.
Definition at line 67 of file JSONUtils.hpp.
References is_param_valid().
| Eigen::SparseMatrix< double > polyfem::utils::lump_matrix | ( | const Eigen::SparseMatrix< double > & | M | ) |
Lump each row of a matrix into the diagonal.
| M | Matrix to lump. |
Definition at line 84 of file MatrixUtils.cpp.
Referenced by polyfem::varform::BilaplacianVarForm::assemble_mass_mat(), polyfem::varform::ElasticVarForm::assemble_mass_mat(), polyfem::varform::FluidVarForm::assemble_mass_mat(), polyfem::varform::GrowthElasticVarForm::assemble_mass_mat(), polyfem::varform::IncompressibleElasticVarForm::assemble_mass_mat(), polyfem::varform::ScalarVarForm::assemble_mass_mat(), polyfem::varform::ThermoElasticVarForm::assemble_mass_mat(), and polyfem::solver::BCLagrangianForm::init_masked_lumped_mass().
| Eigen::SparseMatrix< double > polyfem::utils::lump_matrix_hrz | ( | const Eigen::SparseMatrix< double > & | M | ) |
Lump a (mass) matrix HRZ-style: keep the diagonal, scaled by a common factor so the total (sum of all entries) is preserved.
Unlike row-sum lumping this is positive for bases of any order (diagonal entries are integrals of squares).
Definition at line 103 of file MatrixUtils.cpp.
Referenced by polyfem::solver::BCLagrangianForm::init_masked_lumped_mass().
| Eigen::MatrixXi polyfem::utils::map_index_matrix | ( | const Eigen::MatrixXi & | in, |
| const Eigen::VectorXi & | index_mapping | ||
| ) |
Map the entrys of an index matrix to new indices.
| in | Input index matrix. |
| index_mapping | Mapping from old to new indices. |
Definition at line 250 of file MatrixUtils.cpp.
| T polyfem::utils::matrix_inner_product | ( | const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | A, |
| const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & | B | ||
| ) |
Definition at line 16 of file MatrixUtils.hpp.
| std::tuple< double, int, double, Tree > polyfem::utils::max_time_step | ( | const int | dim, |
| const std::vector< basis::ElementBases > & | bases, | ||
| const std::vector< basis::ElementBases > & | gbases, | ||
| const Eigen::VectorXd & | u1, | ||
| const Eigen::VectorXd & | u2, | ||
| double | precision, | ||
| double | threshold, | ||
| const unsigned | max_iter | ||
| ) |
Definition at line 286 of file Jacobian.cpp.
References extract_nodes(), polyfem::log_and_throw_error(), and polyfem::logger().
|
inline |
|
inline |
Referenced by polyfem::assembler::MixedNLAssembler::assemble_energy(), polyfem::assembler::NLAssembler::assemble_energy(), polyfem::assembler::MixedNLAssembler::assemble_energy_per_element(), polyfem::assembler::NLAssembler::assemble_energy_per_element(), polyfem::assembler::MixedNLAssembler::assemble_gradient(), polyfem::assembler::MixedNLAssembler::assemble_hessian(), polyfem::assembler::RhsAssembler::compute_energy(), polyfem::assembler::PressureAssembler::compute_grad_volume(), polyfem::assembler::PressureAssembler::compute_grad_volume_id(), polyfem::assembler::PressureAssembler::compute_hess_volume_2d(), polyfem::assembler::PressureAssembler::compute_hess_volume_3d(), polyfem::assembler::PressureAssembler::compute_volume(), polyfem::solver::InversionBarrierForm::first_derivative_unweighted(), polyfem::solver::ElasticForceDerivative::force_material_derivative(), polyfem::solver::BodyForceDerivative::force_shape_derivative(), polyfem::solver::InertiaForceDerivative::force_shape_derivative(), polyfem::solver::ElasticForceDerivative::force_shape_derivative(), polyfem::assembler::AssemblyValsCache::init(), polyfem::solver::AdjointTools::integrate_objective(), polyfem::assembler::PressureAssembler::is_closed_or_boundary_fixed(), polyfem::utils::SparseMatrixCache::operator+(), polyfem::utils::SparseMatrixCache::operator+=(), polyfem::solver::InversionBarrierForm::second_derivative_unweighted(), polyfem::solver::SDFTargetForm::solution_changed_step(), polyfem::solver::MeshTargetForm::solution_changed_step(), polyfem::solver::AdjointNLProblem::solve_pde(), polyfem::solver::BarrierContactForm::value_per_element_unweighted(), polyfem::solver::NormalAdhesionForm::value_per_element_unweighted(), polyfem::solver::InversionBarrierForm::value_unweighted(), and polyfem::solver::MaxStressForm::value_unweighted_step().
| polyfem::utils::NLOHMANN_JSON_SERIALIZE_ENUM | ( | PiecewiseInterpolation::Extend | , |
| {{PiecewiseInterpolation::Extend::CONSTANT, "constant"}, {PiecewiseInterpolation::Extend::EXTRAPOLATE, "extrapolate"}, {PiecewiseInterpolation::Extend::REPEAT, "repeat"}, {PiecewiseInterpolation::Extend::REPEAT_OFFSET, "repeat_offset"}} | |||
| ) |
| void polyfem::utils::par_for | ( | const int | size, |
| const std::function< void(int, int, int)> & | func | ||
| ) |
Definition at line 10 of file par_for.cpp.
References get_n_threads(), and x.
| bool polyfem::utils::python_gil_held | ( | ) |
Whether the caller holds Python's interpreter lock.
False without Python. Work that may invoke Python must stay on this thread until it releases the lock.
Definition at line 38 of file ExpressionValue.cpp.
Referenced by polyfem::varform::VarForm::save_timestep().
| void polyfem::utils::regular_2d_grid | ( | const int | n, |
| bool | tri, | ||
| Eigen::MatrixXd & | V, | ||
| Eigen::MatrixXi & | F | ||
| ) |
Generate a canonical triangle/quad subdivided from a regular grid.
| [in] | n | n grid quads |
| [in] | tri | is a tri or a quad |
| [out] | V | V x 2 output vertices positions |
| [out] | F | F x 3 output triangle indices |
Definition at line 34 of file RefElementSampler.cpp.
References polyfem::F, and V.
Referenced by polyfem::utils::RefElementSampler::build().
| void polyfem::utils::regular_3d_grid | ( | const int | nn, |
| bool | tet, | ||
| bool | prism, | ||
| bool | pyramid, | ||
| Eigen::MatrixXd & | V, | ||
| Eigen::MatrixXi & | F, | ||
| Eigen::MatrixXi & | T | ||
| ) |
Generate a canonical tet/hex subdivided from a regular grid.
| [in] | n | n grid quads |
| [in] | tet | is a tet |
| [in] | prism | is a prism |
| [in] | pyramid | is a pyramid |
| [out] | V | V x 3 output vertices positions |
| [out] | F | F x 3 output triangle indices |
| [out] | T | F x 4 output tet indices |
Definition at line 134 of file RefElementSampler.cpp.
References polyfem::F, V, and z.
Referenced by polyfem::utils::RefElementSampler::build().
| Eigen::MatrixXd polyfem::utils::reorder_matrix | ( | const Eigen::MatrixXd & | in, |
| const Eigen::VectorXi & | in_to_out, | ||
| int | out_blocks = -1, |
||
| const int | block_size = 1 |
||
| ) |
Reorder row blocks in a matrix.
| in | Input matrix. |
| in_to_out | Mapping from input blocks to output blocks. |
| out_blocks | Number of blocks in the output matrix. |
| block_size | Size of each block. |
Definition at line 189 of file MatrixUtils.cpp.
Referenced by polyfem::varform::VarForm::reorder_checkpoint_block().
| std::string polyfem::utils::resolve_path | ( | const std::string & | path, |
| const std::string & | input_file_path, | ||
| const bool | only_if_exists = false |
||
| ) |
Definition at line 103 of file StringUtils.cpp.
Referenced by apply_common_params(), and expand_bc_sidecars().
| Eigen::VectorXd polyfem::utils::robust_evaluate_jacobian | ( | const int | order, |
| const Eigen::MatrixXd & | cp, | ||
| const Eigen::MatrixXd & | uv | ||
| ) |
Definition at line 67 of file Jacobian.cpp.
References polyfem::log_and_throw_error(), polyfem::autogen::p_grad_basis_value_2d(), and polyfem::autogen::p_grad_basis_value_3d().
Referenced by polyfem::assembler::ElementAssemblyValues::eval_deformed_jacobian_determinant().
| void polyfem::utils::scatter_matrix | ( | const int | n_dofs, |
| const int | dim, | ||
| const Eigen::MatrixXd & | A, | ||
| const Eigen::MatrixXd & | b, | ||
| const std::vector< int > & | local_to_global, | ||
| StiffnessMatrix & | Aout, | ||
| Eigen::MatrixXd & | bout | ||
| ) |
Definition at line 265 of file MatrixUtils.cpp.
Referenced by polyfem::solver::SolveData::init_forms().
| void polyfem::utils::scatter_matrix | ( | const int | n_dofs, |
| const int | dim, | ||
| const std::vector< long > & | shape, | ||
| const std::vector< int > & | rows, | ||
| const std::vector< int > & | cols, | ||
| const std::vector< double > & | vals, | ||
| const Eigen::MatrixXd & | b, | ||
| const std::vector< int > & | local_to_global, | ||
| StiffnessMatrix & | Aout, | ||
| Eigen::MatrixXd & | bout | ||
| ) |
Definition at line 349 of file MatrixUtils.cpp.
| void polyfem::utils::scatter_matrix_col | ( | const int | n_dofs, |
| const int | dim, | ||
| const Eigen::MatrixXd & | A, | ||
| const Eigen::MatrixXd & | b, | ||
| const std::vector< int > & | local_to_global, | ||
| StiffnessMatrix & | Aout, | ||
| Eigen::MatrixXd & | bout | ||
| ) |
Definition at line 338 of file MatrixUtils.cpp.
References polyfem::log_and_throw_error().
Referenced by polyfem::solver::SolveData::init_forms().
| void polyfem::utils::scatter_matrix_col | ( | const int | n_dofs, |
| const int | dim, | ||
| const std::vector< long > & | shape, | ||
| const std::vector< int > & | rows, | ||
| const std::vector< int > & | cols, | ||
| const std::vector< double > & | vals, | ||
| const Eigen::MatrixXd & | b, | ||
| const std::vector< int > & | local_to_global, | ||
| StiffnessMatrix & | Aout, | ||
| Eigen::MatrixXd & | bout | ||
| ) |
Definition at line 429 of file MatrixUtils.cpp.
| void polyfem::utils::show_matrix_stats | ( | const Eigen::MatrixXd & | M | ) |
Definition at line 8 of file MatrixUtils.cpp.
References polyfem::logger().
Referenced by polyfem::basis::RBFWithQuadraticLagrange::compute_constraints_matrix_2d_old(), and polyfem::basis::RBFWithQuadraticLagrange::compute_constraints_matrix_3d().
| Eigen::Vector< double, dim > polyfem::utils::singular_values | ( | const Eigen::Matrix< double, dim, dim > & | A | ) |
Definition at line 383 of file svd.hpp.
References polyfem::utils::AutoFlipSVD< MatrixType >::singularValues().
Referenced by polyfem::utils::AutoFlipSVD< MatrixType >::fastComputeSingularValues3d(), and polyfem::utils::AutoFlipSVD< MatrixType >::fastSVD3d().
|
inline |
Definition at line 83 of file MatrixUtils.hpp.
Referenced by polyfem::solver::BCLagrangianForm::init_masked_lumped_mass().
| bool polyfem::utils::tetrahedron_intersects_ball | ( | const Eigen::Vector3d & | t0, |
| const Eigen::Vector3d & | t1, | ||
| const Eigen::Vector3d & | t2, | ||
| const Eigen::Vector3d & | t3, | ||
| const Eigen::Vector3d & | center, | ||
| const double | radius | ||
| ) |
Determine if a 3D tetrahedron intersects a 3D ball.
| t0 | Tetrahedron first vertex. |
| t1 | Tetrahedron second vertex. |
| t2 | Tetrahedron third vertex. |
| t3 | Tetrahedron fourth vertex. |
| center | Center of the ball. |
| radius | Radius of the ball. |
Definition at line 148 of file GeometryUtils.cpp.
| double polyfem::utils::tetrahedron_volume | ( | const Eigen::MatrixXd | V | ) |
Compute the signed volume of a tetrahedron defined by four points.
| V | The vertices of the terahedron as rows of a matrix. |
Definition at line 63 of file GeometryUtils.cpp.
References tetrahedron_volume(), and V.
| double polyfem::utils::tetrahedron_volume | ( | const Eigen::Vector3d & | a, |
| const Eigen::Vector3d & | b, | ||
| const Eigen::Vector3d & | c, | ||
| const Eigen::Vector3d & | d | ||
| ) |
Compute the signed volume of a tetrahedron defined by four points.
| a | First point of the tetrahedron. |
| b | Second point of the tetrahedron. |
| c | Third point of the tetrahedron. |
| d | Fourth point of the tetrahedron. |
Definition at line 54 of file GeometryUtils.cpp.
Referenced by polyfem::assembler::MassMatrixAssembler::assemble_cross(), polyfem::utils::TetrahedronClipping::clip(), polyfem::solver::InversionBarrierForm::element_volume(), is_flipped(), and tetrahedron_volume().
| void polyfem::utils::tetrahedron_volume_gradient | ( | double | ax, |
| double | ay, | ||
| double | az, | ||
| double | bx, | ||
| double | by, | ||
| double | bz, | ||
| double | cx, | ||
| double | cy, | ||
| double | cz, | ||
| double | dx, | ||
| double | dy, | ||
| double | dz, | ||
| double | g[12] | ||
| ) |
Compute the gradient of the signed volume of a tetrahedron defined by four points.
| ax | First point's x coordinate. |
| ay | First point's y coordinate. |
| ay | First point's z coordinate. |
| bx | Second point's x coordinate. |
| by | Second point's y coordinate. |
| by | Second point's z coordinate. |
| cx | Third point's x coordinate. |
| cy | Third point's y coordinate. |
| cy | Third point's z coordinate. |
| dx | Fourth point's x coordinate. |
| dy | Fourth point's y coordinate. |
| dy | Fourth point's z coordinate. |
| g | Output gradient with respect to the four points. |
Definition at line 272 of file GeometryUtils.cpp.
Referenced by polyfem::solver::InversionBarrierForm::element_volume_gradient().
| void polyfem::utils::tetrahedron_volume_hessian | ( | double | ax, |
| double | ay, | ||
| double | az, | ||
| double | bx, | ||
| double | by, | ||
| double | bz, | ||
| double | cx, | ||
| double | cy, | ||
| double | cz, | ||
| double | dx, | ||
| double | dy, | ||
| double | dz, | ||
| double | H[144] | ||
| ) |
Compute the gradient of the signed area of a 2D triangle defined by three points.
| ax | First point's x coordinate. |
| ay | First point's y coordinate. |
| ay | First point's z coordinate. |
| bx | Second point's x coordinate. |
| by | Second point's y coordinate. |
| by | Second point's z coordinate. |
| cx | Third point's x coordinate. |
| cy | Third point's y coordinate. |
| cy | Third point's z coordinate. |
| dx | Fourth point's x coordinate. |
| dy | Fourth point's y coordinate. |
| dy | Fourth point's z coordinate. |
| g | Output flattened Hessian with respect to the four points. |
Definition at line 306 of file GeometryUtils.cpp.
Referenced by polyfem::solver::InversionBarrierForm::element_volume_hessian().
| Eigen::Matrix3d polyfem::utils::to_rotation_matrix | ( | const json & | jr, |
| std::string | mode | ||
| ) |
Definition at line 204 of file JSONUtils.cpp.
References deg2rad().
Referenced by polyfem::mesh::GeometryLoader::construct_affine_transformation().
| double polyfem::utils::triangle_area | ( | const Eigen::MatrixXd | V | ) |
Compute the signed area of a triangle defined by three points.
| V | The vertices of the triangle as rows of a matrix. |
Definition at line 41 of file GeometryUtils.cpp.
References triangle_area_2D(), triangle_area_3D(), and V.
Referenced by polyfem::assembler::MassMatrixAssembler::assemble_cross(), polyfem::solver::InversionBarrierForm::element_volume(), polyfem::mesh::irregular_triangle(), and triangle_to_clockwise_order().
| double polyfem::utils::triangle_area_2D | ( | const Eigen::Vector2d & | a, |
| const Eigen::Vector2d & | b, | ||
| const Eigen::Vector2d & | c | ||
| ) |
Compute the signed area of a 2D triangle defined by three points.
| a | First point of the triangle. |
| b | Second point of the triangle. |
| c | Third point of the triangle. |
Definition at line 25 of file GeometryUtils.cpp.
Referenced by triangle_area().
| void polyfem::utils::triangle_area_2D_gradient | ( | double | ax, |
| double | ay, | ||
| double | bx, | ||
| double | by, | ||
| double | cx, | ||
| double | cy, | ||
| double | g[6] | ||
| ) |
Compute the gradient of the signed area of a 2D triangle defined by three points.
| ax | First point's x coordinate. |
| ay | First point's y coordinate. |
| bx | Second point's x coordinate. |
| by | Second point's y coordinate. |
| cx | Third point's x coordinate. |
| cy | Third point's y coordinate. |
| g | Output gradient with respect to the three points. |
Definition at line 220 of file GeometryUtils.cpp.
Referenced by polyfem::solver::InversionBarrierForm::element_volume_gradient().
| void polyfem::utils::triangle_area_2D_hessian | ( | double | ax, |
| double | ay, | ||
| double | bx, | ||
| double | by, | ||
| double | cx, | ||
| double | cy, | ||
| double | H[36] | ||
| ) |
Compute the Hessian of the signed area of a 2D triangle defined by three points.
| ax | First point's x coordinate. |
| ay | First point's y coordinate. |
| bx | Second point's x coordinate. |
| by | Second point's y coordinate. |
| cx | Third point's x coordinate. |
| cy | Third point's y coordinate. |
| g | Output flattened Hessian with respect to the three points. |
Definition at line 232 of file GeometryUtils.cpp.
Referenced by polyfem::solver::InversionBarrierForm::element_volume_hessian().
| double polyfem::utils::triangle_area_3D | ( | const Eigen::Vector3d & | a, |
| const Eigen::Vector3d & | b, | ||
| const Eigen::Vector3d & | c | ||
| ) |
Compute the area of a 3D triangle defined by three points.
| a | First point of the triangle. |
| b | Second point of the triangle. |
| c | Third point of the triangle. |
Definition at line 33 of file GeometryUtils.cpp.
Referenced by triangle_area().
| std::vector< Eigen::MatrixXd > polyfem::utils::triangle_fan | ( | const Eigen::MatrixXd & | convex_polygon | ) |
Convert a convex polygon to a list of triangles fanned around the first vertex.
| convex_polygon | The vertices of the convex polygon as rows of a matrix. |
Definition at line 85 of file GeometryUtils.cpp.
Referenced by polyfem::utils::TriangleClipping::clip().
| bool polyfem::utils::triangle_intersects_disk | ( | const Eigen::Vector2d & | t0, |
| const Eigen::Vector2d & | t1, | ||
| const Eigen::Vector2d & | t2, | ||
| const Eigen::Vector2d & | center, | ||
| const double | radius | ||
| ) |
Determine if a 2D triangle intersects a 2D disk.
| t0 | Triangle first vertex. |
| t1 | Triangle second vertex. |
| t2 | Triangle third vertex. |
| center | Center of the disk. |
| radius | Radius of the disk. |
Definition at line 118 of file GeometryUtils.cpp.
| Eigen::MatrixXd polyfem::utils::triangle_to_clockwise_order | ( | const Eigen::MatrixXd & | triangle | ) |
Reorder the vertices of a triangle so they are in clockwise order.
| triangle | The vertices of the triangle as rows of a matrix. |
Definition at line 69 of file GeometryUtils.cpp.
References triangle_area().
Referenced by polyfem::utils::TriangleClipping::clip().
| Eigen::MatrixXd polyfem::utils::unflatten | ( | const Eigen::VectorXd & | x, |
| int | dim | ||
| ) |
Unflatten rowwises, so every dim elements in x become a row.
Definition at line 53 of file MatrixUtils.cpp.
References x.
Referenced by polyfem::solver::AdjointNLProblem::after_line_search_custom_operation(), polyfem::varform::ElasticVarForm::append_primary_output_fields(), polyfem::solver::PeriodicMeshToMesh::apply_jacobian(), polyfem::solver::GCPContactForceForm::compute_adjoint_rhs_step(), polyfem::solver::ProxyContactForceForm::compute_adjoint_rhs_step(), polyfem::solver::ContactForm::compute_displaced_surface(), polyfem::solver::NormalAdhesionForm::compute_displaced_surface(), polyfem::solver::CollisionBarrierForm::compute_partial_gradient(), polyfem::solver::DeformedCollisionBarrierForm::compute_partial_gradient(), polyfem::solver::GCPContactForceForm::compute_partial_gradient_step(), polyfem::solver::SpatialIntegralForm::compute_partial_gradient_step(), polyfem::solver::ProxyContactForceForm::compute_partial_gradient_step(), polyfem::solver::FrictionForm::compute_surface_velocities(), polyfem::solver::TangentialAdhesionForm::compute_surface_velocities(), polyfem::varform::ElasticVarForm::elastic_output_fields(), polyfem::solver::PeriodicMeshToMesh::eval(), polyfem::solver::BSplineParametrization1DTo2D::eval(), polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::ElasticVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), polyfem::varform::OperatorSplittingVarForm::export_data(), polyfem::varform::ScalarVarForm::export_data(), polyfem::solver::InversionBarrierForm::first_derivative_unweighted(), polyfem::solver::PeriodicContactForceDerivative::force_shape_derivative(), polyfem::solver::FrictionForceDerivative::force_shape_derivative(), polyfem::solver::TangentialAdhesionForceDerivative::force_shape_derivative(), polyfem::solver::ElasticEnergyForm::get_integral_functional(), polyfem::utils::PiecewiseCubicInterpolation::init(), polyfem::varform::NonlinearElasticVarForm::init_solve_data(), polyfem::solver::PeriodicMeshToMesh::inverse_eval(), polyfem::solver::BSplineParametrization1DTo2D::inverse_eval(), polyfem::solver::BoundedBiharmonicWeights2Dto3D::inverse_eval(), polyfem::solver::CollisionBarrierForm::is_step_collision_free(), polyfem::solver::AMIPSForm::is_step_valid(), polyfem::solver::InversionBarrierForm::is_step_valid(), polyfem::solver::AdjointNLProblem::is_step_valid(), polyfem::solver::CollisionBarrierForm::max_step_size(), polyfem::varform::NonlinearElasticVarForm::output_fields(), polyfem::solver::NLHomoProblem::reduced_to_disp_grad(), polyfem::solver::NLHomoProblem::reduced_to_full(), polyfem::solver::InversionBarrierForm::second_derivative_unweighted(), polyfem::solver::CollisionBarrierForm::solution_changed(), polyfem::solver::DeformedCollisionBarrierForm::solution_changed(), polyfem::solver::GCPContactForceForm::solution_changed_step(), polyfem::solver::DirichletNodesVariableToSimulation::update(), polyfem::solver::PeriodicShapeVariableToSimulation::update(), polyfem::solver::CollisionBarrierForm::value_unweighted(), polyfem::solver::DeformedCollisionBarrierForm::value_unweighted(), polyfem::solver::InversionBarrierForm::value_unweighted(), polyfem::solver::GCPContactForceForm::value_unweighted_step(), polyfem::solver::ProxyContactForceForm::value_unweighted_step(), and vector2matrix().
| Eigen::MatrixXd polyfem::utils::unreorder_matrix | ( | const Eigen::MatrixXd & | out, |
| const Eigen::VectorXi & | in_to_out, | ||
| int | in_blocks = -1, |
||
| const int | block_size = 1 |
||
| ) |
Undo the reordering of row blocks in a matrix.
| out | Reordered matrix. |
| in_to_out | Mapping from input blocks to output blocks. |
| in_blocks | Number of blocks in the input matrix. |
| block_size | Size of each block. |
Definition at line 220 of file MatrixUtils.cpp.
Referenced by polyfem::varform::VarForm::reorder_checkpoint_block().
| void polyfem::utils::vector2matrix | ( | const Eigen::VectorXd & | vec, |
| Eigen::MatrixXd & | mat | ||
| ) |
Definition at line 69 of file MatrixUtils.cpp.
References unflatten(), and vec.
Referenced by polyfem::solver::ComplianceForm::compute_partial_gradient_step(), polyfem::solver::AdjointTools::compute_shape_derivative_functional_term(), polyfem::solver::ElasticForceDerivative::force_material_derivative(), polyfem::solver::ElasticForceDerivative::force_shape_derivative(), polyfem::solver::ComplianceForm::get_integral_functional(), and polyfem::solver::StressForm::get_integral_functional().