8 #ifndef COMMON_INTERSECTIONS_PARALLEL_STITCH_MESHES_H_
9 #define COMMON_INTERSECTIONS_PARALLEL_STITCH_MESHES_H_
125 Stitch_Meshes( libMesh::Mesh& output_mesh,
const std::string output_filename =
"test_stitched",
long grid_n_min = static_cast<long>(1E9),
bool debugOutput =
true) :
126 m_world_comm { output_mesh.comm() },
127 m_nodes { m_world_comm.size() },
128 m_rank { m_world_comm.rank() },
129 m_Stitched_mesh { output_mesh },
131 m_base_output { output_filename },
134 m_GridN { std::vector<long> (3,-1) },
135 m_dummy_discrete_point { std::vector<long> (3,-1) },
136 m_Grid_MinPoint { libMesh::Point(0,0,0) },
137 m_Grid_MaxPoint { libMesh::Point(1,1,1) },
138 m_GridN_min { grid_n_min },
139 m_nb_of_intersections { 0 },
140 m_nb_of_elements { 0 },
142 m_maximum_nb_of_nodes { 0 },
143 m_bFilenamesSet {
false },
144 m_bGridDefined {
false },
145 m_bGridPreallocated {
false },
146 m_bMeshFinalized {
false },
147 m_bPrintDebug { debugOutput }
149 m_Stitched_mesh.allow_renumbering(
false);
153 const libMesh::ReplicatedMesh &
mesh();
163 void set_base_filenames(std::vector<std::string> & mesh_filenames, std::vector<std::string> & table_filenames);
166 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);
172 void set_grid_constraints(
const libMesh::Mesh & mesh_A,
const libMesh::Mesh & mesh_B,
double vol_tol = -1);
std::vector< long > m_GridN
Dimensions of the discrete point grid.
long m_GridN_min
Minimal number of integers over each dimension of the discrete grid.
const unsigned int m_nodes
Number of processors.
unsigned int m_nb_files
Number of files.
std::vector< std::pair< unsigned int, unsigned int > > m_intersection_pairs
Vector containing all the intersection pairs.
bool m_bGridDefined
Is the grid defined?
std::string m_table_output
Intersection table output filename.
double m_eps
Precision of the discrete point grid.
unsigned int m_nb_of_elements
Final mesh's number of elements.
std::unordered_set< unsigned int > m_restriction_set_second
Set of elements used for the restriction of the second mesh.
bool m_bGridPreallocated
Is the grid preallocated?
bool m_bFilenamesSet
Have the filenames been set?
std::vector< unsigned int > m_intersection_nb_of_elements
Nmber of elements inside each intersection.
void preallocate_grid(int map_preallocation)
Preallocate the discrete points grid.
unsigned int m_nb_of_intersections
Final mesh's number of intersections.
std::string m_base_output
Base output filename.
unsigned int m_nb_of_nodes
Final mesh's number of nodes.
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.
std::unordered_set< unsigned int > m_restriction_set_first
Set of elements used for the restriction of the first mesh.
std::vector< long > m_dummy_discrete_point
void stitch_meshes()
Stitch the meshes.
libMesh::ReplicatedMesh & m_Stitched_mesh
Final, stitched mesh.
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...
void join_tables()
Join the intersection tables.
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).
void convert_to_discrete(const libMesh::Point &iPoint, std::vector< long > &oPoint)
Convert a real valued point to a discrete point.
libMesh::Point m_Grid_MinPoint
Minimal point of the discrete grid.
const unsigned int m_rank
Processor rank.
Class used to stitch together different meshes.
double m_vol_tol
Grid minimum volume.
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...
std::string m_mesh_output
Mesh output filename.
bool m_bPrintDebug
Print debug information? Default: false.
const libMesh::Parallel::Communicator & m_world_comm
MPI Communicator.
bool m_bMeshFinalized
Is final mesh finalized?
libMesh::Point m_Grid_MaxPoint
Maximum point of the discrete grid.
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...
unsigned int m_maximum_nb_of_nodes
Upper limit for the final mesh's number of nodes.
std::vector< std::string > m_mesh_filenames
File names of the meshes to be stitched.
const libMesh::ReplicatedMesh & mesh()
Returns the stitched mesh.
std::vector< std::string > m_table_filenames
File names of intersection tables to joined.
Stitch_Meshes(libMesh::Mesh &output_mesh, const std::string output_filename="test_stitched", long grid_n_min=static_cast< long >(1E9), bool debugOutput=true)