35 Eigen::Vector2d coords0(2, 0);
36 Eigen::Vector2d coords1(-1, 4);
37 Eigen::Vector2d coords2(0, 1);
55 BOOST_TEST(cog.size() == 2);
56 BOOST_TEST(referenceBox == bBox);
58 for (
decltype(cog.size()) d = 0; d < cog.size(); d++) {
59 BOOST_TEST(referenceCOG.at(d) == cog(d));
66 Eigen::Vector3d coords0(2, 0, -3);
67 Eigen::Vector3d coords1(-1, 4, 8);
68 Eigen::Vector3d coords2(0, 1, -2);
69 Eigen::Vector3d coords3(3.5, 2, -2);
89 BOOST_TEST(cog.size() == 3);
90 BOOST_TEST(referenceBox == bBox);
92 for (
decltype(cog.size()) d = 0; d < cog.size(); d++) {
93 BOOST_TEST(referenceCOG.at(d) == cog(d));
100 for (
int dim = 2; dim <= 3; dim++) {
106 BOOST_TEST(mesh.
getName() == meshName);
109 Eigen::VectorXd coords0(dim);
110 Eigen::VectorXd coords1(dim);
111 Eigen::VectorXd coords2(dim);
117 coords0 << 0.0, 0.0, 0.0;
118 coords1 << 1.0, 0.0, 0.0;
119 coords2 << 0.0, 0.0, 1.0;
131 BOOST_TEST(vertex.getID() == v0.
getID());
132 }
else if (
index == 1) {
133 BOOST_TEST(vertex.getID() == v1.
getID());
134 }
else if (
index == 2) {
135 BOOST_TEST(vertex.getID() == v2.
getID());
168 int dataDimensions = dim;
174 BOOST_TEST(data->getName() == dataName);
175 BOOST_TEST(data->getDimensions() == dataDimensions);
178 BOOST_TEST(mesh.
data().
size() == 1);
179 BOOST_TEST(mesh.
data(0)->getName() == dataName);
186 Eigen::VectorXd &dataValues = data->values();
187 BOOST_TEST(dataValues.size() == 3 * dim);
188 BOOST_TEST(v0.
getID() == 0);
189 Eigen::VectorXd value = Eigen::VectorXd::Zero(dim);
190 for (
int i = 0; i < dim; i++) {
191 value(i) = dataValues(v0.
getID() * dim + i);
203 for (
auto ptr : meshes) {
205 Eigen::VectorXd coords0(dim);
206 Eigen::VectorXd coords1(dim);
207 Eigen::VectorXd coords2(dim);
208 Eigen::VectorXd coords3(dim);
209 coords0 << 0.0, 0.0, 0.0;
210 coords1 << 1.0, 0.0, 0.0;
211 coords2 << 0.0, 0.0, 1.0;
212 coords3 << 1.0, 0.0, 1.0;
213 Vertex &v0 = mesh.createVertex(coords0);
214 Vertex &v1 = mesh.createVertex(coords1);
215 Vertex &v2 = mesh.createVertex(coords2);
216 Vertex &v3 = mesh.createVertex(coords3);
217 Edge & e0 = mesh.createEdge(v0, v1);
218 Edge & e1 = mesh.createEdge(v1, v2);
219 Edge & e2 = mesh.createEdge(v2, v0);
220 mesh.createEdge(v1, v3);
221 mesh.createEdge(v3, v2);
222 mesh.createTriangle(e0, e1, e2);
224 BOOST_TEST(mesh1 == mesh2);
244 "Mesh \"WKTMesh\", dimensionality = 3:\n"
245 "GEOMETRYCOLLECTION(\n"
246 "POINT (0 0 0), POINT (1 0 0), POINT (0 0 1), POINT (1 0 1),\n"
247 "LINESTRING (0 0 0, 1 0 0), LINESTRING (1 0 0, 0 0 1), LINESTRING (0 0 0, 0 0 1), LINESTRING (1 0 0, 1 0 1), LINESTRING (0 0 1, 1 0 1),\n"
248 "POLYGON ((0 0 0, 1 0 0, 0 0 1, 0 0 0))\n"
250 BOOST_TEST(reference == sstream.
str());
265 BOOST_TEST(values.size() == 2);
273 BOOST_TEST(values.size() == 5);
290 BOOST_TEST(values.size() == 4);
298 BOOST_TEST(values.size() == 2);
309 Eigen::Vector3d coords0;
310 Eigen::Vector3d coords1;
311 Eigen::Vector3d coords2;
312 Eigen::Vector3d coords3;
313 coords0 << 1.0, 0.0, 0.0;
314 coords1 << 0.0, 0.0, 0.0;
315 coords2 << 2.0, 2.0, 0.0;
316 coords3 << 0.0, 1.0, 0.0;
333 BOOST_REQUIRE(chain.connected);
335 BOOST_TEST(chain.edges.at(0) == &e0);
336 BOOST_TEST(chain.edges.at(1) == &e2);
337 BOOST_TEST(chain.edges.at(2) == &e1);
338 BOOST_TEST(chain.edges.at(3) == &e3);
340 BOOST_TEST(chain.vertices.at(0) == &v1);
341 BOOST_TEST(chain.vertices.at(1) == &v3);
342 BOOST_TEST(chain.vertices.at(2) == &v2);
343 BOOST_TEST(chain.vertices.at(3) == &v0);
352 Eigen::Vector3d coords0;
353 Eigen::Vector3d coords1;
354 Eigen::Vector3d coords2;
355 Eigen::Vector3d coords3;
356 coords0 << 1.0, 0.0, 0.0;
357 coords1 << 0.0, 0.0, 0.0;
358 coords2 << 2.0, 2.0, 0.0;
359 coords3 << 0.0, 1.0, 0.0;
390 Eigen::Vector3d coords0;
391 Eigen::Vector3d coords1;
392 coords0 << 1.0, 0.0, 0.0;
393 coords1 << 0.0, 1.0, 0.0;
406 Eigen::Vector3d coords0;
407 Eigen::Vector3d coords1;
408 Eigen::Vector3d coords2;
409 Eigen::Vector3d coords3;
410 coords0 << 1.0, 0.0, 0.0;
411 coords1 << 0.0, 0.0, 0.0;
412 coords2 << 2.0, 2.0, 0.0;
413 coords3 << 0.0, 1.0, 0.0;
424 BOOST_REQUIRE(result.size() == 3);
425 BOOST_TEST(result == expected);
434 Eigen::Vector3d coords0;
435 Eigen::Vector3d coords1;
436 Eigen::Vector3d coords2;
437 Eigen::Vector3d coords3;
438 coords0 << 1.0, 0.0, 0.0;
439 coords1 << 0.0, 0.0, 0.0;
440 coords2 << 2.0, 2.0, 0.0;
441 coords3 << 0.0, 1.0, 0.0;
452 BOOST_REQUIRE(result.size() == 3);
453 BOOST_TEST(result == expected);
462 Eigen::Vector3d coords0;
463 Eigen::Vector3d coords1;
464 Eigen::Vector3d coords2;
465 Eigen::Vector3d coords3;
466 coords0 << 1.0, 0.0, 0.0;
467 coords1 << 0.0, 0.0, 0.0;
468 coords2 << 2.0, 2.0, 0.0;
469 coords3 << 0.0, 1.0, 0.0;
480 BOOST_REQUIRE(result.size() == 3);
481 BOOST_TEST(result == expected);
490 auto &v1 = mesh->
createVertex(Eigen::Vector2d(0.0, 0.0));
491 auto &v2 = mesh->
createVertex(Eigen::Vector2d(0.0, 0.5));
492 auto &v3 = mesh->
createVertex(Eigen::Vector2d(0.0, 1.5));
493 auto &v4 = mesh->
createVertex(Eigen::Vector2d(0.0, 3.5));
500 mesh->
data(0)->values()(0) = 1.0;
501 mesh->
data(0)->values()(1) = 3.0;
502 mesh->
data(0)->values()(2) = 5.0;
503 mesh->
data(0)->values()(3) = 7.0;
506 double expected = 17.0;
507 BOOST_REQUIRE(result.size() == 1);
508 BOOST_TEST(result(0) == expected);
517 auto &v1 = mesh->
createVertex(Eigen::Vector2d(0.0, 0.0));
518 auto &v2 = mesh->
createVertex(Eigen::Vector2d(0.0, 0.5));
519 auto &v3 = mesh->
createVertex(Eigen::Vector2d(0.0, 1.5));
520 auto &v4 = mesh->
createVertex(Eigen::Vector2d(0.0, 3.5));
527 mesh->
data(0)->values()(0) = 1.0;
528 mesh->
data(0)->values()(1) = 2.0;
529 mesh->
data(0)->values()(2) = 3.0;
530 mesh->
data(0)->values()(3) = 4.0;
531 mesh->
data(0)->values()(4) = 5.0;
532 mesh->
data(0)->values()(5) = 6.0;
533 mesh->
data(0)->values()(6) = 7.0;
534 mesh->
data(0)->values()(7) = 8.0;
537 Eigen::Vector2d expected(17.0, 20.5);
538 BOOST_REQUIRE(result.size() == 2);
539 BOOST_TEST(result(0) == expected(0));
540 BOOST_TEST(result(1) == expected(1));
549 auto &v1 = mesh->
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
550 auto &v2 = mesh->
createVertex(Eigen::Vector3d(3.0, 0.0, 0.0));
551 auto &v3 = mesh->
createVertex(Eigen::Vector3d(3.0, 4.0, 0.0));
552 auto &v4 = mesh->
createVertex(Eigen::Vector3d(0.0, 8.0, 0.0));
564 mesh->
data(0)->values()(0) = 1.0;
565 mesh->
data(0)->values()(1) = 3.0;
566 mesh->
data(0)->values()(2) = 5.0;
567 mesh->
data(0)->values()(3) = 7.0;
570 double expected = 70.0;
571 BOOST_REQUIRE(result.size() == 1);
572 BOOST_TEST(result(0) == expected);
581 auto &v1 = mesh->
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
582 auto &v2 = mesh->
createVertex(Eigen::Vector3d(3.0, 0.0, 0.0));
583 auto &v3 = mesh->
createVertex(Eigen::Vector3d(3.0, 4.0, 0.0));
584 auto &v4 = mesh->
createVertex(Eigen::Vector3d(0.0, 8.0, 0.0));
596 mesh->
data(0)->values()(0) = 1.0;
597 mesh->
data(0)->values()(1) = 2.0;
598 mesh->
data(0)->values()(2) = 3.0;
599 mesh->
data(0)->values()(3) = 4.0;
600 mesh->
data(0)->values()(4) = 5.0;
601 mesh->
data(0)->values()(5) = 6.0;
602 mesh->
data(0)->values()(6) = 7.0;
603 mesh->
data(0)->values()(7) = 8.0;
606 Eigen::Vector2d expected(70.0, 88.0);
607 BOOST_REQUIRE(result.size() == 2);
608 BOOST_TEST(result(0) == expected(0));
609 BOOST_TEST(result(1) == expected(1));
617 Eigen::Vector2d x0{0.0, 0.0};
618 Eigen::Vector2d x1{1.0, 0.0};
619 Eigen::Vector2d x2{1.0, 1.0};
620 Eigen::Vector2d x3{0.0, 1.0};
645 BOOST_REQUIRE(mesh->
triangles()[0].getArea() == 0.5);
646 BOOST_REQUIRE(mesh->
triangles()[1].getArea() == 0.5);
650 mesh->
data(0)->values()(0) = 1.0;
651 mesh->
data(0)->values()(1) = 3.0;
652 mesh->
data(0)->values()(2) = 7.0;
653 mesh->
data(0)->values()(3) = 5.0;
656 double expected = 4.0;
657 BOOST_REQUIRE(result.size() == 1);
658 BOOST_TEST(result(0) == expected);
683 BOOST_REQUIRE(mesh->
triangles()[0].getArea() == 0.5);
684 BOOST_REQUIRE(mesh->
triangles()[1].getArea() == 0.5);
688 mesh->
data(0)->values()(0) = 1.0;
689 mesh->
data(0)->values()(2) = 3.0;
690 mesh->
data(0)->values()(4) = 7.0;
691 mesh->
data(0)->values()(6) = 5.0;
693 mesh->
data(0)->values()(1) = 2.0;
694 mesh->
data(0)->values()(3) = 4.0;
695 mesh->
data(0)->values()(5) = 8.0;
696 mesh->
data(0)->values()(7) = 6.0;
699 Eigen::Vector2d expected(4.0, 5.0);
700 BOOST_REQUIRE(result.size() == 2);
701 BOOST_TEST(result(0) == expected(0));
702 BOOST_TEST(result(1) == expected(1));
706 Eigen::Vector3d
x1{0.0, 0.0, 0.0};
707 Eigen::Vector3d
x2{1.0, 0.0, 0.0};
708 Eigen::Vector3d
x3{0.0, 1.0, 0.0};
709 Eigen::Vector3d
x4{0.0, 0.0, 1.0};
727 BOOST_REQUIRE(mesh->
tetrahedra()[0].getVolume() == 1. / 6);
731 mesh->
data(0)->values()(0) = 1.0;
732 mesh->
data(0)->values()(1) = 3.0;
733 mesh->
data(0)->values()(2) = 5.0;
734 mesh->
data(0)->values()(3) = 7.0;
737 double expected = 4.0 / 6;
738 BOOST_REQUIRE(result.size() == 1);
739 BOOST_TEST(result(0) == expected);
757 BOOST_REQUIRE(mesh->
tetrahedra()[0].getVolume() == 1. / 6);
761 mesh->
data(0)->values()(0 * 3) = 1.0;
762 mesh->
data(0)->values()(1 * 3) = 3.0;
763 mesh->
data(0)->values()(2 * 3) = 5.0;
764 mesh->
data(0)->values()(3 * 3) = 7.0;
766 mesh->
data(0)->values()(0 * 3 + 1) = 1.0;
767 mesh->
data(0)->values()(1 * 3 + 1) = 1.0;
768 mesh->
data(0)->values()(2 * 3 + 1) = 1.0;
769 mesh->
data(0)->values()(3 * 3 + 1) = 1.0;
771 mesh->
data(0)->values()(0 * 3 + 2) = 1.0;
772 mesh->
data(0)->values()(1 * 3 + 2) = 0.0;
773 mesh->
data(0)->values()(2 * 3 + 2) = 0.0;
774 mesh->
data(0)->values()(3 * 3 + 2) = 0.0;
777 Eigen::Vector3d expected(4.0 / 6, 1.0 / 6, 1.0 / 24);
778 BOOST_REQUIRE(result.size() == 3);
779 BOOST_TEST(result(0) == expected(0));
780 BOOST_TEST(result(1) == expected(1));
781 BOOST_TEST(result(2) == expected(2));
793 auto &v01 = globalMesh->
createVertex(Eigen::Vector3d{0.0, 0.0, 0.0});
794 auto &v02 = globalMesh->
createVertex(Eigen::Vector3d{1.0, 0.0, 0.0});
795 auto &v03 = globalMesh->
createVertex(Eigen::Vector3d{0.0, 1.0, 0.0});
796 auto &v04 = globalMesh->
createVertex(Eigen::Vector3d{0.0, 0.0, 1.0});
803 auto &v11 = subMesh->
createVertex(Eigen::Vector3d{0.0, 0.0, 0.0});
804 auto &v12 = subMesh->
createVertex(Eigen::Vector3d{2.0, 0.0, 0.0});
805 auto &v13 = subMesh->
createVertex(Eigen::Vector3d{0.0, 4.0, 0.0});
806 auto &v14 = subMesh->
createVertex(Eigen::Vector3d{0.0, 0.0, 3.0});
807 auto &v15 = subMesh->
createVertex(Eigen::Vector3d{5.0, 0.0, 1.0});
818 BOOST_TEST(globalMesh->
nVertices() == 9);
819 BOOST_TEST(globalMesh->
edges().
size() == 3);
829 Mesh mesh{
"Mesh1", 3, 0};
831 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
832 auto &v2 = mesh.createVertex(Eigen::Vector3d(3.0, 0.0, 0.0));
833 auto &v3 = mesh.createVertex(Eigen::Vector3d(3.0, 4.0, 0.0));
834 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.0, 8.0, 0.0));
836 mesh.createEdge(v1, v2);
837 mesh.createEdge(v2, v3);
838 mesh.createEdge(v3, v4);
841 mesh.createEdge(v3, v4);
844 for (
int i = 0; i < 1000; ++i) {
845 mesh.createEdge(v2, v3);
847 BOOST_TEST(mesh.edges().size() == 1004);
851 BOOST_TEST(mesh.edges().size() == 3);
852 BOOST_TEST(mesh.triangles().empty());
853 BOOST_TEST(mesh.tetrahedra().empty());
856 for (
auto &e : expectedEdges) {
857 auto cnt =
std::count(mesh.edges().begin(), mesh.edges().end(), e);
858 BOOST_TEST(cnt == 1);
865 Mesh mesh{
"Mesh1", 3, 0};
867 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
868 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
869 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
871 mesh.createTriangle(v1, v2, v3);
875 BOOST_TEST(mesh.edges().size() == 3);
876 BOOST_TEST(mesh.triangles().size() == 1);
877 BOOST_TEST(mesh.tetrahedra().size() == 0);
883 Mesh mesh{
"Mesh1", 3, 0};
885 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
886 auto &v2 = mesh.createVertex(Eigen::Vector3d(1.0, 0.0, 0.0));
887 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
888 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
890 mesh.createTriangle(v1, v2, v3);
891 mesh.createTriangle(v2, v3, v4);
895 BOOST_TEST(mesh.edges().size() == 5);
896 BOOST_TEST(mesh.triangles().size() == 2);
897 BOOST_TEST(mesh.tetrahedra().size() == 0);
903 Mesh mesh{
"Mesh1", 3, 0};
905 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
906 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
907 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
908 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.3, 0.3, 1.0));
910 mesh.createTetrahedron(v1, v2, v3, v4);
914 BOOST_TEST(mesh.edges().size() == 6);
915 BOOST_TEST(mesh.triangles().size() == 4);
916 BOOST_TEST(mesh.tetrahedra().size() == 1);
922 Mesh mesh{
"Mesh1", 3, 0};
924 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
925 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
926 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
928 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.3, 0.3, 1.0));
929 auto &v5 = mesh.createVertex(Eigen::Vector3d(0.3, 0.3, -1.0));
931 mesh.createTetrahedron(v1, v2, v3, v4);
932 mesh.createTetrahedron(v1, v2, v3, v5);
936 BOOST_TEST(mesh.edges().size() == 9);
937 BOOST_TEST(mesh.triangles().size() == 7);
938 BOOST_TEST(mesh.tetrahedra().size() == 2);
944 Mesh mesh{
"Mesh1", 3, 0};
946 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
947 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
948 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
950 mesh.createTriangle(v1, v2, v3);
951 mesh.createEdge(v2, v3);
955 BOOST_TEST(mesh.edges().size() == 3);
956 BOOST_TEST(mesh.triangles().size() == 1);
957 BOOST_TEST(mesh.tetrahedra().size() == 0);
963 Mesh mesh{
"Mesh1", 3, 0};
965 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
966 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
967 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
969 mesh.createTriangle(v1, v2, v3);
970 mesh.createEdge(v1, v2);
971 mesh.createEdge(v2, v3);
975 BOOST_TEST(mesh.edges().size() == 3);
976 BOOST_TEST(mesh.triangles().size() == 1);
977 BOOST_TEST(mesh.tetrahedra().size() == 0);
983 Mesh mesh{
"Mesh1", 3, 0};
985 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
986 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
987 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
988 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.3, 0.3, 1.0));
990 mesh.createTetrahedron(v1, v2, v3, v4);
991 mesh.createTriangle(v1, v2, v3);
995 BOOST_TEST(mesh.edges().size() == 6);
996 BOOST_TEST(mesh.triangles().size() == 4);
997 BOOST_TEST(mesh.tetrahedra().size() == 1);
1003 Mesh mesh{
"Mesh1", 3, 0};
1005 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
1006 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
1007 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
1008 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.3, 0.3, 1.0));
1010 mesh.createTetrahedron(v1, v2, v3, v4);
1011 mesh.createTriangle(v1, v2, v3);
1012 mesh.createTriangle(v1, v2, v4);
1013 mesh.createTriangle(v3, v4, v1);
1014 mesh.createTriangle(v3, v4, v2);
1018 BOOST_TEST(mesh.edges().size() == 6);
1019 BOOST_TEST(mesh.triangles().size() == 4);
1020 BOOST_TEST(mesh.tetrahedra().size() == 1);
1026 Mesh mesh{
"Mesh1", 3, 0};
1028 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
1029 auto &v2 = mesh.createVertex(Eigen::Vector3d(0.0, 1.0, 0.0));
1030 auto &v3 = mesh.createVertex(Eigen::Vector3d(1.0, 1.0, 0.0));
1031 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.3, 0.3, 1.0));
1033 mesh.createTetrahedron(v1, v2, v3, v4);
1034 mesh.createTriangle(v1, v2, v3);
1035 mesh.createEdge(v3, v4);
1039 BOOST_TEST(mesh.edges().size() == 6);
1040 BOOST_TEST(mesh.triangles().size() == 4);
1041 BOOST_TEST(mesh.tetrahedra().size() == 1);
1047 Mesh mesh{
"Mesh1", 3, 0};
1049 auto &v1 = mesh.
createVertex(Eigen::Vector3d(0.0, 0.0, 0.0));
1050 auto &v2 = mesh.createVertex(Eigen::Vector3d(3.0, 0.0, 0.0));
1051 auto &v3 = mesh.createVertex(Eigen::Vector3d(3.0, 4.0, 0.0));
1052 auto &v4 = mesh.createVertex(Eigen::Vector3d(0.0, 8.0, 0.0));
1054 mesh.createEdge(v1, v2);
1055 mesh.createEdge(v2, v3);
1056 mesh.createEdge(v3, v4);
1059 mesh.createEdge(v3, v4);
1062 for (
int i = 0; i < 1000; ++i) {
1063 mesh.createEdge(v2, v3);
1065 BOOST_TEST(mesh.edges().size() == 1004);
1067 mesh.createTriangle(v1, v2, v3);
1068 mesh.createTriangle(v2, v3, v4);
1069 for (
int i = 0; i < 1000; ++i) {
1070 mesh.createTriangle(v2, v3, v4);
1072 BOOST_TEST(mesh.triangles().size() == 1002);
1077 BOOST_TEST(mesh.edges().size() == 5);
1078 BOOST_TEST(mesh.triangles().size() == 2);
1080 std::vector<Edge> expectedEdges{{v1, v2}, {v1, v3}, {v2, v3}, {v3, v4}, {v2, v4}};
1081 for (
auto &e : expectedEdges) {
1082 auto cnt =
std::count(mesh.edges().begin(), mesh.edges().end(), e);
1083 BOOST_TEST(cnt == 1);
1087 for (
auto &t : expectedTriangles) {
1088 auto cnt =
std::count(mesh.triangles().begin(), mesh.triangles().end(), t);
1089 BOOST_TEST(cnt == 1);
BOOST_AUTO_TEST_SUITE(PreProcess)
BOOST_AUTO_TEST_CASE(BoundingBoxCOG_2D)
BOOST_FIXTURE_TEST_CASE(Integrate2DScalarDataVolume, UnitSquareFixture)
BOOST_AUTO_TEST_SUITE_END()
#define PRECICE_TEST(...)
An axis-aligned bounding box around a (partition of a) mesh.
int getDimension() const
Getter dimension of the bounding box.
Eigen::VectorXd center() const
Returns the Center Of Gravity of the mesh.
Eigen::VectorXd & values()
Returns a reference to the data values.
Linear edge of a mesh, defined by two Vertex objects.
Container and creator for meshes.
Triangle & createTriangle(Edge &edgeOne, Edge &edgeTwo, Edge &edgeThree)
Creates and initializes a Triangle object.
VertexContainer & vertices()
Returns modifieable container holding all vertices.
void clear()
Removes all mesh elements and data values (does not remove data or the bounding boxes).
void addMesh(Mesh &deltaMesh)
const std::string & getName() const
Returns the name of the mesh, as set in the config file.
std::size_t nVertices() const
Returns the number of vertices.
TetraContainer & tetrahedra()
Returns modifiable container holding all tetrahedra.
PtrData & createData(const std::string &name, int dimension, DataID id, int waveformDegree=time::Time::DEFAULT_WAVEFORM_DEGREE)
Create only data for vertex.
void computeBoundingBox()
Computes the boundingBox for the vertices.
Tetrahedron & createTetrahedron(Vertex &vertexOne, Vertex &vertexTwo, Vertex &vertexThree, Vertex &vertexFour)
Creates and initializes a Tetrahedron object.
const DataContainer & data() const
Allows access to all data.
TriangleContainer & triangles()
Returns modifiable container holding all triangles.
const BoundingBox & getBoundingBox() const
Returns the bounding box of the mesh.
Edge & createEdge(Vertex &vertexOne, Vertex &vertexTwo)
Creates and initializes an Edge object.
EdgeContainer & edges()
Returns modifiable container holding all edges.
Vertex & createVertex(const Eigen::VectorXd &coords)
Creates and initializes a Vertex object.
void allocateDataValues()
Allocates memory for the vertex data values and corresponding gradient values.
bool hasTriangles() const
Triangle of a mesh, defined by three vertices.
VertexID getID() const
Returns the unique (among vertices of one mesh on one processor) ID of the vertex.
provides Mesh, Data and primitives.
Eigen::VectorXd integrateSurface(const PtrMesh &mesh, const Eigen::VectorXd &input)
Given the data and the mesh, this function returns the surface integral. Assumes no overlap exists fo...
Eigen::VectorXd integrateVolume(const PtrMesh &mesh, const Eigen::VectorXd &input)
Given the data and the mesh, this function returns the volume integral. Assumes no overlap exists for...
std::array< Eigen::VectorXd, n > coordsFor(const Mesh &mesh, const std::array< int, n > &vertexIDs)
Given a mesh and an array of vertexIDS, this function returns an array of coordinates of the vertices...
Vertex * sharedVertex(Edge &a, Edge &b)
std::array< Vertex *, n > vertexPtrsFor(Mesh &mesh, const std::array< int, n > &vertexIDs)
Given a mesh and an array of vertexIDS, this function returns an array of pointers to vertices.
double edgeLength(const Edge &e)
Chain< n > asChain(std::array< mesh::Edge *, n > edges)
boost::test_tools::predicate_result equals(const std::vector< float > &VectorA, const std::vector< float > &VectorB, float tolerance)
equals to be used in tests. Compares two std::vectors using a given tolerance. Prints both operands o...
auto make_array(Elements &&... elements) -> std::array< typename std::common_type< Elements... >::type, sizeof...(Elements)>
Function that generates an array from given elements.
Main namespace of the precice library.