CArl
Code Arlequin / C++ implementation
|
Class used to stitch together different meshes. More...
#include <stitch_meshes.h>
Public Member Functions | |
Stitch_Meshes (libMesh::Mesh &output_mesh, const std::string output_filename="test_stitched", long grid_n_min=static_cast< long >(1E9), bool debugOutput=true) | |
const libMesh::ReplicatedMesh & | mesh () |
Returns the stitched mesh. More... | |
const std::unordered_set< unsigned int > * | get_restricted_set_pointer_first () |
Returns the pointer to the set with the elements used to form the first restricted mesh. More... | |
const std::unordered_set< unsigned int > * | get_restricted_set_pointer_second () |
Returns the pointer to the set with the elements used to form the second restricted mesh. More... | |
void | set_base_filenames (std::vector< std::string > &mesh_filenames, std::vector< std::string > &table_filenames) |
Set by hand the filenames used to build the stitched mesh. More... | |
void | set_base_filenames (const std::string &filename_base=std::string("test_r_"), const std::string &mesh_format=std::string(".msh"), unsigned int nb_of_files=0) |
Set the filenames used to build the stitched mesh from a common filename base. More... | |
void | preallocate_grid (int map_preallocation) |
Preallocate the discrete points grid. More... | |
void | set_grid_constraints (const libMesh::Mesh &mesh_A, const libMesh::Mesh &mesh_B, double vol_tol=-1) |
Set the boundaries of the discrete points grid, using the intersected meshes as a base. More... | |
void | set_grid_constraints (Mesh_Intersection &mesh_inter_obj) |
Copy the boundaries of the discrete points grid from a carl::Mesh_Intersection object. More... | |
void | join_tables () |
Join the intersection tables. More... | |
void | stitch_meshes () |
Stitch the meshes. More... | |
void | convert_to_discrete (const libMesh::Point &iPoint, std::vector< long > &oPoint) |
Convert a real valued point to a discrete point. More... | |
Protected Member Functions | |
Stitch_Meshes () | |
Protected Attributes | |
const libMesh::Parallel::Communicator & | m_world_comm |
MPI Communicator. More... | |
const unsigned int | m_nodes |
Number of processors. More... | |
const unsigned int | m_rank |
Processor rank. More... | |
libMesh::ReplicatedMesh & | m_Stitched_mesh |
Final, stitched mesh. More... | |
std::vector< std::string > | m_mesh_filenames |
File names of the meshes to be stitched. More... | |
std::vector< std::string > | m_table_filenames |
File names of intersection tables to joined. More... | |
unsigned int | m_nb_files |
Number of files. More... | |
std::string | m_base_output |
Base output filename. More... | |
std::string | m_mesh_output |
Mesh output filename. More... | |
std::string | m_table_output |
Intersection table output filename. More... | |
std::vector< std::pair< unsigned int, unsigned int > > | m_intersection_pairs |
Vector containing all the intersection pairs. More... | |
std::unordered_set< unsigned int > | m_restriction_set_first |
Set of elements used for the restriction of the first mesh. More... | |
std::unordered_set< unsigned int > | m_restriction_set_second |
Set of elements used for the restriction of the second mesh. More... | |
std::vector< unsigned int > | m_intersection_nb_of_elements |
Nmber of elements inside each intersection. More... | |
double | m_eps |
Precision of the discrete point grid. More... | |
double | m_vol_tol |
Grid minimum volume. More... | |
std::vector< long > | m_GridN |
Dimensions of the discrete point grid. More... | |
std::vector< long > | m_dummy_discrete_point |
libMesh::Point | m_Grid_MinPoint |
Minimal point of the discrete grid. More... | |
libMesh::Point | m_Grid_MaxPoint |
Maximum point of the discrete grid. More... | |
std::unordered_map< std::vector< long >, unsigned int, PointHash_3D, PointHash_3D_Equal > | m_discrete_vertices |
Unordered map (or hash) for the discrete points (key). More... | |
long | m_GridN_min |
Minimal number of integers over each dimension of the discrete grid. More... | |
unsigned int | m_nb_of_intersections |
Final mesh's number of intersections. More... | |
unsigned int | m_nb_of_elements |
Final mesh's number of elements. More... | |
unsigned int | m_nb_of_nodes |
Final mesh's number of nodes. More... | |
unsigned int | m_maximum_nb_of_nodes |
Upper limit for the final mesh's number of nodes. More... | |
bool | m_bFilenamesSet |
Have the filenames been set? More... | |
bool | m_bGridDefined |
Is the grid defined? More... | |
bool | m_bGridPreallocated |
Is the grid preallocated? More... | |
bool | m_bMeshFinalized |
Is final mesh finalized? More... | |
bool | m_bPrintDebug |
Print debug information? Default: false. More... | |
Class used to stitch together different meshes.
This class supposes that the meshes being stitched have compatible interfaces. In other words, that the stitched faces have the same vertices and surface elements. For the intersection search algorithms, it also joins the local intersection tables into a single, global table. To avoid rounding error problems during the mesh constructions, each vertex point is associated to a discrete point inside a grid. This grid is constructed taking into account the dimensions of the mesh, in a similar fashion to what is done for the carl::Mesh_Intersection class. (idea: create a grid class, create a more primitive class ignoring the intersections).
Definition at line 35 of file stitch_meshes.h.
|
protected |
|
inline |
Definition at line 125 of file stitch_meshes.h.
void carl::Stitch_Meshes::convert_to_discrete | ( | const libMesh::Point & | iPoint, |
std::vector< long > & | oPoint | ||
) |
Convert a real valued point to a discrete point.
Definition at line 368 of file stitch_meshes.cpp.
const std::unordered_set< unsigned int > * carl::Stitch_Meshes::get_restricted_set_pointer_first | ( | ) |
Returns the pointer to the set with the elements used to form the first restricted mesh.
Definition at line 375 of file stitch_meshes.cpp.
const std::unordered_set< unsigned int > * carl::Stitch_Meshes::get_restricted_set_pointer_second | ( | ) |
Returns the pointer to the set with the elements used to form the second restricted mesh.
Definition at line 380 of file stitch_meshes.cpp.
void carl::Stitch_Meshes::join_tables | ( | ) |
Join the intersection tables.
Definition at line 162 of file stitch_meshes.cpp.
const libMesh::ReplicatedMesh & carl::Stitch_Meshes::mesh | ( | ) |
Returns the stitched mesh.
Definition at line 12 of file stitch_meshes.cpp.
void carl::Stitch_Meshes::preallocate_grid | ( | int | map_preallocation | ) |
Preallocate the discrete points grid.
Definition at line 64 of file stitch_meshes.cpp.
void carl::Stitch_Meshes::set_base_filenames | ( | std::vector< std::string > & | mesh_filenames, |
std::vector< std::string > & | table_filenames | ||
) |
Set by hand the filenames used to build the stitched mesh.
Definition at line 17 of file stitch_meshes.cpp.
void carl::Stitch_Meshes::set_base_filenames | ( | const std::string & | filename_base = std::string("test_r_") , |
const std::string & | mesh_format = std::string(".msh") , |
||
unsigned int | nb_of_files = 0 |
||
) |
Set the filenames used to build the stitched mesh from a common filename base.
Definition at line 36 of file stitch_meshes.cpp.
void carl::Stitch_Meshes::set_grid_constraints | ( | const libMesh::Mesh & | mesh_A, |
const libMesh::Mesh & | mesh_B, | ||
double | vol_tol = -1 |
||
) |
Set the boundaries of the discrete points grid, using the intersected meshes as a base.
Definition at line 71 of file stitch_meshes.cpp.
void carl::Stitch_Meshes::set_grid_constraints | ( | Mesh_Intersection & | mesh_inter_obj | ) |
Copy the boundaries of the discrete points grid from a carl::Mesh_Intersection object.
Definition at line 140 of file stitch_meshes.cpp.
void carl::Stitch_Meshes::stitch_meshes | ( | ) |
Stitch the meshes.
Definition at line 261 of file stitch_meshes.cpp.
|
protected |
Base output filename.
Definition at line 56 of file stitch_meshes.h.
|
protected |
Have the filenames been set?
Definition at line 105 of file stitch_meshes.h.
|
protected |
Is the grid defined?
Definition at line 108 of file stitch_meshes.h.
|
protected |
Is the grid preallocated?
Definition at line 109 of file stitch_meshes.h.
|
protected |
Is final mesh finalized?
Definition at line 112 of file stitch_meshes.h.
|
protected |
Print debug information? Default: false.
Definition at line 115 of file stitch_meshes.h.
|
protected |
Unordered map (or hash) for the discrete points (key).
Definition at line 93 of file stitch_meshes.h.
|
protected |
Definition at line 83 of file stitch_meshes.h.
|
protected |
Precision of the discrete point grid.
Definition at line 75 of file stitch_meshes.h.
|
protected |
Maximum point of the discrete grid.
Definition at line 89 of file stitch_meshes.h.
|
protected |
Minimal point of the discrete grid.
Definition at line 86 of file stitch_meshes.h.
|
protected |
Dimensions of the discrete point grid.
Definition at line 81 of file stitch_meshes.h.
|
protected |
Minimal number of integers over each dimension of the discrete grid.
Definition at line 96 of file stitch_meshes.h.
|
protected |
Nmber of elements inside each intersection.
Definition at line 69 of file stitch_meshes.h.
|
protected |
Vector containing all the intersection pairs.
Definition at line 61 of file stitch_meshes.h.
|
protected |
Upper limit for the final mesh's number of nodes.
Definition at line 102 of file stitch_meshes.h.
|
protected |
File names of the meshes to be stitched.
Definition at line 47 of file stitch_meshes.h.
|
protected |
Mesh output filename.
Definition at line 57 of file stitch_meshes.h.
|
protected |
Number of files.
Definition at line 53 of file stitch_meshes.h.
|
protected |
Final mesh's number of elements.
Definition at line 100 of file stitch_meshes.h.
|
protected |
Final mesh's number of intersections.
Definition at line 99 of file stitch_meshes.h.
|
protected |
Final mesh's number of nodes.
Definition at line 101 of file stitch_meshes.h.
|
protected |
Number of processors.
Definition at line 40 of file stitch_meshes.h.
|
protected |
Processor rank.
Definition at line 41 of file stitch_meshes.h.
|
protected |
Set of elements used for the restriction of the first mesh.
Definition at line 65 of file stitch_meshes.h.
|
protected |
Set of elements used for the restriction of the second mesh.
Definition at line 66 of file stitch_meshes.h.
|
protected |
Final, stitched mesh.
Definition at line 44 of file stitch_meshes.h.
|
protected |
File names of intersection tables to joined.
Definition at line 50 of file stitch_meshes.h.
|
protected |
Intersection table output filename.
Definition at line 58 of file stitch_meshes.h.
|
protected |
Grid minimum volume.
Definition at line 78 of file stitch_meshes.h.
|
protected |
MPI Communicator.
Definition at line 39 of file stitch_meshes.h.