Wildmeshing Toolkit
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | List of all members
wmtk::MshData Class Reference

#include <io.hpp>

Public Member Functions

template<typename Fn >
void add_edge_vertices (size_t num_vertices, const Fn &get_vertex_cb)
 
template<typename Fn >
void add_face_vertices (size_t num_vertices, const Fn &get_vertex_cb)
 Add vertex block. Must be called before adding anything else.
 
template<typename Fn >
void add_tet_vertices (size_t num_vertices, const Fn &get_vertex_cb)
 
void add_empty_vertices (int dim)
 
void add_edge_vertices ()
 
void add_face_vertices ()
 
void add_tet_vertices ()
 
template<typename Fn >
void add_edges (size_t num_edges, const Fn &get_edge_cb)
 
template<typename Fn >
void add_faces (size_t num_faces, const Fn &get_face_cb)
 Add face block. Must be called after vertices were added.
 
template<typename Fn >
void add_tets (size_t num_tets, const Fn &get_tet_cb)
 
template<int NUM_FIELDS, typename Fn >
void add_edge_vertex_attribute (const std::string &name, const Fn &get_attribute_cb)
 
template<int NUM_FIELDS, typename Fn >
void add_face_vertex_attribute (const std::string &name, const Fn &get_attribute_cb)
 
template<int NUM_FIELDS, typename Fn >
void add_tet_vertex_attribute (const std::string &name, const Fn &get_attribute_cb)
 
template<int NUM_FIELDS, typename Fn >
void add_edge_attribute (const std::string &name, const Fn &get_attribute_cb)
 
template<int NUM_FIELDS, typename Fn >
void add_face_attribute (const std::string &name, const Fn &get_attribute_cb)
 
template<int NUM_FIELDS, typename Fn >
void add_tet_attribute (const std::string &name, const Fn &get_attribute_cb)
 
void add_physical_group (const std::string &name)
 Adds the pysical group and the corresponding entity entry.
 
size_t get_num_edge_vertices () const
 
size_t get_num_face_vertices () const
 
size_t get_num_tet_vertices () const
 
size_t get_num_edges () const
 
size_t get_num_faces () const
 
size_t get_num_tets () const
 
template<typename Fn >
void extract_tet_vertices (Fn &&set_vertex_cb) const
 
template<typename Fn >
void extract_face_vertices (Fn &&set_vertex_cb) const
 
template<typename Fn >
void extract_edge_vertices (Fn &&set_vertex_cb) const
 
template<typename Fn >
void extract_edges (Fn &&set_edge_cb) const
 
template<typename Fn >
void extract_faces (Fn &&set_face_cb) const
 
template<typename Fn >
void extract_tets (Fn &&set_tet_cb) const
 
std::vector< std::string > get_edge_vertex_attribute_names () const
 
std::vector< std::string > get_face_vertex_attribute_names () const
 
std::vector< std::string > get_tet_vertex_attribute_names () const
 
std::vector< std::string > get_edge_attribute_names () const
 
std::vector< std::string > get_face_attribute_names () const
 
std::vector< std::string > get_tet_attribute_names () const
 
template<typename Fn >
void extract_edge_vertex_attribute (const std::string &attr_name, Fn &&set_attr)
 
template<typename Fn >
void extract_face_vertex_attribute (const std::string &attr_name, Fn &&set_attr)
 
template<typename Fn >
void extract_tet_vertex_attribute (const std::string &attr_name, Fn &&set_attr)
 
template<typename Fn >
void extract_edge_attribute (const std::string &attr_name, Fn &&set_attr)
 
template<typename Fn >
void extract_face_attribute (const std::string &attr_name, Fn &&set_attr)
 
template<typename Fn >
void extract_tet_attribute (const std::string &attr_name, Fn &&set_attr)
 
std::optional< mshio::PhysicalGroup > get_physical_group_by_name (const std::string &name)
 Returns the (first) physical group with the given name, if it exists.
 
void get_VF (const int &dim, const int &tag, MatrixXd &V, MatrixXi &F)
 
void save (const std::string &filename, bool binary=true)
 
void save (std::ostream &out, bool binary=true)
 
void load (const std::string &filename)
 
void load (std::istream &in)
 

Public Attributes

mshio::MshSpec m_spec
 

Private Member Functions

template<int DIM, typename Fn >
void add_vertices (size_t num_vertices, const Fn &get_vertex_cb)
 
template<int DIM, typename Fn >
void add_simplex_elements (size_t num_elements, const Fn &get_element_cb)
 
template<int NUM_FIELDS, int ELEMENT_DIM, typename Fn >
void add_vertex_attribute (const std::string &name, const Fn &get_attribute_cb)
 
template<int NUM_FIELDS, int ELEMENT_DIM, typename Fn >
void add_element_attribute (const std::string &name, const Fn &get_attribute_cb)
 
const mshio::NodeBlock * get_vertex_block (const int dim) const
 
const mshio::NodeBlock * get_vertex_block (const int dim, const int tag) const
 
const mshio::ElementBlock * get_simplex_element_block (const int dim) const
 
const mshio::ElementBlock * get_simplex_element_block (const int dim, const int tag) const
 
size_t get_num_vertices (const int dim) const
 
size_t get_num_vertices (const int dim, const int tag) const
 
size_t get_num_simplex_elements (const int dim) const
 
size_t get_num_simplex_elements (const int dim, const int tag) const
 
template<typename Fn >
void extract_vertices (const int dim, Fn &&set_vertex_cb) const
 
template<typename Fn >
void extract_vertices (const int dim, const int tag, Fn &&set_vertex_cb) const
 
template<int DIM, typename Fn >
void extract_simplex_elements (Fn &&set_element_cb) const
 
template<int DIM>
std::vector< std::string > get_vertex_attribute_names () const
 
template<int DIM>
std::vector< std::string > get_element_attribute_names () const
 
template<int DIM, typename Fn >
void extract_vertex_attribute (const std::string &attr_name, Fn &&set_attr)
 
template<int DIM, typename Fn >
void extract_element_attribute (const std::string &attr_name, Fn &&set_attr)
 

Detailed Description

Write meshes to a .msh file. The right order of calling functions is important!

  1. Add vertices. Creates a new entity.
  2. Add faces/tets. Adds faces/tets with the same entity tag as the last added vertex block. If the vertex block was empty, the vertex IDs in the elements will be considered global (no offset is applied to the IDs).
  3. Add attributes and physical groups.

Member Function Documentation

◆ add_faces()

template<typename Fn >
void wmtk::MshData::add_faces ( size_t  num_faces,
const Fn &  get_face_cb 
)
inline

Add face block. Must be called after vertices were added.

The face block will get the same entity tag as the previously added vertex block.

Parameters
num_facesNumber of faces.
get_face_cbCallback function for getting a face by ID.

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