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 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 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 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_function (const mesh::Mesh &mesh, const int actual_dim, 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::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 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 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) |
computes scalar quantity of funtion (ie von mises for elasticity and norm of velocity for fluid) the scalar value is averaged around every node to make it continuos | |
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 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 velocy) | |
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 |
computes scalar quantity of funtion (ie von mises for elasticity and norm of velocity for fluid) the scalar value is averaged around every node to make it continuos
[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] | 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 | 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 152 of file Evaluator.cpp.
References polyfem::basis::ElementBases::bases, polyfem::assembler::Assembler::compute_scalar_value(), polyfem::mesh::Mesh::dimension(), polyfem::basis::Basis::global(), interpolate_function(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_simplex(), polyfem::logger(), polyfem::autogen::p_nodes_2d(), polyfem::autogen::p_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 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] | 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 592 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_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().
|
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] | 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 674 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_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(), 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] | assembler | assembler |
[in] | fun | function to use |
[out] | result | output displacement |
[out] | von_mises | output von mises |
Definition at line 283 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_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 velocy)
[in] | mesh | mesh |
[in] | is_problem_scalar | if problem is scalar |
[in] | bases | bases |
[in] | gbases | geom bases |
[in] | disc_orders | 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 772 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_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().
|
static |
Definition at line 884 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 871 of file Evaluator.cpp.
Referenced by polyfem::solver::NLHomoProblem::constraint_grad(), and generate_linear_field().
|
static |
Definition at line 892 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 559 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 492 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::ElasticForm::force_material_derivative(), polyfem::solver::InertiaForm::force_shape_derivative(), polyfem::solver::ElasticForm::force_shape_derivative(), polyfem::solver::BodyForm::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 510 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 56 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_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::mesh::Mesh3D::n_cell_faces(), polyfem::mesh::Mesh::n_elements(), 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] | 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 380 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] | 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 402 of file Evaluator.cpp.
References polyfem::basis::ElementBases::bases, polyfem::utils::RefElementSampler::cube_points(), polyfem::basis::ElementBases::evaluate_bases(), polyfem::basis::Basis::global(), 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().