PolyFEM
Loading...
Searching...
No Matches
GeometryLoader.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <polyfem/Common.hpp>
4#include <polyfem/Units.hpp>
10
11namespace polyfem::mesh
12{
14 {
15 public:
16 std::unique_ptr<Mesh> fem;
18 };
19
22 {
23 public:
24 GeometryLoader(Units units, const io::ResourceIO &resources)
25 : units_(std::move(units)), resources_(resources) {}
26
28 const json &geometry,
29 const std::vector<json> &obstacle_displacements,
30 const std::vector<json> &dirichlet_conditions,
31 bool non_conforming = false) const;
32
34 std::unique_ptr<Mesh> load_fem(
35 const json &geometry,
36 bool non_conforming = false) const;
37 std::unique_ptr<Mesh> load_fem_entry(
38 const json &geometry,
39 bool non_conforming = false) const;
40
43 const json &geometry,
44 int dimension) const;
45
47 const json &geometry,
48 const std::vector<json> &obstacle_displacements,
49 const std::vector<json> &dirichlet_conditions,
50 int dimension,
51 bool non_conforming = false) const;
52
55 Mesh &mesh,
56 const json &geometry_selection) const;
57
60 double unit_scale,
61 const json &transform,
62 const VectorNd &mesh_dimensions,
63 MatrixNd &A,
64 VectorNd &b);
65
66 private:
69 };
70} // namespace polyfem::mesh
Read-only interface to a hierarchical collection of simulation resources.
Applies geometry JSON semantics while delegating all decoding to MeshLoader.
std::unique_ptr< Mesh > load_fem(const json &geometry, bool non_conforming=false) const
Load and combine the enabled FEM entries in a geometry configuration.
Obstacle load_obstacles(const json &geometry, const std::vector< json > &obstacle_displacements, const std::vector< json > &dirichlet_conditions, int dimension, bool non_conforming=false) const
const io::ResourceIO & resources_
LoadedGeometry load(const json &geometry, const std::vector< json > &obstacle_displacements, const std::vector< json > &dirichlet_conditions, bool non_conforming=false) const
static void construct_affine_transformation(double unit_scale, const json &transform, const VectorNd &mesh_dimensions, MatrixNd &A, VectorNd &b)
Construct the affine map used by geometry and collision-proxy inputs.
void apply_geometry_selection(Mesh &mesh, const json &geometry_selection) const
Apply configured geometry IDs to an already constructed mesh.
GeometryLoader(Units units, const io::ResourceIO &resources)
SurfaceMesh load_surface(const json &geometry, int dimension) const
Load and prepare one configured surface/codimensional geometry entry.
std::unique_ptr< Mesh > load_fem_entry(const json &geometry, bool non_conforming=false) const
std::unique_ptr< Mesh > fem
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:50
Eigen::Matrix< double, Eigen::Dynamic, 1, 0, 3, 1 > VectorNd
Definition Types.hpp:11
nlohmann::json json
Definition Common.hpp:9
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor, 3, 3 > MatrixNd
Definition Types.hpp:14