#include <Mesh.hpp>
Classes | |
class | Connection_validity |
An object to provide information about whether the mesh connectivity is valid and if not, why. More... | |
struct | elem_handle |
minimum information required to identify an element More... | |
class | Reset_vertices |
Temporarily resets the vertices of a mesh to their nominal positions for debugging. More... | |
Public Member Functions | |
virtual double | root_size ()=0 |
Manual mesh creation | |
| |
virtual int | add_element (int ref_level, bool is_deformed, std::vector< int > position)=0 |
virtual void | connect_cartesian (int ref_level, std::array< int, 2 > serial_n, Con_dir< Element > dir, std::array< bool, 2 > is_deformed={false, false})=0 |
virtual void | connect_deformed (int ref_level, std::array< int, 2 > serial_n, Con_dir< Deformed_element > direction)=0 |
Specify that two elements are connected via a deformed face. Requires both elements to be deformed. | |
virtual void | connect_hanging (int coarse_ref_level, int coarse_serial, std::vector< int > fine_serial, Con_dir< Deformed_element >, bool coarse_deformed=false, std::vector< bool > fine_deformed={false, false, false, false}, std::array< bool, 2 > stretch={false, false})=0 |
virtual int | add_boundary_condition (Flow_bc *flow_bc, Mesh_bc *mesh_bc)=0 |
Acquires owenership of *flow_bc and *mesh_bc and constructs a Boundary_condition from them. | |
virtual void | connect_boundary (int ref_level, bool is_deformed, int element_serial_n, int i_dim, int face_sign, int bc_serial_n)=0 |
Connect a face of an element to a boundary condition. | |
virtual void | disconnect_boundary (int bc_sn)=0 |
delete all boundary connections involving a certain boundary condition | |
virtual void | connect_rest (int bc_sn)=0 |
connects all yet-unconnected faces to a boundary condition specified by serial number | |
virtual void | extrude (bool collapse=false, double offset=0, bool force=false)=0 |
void | extrude (Layer_sequence layers) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
virtual void | cleanup ()=0 |
Does some work that has to happen after you manually add elements and/or connections. | |
Automated tree meshing | |
virtual void | add_tree (std::vector< Flow_bc * > extremal_bcs, Mat<> origin=Mat<>::Zero(3))=0 |
Initializes meshing with bin/quad/octree topology. | |
virtual void | set_surface (Surface_geom *geometry, Flow_bc *surface_bc, Eigen::VectorXd flood_fill_start=Eigen::VectorXd::Zero(3))=0 |
Defines the surface geometry to be meshed as a boundary. | |
virtual void | set_unref_locks (std::function< bool(Element &)> lock_if=criteria::never)=0 |
virtual bool | update (std::function< bool(Element &)> refine_criterion=criteria::always, std::function< bool(Element &)> unrefine_criterion=criteria::never)=0 |
Updates tree mesh based on user-supplied (un)refinement criteria. | |
virtual void | set_all_smooth ()=0 |
sets need_smooth to true for all vertices to perform global relaxation | |
virtual void | relax (double factor=0.9)=0 |
Relax the vertices to improve mesh quality. | |
virtual int | surface_bc_sn ()=0 |
what is the serial number of the geometry surface BC? | |
virtual void | relax_and_match (int n_relax=0, double factor=.9)=0 |
observers | |
virtual int | n_elements ()=0 |
number of elements currently in the mesh | |
virtual Connection_validity | valid ()=0 |
Returns a Connection_validity object describing whether the mesh connectivity is valid. | |
virtual std::vector< elem_handle > | elem_handles ()=0 |
get handles for all elements currently in the mesh, in no particular order (mostly for testing/debugging) | |
virtual const Stopwatch_tree & | stopwatch_tree () const =0 |
Obtain performance data. | |
I/O | |
write this mesh to a file to be reused in another simulation | |
virtual void | write (std::string file_name)=0 |
virtual void | export_polymesh (std::string dir_name)=0 |
write the mesh in the OpenFOAM PolyMesh format | |
Protected Member Functions | |
virtual void | reset_verts ()=0 |
virtual void | restore_verts ()=0 |
Represents a collection of interconnected elements. This class is an interface which supports only manipulation of the mesh itself, not access to the elements it contains. One common theme in this interface is the use of "serial numbers" to identify objects owned by the Mesh
object. These "serial numbers" are unique (among objects of a specified class), nonnegative, and permanent, but otherwise arbitrary. Unlike indices, which are expected to be consecutive, the serial numbers remain valid regardless of any addition or deletion of objects. They are also preferable to pointers or references because they preclude (illegal) attempts to relate objects owned by different meshes.
|
pure virtual |
Acquires owenership of *flow_bc
and *mesh_bc
and constructs a Boundary_condition
from them.
Returns a serial number which uniquely identifies the new boundary condition among this Mesh
's boundary conditions. It is recommended to use this with new
, like the constructor for std::unique_ptr
.
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Add an element at specified nominal position and serial number which uniquely identifies it among elements of this mesh with the same refinement level and deformedness.
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Initializes meshing with bin/quad/octree topology.
Creates a tree initialized with one element with ref level 0. Technically, free-form elements can also be created in the same mesh, but they will not be connected to the tree. Only one tree can be created. Connections and boundary conditions are set automatically for tree elements, so tree meshes should always automatically be valid unless you explicitly invalidate it with Mesh::disconnect_boundary
.
extremal_bcs | Boundary conditions to apply to elements with exposed faces at the extremal boundaries of the tree. Takes ownership of objects that the vector entries point to. It must contain exactly 2*n_dim entries. E.g. extremal_bcs[0] is the boundary condition to apply to the minimum \(x_0\) face, extremal_bcs[1] is the BC for the maximum \(x_0\) face, extremal_bcs[2] is for minimum \(x_1\). |
origin | The minimal corner of the tree root will be located at origin . |
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Does some work that has to happen after you manually add elements and/or connections.
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Connect a face of an element to a boundary condition.
This BC will now be applied to that face. i_dim
and face_sign
are used to identify which face of the element is participating in the boundary condition.
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Specify that two elements are connected via a Cartesian face. Note: although the interface is stipulated to be Cartesian, the elements themselves can be deformed
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Specify that two elements are connected via a deformed face. Requires both elements to be deformed.
Implemented in hexed::Accessible_mesh.
|
pure virtual |
specify that an element of refinement level coarse_ref_level
is connected to some elements of refinement level coarse_ref_level + 1
. Coarse element comes first in Con_dir
. coarse_deformed
and fine_deformed
specify whether the elements are Cartesian or deformed. If any of the elements are Cartesian, the entire face is assumed to be Cartesian. In this case, all the vertices must occupy their nominal positions and the Con_dir
must be appropriate for a Cartesian connection. If these requirements are not satisfied, the invocation is incorrect. The number of fine elements can be any power of 2 (with a maximum of 2^(n_dim - 1
)). In order to match the faces when less than the maximum number of elements is used, stretch
specifies along which dimensions the fine elements are to be stretched to match the coarse. Only the first n_dim - 1
elements of stretch
are meaningful. The rest are ignored.
Implemented in hexed::Accessible_mesh.
|
pure virtual |
connects all yet-unconnected faces to a boundary condition specified by serial number
Implemented in hexed::Accessible_mesh.
|
pure virtual |
delete all boundary connections involving a certain boundary condition
Implemented in hexed::Accessible_mesh.
|
pure virtual |
get handles for all elements currently in the mesh, in no particular order (mostly for testing/debugging)
Implemented in hexed::Accessible_mesh.
|
pure virtual |
write the mesh in the OpenFOAM PolyMesh format
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Extrudes a layer of elements from unconnected faces:
collapse == true
then the new elements will be collapsed in the extrusion direction, such that they have zero volume and exist purely on the extruded face. If the mesh has already been extruded once and offset
is specified, the interior vertices of the extruded element will then be moved some distance toward the interior neighbor depending on the value of offset
, where offset == 0
yields no motion and offset == 1
moves them exactly to the neighbor. If the mesh has not been extruded, the vertices shall be moved in an unspecified manner (but maintaining a valid mesh state). Offsetting thus provides a rudimentary way of creating anisotropic wall layers. If force == false
(default) then in a tree mesh, only tree elements will be extruded from (which is necessary because some of the extruded elements from the previous refinement sweep may have non-surface-facing exposed faces). If force == true
then all exposed faces will be extruded from. Implemented in hexed::Accessible_mesh.
|
pure virtual |
number of elements currently in the mesh
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Relax the vertices to improve mesh quality.
By default, relaxation is performed incrementally—only vertices of elements that are new in the most recent update()
cycle are smoothed. To smooth all, call set_all_smooth()
.
factor | A larger number yields more change in the mesh. 0 => no update, 1 => "full" update, > 1 allowed but suspect |
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Implemented in hexed::Accessible_mesh.
|
pure virtual |
sets need_smooth
to true
for all vertices to perform global relaxation
(only effective until the next update()
cycle)
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Defines the surface geometry to be meshed as a boundary.
Acquires ownership of the objects pointed to geometry
and surface_bc
. The geometric surface represented by geometry
is now a boundary of the domain and its boundary condition is surface_bc
. The flood fill algorithm is then executed starting at flood_fill_start
to determine which elements are in the domain and extrusion is executed to create a suitably body-fitted mesh. flood_fill_start
must have at least n_dim
entries and extra entries are ignored. If the mesh is excessively coarse, there may be no elements in the domain as they are all too close to the surfaces. So, Mesh::update
should be calling a few times before Mesh::set_surfaces
. Any surfaces defined by previous invokations of set_surface
are forgotten. sets the Element::unrefinement_locked
member of all elements
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Obtain performance data.
Implemented in hexed::Accessible_mesh.
|
pure virtual |
what is the serial number of the geometry surface BC?
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Updates tree mesh based on user-supplied (un)refinement criteria.
Evaluates refine_criterion
and unrefine_criterion
on every element in the tree (if a tree exists). Whenever refine_criterion
is true
and unrefine_criterion
is false
, that element is refined. Whenever unrefine_criterion
is true
and refine_criterion
is false
for a complete group of sibling elements, that group is unrefined. Since extruded elements cannot be directly refined or unrefined, their extrusion parents inherit their (un)refinement flags and any unrefinement locks. In order to satisfy some criteria regarding the refinement level of neighbors, some additional elements may be refined and some elements may not be unrefined. Both criteria must be thread-safe and must not depend on the order in which elements are processed. The flood fill and extrusion are also updated.
true
if the mesh was changed, else false
Implemented in hexed::Accessible_mesh.
|
pure virtual |
Returns a Connection_validity
object describing whether the mesh connectivity is valid.
Suggested uses:
if (mesh.valid()) {\\...do something that requires a valid mesh}
mesh.valid().assert_valid();
Implemented in hexed::Accessible_mesh.