From 9fc6f272432ea9eeb64d1f491afaa7924cb42306 Mon Sep 17 00:00:00 2001 From: "Garth N. Wells" Date: Wed, 11 Sep 2024 15:51:42 +0100 Subject: [PATCH] Fix formatting --- cpp/test/mesh/generation.cpp | 82 ++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/cpp/test/mesh/generation.cpp b/cpp/test/mesh/generation.cpp index ac5a0c69aec..810a0f35ccc 100644 --- a/cpp/test/mesh/generation.cpp +++ b/cpp/test/mesh/generation.cpp @@ -1,48 +1,50 @@ -#include - -#include +// Copyright (C) 2024 Paul Kühner +// +// This file is part of DOLFINx (https://www.fenicsproject.org) +// +// SPDX-License-Identifier: LGPL-3.0-or-later #include "dolfinx/mesh/generation.h" +#include +#include using namespace dolfinx; TEST_CASE("Generation", "create_interval") { - mesh::Mesh mesh = mesh::create_interval(MPI_COMM_SELF, 4, {0., 1.}); - - { - int comp_result; - MPI_Comm_compare(mesh.comm(), MPI_COMM_SELF, &comp_result); - CHECK(comp_result == MPI_CONGRUENT); - } - - CHECK(mesh.geometry().dim() == 1); - auto vertices = mesh.geometry().x(); - CHECK(vertices[0*3] == 0.0); - CHECK(vertices[1*3] == 0.25); - CHECK(vertices[2*3] == 0.5); - CHECK(vertices[3*3] == 0.75); - CHECK(vertices[4*3] == 1.0); - - mesh.topology()->create_connectivity(0, 1); - auto point_conn = mesh.topology()->connectivity(0, 1); - - CHECK(point_conn->num_nodes() == 5); - - CHECK(point_conn->num_links(0) == 1); - CHECK(point_conn->num_links(1) == 2); - CHECK(point_conn->num_links(2) == 2); - CHECK(point_conn->num_links(3) == 2); - CHECK(point_conn->num_links(4) == 1); - - CHECK(point_conn->links(0)[0] == 0); - CHECK(point_conn->links(1)[0] == 0); - CHECK(point_conn->links(1)[1] == 1); - CHECK(point_conn->links(2)[0] == 1); - CHECK(point_conn->links(2)[1] == 2); - CHECK(point_conn->links(3)[0] == 2); - CHECK(point_conn->links(3)[1] == 3); - CHECK(point_conn->links(4)[0] == 3); + mesh::Mesh mesh = mesh::create_interval(MPI_COMM_SELF, 4, {0., 1.}); + + { + int comp_result; + MPI_Comm_compare(mesh.comm(), MPI_COMM_SELF, &comp_result); + CHECK(comp_result == MPI_CONGRUENT); + } + + CHECK(mesh.geometry().dim() == 1); + auto vertices = mesh.geometry().x(); + CHECK(vertices[0 * 3] == 0.0); + CHECK(vertices[1 * 3] == 0.25); + CHECK(vertices[2 * 3] == 0.5); + CHECK(vertices[3 * 3] == 0.75); + CHECK(vertices[4 * 3] == 1.0); + + mesh.topology()->create_connectivity(0, 1); + auto point_conn = mesh.topology()->connectivity(0, 1); + + CHECK(point_conn->num_nodes() == 5); + + CHECK(point_conn->num_links(0) == 1); + CHECK(point_conn->num_links(1) == 2); + CHECK(point_conn->num_links(2) == 2); + CHECK(point_conn->num_links(3) == 2); + CHECK(point_conn->num_links(4) == 1); + + CHECK(point_conn->links(0)[0] == 0); + CHECK(point_conn->links(1)[0] == 0); + CHECK(point_conn->links(1)[1] == 1); + CHECK(point_conn->links(2)[0] == 1); + CHECK(point_conn->links(2)[1] == 2); + CHECK(point_conn->links(3)[0] == 2); + CHECK(point_conn->links(3)[1] == 3); + CHECK(point_conn->links(4)[0] == 3); } - -// TODO extend for further mesh types.