|
PolyFEM
|
Utilies related to export of geometry. More...
#include <OutData.hpp>
Classes | |
| struct | ExportOptions |
| different export flags More... | |
Public Member Functions | |
| void | init_sampler (const polyfem::mesh::Mesh &mesh, const double vismesh_rel_area) |
| unitalize the ref element sampler | |
| void | build_grid (const polyfem::mesh::Mesh &mesh, const double spacing) |
| builds the grid to export the solution | |
| void | export_data (const OutputSpace &space, const OutputFieldFunction &output_fields, const bool is_time_dependent, const double tend_in, const double dt, const ExportOptions &opts, const std::string &vis_mesh_path) const |
| exports everytihng, txt, vtu, etc | |
| void | save_vtu (const std::string &path, const OutputSpace &space, const OutputFieldFunction &output_fields, const double t, const double dt, const ExportOptions &opts) const |
| saves the vtu file for time t | |
| void | save_volume (const std::string &path, const OutputSpace &space, const OutputFieldFunction &output_fields, const double t, const double dt, const ExportOptions &opts) const |
| saves the volume vtu file | |
| void | save_surface (const std::string &export_surface, const OutputSpace &space, const OutputFieldFunction &output_fields, const double t, const double dt_in, const ExportOptions &opts) const |
| saves the surface vtu file for for surface quantites, eg traction forces | |
| void | save_contact_surface (const std::string &export_surface, const OutputSpace &space, const OutputFieldFunction &output_fields, const double t, const double dt_in, const ExportOptions &opts) const |
| saves the surface vtu file for for constact quantites, eg contact or friction forces | |
| void | save_wire (const std::string &name, const OutputSpace &space, const OutputFieldFunction &output_fields, const double t, const ExportOptions &opts) const |
| saves the wireframe | |
| void | save_points (const std::string &path, const OutputSpace &space, const OutputFieldFunction &output_fields, const ExportOptions &opts) const |
| saves the nodal values | |
| void | save_pvd (const std::string &name, const std::function< std::string(int)> &vtu_names, int time_steps, double t0, double dt, int skip_frame=1) const |
| save a PVD of a time dependent simulation | |
Static Public Member Functions | |
| static void | extract_boundary_mesh (const mesh::Mesh &mesh, const int n_bases, const std::vector< basis::ElementBases > &bases, const std::vector< mesh::LocalBoundary > &total_local_boundary, Eigen::MatrixXd &node_positions, Eigen::MatrixXi &boundary_edges, Eigen::MatrixXi &boundary_triangles, std::vector< Eigen::Triplet< double > > &displacement_map_entries) |
| extracts the boundary mesh | |
Private Member Functions | |
| void | build_vis_boundary_mesh (const mesh::Mesh &mesh, const std::vector< basis::ElementBases > &gbases, const std::vector< mesh::LocalBoundary > &total_local_boundary, Eigen::MatrixXd &boundary_vis_vertices, Eigen::MatrixXd &boundary_vis_local_vertices, Eigen::MatrixXi &boundary_vis_elements, Eigen::MatrixXi &boundary_vis_elements_ids, Eigen::MatrixXi &boundary_vis_primitive_ids, Eigen::MatrixXd &boundary_vis_normals) const |
| builds the boundary mesh for visualization | |
| void | build_vis_mesh (const mesh::Mesh &mesh, const Eigen::VectorXi &disc_orders, const std::vector< basis::ElementBases > &gbases, const std::map< int, Eigen::MatrixXd > &polys, const std::map< int, std::pair< Eigen::MatrixXd, Eigen::MatrixXi > > &polys_3d, const bool boundary_only, Eigen::MatrixXd &points, Eigen::MatrixXi &tets, Eigen::MatrixXi &el_id, Eigen::MatrixXd &discr, Eigen::MatrixXd &local_points) const |
| builds visualzation mesh, upsampled mesh used for visualization the visualization mesh is a dense mesh per element all disconnected it also retuns the mapping to element id and discretization of every elment works in 2 and 3d. | |
| void | build_high_order_vis_mesh (const mesh::Mesh &mesh, const Eigen::VectorXi &output_orders, const std::vector< basis::ElementBases > &bases, Eigen::MatrixXd &points, std::vector< paraviewo::CellElement > &elements, Eigen::MatrixXi &el_id, Eigen::MatrixXd &discr, Eigen::MatrixXd &local_points) const |
| builds high-der visualzation mesh per element all disconnected it also retuns the mapping to element id and discretization of every elment works in 2 and 3d. | |
Private Attributes | |
| utils::RefElementSampler | ref_element_sampler |
| used to sample the solution | |
| Eigen::MatrixXd | grid_points |
| grid mesh points to export solution sampled on a grid | |
| Eigen::MatrixXi | grid_points_to_elements |
| grid mesh mapping to fe elements | |
| Eigen::MatrixXd | grid_points_bc |
| grid mesh boundaries | |
Utilies related to export of geometry.
Definition at line 23 of file OutData.hpp.
| void polyfem::io::OutGeometryData::build_grid | ( | const polyfem::mesh::Mesh & | mesh, |
| const double | spacing | ||
| ) |
builds the grid to export the solution
| [in] | mesh | mesh |
| [in] | spacing | grid spacing, <=0 mean no grid |
Definition at line 1630 of file OutData.cpp.
References polyfem::mesh::Mesh::barycentric_coords(), polyfem::mesh::Mesh::bounding_box(), polyfem::mesh::Mesh::elements_boxes(), grid_points, grid_points_bc, grid_points_to_elements, polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), x, y, and z.
Referenced by polyfem::varform::VarForm::ensure_output_sampler().
|
private |
builds high-der visualzation mesh per element all disconnected it also retuns the mapping to element id and discretization of every elment works in 2 and 3d.
if the mesh is not simplicial it gets tri/tet halized
| [in] | mesh | mesh |
| [in] | output_orders | output cell order per element |
| [in] | bases | bases used to map output reference nodes |
| [out] | points | mesh points |
| [out] | elements | mesh high-order cells |
| [out] | el_id | mapping from points to elements id |
| [out] | discr | mapping from points to discretization order |
Referenced by save_volume().
|
private |
builds the boundary mesh for visualization
| [in] | mesh | mesh |
| [in] | gbases | geometric bases |
| [in] | total_local_boundary | boundaries |
| [out] | boundary_vis_vertices | boundary visualization mesh vertices |
| [out] | boundary_vis_local_vertices | boundary visualization mesh vertices pre image in ref element |
| [out] | boundary_vis_elements | boundary visualization mesh connectivity |
| [out] | boundary_vis_elements_ids | boundary visualization mesh elements ids |
| [out] | boundary_vis_primitive_ids | boundary visualization mesh edge/face id |
| [out] | boundary_vis_normals | boundary visualization mesh normals |
Definition at line 495 of file OutData.cpp.
References polyfem::mesh::Mesh::is_volume(), polyfem::utils::BoundarySampler::normal_for_polygon_edge(), polyfem::utils::BoundarySampler::normal_for_prism_face(), polyfem::utils::BoundarySampler::normal_for_pyramid_face(), polyfem::utils::BoundarySampler::normal_for_quad_edge(), polyfem::utils::BoundarySampler::normal_for_quad_face(), polyfem::utils::BoundarySampler::normal_for_tri_edge(), polyfem::utils::BoundarySampler::normal_for_tri_face(), polyfem::utils::RefElementSampler::num_samples(), ref_element_sampler, polyfem::utils::BoundarySampler::sample_parametric_prism_face(), polyfem::utils::BoundarySampler::sample_parametric_pyramid_face(), polyfem::utils::BoundarySampler::sample_parametric_quad_edge(), polyfem::utils::BoundarySampler::sample_parametric_quad_face(), polyfem::utils::BoundarySampler::sample_parametric_tri_edge(), polyfem::utils::BoundarySampler::sample_parametric_tri_face(), polyfem::utils::BoundarySampler::sample_polygon_edge(), and vals.
Referenced by save_surface().
|
private |
builds visualzation mesh, upsampled mesh used for visualization the visualization mesh is a dense mesh per element all disconnected it also retuns the mapping to element id and discretization of every elment works in 2 and 3d.
if the mesh is not simplicial it gets tri/tet halized
| [in] | mesh | mesh |
| [in] | disc_orders | discretization orders |
| [in] | gbases | geometric bases |
| [in] | polys | polygons |
| [in] | polys_3d | polyhedra |
| [in] | boundary_only | is build only elements touching the boundary |
| [out] | points | mesh points |
| [out] | tets | mesh cells |
| [out] | el_id | mapping from points to elements id |
| [out] | discr | mapping from points to discretization order |
Definition at line 721 of file OutData.cpp.
References polyfem::mesh::Mesh::dimension(), polyfem::mesh::Mesh::is_boundary_element(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_pyramid(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_volume(), ref_element_sampler, and polyfem::utils::RefElementSampler::simplex_volume().
Referenced by save_volume(), and save_wire().
| void polyfem::io::OutGeometryData::export_data | ( | const OutputSpace & | space, |
| const OutputFieldFunction & | output_fields, | ||
| const bool | is_time_dependent, | ||
| const double | tend_in, | ||
| const double | dt, | ||
| const ExportOptions & | opts, | ||
| const std::string & | vis_mesh_path | ||
| ) | const |
exports everytihng, txt, vtu, etc
| [in] | space | output geometry data |
| [in] | output_fields | callback appending physics-specific fields |
| [in] | is_time_dependent | if the sim is time dependent |
| [in] | tend_in | end time |
| [in] | dt | delta t |
| [in] | opts | export options |
| [in] | vis_mesh_path | vtu path |
Definition at line 1124 of file OutData.cpp.
References polyfem::logger(), polyfem::io::OutputSpace::mesh, and save_vtu().
Referenced by polyfem::varform::BilaplacianVarForm::export_data(), polyfem::varform::FluidVarForm::export_data(), and polyfem::varform::ScalarVarForm::export_data().
|
static |
extracts the boundary mesh
| [in] | mesh | mesh |
| [in] | n_bases | number of bases |
| [in] | bases | bases |
| [in] | total_local_boundary | mesh boundaries |
| [out] | node_positions | nodes positions |
| [out] | boundary_edges | edges |
| [out] | boundary_triangles | triangles |
| [out] | displacement_map | map of collision mesh vertices to nodes, empty if identity |
Definition at line 95 of file OutData.cpp.
References polyfem::basis::Basis::global(), polyfem::mesh::Mesh::has_poly(), polyfem::mesh::Mesh::is_conforming(), polyfem::mesh::Mesh::is_cube(), polyfem::mesh::Mesh::is_prism(), polyfem::mesh::Mesh::is_pyramid(), polyfem::mesh::Mesh::is_simplex(), polyfem::mesh::Mesh::is_simplicial(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), and polyfem::mesh::Mesh::n_faces().
Referenced by polyfem::varform::NonlinearElasticVarForm::build_collision_mesh().
| void polyfem::io::OutGeometryData::init_sampler | ( | const polyfem::mesh::Mesh & | mesh, |
| const double | vismesh_rel_area | ||
| ) |
unitalize the ref element sampler
| [in] | mesh | mesh |
| [in] | vismesh_rel_area | relative sampling size |
Definition at line 1625 of file OutData.cpp.
References polyfem::utils::RefElementSampler::init(), polyfem::mesh::Mesh::is_volume(), polyfem::mesh::Mesh::n_elements(), and ref_element_sampler.
Referenced by polyfem::varform::VarForm::ensure_output_sampler().
| void polyfem::io::OutGeometryData::save_contact_surface | ( | const std::string & | export_surface, |
| const OutputSpace & | space, | ||
| const OutputFieldFunction & | output_fields, | ||
| const double | t, | ||
| const double | dt_in, | ||
| const ExportOptions & | opts | ||
| ) | const |
saves the surface vtu file for for constact quantites, eg contact or friction forces
| [in] | export_surface | filename |
| [in] | space | output geometry data |
| [in] | output_fields | callback appending physics-specific fields |
| [in] | t | time |
| [in] | dt_in | delta_t |
| [in] | opts | export options |
Definition at line 1472 of file OutData.cpp.
References polyfem::io::OutputSample::cell_count, polyfem::io::OutputSpace::collision_mesh, polyfem::io::OutputSample::Contact, polyfem::io::OutputSample::domain, polyfem::io::OutputSample::dt, polyfem::io::OutputSample::points, polyfem::io::OutputSample::time, and polyfem::io::OutGeometryData::ExportOptions::use_hdf5.
Referenced by save_vtu().
| void polyfem::io::OutGeometryData::save_points | ( | const std::string & | path, |
| const OutputSpace & | space, | ||
| const OutputFieldFunction & | output_fields, | ||
| const ExportOptions & | opts | ||
| ) | const |
saves the nodal values
| [in] | path | filename |
| [in] | space | output geometry data |
| [in] | output_fields | callback appending physics-specific fields |
| [in] | opts | export options |
Definition at line 1563 of file OutData.cpp.
References polyfem::io::OutputSample::cell_count, polyfem::mesh::Mesh::dimension(), polyfem::io::OutputSpace::dirichlet_nodes, polyfem::io::OutputSpace::dirichlet_nodes_position, polyfem::io::OutputSample::domain, polyfem::io::OutGeometryData::ExportOptions::export_field(), polyfem::mesh::Mesh::get_node_id(), polyfem::io::OutputSpace::mesh, polyfem::io::OutputSample::node_ids, polyfem::io::OutputSample::Points, polyfem::io::OutputSample::points, and polyfem::io::OutGeometryData::ExportOptions::use_hdf5.
Referenced by save_vtu().
| void polyfem::io::OutGeometryData::save_pvd | ( | const std::string & | name, |
| const std::function< std::string(int)> & | vtu_names, | ||
| int | time_steps, | ||
| double | t0, | ||
| double | dt, | ||
| int | skip_frame = 1 |
||
| ) | const |
save a PVD of a time dependent simulation
| [in] | name | filename |
| [in] | vtu_names | names of the vtu files |
| [in] | time_steps | total time stesp |
| [in] | t0 | initial time |
| [in] | dt | delta t |
| [in] | skip_frame | every which frame to skip |
Definition at line 1617 of file OutData.cpp.
Referenced by polyfem::varform::VarForm::save_timestep().
| void polyfem::io::OutGeometryData::save_surface | ( | const std::string & | export_surface, |
| const OutputSpace & | space, | ||
| const OutputFieldFunction & | output_fields, | ||
| const double | t, | ||
| const double | dt_in, | ||
| const ExportOptions & | opts | ||
| ) | const |
saves the surface vtu file for for surface quantites, eg traction forces
| [in] | export_surface | filename |
| [in] | space | output geometry data |
| [in] | output_fields | callback appending physics-specific fields |
| [in] | t | time |
| [in] | dt_in | delta_t |
| [in] | opts | export options |
Definition at line 1401 of file OutData.cpp.
References build_vis_boundary_mesh(), polyfem::io::OutputSample::cell_count, polyfem::io::OutputSample::domain, polyfem::io::OutputSample::dt, polyfem::io::OutputSample::element_ids, polyfem::io::OutGeometryData::ExportOptions::export_field(), polyfem::io::OutputSpace::geometry_bases, polyfem::mesh::Mesh::get_boundary_id(), polyfem::mesh::Mesh::is_volume(), polyfem::io::OutputSample::local_points, polyfem::io::OutputSpace::mesh, polyfem::mesh::Mesh::n_elements(), polyfem::io::OutputSample::normals, polyfem::io::OutputSpace::output_orders, polyfem::io::OutputSample::points, polyfem::io::OutputSample::primitive_ids, polyfem::io::OutputSample::Surface, polyfem::io::OutputSample::time, polyfem::io::OutputSpace::total_local_boundary, and polyfem::io::OutGeometryData::ExportOptions::use_hdf5.
Referenced by save_vtu().
| void polyfem::io::OutGeometryData::save_volume | ( | const std::string & | path, |
| const OutputSpace & | space, | ||
| const OutputFieldFunction & | output_fields, | ||
| const double | t, | ||
| const double | dt, | ||
| const ExportOptions & | opts | ||
| ) | const |
saves the volume vtu file
| [in] | path | filename |
| [in] | space | output geometry data |
| [in] | output_fields | callback appending physics-specific fields |
| [in] | t | time |
| [in] | dt | delta t |
| [in] | opts | export options |
Definition at line 1248 of file OutData.cpp.
References polyfem::io::OutGeometryData::ExportOptions::boundary_only, build_high_order_vis_mesh(), build_vis_mesh(), polyfem::io::OutputSample::cell_count, polyfem::mesh::Mesh::dimension(), polyfem::io::OutGeometryData::ExportOptions::discretization_order, polyfem::io::OutputSample::domain, polyfem::io::OutputSample::dt, polyfem::io::OutputSample::element_ids, polyfem::io::OutGeometryData::ExportOptions::export_field(), polyfem::io::OutputSpace::geometry_bases, polyfem::mesh::Obstacle::get_edge_connectivity(), polyfem::mesh::Obstacle::get_face_connectivity(), polyfem::mesh::Obstacle::get_vertex_connectivity(), polyfem::io::OutputSample::Grid, grid_points, grid_points_bc, grid_points_to_elements, polyfem::mesh::Mesh::is_volume(), polyfem::io::OutputSample::local_points, polyfem::io::OutputSpace::mesh, polyfem::mesh::Mesh::n_elements(), polyfem::mesh::Obstacle::n_vertices(), polyfem::io::OutputSpace::obstacle, polyfem::io::OutputSpace::output_orders, polyfem::io::OutputField::Point, polyfem::io::OutputSample::points, polyfem::io::OutputSpace::polys, polyfem::io::OutputSpace::polys_3d, polyfem::io::OutputSample::requested_fields, polyfem::io::OutGeometryData::ExportOptions::sol_on_grid, polyfem::io::OutputSample::time, polyfem::io::OutGeometryData::ExportOptions::use_hdf5, polyfem::io::OutGeometryData::ExportOptions::use_sampler, polyfem::mesh::Obstacle::v(), polyfem::io::OutputSample::Volume, and polyfem::io::write_matrix().
Referenced by save_vtu().
| void polyfem::io::OutGeometryData::save_vtu | ( | const std::string & | path, |
| const OutputSpace & | space, | ||
| const OutputFieldFunction & | output_fields, | ||
| const double | t, | ||
| const double | dt, | ||
| const ExportOptions & | opts | ||
| ) | const |
saves the vtu file for time t
| [in] | path | filename |
| [in] | space | output geometry data |
| [in] | output_fields | callback appending physics-specific fields |
| [in] | t | time |
| [in] | dt | delta t |
| [in] | opts | export options |
Definition at line 1183 of file OutData.cpp.
References polyfem::io::OutputSpace::collision_mesh, polyfem::io::OutGeometryData::ExportOptions::contact_forces, polyfem::io::OutGeometryData::ExportOptions::export_field(), polyfem::io::OutGeometryData::ExportOptions::fields, polyfem::io::OutGeometryData::ExportOptions::file_extension(), polyfem::io::OutGeometryData::ExportOptions::friction_forces, polyfem::logger(), polyfem::io::OutputSpace::mesh, polyfem::io::OutGeometryData::ExportOptions::normal_adhesion_forces, polyfem::io::OutGeometryData::ExportOptions::points, save_contact_surface(), save_points(), save_surface(), save_volume(), save_wire(), polyfem::io::OutGeometryData::ExportOptions::surface, polyfem::io::OutGeometryData::ExportOptions::tangential_adhesion_forces, polyfem::io::OutGeometryData::ExportOptions::volume, and polyfem::io::OutGeometryData::ExportOptions::wire.
Referenced by export_data(), polyfem::varform::VarForm::save_subsolve(), and polyfem::varform::VarForm::save_timestep().
| void polyfem::io::OutGeometryData::save_wire | ( | const std::string & | name, |
| const OutputSpace & | space, | ||
| const OutputFieldFunction & | output_fields, | ||
| const double | t, | ||
| const ExportOptions & | opts | ||
| ) | const |
saves the wireframe
| [in] | name | filename |
| [in] | space | output geometry data |
| [in] | output_fields | callback appending physics-specific fields |
| [in] | t | time |
| [in] | opts | export options |
Definition at line 1512 of file OutData.cpp.
References build_vis_mesh(), polyfem::io::OutputSample::cell_count, polyfem::io::OutputSample::domain, polyfem::io::OutputSample::element_ids, polyfem::io::OutputSpace::geometry_bases, polyfem::io::OutputSample::local_points, polyfem::io::OutputSpace::mesh, polyfem::mesh::Mesh::n_elements(), polyfem::io::OutputSpace::output_orders, polyfem::io::OutputSample::points, polyfem::io::OutputSpace::polys, polyfem::io::OutputSpace::polys_3d, polyfem::io::OutputSample::time, polyfem::io::OutGeometryData::ExportOptions::use_hdf5, and polyfem::io::OutputSample::Wire.
Referenced by save_vtu().
|
private |
grid mesh points to export solution sampled on a grid
Definition at line 209 of file OutData.hpp.
Referenced by build_grid(), and save_volume().
|
private |
grid mesh boundaries
Definition at line 213 of file OutData.hpp.
Referenced by build_grid(), and save_volume().
|
private |
grid mesh mapping to fe elements
Definition at line 211 of file OutData.hpp.
Referenced by build_grid(), and save_volume().
|
private |
used to sample the solution
Definition at line 206 of file OutData.hpp.
Referenced by build_vis_boundary_mesh(), build_vis_mesh(), and init_sampler().