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

Function test_cell_geometry

tests/mesh/test-regular-grid.cpp:218–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218void test_cell_geometry( const geode::RegularGrid3D& grid )
219{
220 const auto pt0 = grid.point( grid.vertex_index( { 0, 0, 0 } ) );
221 geode::OpenGeodeMeshException::test( pt0 == geode::Point3D( { 1.5, 0, 1 } ),
222 "Wrong point coordinates: ", pt0.string(), " instead of [1.5, 0, 1]." );
223 const auto pt1 = grid.point( grid.vertex_index( { 0, 0, 1 } ) );
224 geode::OpenGeodeMeshException::test(
225 pt1 == geode::Point3D( { 1.5, -3, 1 } ),
226 "Wrong point coordinates: ", pt1.string(),
227 " instead of [1.5, -3, 1]." );
228 const auto pt2 = grid.point( grid.vertex_index( { 1, 1, 1 } ) );
229 geode::OpenGeodeMeshException::test(
230 pt2 == geode::Point3D( { -0.5, -3, 2 } ),
231 "Wrong point coordinates: ", pt2.string(),
232 " instead of [-0.5, -3, 2]." );
233 const auto pt3 = grid.point( grid.vertex_index( { 2, 1, 4 } ) );
234 geode::OpenGeodeMeshException::test(
235 pt3 == geode::Point3D( { -0.5, -12, 3 } ),
236 "Wrong point coordinates: ", pt3.string(),
237 " instead of [-0.5, -12, 3]." );
238 const auto pt4 =
239 grid.polyhedron_barycenter( grid.cell_index( { 2, 1, 4 } ) );
240 geode::OpenGeodeMeshException::test(
241 pt4 == geode::Point3D( { -1.5, -13.5, 3.5 } ),
242 "Wrong point coordinates: ", pt4.string(),
243 " instead of [-1.5, -13.5, 3.5]." );
244}
245
246void test_cell_query( const geode::RegularGrid3D& grid )
247{

Callers 1

test_gridFunction · 0.70

Calls 6

polyhedron_barycenterMethod · 0.80
testFunction · 0.70
pointMethod · 0.45
vertex_indexMethod · 0.45
stringMethod · 0.45
cell_indexMethod · 0.45

Tested by

no test coverage detected