36 #include <ringmesh/ringmesh_tests_config.h> 53 template < index_t DIMENSION >
65 return vec3( i, j, 0 );
68 template < index_t DIMENSION >
72 for( index_t i :
range( size ) )
74 builder->
set_vertex( i, create_vertex< DIMENSION >( i, i + 1 ) );
78 template < index_t DIMENSION >
83 for( index_t i :
range( size ) )
85 for( index_t j :
range( size ) )
87 builder->
set_vertex(
id++, create_vertex< DIMENSION >( i, j ) );
92 template < index_t DIMENSION >
97 for( index_t i :
range( size ) )
99 for( index_t j :
range( size ) )
101 for( index_t k :
range( size ) )
109 template < index_t DIMENSION >
113 for( index_t i :
range( size - 1 ) )
120 template < index_t DIMENSION >
125 for( index_t i :
range( size - 1 ) )
127 for( index_t j :
range( size - 1 ) )
147 template < index_t DIMENSION >
153 for( index_t i :
range( size - 1 ) )
155 for( index_t j :
range( size - 1 ) )
157 for( index_t k :
range( size - 1 ) )
159 index_t corner = i + j * size + k * size * size;
172 corner + size * size + size + 1 );
182 template < index_t DIMENSION >
187 for( index_t i :
range( size - 1 ) )
189 for( index_t j :
range( size - 1 ) )
192 create_vertex< DIMENSION >( i + offset, j + offset );
193 index_t triangle1 = NO_ID;
195 std::tie( triangle1, nearest_point1, std::ignore ) =
197 if( triangle1 !=
id++ )
200 "TEST",
"Not the correct triangle found" );
202 if( nearest_point1 != query1 )
205 "TEST",
"Not the correct nearest point found" );
209 create_vertex< DIMENSION >( i + 1 - offset, j + 1 - offset );
210 index_t triangle2 = NO_ID;
212 std::tie( triangle2, nearest_point2, std::ignore ) =
214 if( triangle2 !=
id++ )
217 "TEST",
"Not the correct triangle found" );
219 if( nearest_point2 != query2 )
222 "TEST",
"Not the correct nearest point found" );
228 index_t triangle = NO_ID;
230 std::tie( triangle, nearest_point, std::ignore ) =
239 "TEST",
"Not the correct nearest point found" );
243 template < index_t DIMENSION >
248 std::vector< index_t > vertices_in_hex( 8 );
249 for( index_t v :
range( 8 ) )
300 template < index_t DIMENSION >
305 std::unique_ptr< VolumeMeshBuilder< DIMENSION > > builder =
315 template < index_t DIMENSION >
318 Logger::out(
"TEST",
"Test Surface AABB ", DIMENSION,
"D" );
320 std::unique_ptr< SurfaceMeshBuilder< DIMENSION > > builder =
331 template < index_t DIMENSION >
339 if( containing_cell != c )
346 template < index_t DIMENSION >
349 Logger::out(
"TEST",
"Test Volume AABB ", DIMENSION,
"D" );
351 std::unique_ptr< VolumeMeshBuilder< DIMENSION > > builder =
363 template < index_t DIMENSION >
370 index_t closest_edge = NO_ID;
371 std::tie( closest_edge, std::ignore, std::ignore ) =
373 if( closest_edge != e )
380 template < index_t DIMENSION >
383 Logger::out(
"TEST",
"Test Line AABB ", DIMENSION,
"D" );
385 std::unique_ptr< LineMeshBuilder< DIMENSION > > builder =
402 test_LineAABB< 2 >();
403 test_LineAABB< 3 >();
404 test_SurfaceAABB< 2 >();
405 test_SurfaceAABB< 3 >();
406 test_VolumeAABB< 3 >();
413 catch(
const std::exception& e )
GEO::vecng< DIMENSION, double > vecn
static std::unique_ptr< LineMeshBuilder > create_builder(LineMesh< DIMENSION > &mesh)
void add_vertices(LineMeshBuilder< DIMENSION > *builder, index_t size)
void add_triangles(SurfaceMeshBuilder< DIMENSION > *builder, index_t size)
std::tuple< index_t, vecn< DIMENSION >, double > closest_edge(const vecn< DIMENSION > &query) const
Gets the closest edge to a given point.
const VolumeAABBTree< DIMENSION > & cell_aabb() const
Creates an AABB tree for a Mesh cells.
index_t nb_edges() const override
Gets the number of all the edges in the whole Mesh.
vecn< DIMENSION > cell_barycenter(index_t cell_id) const
index_t cell_vertex(const ElementLocalVertex &cell_local_vertex) const override
Gets a vertex index by cell and local vertex index.
void add_edges(LineMeshBuilder< DIMENSION > *builder, index_t size)
void set_cell_vertex(const ElementLocalVertex &cell_local_vertex, index_t vertex_id)
Sets a vertex of a cell by local vertex index.
static std::unique_ptr< VolumeMeshBuilder< DIMENSION > > create_builder(VolumeMesh< DIMENSION > &mesh)
index_t create_triangles(index_t nb_triangles)
Creates a contiguous chunk of triangles.
static void err(const std::string &feature, const Args &... args)
void create_5_tets_from_hex(VolumeMeshBuilder< DIMENSION > &builder, const GeogramVolumeMesh< DIMENSION > &mesh_hex, index_t hex)
static void out(const std::string &feature, const Args &... args)
index_t create_vertices(index_t nb)
Creates a contiguous chunk of vertices.
vecn< DIMENSION > edge_barycenter(index_t edge_id) const
void set_polygon_vertex(const PolygonLocalEdge &polygon_local_edge, index_t vertex_id)
Sets a vertex of a polygon by local vertex index.
void add_hexs(VolumeMeshBuilder< DIMENSION > *builder, index_t size)
void set_vertex(index_t v_id, const vecn< DIMENSION > &vertex)
Sets a point.
void test_locate_cell_on_3D_mesh(const GeogramVolumeMesh< DIMENSION > &mesh)
void check_tree(const SurfaceAABBTree< DIMENSION > &tree, index_t size)
const LineAABBTree< DIMENSION > & edge_aabb() const
Creates an AABB tree for a Mesh edges.
index_t create_cells(index_t nb_cells, CellType type)
Creates a contiguous chunk of cells of the same type.
void decompose_in_tet(const GeogramVolumeMesh< DIMENSION > &hex_mesh, GeogramVolumeMesh< DIMENSION > &tet_mesh, index_t size)
index_t nb_cells() const override
Gets the number of cells in the Mesh.
index_t containing_cell(const vecn< DIMENSION > &query) const
Gets the cell contining a point.
const std::string & category() const
virtual void connect_cells()=0
Retrieve the adjacencies.
Classes to build GeoModel from various inputs.
index_t create_edges(index_t nb_edges)
Creates a contiguous chunk of edges.
void test_locate_edge_on_1D_mesh(const GeogramLineMesh< DIMENSION > &mesh)
vecn< DIMENSION > create_vertex(double i, double j)
void set_edge_vertex(const EdgeLocalVertex &edge_local_vertex, index_t vertex_id)
Sets a vertex of a edge by local vertex index.
std::tuple< index_t, vecn< DIMENSION >, double > closest_triangle(const vecn< DIMENSION > &query) const
Gets the closest triangle to a given point.
static std::unique_ptr< SurfaceMeshBuilder< DIMENSION > > create_builder(SurfaceMesh< DIMENSION > &mesh)
void RINGMESH_API default_configure()