13#include <paraviewo/ParaviewWriter.hpp>
14#include <paraviewo/VTUWriter.hpp>
15#include <paraviewo/HDF5VTUWriter.hpp>
84 const bool is_mesh_linear,
85 const bool is_problem_scalar,
105 const std::vector<basis::ElementBases> &bases,
106 const std::vector<mesh::LocalBoundary> &total_local_boundary,
107 Eigen::MatrixXd &node_positions,
108 Eigen::MatrixXi &boundary_edges,
109 Eigen::MatrixXi &boundary_triangles,
110 std::vector<Eigen::Triplet<double>> &displacement_map_entries);
139 const Eigen::MatrixXd &sol,
140 const Eigen::MatrixXd &pressure,
141 const bool is_time_dependent,
142 const double tend_in,
144 const ExportOptions &opts,
145 const std::string &vis_mesh_path,
146 const std::string &nodes_path,
147 const std::string &solution_path,
148 const std::string &stress_path,
149 const std::string &mises_path,
150 const bool is_contact_enabled,
151 std::vector<SolutionFrame> &solution_frames)
const;
163 void save_vtu(
const std::string &path,
165 const Eigen::MatrixXd &sol,
166 const Eigen::MatrixXd &pressure,
169 const ExportOptions &opts,
170 const bool is_contact_enabled,
171 std::vector<SolutionFrame> &solution_frames)
const;
184 const Eigen::MatrixXd &sol,
185 const Eigen::MatrixXd &pressure,
188 const ExportOptions &opts,
189 std::vector<SolutionFrame> &solution_frames)
const;
203 const Eigen::MatrixXd &sol,
204 const Eigen::MatrixXd &pressure,
207 const ExportOptions &opts,
208 const bool is_contact_enabled,
209 std::vector<SolutionFrame> &solution_frames)
const;
222 const std::string &export_surface,
224 const Eigen::MatrixXd &sol,
225 const Eigen::MatrixXd &pressure,
228 const ExportOptions &opts,
229 const bool is_contact_enabled,
230 std::vector<SolutionFrame> &solution_frames)
const;
241 const Eigen::MatrixXd &sol,
243 const ExportOptions &opts,
244 std::vector<SolutionFrame> &solution_frames)
const;
253 const std::string &path,
255 const Eigen::MatrixXd &sol,
256 const ExportOptions &opts,
257 std::vector<SolutionFrame> &solution_frames)
const;
266 void save_pvd(
const std::string &name,
const std::function<std::string(
int)> &vtu_names,
267 int time_steps,
double t0,
double dt,
int skip_frame = 1)
const;
296 const std::vector<basis::ElementBases> &bases,
297 const std::vector<basis::ElementBases> &gbases,
298 const std::vector<mesh::LocalBoundary> &total_local_boundary,
299 const Eigen::MatrixXd &solution,
300 const int problem_dim,
301 Eigen::MatrixXd &boundary_vis_vertices,
302 Eigen::MatrixXd &boundary_vis_local_vertices,
303 Eigen::MatrixXi &boundary_vis_elements,
304 Eigen::MatrixXi &boundary_vis_elements_ids,
305 Eigen::MatrixXi &boundary_vis_primitive_ids,
306 Eigen::MatrixXd &boundary_vis_normals,
307 Eigen::MatrixXd &displaced_boundary_vis_normals)
const;
325 const Eigen::VectorXi &disc_orders,
326 const std::vector<basis::ElementBases> &gbases,
327 const std::map<int, Eigen::MatrixXd> &polys,
328 const std::map<
int, std::pair<Eigen::MatrixXd, Eigen::MatrixXi>> &polys_3d,
329 const bool boundary_only,
330 Eigen::MatrixXd &points,
331 Eigen::MatrixXi &tets,
332 Eigen::MatrixXi &el_id,
333 Eigen::MatrixXd &discr)
const;
347 const Eigen::VectorXi &disc_orders,
348 const std::vector<basis::ElementBases> &bases,
349 Eigen::MatrixXd &points,
350 std::vector<std::vector<int>> &elements,
351 Eigen::MatrixXi &el_id,
352 Eigen::MatrixXd &discr)
const;
356 const Eigen::MatrixXd &points,
358 const std::string &name,
359 const Eigen::VectorXd &field,
360 paraviewo::ParaviewWriter &writer)
const;
453 const std::vector<polyfem::basis::ElementBases> &bases,
454 const std::vector<polyfem::basis::ElementBases> &gbases,
458 const Eigen::MatrixXd &sol);
497 void save_json(
const nlohmann::json &args,
498 const int n_bases,
const int n_pressure_bases,
499 const Eigen::MatrixXd &sol,
501 const Eigen::VectorXi &disc_orders,
504 const std::string &formulation,
505 const bool isoparametric,
506 const int sol_at_node_id,
516 void write(
const int i,
const Eigen::MatrixXd &sol);
529 void write(
const int t,
const double forward,
const double remeshing,
const double global_relaxation,
const Eigen::MatrixXd &sol);
main class that contains the polyfem solver and all its state
const solver::SolveData & solve_data
void write(const int i, const Eigen::MatrixXd &sol)
Utilies related to export of geometry.
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) const
builds visualzation mesh, upsampled mesh used for visualization the visualization mesh is a dense mes...
void build_high_order_vis_mesh(const mesh::Mesh &mesh, const Eigen::VectorXi &disc_orders, const std::vector< basis::ElementBases > &bases, Eigen::MatrixXd &points, std::vector< std::vector< int > > &elements, Eigen::MatrixXi &el_id, Eigen::MatrixXd &discr) const
builds high-der visualzation mesh per element all disconnected it also retuns the mapping to element ...
void save_points(const std::string &path, const State &state, const Eigen::MatrixXd &sol, const ExportOptions &opts, std::vector< SolutionFrame > &solution_frames) const
saves the nodal values
void save_volume_vector_field(const State &state, const Eigen::MatrixXd &points, const ExportOptions &opts, const std::string &name, const Eigen::VectorXd &field, paraviewo::ParaviewWriter &writer) const
Eigen::MatrixXd grid_points_bc
grid mesh boundaries
Eigen::MatrixXd grid_points
grid mesh points to export solution sampled on a grid
void save_wire(const std::string &name, const State &state, const Eigen::MatrixXd &sol, const double t, const ExportOptions &opts, std::vector< SolutionFrame > &solution_frames) const
saves the wireframe
void save_surface(const std::string &export_surface, const State &state, const Eigen::MatrixXd &sol, const Eigen::MatrixXd &pressure, const double t, const double dt_in, const ExportOptions &opts, const bool is_contact_enabled, std::vector< SolutionFrame > &solution_frames) const
saves the surface vtu file for for surface quantites, eg traction forces
void build_vis_boundary_mesh(const mesh::Mesh &mesh, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &gbases, const std::vector< mesh::LocalBoundary > &total_local_boundary, const Eigen::MatrixXd &solution, const int problem_dim, 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, Eigen::MatrixXd &displaced_boundary_vis_normals) const
builds the boundary mesh for visualization
void build_grid(const polyfem::mesh::Mesh &mesh, const double spacing)
builds the grid to export the solution
void save_volume(const std::string &path, const State &state, const Eigen::MatrixXd &sol, const Eigen::MatrixXd &pressure, const double t, const double dt, const ExportOptions &opts, std::vector< SolutionFrame > &solution_frames) const
saves the volume vtu file
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
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
void export_data(const State &state, const Eigen::MatrixXd &sol, const Eigen::MatrixXd &pressure, const bool is_time_dependent, const double tend_in, const double dt, const ExportOptions &opts, const std::string &vis_mesh_path, const std::string &nodes_path, const std::string &solution_path, const std::string &stress_path, const std::string &mises_path, const bool is_contact_enabled, std::vector< SolutionFrame > &solution_frames) const
exports everytihng, txt, vtu, etc
void save_vtu(const std::string &path, const State &state, const Eigen::MatrixXd &sol, const Eigen::MatrixXd &pressure, const double t, const double dt, const ExportOptions &opts, const bool is_contact_enabled, std::vector< SolutionFrame > &solution_frames) const
saves the vtu file for time t
void save_contact_surface(const std::string &export_surface, const State &state, const Eigen::MatrixXd &sol, const Eigen::MatrixXd &pressure, const double t, const double dt_in, const ExportOptions &opts, const bool is_contact_enabled, std::vector< SolutionFrame > &solution_frames) const
saves the surface vtu file for for constact quantites, eg contact or friction forces
void init_sampler(const polyfem::mesh::Mesh &mesh, const double vismesh_rel_area)
unitalize the ref element sampler
Eigen::MatrixXi grid_points_to_elements
grid mesh mapping to fe elements
utils::RefElementSampler ref_element_sampler
used to sample the solution
double loading_mesh_time
time to load the mesh
double total_time()
computes total time
double assembling_stiffness_mat_time
time to assembly
double assigning_rhs_time
time to computing the rhs
double assembling_mass_mat_time
time to assembly mass
double building_basis_time
time to construct the basis
double solving_time
time to solve
double computing_poly_basis_time
time to build the polygonal/polyhedral bases
void save_json(const nlohmann::json &args, const int n_bases, const int n_pressure_bases, const Eigen::MatrixXd &sol, const mesh::Mesh &mesh, const Eigen::VectorXi &disc_orders, const assembler::Problem &problem, const OutRuntimeData &runtime, const std::string &formulation, const bool isoparametric, const int sol_at_node_id, nlohmann::json &j)
saves the output statistic to a json object
int n_flipped
number of flipped elements, compute only when using count_flipped_els (false by default)
int simplex_count
statiscs on the mesh (simplices)
json solver_info
information of the solver, eg num iteration, time, errors, etc the informations varies depending on t...
int simple_singular_count
statiscs on the mesh (irregular quad/hex part of the mesh), see Polyspline paper for desciption
Eigen::Vector4d spectrum
spectrum of the stiffness matrix, enable only if POLYSOLVE_WITH_SPECTRA is ON (off by default)
void count_flipped_elements(const polyfem::mesh::Mesh &mesh, const std::vector< polyfem::basis::ElementBases > &gbases)
counts the number of flipped elements
double l2_err
errors, lp_err is in fact an L8 error
int undefined_count
statiscs on the mesh (not quad/hex simplex), see Polyspline paper for desciption
void compute_errors(const int n_bases, const std::vector< polyfem::basis::ElementBases > &bases, const std::vector< polyfem::basis::ElementBases > &gbases, const polyfem::mesh::Mesh &mesh, const assembler::Problem &problem, const double tend, const Eigen::MatrixXd &sol)
compute errors
void compute_mesh_size(const polyfem::mesh::Mesh &mesh_in, const std::vector< polyfem::basis::ElementBases > &bases_in, const int n_samples, const bool use_curved_mesh_size)
computes the mesh size, it samples every edges n_samples times uses curved_mesh_size (false by defaul...
double average_edge_length
avg edge lenght
double max_angle
statiscs on angle, compute only when using p_ref (false by default)
int non_regular_boundary_count
statiscs on the mesh (irregular boundary quad/hex part of the mesh), see Polyspline paper for descipt...
int non_regular_count
statiscs on the mesh (irregular quad/hex part of the mesh), see Polyspline paper for desciption
int regular_boundary_count
statiscs on the mesh (regular quad/hex boundary part of the mesh), see Polyspline paper for desciptio...
long long nn_zero
non zeros and sytem matrix size num dof is the total dof in the system
double mesh_size
max edge lenght
void reset()
clears all stats
int multi_singular_boundary_count
statiscs on the mesh (irregular boundary quad/hex part of the mesh), see Polyspline paper for descipt...
void compute_mesh_stats(const polyfem::mesh::Mesh &mesh)
compute stats (counts els type, mesh lenght, etc), step 1 of solve
double sigma_max
statiscs on tri/tet quality, compute only when using p_ref (false by default)
int boundary_count
statiscs on the mesh (boundary quads/hexs), see Polyspline paper for desciption
int regular_count
statiscs on the mesh (regular quad/hex part of the mesh), see Polyspline paper for desciption
double min_edge_length
min edge lenght
int multi_singular_count
statiscs on the mesh (irregular quad/hex part of the mesh), see Polyspline paper for desciption
double total_forward_solve_time
void write(const int t, const double forward, const double remeshing, const double global_relaxation, const Eigen::MatrixXd &sol)
double total_remeshing_time
double total_global_relaxation_time
class used to save the solution of time dependent problems in code instead of saving it to the disc
Eigen::MatrixXi connectivity
Eigen::MatrixXd scalar_value_avg
Eigen::MatrixXd scalar_value
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
class to store time stepping data
std::string file_extension() const
return the extension of the output paraview files depending on use_hdf5
bool discretization_order
bool solve_export_to_file