1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
// Copyright (C) 2017 August Johansson, Benjamin Kehlet
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
//
// Unit tests for the multimesh functionality
// These tests currently only instantiates and initializes some
// multimesh objects, ie. the only thing that is tested is that it
// doesn't crash
#include <dolfin.h>
#include <catch.hpp>
using namespace dolfin;
TEST_CASE("MultiMesh", "[!hide]")
{
SECTION("Trivial test case 3D")
{
// DISABLED
// FIXME: Enable this test when it is working
std::shared_ptr<Mesh> background(new Mesh(UnitTetrahedronMesh::create()));
std::shared_ptr<Mesh> overlapping(new Mesh(UnitTetrahedronMesh::create()));
overlapping->translate(Point(.1, .1, .1));
MultiMesh multimesh(background, overlapping, 1);
}
SECTION("Trivial case 3D 2")
{
// FIXME: Enable this test when it is working
std::shared_ptr<Mesh> background = std::make_shared<UnitCubeMesh>(1,1,1);
std::shared_ptr<Mesh> refmesh = std::make_shared<BoxMesh>(Point(0.394383, 0.783099, 0.197551),
Point(0.840188, 0.79844, 0.911647),
1,1,1);
const std::vector<double>& refmeshcoords = refmesh->coordinates();
std::shared_ptr<Mesh> tetmesh(new Mesh(UnitTetrahedronMesh::create()));
std::vector<double>& tetmesh_coords = tetmesh->coordinates();
for (CellIterator cell(*refmesh); !cell.end(); ++cell)
{
const unsigned int* vertex_indices = cell->entities(0);
for (int i = 0; i < 4; i++)
{
tetmesh_coords[i*3] = refmeshcoords[vertex_indices[i]];
tetmesh_coords[i*3 + 1] = refmeshcoords[vertex_indices[i] + 1];
tetmesh_coords[i*3 + 2] = refmeshcoords[vertex_indices[i] + 2];
}
MultiMesh multimesh(background, tetmesh, 1);
}
}
SECTION("Takes forever")
{
// FIXME: Enable this test when it is working
std::shared_ptr<Mesh> background(new Mesh(UnitTetrahedronMesh::create()));
{
std::vector<double>& coords = background->coordinates();
coords = { 0, 0, 0,
0, 0, 1,
1, 0, 1,
1, 1, 1 };
}
std::shared_ptr<Mesh> overlapping = std::make_shared<BoxMesh>(Point(0.394383, 0.783099, 0.197551),
Point(0.840188, 0.79844, 0.911647),
1,1,1);
MultiMesh multimesh(background, overlapping, 1);
}
}
|