PolyFEM
Loading...
Searching...
No Matches
polyfem::mesh::GeometryLoader Class Reference

Applies geometry JSON semantics while delegating all decoding to MeshLoader. More...

#include <GeometryLoader.hpp>

Collaboration diagram for polyfem::mesh::GeometryLoader:
[legend]

Public Member Functions

 GeometryLoader (Units units, 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
 
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.
 
std::unique_ptr< Mesh > load_fem_entry (const json &geometry, bool non_conforming=false) const
 
SurfaceMesh load_surface (const json &geometry, int dimension) const
 Load and prepare one configured surface/codimensional geometry entry.
 
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
 
void apply_geometry_selection (Mesh &mesh, const json &geometry_selection) const
 Apply configured geometry IDs to an already constructed mesh.
 

Static Public Member Functions

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.
 

Private Attributes

Units units_
 
const io::ResourceIO & resources_
 

Detailed Description

Applies geometry JSON semantics while delegating all decoding to MeshLoader.

Definition at line 21 of file GeometryLoader.hpp.

Constructor & Destructor Documentation

◆ GeometryLoader()

polyfem::mesh::GeometryLoader::GeometryLoader ( Units  units,
const io::ResourceIO &  resources 
)
inline

Definition at line 24 of file GeometryLoader.hpp.

Member Function Documentation

◆ apply_geometry_selection()

void polyfem::mesh::GeometryLoader::apply_geometry_selection ( Mesh &  mesh,
const json &  geometry_selection 
) const

Apply configured geometry IDs to an already constructed mesh.

Definition at line 37 of file GeometryLoader.cpp.

References polyfem::mesh::Mesh::bounding_box(), polyfem::utils::Selection::build_selections(), polyfem::mesh::Mesh::compute_element_barycenters(), polyfem::mesh::Mesh::element_vertices(), polyfem::mesh::Mesh::get_body_id(), polyfem::mesh::Mesh::n_elements(), resources_, and polyfem::mesh::Mesh::set_geometry_ids().

Referenced by load_fem_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ construct_affine_transformation()

void polyfem::mesh::GeometryLoader::construct_affine_transformation ( double  unit_scale,
const json &  transform,
const VectorNd &  mesh_dimensions,
MatrixNd &  A,
VectorNd &  b 
)
static

Construct the affine map used by geometry and collision-proxy inputs.

Definition at line 692 of file GeometryLoader.cpp.

References polyfem::utils::deg2rad(), polyfem::log_and_throw_error(), and polyfem::utils::to_rotation_matrix().

Referenced by load_fem_entry(), and load_surface().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load()

LoadedGeometry polyfem::mesh::GeometryLoader::load ( const json &  geometry,
const std::vector< json > &  obstacle_displacements,
const std::vector< json > &  dirichlet_conditions,
bool  non_conforming = false 
) const

Definition at line 21 of file GeometryLoader.cpp.

References polyfem::mesh::LoadedGeometry::fem, load_fem(), load_obstacles(), polyfem::log_and_throw_error(), and polyfem::mesh::LoadedGeometry::obstacle.

Referenced by polyfem::State::load_mesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_fem()

std::unique_ptr< Mesh > polyfem::mesh::GeometryLoader::load_fem ( const json &  geometry,
bool  non_conforming = false 
) const

Load and combine the enabled FEM entries in a geometry configuration.

Definition at line 312 of file GeometryLoader.cpp.

References polyfem::utils::json_as_array(), load_fem_entry(), and polyfem::log_and_throw_error().

Referenced by load(), and polyfem::legacy::State::load_mesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_fem_entry()

std::unique_ptr< Mesh > polyfem::mesh::GeometryLoader::load_fem_entry ( const json &  geometry,
bool  non_conforming = false 
) const

Definition at line 75 of file GeometryLoader.cpp.

References apply_geometry_selection(), polyfem::utils::Selection::build_selections(), construct_affine_transformation(), polyfem::Units::convert(), polyfem::utils::is_param_valid(), polyfem::Units::length(), polyfem::mesh::MeshLoader::load_fem(), polyfem::log_and_throw_error(), polyfem::logger(), resources_, and units_.

Referenced by load_fem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_obstacles()

Obstacle polyfem::mesh::GeometryLoader::load_obstacles ( const json &  geometry,
const std::vector< json > &  obstacle_displacements,
const std::vector< json > &  dirichlet_conditions,
int  dimension,
bool  non_conforming = false 
) const

◆ load_surface()

SurfaceMesh polyfem::mesh::GeometryLoader::load_surface ( const json &  geometry,
int  dimension 
) const

Load and prepare one configured surface/codimensional geometry entry.

Definition at line 382 of file GeometryLoader.cpp.

References construct_affine_transformation(), polyfem::Units::convert(), polyfem::mesh::SurfaceMeshData::edges, faces, polyfem::mesh::SurfaceMeshData::faces, polyfem::utils::is_param_valid(), polyfem::Units::length(), polyfem::mesh::MeshLoader::load_surface(), polyfem::log_and_throw_error(), polyfem::mesh::SurfaceMeshData::points, resources_, units_, and polyfem::mesh::SurfaceMeshData::vertices.

Referenced by load_obstacles().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ resources_

const io::ResourceIO& polyfem::mesh::GeometryLoader::resources_
private

◆ units_

Units polyfem::mesh::GeometryLoader::units_
private

Definition at line 67 of file GeometryLoader.hpp.

Referenced by load_fem_entry(), load_obstacles(), and load_surface().


The documentation for this class was generated from the following files: