MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test

Function test

tests/mesh/test-build-grid.cpp:32–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#include <geode/tests/common.hpp>
31
32void test()
33{
34 geode::OpenGeodeMeshLibrary::initialize();
35 const geode::index_t max_nb_cells{ 100 };
36 geode::BoundingBox2D bbox;
37 bbox.add_point( geode::Point2D{ { 0, 0 } } );
38 bbox.add_point( geode::Point2D{ { 1, 1 } } );
39 const auto grid =
40 geode::build_grid_from_bbox_target_length_and_maximum_cell_number(
41 bbox, 0.01, max_nb_cells );
42 DEBUG( grid.nb_cells() );
43 DEBUG( grid.nb_cells_in_direction( 0 ) );
44 DEBUG( grid.nb_cells_in_direction( 1 ) );
45 DEBUG( grid.cell_length_in_direction( 0 ) );
46 DEBUG( grid.cell_length_in_direction( 1 ) );
47 geode::OpenGeodeMeshException::test(
48 grid.nb_cells() <= max_nb_cells, "Too much cells in built grid" );
49
50 bbox.add_point( geode::Point2D{ { 1, 10 } } );
51 const auto grid2 =
52 geode::build_grid_from_bbox_target_length_and_maximum_cell_number(
53 bbox, 0.01, max_nb_cells );
54 DEBUG( grid2.nb_cells() );
55 DEBUG( grid2.nb_cells_in_direction( 0 ) );
56 DEBUG( grid2.nb_cells_in_direction( 1 ) );
57 DEBUG( grid2.cell_length_in_direction( 0 ) );
58 DEBUG( grid2.cell_length_in_direction( 1 ) );
59 geode::OpenGeodeMeshException::test(
60 grid.nb_cells() <= max_nb_cells, "Too much cells in built grid2" );
61
62 bbox.add_point( geode::Point2D{ { 3, 10 } } );
63 const auto grid3 =
64 geode::build_grid_from_bbox_target_length_and_maximum_cell_number(
65 bbox, 0.01, max_nb_cells );
66 DEBUG( grid3.nb_cells() );
67 DEBUG( grid3.nb_cells_in_direction( 0 ) );
68 DEBUG( grid3.nb_cells_in_direction( 1 ) );
69 DEBUG( grid3.cell_length_in_direction( 0 ) );
70 DEBUG( grid3.cell_length_in_direction( 1 ) );
71 geode::OpenGeodeMeshException::test(
72 grid.nb_cells() <= max_nb_cells, "Too much cells in built grid3" );
73}
74
75OPENGEODE_TEST( "graph" )

Callers

nothing calls this directly

Calls 6

initializeFunction · 0.85
add_pointMethod · 0.45
nb_cellsMethod · 0.45
nb_cells_in_directionMethod · 0.45

Tested by

no test coverage detected