| 43 | #include <geode/tests/common.hpp> |
| 44 | |
| 45 | void test_gradient_grid2D() |
| 46 | { |
| 47 | auto grid = geode::RegularGrid< 2 >::create(); |
| 48 | auto builder = geode::RegularGridBuilder< 2 >::create( *grid ); |
| 49 | builder->initialize_grid( geode::Point2D{ { 0, 0 } }, { 3, 3 }, |
| 50 | { geode::Vector2D{ { 1, 0 } }, geode::Vector2D{ { 0, 1 } } } ); |
| 51 | const auto scalar_function_name = "scalar_function"; |
| 52 | auto attribute = |
| 53 | grid->vertex_attribute_manager() |
| 54 | .find_or_create_attribute< geode::VariableAttribute, double >( |
| 55 | scalar_function_name, 0 ); |
| 56 | attribute->set_value( 1, 1 ); |
| 57 | attribute->set_value( 4, 1 ); |
| 58 | attribute->set_value( 6, 1 ); |
| 59 | attribute->set_value( 9, 1 ); |
| 60 | attribute->set_value( 2, 2 ); |
| 61 | attribute->set_value( 3, 3 ); |
| 62 | attribute->set_value( 7, 2 ); |
| 63 | attribute->set_value( 8, 2 ); |
| 64 | attribute->set_value( 10, 2 ); |
| 65 | attribute->set_value( 11, 3 ); |
| 66 | attribute->set_value( 12, 3 ); |
| 67 | attribute->set_value( 13, 2 ); |
| 68 | attribute->set_value( 14, 3 ); |
| 69 | attribute->set_value( 15, 8 ); |
| 70 | const auto gradient_name = geode::compute_surface_scalar_function_gradient( |
| 71 | *grid, scalar_function_name ); |
| 72 | geode::Logger::info( "Gradient attribute name: ", gradient_name ); |
| 73 | geode::save_regular_grid< 2 >( *grid, "grid_with_gradient.og_rgd2d" ); |
| 74 | } |
| 75 | |
| 76 | void test_gradient_triangulated_surface2D() |
| 77 | { |
no test coverage detected