13#include <paraviewo/ParaviewWriter.hpp>
14#include <paraviewo/VTUWriter.hpp>
15#include <paraviewo/HDF5VTUWriter.hpp>
83 const bool is_mesh_linear,
84 const bool is_problem_scalar,
104 const std::vector<basis::ElementBases> &bases,
105 const std::vector<mesh::LocalBoundary> &total_local_boundary,
106 Eigen::MatrixXd &node_positions,
107 Eigen::MatrixXi &boundary_edges,
108 Eigen::MatrixXi &boundary_triangles,
109 std::vector<Eigen::Triplet<double>> &displacement_map_entries);
138 const Eigen::MatrixXd &sol,
139 const Eigen::MatrixXd &pressure,
140 const bool is_time_dependent,
141 const double tend_in,
143 const ExportOptions &opts,
144 const std::string &vis_mesh_path,
145 const std::string &nodes_path,
146 const std::string &solution_path,
147 const std::string &stress_path,
148 const std::string &mises_path,
149 const bool is_contact_enabled,
150 std::vector<SolutionFrame> &solution_frames)
const;
162 void save_vtu(
const std::string &path,
164 const Eigen::MatrixXd &sol,
165 const Eigen::MatrixXd &pressure,
168 const ExportOptions &opts,
169 const bool is_contact_enabled,
170 std::vector<SolutionFrame> &solution_frames)
const;
183 const Eigen::MatrixXd &sol,
184 const Eigen::MatrixXd &pressure,
187 const ExportOptions &opts,
188 std::vector<SolutionFrame> &solution_frames)
const;
202 const Eigen::MatrixXd &sol,
203 const Eigen::MatrixXd &pressure,
206 const ExportOptions &opts,
207 const bool is_contact_enabled,
208 std::vector<SolutionFrame> &solution_frames)
const;
221 const std::string &export_surface,
223 const Eigen::MatrixXd &sol,
224 const Eigen::MatrixXd &pressure,
227 const ExportOptions &opts,
228 const bool is_contact_enabled,
229 std::vector<SolutionFrame> &solution_frames)
const;
240 const Eigen::MatrixXd &sol,
242 const ExportOptions &opts,
243 std::vector<SolutionFrame> &solution_frames)
const;
252 const std::string &path,
254 const Eigen::MatrixXd &sol,
255 const ExportOptions &opts,
256 std::vector<SolutionFrame> &solution_frames)
const;
265 void save_pvd(
const std::string &name,
const std::function<std::string(
int)> &vtu_names,
266 int time_steps,
double t0,
double dt,
int skip_frame = 1)
const;
295 const std::vector<basis::ElementBases> &bases,
296 const std::vector<basis::ElementBases> &gbases,
297 const std::vector<mesh::LocalBoundary> &total_local_boundary,
298 const Eigen::MatrixXd &solution,
299 const int problem_dim,
300 Eigen::MatrixXd &boundary_vis_vertices,
301 Eigen::MatrixXd &boundary_vis_local_vertices,
302 Eigen::MatrixXi &boundary_vis_elements,
303 Eigen::MatrixXi &boundary_vis_elements_ids,
304 Eigen::MatrixXi &boundary_vis_primitive_ids,
305 Eigen::MatrixXd &boundary_vis_normals,
306 Eigen::MatrixXd &displaced_boundary_vis_normals)
const;
324 const Eigen::VectorXi &disc_orders,
325 const std::vector<basis::ElementBases> &gbases,
326 const std::map<int, Eigen::MatrixXd> &polys,
327 const std::map<
int, std::pair<Eigen::MatrixXd, Eigen::MatrixXi>> &polys_3d,
328 const bool boundary_only,
329 Eigen::MatrixXd &points,
330 Eigen::MatrixXi &tets,
331 Eigen::MatrixXi &el_id,
332 Eigen::MatrixXd &discr)
const;
346 const Eigen::VectorXi &disc_orders,
347 const std::vector<basis::ElementBases> &bases,
348 Eigen::MatrixXd &points,
349 std::vector<std::vector<int>> &elements,
350 Eigen::MatrixXi &el_id,
351 Eigen::MatrixXd &discr)
const;
355 const Eigen::MatrixXd &points,
357 const std::string &name,
358 const Eigen::VectorXd &field,
359 paraviewo::ParaviewWriter &writer)
const;
452 const std::vector<polyfem::basis::ElementBases> &bases,
453 const std::vector<polyfem::basis::ElementBases> &gbases,
457 const Eigen::MatrixXd &sol);
496 void save_json(
const nlohmann::json &args,
497 const int n_bases,
const int n_pressure_bases,
498 const Eigen::MatrixXd &sol,
500 const Eigen::VectorXi &disc_orders,
503 const std::string &formulation,
504 const bool isoparametric,
505 const int sol_at_node_id,
515 void write(
const int i,
const Eigen::MatrixXd &sol);
528 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