QUGaR 0.0.4
Loading...
Searching...
No Matches
qugar::ReparamMesh< dim, range > Class Template Reference

Class for storing an implicit domain reparameterization using Lagrange cells. More...

#include <reparam_mesh.hpp>

Inheritance diagram for qugar::ReparamMesh< dim, range >:
[legend]

Public Member Functions

 ReparamMesh (int order)
 Constructor.
 
virtual ~ReparamMesh ()=default
 Default virtual destructor.
 
void merge (const ReparamMesh< dim, range > &mesh)
 Merges the given mesh into the current mesh.
 
template<int aux_dim = dim>
requires (aux_dim == dim && dim == range)
void add_full_cell (const BoundBox< dim > &domain, bool wirebasket)
 Adds a full cell to the mesh corresponding to the given domain.
 
template<int aux_dim = dim>
requires (aux_dim == dim && dim == range)
void add_full_cells (const CartGridTP< dim > &grid, const std::vector< int > &cell_ids, bool wirebasket)
 Adds full cells to the mesh corresponding to the grid.
 
bool use_Chebyshev () const
 Determines whether the Chebyshev nodes are used, or equally spaced nodes.
 
void insert_cell_point (const Point< range > &point, int cell_id, int pt_id)
 This method sets the given point point, with index pt_id, to the cell designed by cell_id.
 
void merge_coincident_points (const Tolerance &tol)
 Merges coincident points in the reparameterization up to tolerance.
 
void scale_points (const std::vector< int > &point_ids, const BoundBox< range > &old_domain, const BoundBox< range > &new_domain)
 Scales points from an old domain to a new domain.
 
void scale_points (const BoundBox< range > &old_domain, const BoundBox< range > &new_domain)
 Scales points from an old domain to a new domain.
 
const std::vector< Point< range > > & get_points () const
 Retrieves the points the reparameterization points.
 
const std::vector< std::size_t > & get_connectivity () const
 Retrieves the reparameterization connectivity.
 
const std::vector< std::size_t > & get_wires_connectivity () const
 Retrieves the wirebasket reparameterization connectivity.
 
int get_order () const
 Retrieves the reparameterization's order.
 
std::size_t get_num_cells () const
 Retrieves the number of reparameterization cells.
 
std::size_t get_num_points () const
 Retrieves the number of points.
 
std::size_t get_num_points_per_cell () const
 Retrieves the number of points per cell, that depends on the reparameterization order.
 
void write_VTK_file (const std::string &filename) const
 Writes the reparameterization data to a VTK file.
 
void permute_cell_directions (std::size_t cell_id)
 Permutes the directions of the given cell.
 
void reserve_cells (std::size_t n_new_cells)
 Reserves memory for a specified number of cells.
 
int allocate_cells (std::size_t n_new_cells)
 Allocates memory for a specified number of cells.
 

Static Public Member Functions

static bool use_Chebyshev (int order)
 Determines whether the Chebyshev nodes are used, or equally spaced nodes.
 

Static Public Attributes

static const int chebyshev_order = 7
 

Protected Member Functions

template<int sub_dim>
bool check_edge_in_subdomain (const std::vector< std::size_t > &edge_points_ids, const BoundBox< range > &domain, const Tolerance &tol) const
 Checks if a reparameterization cell's edge belongs to a subentity of a domain.
 
bool check_subentity_degenerate (const std::vector< std::size_t > &points_ids, const Tolerance &tol) const
 Checks if a reparameterization cell's sub-entity is degenerate (it has zero length).
 
template<int aux_dim = dim>
requires (aux_dim == dim && 1 < dim)
std::vector< std::size_t > get_edge_points (int cell_id, int edge_id) const
 Gets the ids of the points of an edge of a reparameterization cell.
 
void sort_edge_points (std::span< std::size_t > edge_points_ids) const
 Sorts the given edge points by their IDs.
 
void sort_wirebasket_edges ()
 
void purge_duplicate_wirebasket_edges ()
 

Protected Attributes

int order_
 Reparameterization order (number of points per direction).
 
std::vector< Point< range > > points_
 Vector of points.
 
std::vector< std::size_t > connectivity_
 Cells' connectivity.
 
std::vector< std::size_t > wires_connectivity_
 Cells wires' connectivity.
 

Detailed Description

template<int dim, int range>
class qugar::ReparamMesh< dim, range >

Class for storing an implicit domain reparameterization using Lagrange cells.

This reparameterization is non-conforming (it may contain hanging nodes), but is intended to be used for visualization purposes.

It stores the cells as a list of point and the connectivity. It also stores the connectivity for the wirebasket of the reparameterization.

Template Parameters
dimParametric dimension of the reparameterization.
rangeRange (or physical dimension) of the reparameterization.

Constructor & Destructor Documentation

◆ ReparamMesh()

template<int dim, int range>
qugar::ReparamMesh< dim, range >::ReparamMesh ( int order)
explicit

Constructor.

Parameters
orderReparameterization order (number of points per direction).

◆ ~ReparamMesh()

template<int dim, int range>
virtual qugar::ReparamMesh< dim, range >::~ReparamMesh ( )
virtualdefault

Default virtual destructor.

Member Function Documentation

◆ add_full_cell()

template<int dim, int range>
template<int aux_dim = dim>
requires (aux_dim == dim && dim == range)
void qugar::ReparamMesh< dim, range >::add_full_cell ( const BoundBox< dim > & domain,
bool wirebasket )

Adds a full cell to the mesh corresponding to the given domain.

Parameters
domainThe bounding box that defines the domain to which the full cell will be added.
wirebasketWhether wirebasket for each cell should be added.

◆ add_full_cells()

template<int dim, int range>
template<int aux_dim = dim>
requires (aux_dim == dim && dim == range)
void qugar::ReparamMesh< dim, range >::add_full_cells ( const CartGridTP< dim > & grid,
const std::vector< int > & cell_ids,
bool wirebasket )

Adds full cells to the mesh corresponding to the grid.

Parameters
gridCartesian grid that define the cells to be added.
cell_idsList of cells to add.
wirebasketWhether wirebasket for each cell should be added.
Note
No coincidents points are merged. If needed, merge_coincident_points should be called after this method.

◆ allocate_cells()

template<int dim, int range>
int qugar::ReparamMesh< dim, range >::allocate_cells ( std::size_t n_new_cells)

Allocates memory for a specified number of cells.

For the points, it just reserves memory for the new points. Thus, new points should be pushed back.

However, for the cells connectivity, it resizes the array, ready to insert new indices at the corresponding positions.

Parameters
n_new_cellsThe number of cells to allocate memory for.
Returns
Id of the first allocated cell.

◆ check_edge_in_subdomain()

template<int dim, int range>
template<int sub_dim>
bool qugar::ReparamMesh< dim, range >::check_edge_in_subdomain ( const std::vector< std::size_t > & edge_points_ids,
const BoundBox< range > & domain,
const Tolerance & tol ) const
nodiscardprotected

Checks if a reparameterization cell's edge belongs to a subentity of a domain.

Template Parameters
sub_dimParametric dimension of the subdomain.
Parameters
edge_points_idsVector of point ids corresponding to the edge.
domainBounding box of the domain being considered.
tolTolerance to be used if points belong to the wirebasket.
Returns
True if the edge sits on the subentity of dimension sub_dim of domain, false otherwise.

◆ check_subentity_degenerate()

template<int dim, int range>
bool qugar::ReparamMesh< dim, range >::check_subentity_degenerate ( const std::vector< std::size_t > & points_ids,
const Tolerance & tol ) const
nodiscardprotected

Checks if a reparameterization cell's sub-entity is degenerate (it has zero length).

Parameters
points_idsVector of point ids corresponding to the sub-entity.
tolTolerance to decide if two points are coincident.
Returns
True if the subentity is degenerate, false otherwise.

◆ get_connectivity()

template<int dim, int range>
const std::vector< std::size_t > & qugar::ReparamMesh< dim, range >::get_connectivity ( ) const
nodiscard

Retrieves the reparameterization connectivity.

Returns
A constant reference to the connectivity vector.

◆ get_edge_points()

template<int dim, int range>
template<int aux_dim = dim>
requires (aux_dim == dim && 1 < dim)
std::vector< std::size_t > qugar::ReparamMesh< dim, range >::get_edge_points ( int cell_id,
int edge_id ) const
nodiscardprotected

Gets the ids of the points of an edge of a reparameterization cell.

Parameters
cell_idId of the reparameterization cell to consider.
edge_idEdge id of the reparameterization cell to consider.
Returns
Vector of point ids of the edge. They are sorted such that the first point is smaller than the last one. If both are the same, the ids of the second points (from the begining and the end) are compared.

◆ get_num_cells()

template<int dim, int range>
std::size_t qugar::ReparamMesh< dim, range >::get_num_cells ( ) const
nodiscard

Retrieves the number of reparameterization cells.

Returns
The number of reparameterization cells.

◆ get_num_points()

template<int dim, int range>
std::size_t qugar::ReparamMesh< dim, range >::get_num_points ( ) const
nodiscard

Retrieves the number of points.

Returns
The number of points.

◆ get_num_points_per_cell()

template<int dim, int range>
std::size_t qugar::ReparamMesh< dim, range >::get_num_points_per_cell ( ) const
nodiscard

Retrieves the number of points per cell, that depends on the reparameterization order.

Returns
The number of points per cell as a std::size_t.

◆ get_order()

template<int dim, int range>
int qugar::ReparamMesh< dim, range >::get_order ( ) const
nodiscard

Retrieves the reparameterization's order.

Returns
int Reparameterization order.

◆ get_points()

template<int dim, int range>
const std::vector< Point< range > > & qugar::ReparamMesh< dim, range >::get_points ( ) const
nodiscard

Retrieves the points the reparameterization points.

Returns
A constant reference to a vector containing points.

◆ get_wires_connectivity()

template<int dim, int range>
const std::vector< std::size_t > & qugar::ReparamMesh< dim, range >::get_wires_connectivity ( ) const
nodiscard

Retrieves the wirebasket reparameterization connectivity.

Returns
A constant reference to the wirebasket connectivity vector.

◆ insert_cell_point()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::insert_cell_point ( const Point< range > & point,
int cell_id,
int pt_id )

This method sets the given point point, with index pt_id, to the cell designed by cell_id.

Parameters
pointPoint to be set.
cell_idFlat index of the cell in which the point is set.
pt_idFlat index of the reparameterization point referred to the cell.

◆ merge()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::merge ( const ReparamMesh< dim, range > & mesh)

Merges the given mesh into the current mesh.

This function takes another mesh as input and merges it with the current mesh. The points, connectivity, and wires connectivity are appended, shifting the indices by the number of points in the current mesh.

Note
Coincident points are not merged and duplicated wires are not purged.
Warning
Both meshes must have the same order.
Parameters
meshThe mesh to be merged with the current mesh.

◆ merge_coincident_points()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::merge_coincident_points ( const Tolerance & tol)

Merges coincident points in the reparameterization up to tolerance.

Parameters
tolTolerance to be used in the comparisons between points.
Note
The connecitivity of cells (and wirebasket) is updated accordingly, and duplicated wirebasket edges are purged.

◆ permute_cell_directions()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::permute_cell_directions ( std::size_t cell_id)

Permutes the directions of the given cell.

If dimension is greater or equal than 2, the first two direction are permuted. Otherwise, if the dimension is 1, the first direction is reversed.

Parameters
cell_idThe identifier of the cell whose directions are to be permuted.

◆ purge_duplicate_wirebasket_edges()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::purge_duplicate_wirebasket_edges ( )
protected

◆ reserve_cells()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::reserve_cells ( std::size_t n_new_cells)

Reserves memory for a specified number of cells.

It only reserves memory, no resize performed, for poitns and cells connectivity. Not for wires.

Parameters
n_new_cellsThe number of cells to allocate memory for.

◆ scale_points() [1/2]

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::scale_points ( const BoundBox< range > & old_domain,
const BoundBox< range > & new_domain )

Scales points from an old domain to a new domain.

This function takes two bounding boxes representing the old and new domains, and scales the points from the old to the new one.

Parameters
old_domainThe bounding box representing the old domain.
new_domainThe bounding box representing the new domain.

◆ scale_points() [2/2]

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::scale_points ( const std::vector< int > & point_ids,
const BoundBox< range > & old_domain,
const BoundBox< range > & new_domain )

Scales points from an old domain to a new domain.

This function takes two bounding boxes representing the old and new domains, and scales the points from the old to the new one.

Parameters
point_idsList of points to scale.
old_domainThe bounding box representing the old domain.
new_domainThe bounding box representing the new domain.

◆ sort_edge_points()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::sort_edge_points ( std::span< std::size_t > edge_points_ids) const
protected

Sorts the given edge points by their IDs.

They are sorted such that the first point is smaller than the last one. If both indices are equal, the ids of the second points (from the begining and the end) are compared.

Parameters
edge_points_idsA span of edge point IDs to be sorted.

◆ sort_wirebasket_edges()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::sort_wirebasket_edges ( )
protected

◆ use_Chebyshev() [1/2]

template<int dim, int range>
bool qugar::ReparamMesh< dim, range >::use_Chebyshev ( ) const
nodiscard

Determines whether the Chebyshev nodes are used, or equally spaced nodes.

Chebyshev nodes should be used for high-order reparameterizations if the reparameterization order is greater or equal than chebyshev_order.

Returns
true if the Chebyshev method is used, false otherwise.

◆ use_Chebyshev() [2/2]

template<int dim, int range>
static bool qugar::ReparamMesh< dim, range >::use_Chebyshev ( int order)
staticnodiscard

Determines whether the Chebyshev nodes are used, or equally spaced nodes.

Chebyshev nodes should be used for high-order reparameterizations if the reparameterization order is greater or equal than chebyshev_order.

Returns
order Reparameterization order.
true if the Chebyshev method is used, false otherwise.

◆ write_VTK_file()

template<int dim, int range>
void qugar::ReparamMesh< dim, range >::write_VTK_file ( const std::string & filename) const

Writes the reparameterization data to a VTK file.

This function takes a reparameterization object and writes its data to a file in VTK format, which can be used for visualization in tools like ParaView.

If the repameterization contains a wirebasket mesh, the generated VTK files is composed of three files: a file with extension .vtmb that calls two .vtu files (one for the internal reparameterization), and one for the wirebasket.

If no wirebasket mesh is present, the generated VTK file is a single .vtu file for the internal reparameterization.

The reparameterizations of both the internal and wirebasket meshes is written as high-order Lagrange VTK cells.

Parameters
filenameThe name of the file to which the data will be written, without extension.

Member Data Documentation

◆ chebyshev_order

template<int dim, int range>
const int qugar::ReparamMesh< dim, range >::chebyshev_order = 7
static

Order for deciding if Chebyshev nodes are used for defining the Lagrange polynomials instead of equally spaced nodes. If the reparameterization order is greater than this value, Chebyshev nodes are used.

◆ connectivity_

template<int dim, int range>
std::vector<std::size_t> qugar::ReparamMesh< dim, range >::connectivity_
protected

Cells' connectivity.

◆ order_

template<int dim, int range>
int qugar::ReparamMesh< dim, range >::order_
protected

Reparameterization order (number of points per direction).

◆ points_

template<int dim, int range>
std::vector<Point<range> > qugar::ReparamMesh< dim, range >::points_
protected

Vector of points.

◆ wires_connectivity_

template<int dim, int range>
std::vector<std::size_t> qugar::ReparamMesh< dim, range >::wires_connectivity_
protected

Cells wires' connectivity.


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