|
PolyFEM
|
#include <Evaluator.hpp>
Public Member Functions | |
| bool | check_scalar_value (const mesh::Mesh &mesh, const bool is_problem_scalar, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const assembler::Assembler &assembler, const utils::RefElementSampler &sampler, const Eigen::MatrixXd &fun, const double t, const bool use_sampler, const bool boundary_only) |
| checks if mises are not nan | |
Static Public Member Functions | |
| static void | compute_stress_at_quadrature_points (const mesh::Mesh &mesh, const bool is_problem_scalar, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, const assembler::Assembler &assembler, const Eigen::MatrixXd &fun, const double t, Eigen::MatrixXd &result, Eigen::VectorXd &von_mises) |
| compute von mises stress at quadrature points for the function fun, also compute the interpolated function | |
| static void | interpolate_function (const mesh::Mesh &mesh, const bool is_problem_scalar, const std::vector< basis::ElementBases > &bases, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const utils::RefElementSampler &sampler, const int n_points, const Eigen::MatrixXd &fun, Eigen::MatrixXd &result, const bool use_sampler, const bool boundary_only) |
| interpolate the function fun. | |
| static void | mark_flipped_cells (const mesh::Mesh &mesh, const std::vector< basis::ElementBases > &gbasis, const std::vector< basis::ElementBases > &basis, const Eigen::VectorXi &disc_orders, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const utils::RefElementSampler &sampler, const int n_points, const Eigen::MatrixXd &fun, Eigen::Vector< bool, -1 > &result, const bool use_sampler, const bool boundary_only) |
| static void | interpolate_function (const mesh::Mesh &mesh, const int actual_dim, const std::vector< basis::ElementBases > &basis, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const utils::RefElementSampler &sampler, const int n_points, const Eigen::MatrixXd &fun, Eigen::MatrixXd &result, const bool use_sampler, const bool boundary_only) |
| interpolate the function fun. | |
| static void | interpolate_at_local_vals (const mesh::Mesh &mesh, const bool is_problem_scalar, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const int el_index, const Eigen::MatrixXd &local_pts, const Eigen::MatrixXd &fun, Eigen::MatrixXd &result, Eigen::MatrixXd &result_grad) |
| interpolate solution and gradient at element (calls interpolate_at_local_vals with sol) | |
| static void | interpolate_at_local_vals (const mesh::Mesh &mesh, const int actual_dim, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const int el_index, const Eigen::MatrixXd &local_pts, const Eigen::MatrixXd &fun, Eigen::MatrixXd &result, Eigen::MatrixXd &result_grad) |
| interpolate the function fun and its gradient at in element el_index for the local_pts in the reference element using bases bases interpolate solution and gradient at element (calls interpolate_at_local_vals with sol) | |
| static void | interpolate_at_local_vals (const int el_index, const int dim, const int actual_dim, const assembler::ElementAssemblyValues &vals, const Eigen::MatrixXd &fun, Eigen::MatrixXd &result, Eigen::MatrixXd &result_grad) |
| static void | compute_scalar_value (const mesh::Mesh &mesh, const bool is_problem_scalar, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const assembler::Assembler &assembler, const utils::RefElementSampler &sampler, const int n_points, const Eigen::MatrixXd &fun, const double t, std::vector< assembler::Assembler::NamedMatrix > &result, const bool use_sampler, const bool boundary_only) |
| computes scalar quantity of funtion (ie von mises for elasticity and norm of velocity for fluid) | |
| static void | average_grad_based_function (const mesh::Mesh &mesh, const bool is_problem_scalar, const int n_bases, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const assembler::Assembler &assembler, const utils::RefElementSampler &sampler, const double t, const int n_points, const Eigen::MatrixXd &fun, std::vector< assembler::Assembler::NamedMatrix > &result_scalar, std::vector< assembler::Assembler::NamedMatrix > &result_tensor, const bool use_sampler, const bool boundary_only) |
| calls compute_scalar_value (i.e von mises for elasticity and norm of velocity for fluid) and compute_tensor_value of funtion using the assembler the values are averaged around every node and interpolated using the bases to make them continuous. | |
| static void | compute_tensor_value (const mesh::Mesh &mesh, const bool is_problem_scalar, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const assembler::Assembler &assembler, const utils::RefElementSampler &sampler, const int n_points, const Eigen::MatrixXd &fun, const double t, std::vector< assembler::Assembler::NamedMatrix > &result, const bool use_sampler, const bool boundary_only) |
| compute tensor quantity (ie stress tensor or velocity) | |
| static void | interpolate_boundary_function (const mesh::Mesh &mesh, const bool is_problem_scalar, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::MatrixXd &pts, const Eigen::MatrixXi &faces, const Eigen::MatrixXd &fun, const bool compute_avg, Eigen::MatrixXd &result) |
| computes integrated solution (fun) per surface face. | |
| static Eigen::MatrixXd | generate_linear_field (const int n_bases, const std::shared_ptr< mesh::MeshNodes > mesh_nodes, const Eigen::MatrixXd &grad) |
| static Eigen::MatrixXd | get_bases_position (const int n_bases, const std::shared_ptr< mesh::MeshNodes > mesh_nodes) |
| static Eigen::VectorXd | integrate_function (const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const Eigen::MatrixXd &fun, const int dim, const int actual_dim) |
Private Member Functions | |
| Evaluator () | |
Definition at line 14 of file Evaluator.hpp.
|
inlineprivate |
Definition at line 17 of file Evaluator.hpp.
|
static |
calls compute_scalar_value (i.e von mises for elasticity and norm of velocity for fluid) and compute_tensor_value of funtion using the assembler the values are averaged around every node and interpolated using the bases to make them continuous.
the averaging is done over the full volume of the neighborhood elements and not just the voronoi/barycentric cell around the node.
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | n_bases | number of bases |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | disc_orders | discretization orders |
| [in] | disc_ordersq | discretization orders |
| [in] | polys | polygons |
| [in] | polys_3d | polyhedra |
| [in] | assembler | assembler |
| [in] | sampler | sampler for the local element |
| [in] | n_points | is the size of the output. |
| [in] | fun | function to be used |
| [out] | result_scalar | scalar value |
| [out] | result_tensor | tensor value |
| [in] | use_sampler | uses the sampler or not |
| [in] | boundary_only | interpolates only at boundary elements |
Definition at line 157 of file Evaluator.cpp.
References polyfem::basis::ElementBases::bases, polyfem::assembler::Assembler::compute_scalar_value(), polyfem::assembler::Assembler::compute_tensor_value(), polyfem::mesh::Mesh::dimension(), polyfem::utils::flatten(), interpolate_function(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_simplex(), polyfem::logger(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), polyfem::autogen::prism_nodes_3d(), polyfem::autogen::q_nodes_2d(), polyfem::autogen::q_nodes_3d(), quadrature, and vals.
Referenced by polyfem::io::OutGeometryData::save_volume().
| bool polyfem::io::Evaluator::check_scalar_value | ( | const mesh::Mesh & | mesh, |
| const bool | is_problem_scalar, | ||
| const std::vector< basis::ElementBases > & | bases, | ||
| const std::vector< basis::ElementBases > & | gbases, | ||
| const Eigen::VectorXi & | disc_orders, | ||
| const Eigen::VectorXi & | disc_ordersq, | ||
| const std::map< int, Eigen::MatrixXd > & | polys, | ||
| const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > & | polys_3d, | ||
| const assembler::Assembler & | assembler, | ||
| const utils::RefElementSampler & | sampler, | ||
| const Eigen::MatrixXd & | fun, | ||
| const double | t, | ||
| const bool | use_sampler, | ||
| const bool | boundary_only | ||
| ) |
checks if mises are not nan
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | disc_orders | discretization orders |
| [in] | disc_ordersq | discretization orders |
| [in] | polys | polygons |
| [in] | polys_3d | polyhedra |
| [in] | assembler | assembler |
| [in] | sampler | sampler for the local element |
| [in] | fun | function to used |
| [in] | use_sampler | uses the sampler or not |
| [in] | boundary_only | interpolates only at boundary elements |
Definition at line 734 of file Evaluator.cpp.
References polyfem::assembler::Assembler::compute_scalar_value(), polyfem::utils::RefElementSampler::cube_points(), polyfem::mesh::Mesh::is_boundary_element(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), polyfem::autogen::prism_nodes_3d(), polyfem::utils::RefElementSampler::prism_points(), polyfem::autogen::q_nodes_2d(), polyfem::autogen::q_nodes_3d(), polyfem::utils::RefElementSampler::sample_polygon(), polyfem::utils::RefElementSampler::sample_polyhedron(), and polyfem::utils::RefElementSampler::simplex_points().
|
static |
computes scalar quantity of funtion (ie von mises for elasticity and norm of velocity for fluid)
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | disc_orders | discretization orders |
| [in] | disc_ordersq | discretization orders |
| [in] | polys | polygons |
| [in] | polys_3d | polyhedra |
| [in] | assembler | assembler |
| [in] | sampler | sampler for the local element |
| [in] | n_points | is the size of the output. |
| [in] | fun | function to used |
| [out] | result | scalar value |
| [in] | use_sampler | uses the sampler or not |
| [in] | boundary_only | interpolates only at boundary elements |
Definition at line 821 of file Evaluator.cpp.
References polyfem::assembler::Assembler::compute_scalar_value(), polyfem::utils::RefElementSampler::cube_points(), polyfem::mesh::Mesh::is_boundary_element(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), polyfem::autogen::prism_nodes_3d(), polyfem::utils::RefElementSampler::prism_points(), polyfem::autogen::q_nodes_2d(), polyfem::autogen::q_nodes_3d(), polyfem::utils::RefElementSampler::sample_polygon(), polyfem::utils::RefElementSampler::sample_polyhedron(), and polyfem::utils::RefElementSampler::simplex_points().
Referenced by polyfem::io::OutGeometryData::save_volume(), and polyfem::io::OutGeometryData::save_wire().
|
static |
compute von mises stress at quadrature points for the function fun, also compute the interpolated function
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | disc_orders | discretization orders |
| [in] | disc_ordersq | discretization orders |
| [in] | assembler | assembler |
| [in] | fun | function to use |
| [out] | result | output displacement |
| [out] | von_mises | output von mises |
Definition at line 332 of file Evaluator.cpp.
References polyfem::assembler::Assembler::compute_scalar_value(), polyfem::assembler::Assembler::compute_tensor_value(), polyfem::mesh::Mesh::dimension(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::mesh::Mesh::n_elements(), and polyfem::quadrature::Quadrature::points.
Referenced by polyfem::io::OutGeometryData::export_data().
|
static |
compute tensor quantity (ie stress tensor or velocity)
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | disc_orders | discretization orders |
| [in] | disc_ordersq | discretization orders |
| [in] | polys | polygons |
| [in] | polys_3d | polyhedra |
| [in] | assembler | assembler |
| [in] | sampler | sampler for the local element |
| [in] | n_points | is the size of the output. |
| [in] | fun | function to used |
| [out] | result | resulting tensor |
| [in] | use_sampler | uses the sampler or not |
| [in] | boundary_only | interpolates only at boundary elements |
Definition at line 924 of file Evaluator.cpp.
References polyfem::assembler::Assembler::compute_tensor_value(), polyfem::utils::RefElementSampler::cube_points(), polyfem::mesh::Mesh::dimension(), polyfem::mesh::Mesh::is_boundary_element(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), polyfem::autogen::prism_nodes_3d(), polyfem::utils::RefElementSampler::prism_points(), polyfem::autogen::q_nodes_2d(), polyfem::autogen::q_nodes_3d(), polyfem::utils::RefElementSampler::sample_polygon(), polyfem::utils::RefElementSampler::sample_polyhedron(), and polyfem::utils::RefElementSampler::simplex_points().
Referenced by polyfem::io::OutGeometryData::save_volume().
|
static |
Definition at line 1041 of file Evaluator.cpp.
References polyfem::utils::flatten(), and get_bases_position().
Referenced by polyfem::solver::NLHomoProblem::full_to_reduced(), polyfem::solver::NLHomoProblem::reduced_to_full(), and polyfem::State::solve_homogenization().
|
static |
Definition at line 1028 of file Evaluator.cpp.
Referenced by polyfem::solver::NLHomoProblem::constraint_grad(), and generate_linear_field().
|
static |
Definition at line 1049 of file Evaluator.cpp.
References polyfem::assembler::ElementAssemblyValues::compute(), da, interpolate_at_local_vals(), quadrature, and vals.
Referenced by polyfem::State::solve_homogenization_step(), and polyfem::State::solve_linear().
|
static |
Definition at line 701 of file Evaluator.cpp.
References polyfem::logger(), val, and vals.
|
static |
interpolate solution and gradient at element (calls interpolate_at_local_vals with sol)
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | el_index | element index |
| [in] | local_pts | points in the reference element |
| [in] | fun | function to use |
| [out] | result | output |
| [out] | result_grad | output gradients |
Definition at line 634 of file Evaluator.cpp.
References polyfem::mesh::Mesh::dimension(), and interpolate_at_local_vals().
Referenced by polyfem::solver::ComplianceForm::compute_partial_gradient_step(), 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::AccelerationForm::get_integral_functional(), polyfem::solver::KineticForm::get_integral_functional(), polyfem::solver::TargetForm::get_integral_functional(), integrate_function(), polyfem::solver::AdjointTools::integrate_objective(), interpolate_at_local_vals(), polyfem::io::OutGeometryData::save_surface(), and polyfem::io::OutGeometryData::save_volume().
|
static |
interpolate the function fun and its gradient at in element el_index for the local_pts in the reference element using bases bases interpolate solution and gradient at element (calls interpolate_at_local_vals with sol)
| [in] | mesh | mesh |
| [in] | actual_dim | is the size of the problem (e.g., 1 for Laplace, dim for elasticity) |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | el_index | element index |
| [in] | local_pts | points in the reference element |
| [in] | fun | function to used |
| [out] | result | output |
| [out] | result_grad | output gradients |
Definition at line 652 of file Evaluator.cpp.
References polyfem::assembler::ElementAssemblyValues::compute(), polyfem::mesh::Mesh::dimension(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), val, and vals.
|
static |
computes integrated solution (fun) per surface face.
pts and faces are the boundary are the boundary on the rest configuration
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | bases | bases |
| [in] | gbases | geom bases |
| [in] | pts | boundary points |
| [in] | faces | boundary faces |
| [in] | fun | function to used |
| [in] | compute_avg | if compute the average across elements |
| [out] | result | resulting value |
Definition at line 59 of file Evaluator.cpp.
References polyfem::basis::ElementBases::bases, polyfem::mesh::Mesh3D::cell_face(), polyfem::assembler::ElementAssemblyValues::compute(), polyfem::mesh::Mesh::face_barycenter(), faces, polyfem::assembler::AssemblyValues::global, polyfem::mesh::Mesh::is_boundary_face(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::mesh::Mesh3D::n_cell_faces(), polyfem::mesh::Mesh::n_elements(), polyfem::utils::BoundarySampler::quadrature_for_prism_face(), polyfem::utils::BoundarySampler::quadrature_for_quad_face(), polyfem::utils::BoundarySampler::quadrature_for_tri_face(), polyfem::assembler::AssemblyValues::val, and vals.
|
static |
interpolate the function fun.
| [in] | mesh | mesh |
| [in] | is_problem_scalar | if problem is scalar |
| [in] | bases | bases |
| [in] | disc_orders | discretization orders |
| [in] | disc_ordersq | discretization orders |
| [in] | polys | polygons |
| [in] | polys_3d | polyhedra |
| [in] | sampler | sampler for the local element |
| [in] | n_points | is the size of the output. |
| [in] | fun | function to used |
| [out] | result | output |
| [in] | use_sampler | uses the sampler or not |
| [in] | boundary_only | interpolates only at boundary elements |
Definition at line 437 of file Evaluator.cpp.
References polyfem::mesh::Mesh::dimension(), and interpolate_function().
Referenced by average_grad_based_function(), interpolate_function(), polyfem::io::OutGeometryData::save_volume(), polyfem::io::OutGeometryData::save_volume_vector_field(), and polyfem::io::OutGeometryData::save_wire().
|
static |
interpolate the function fun.
| [in] | mesh | mesh |
| [in] | actual_dim | is the size of the problem (e.g., 1 for Laplace, dim for elasticity) |
| [in] | bases | bases |
| [in] | disc_orders | discretization orders |
| [in] | disc_ordersq | discretization orders |
| [in] | polys | polygons |
| [in] | polys_3d | polyhedra |
| [in] | sampler | sampler for the local element |
| [in] | n_points | is the size of the output. |
| [in] | fun | function to used |
| [out] | result | output |
| [in] | use_sampler | uses the sampler or not |
| [in] | boundary_only | interpolates only at boundary elements |
Definition at line 538 of file Evaluator.cpp.
References polyfem::basis::ElementBases::bases, polyfem::utils::RefElementSampler::cube_points(), polyfem::basis::ElementBases::evaluate_bases(), polyfem::mesh::Mesh::is_boundary_element(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), polyfem::autogen::prism_nodes_3d(), polyfem::utils::RefElementSampler::prism_points(), polyfem::autogen::q_nodes_2d(), polyfem::autogen::q_nodes_3d(), polyfem::utils::RefElementSampler::sample_polygon(), polyfem::utils::RefElementSampler::sample_polyhedron(), and polyfem::utils::RefElementSampler::simplex_points().
|
static |
Definition at line 460 of file Evaluator.cpp.
References polyfem::utils::count_invalid(), polyfem::utils::RefElementSampler::cube_points(), polyfem::mesh::Mesh::dimension(), polyfem::mesh::Mesh::is_boundary_element(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_nodes_3d(), polyfem::autogen::q_nodes_2d(), polyfem::autogen::q_nodes_3d(), polyfem::utils::RefElementSampler::sample_polygon(), polyfem::utils::RefElementSampler::sample_polyhedron(), and polyfem::utils::RefElementSampler::simplex_points().
Referenced by polyfem::io::OutGeometryData::save_volume().