Пример #1
0
    virtual void SetUp() {
        this->mesh = createTetMesh();
        this->mesher = new cleaver::CleaverMesherImp();
        mesher->setBackgroundMesh(mesh);
        mesher->buildAdjacency();
        ASSERT_EQ(1, mesh->tets.size());

        // get adjacency info
        tet = mesh->tets[0];
        mesh->getAdjacencyListsForTet(tet, verts, edges, faces);

        // make tet regular
        verts[0]->pos() = cleaver::vec3( 1, 1, 1);
        verts[1]->pos() = cleaver::vec3( 1,-1,-1);
        verts[2]->pos() = cleaver::vec3(-1, 1,-1);
        verts[3]->pos() = cleaver::vec3(-1,-1, 1);

        // ensure volume is what we expect
        ASSERT_NEAR(2.666, tet->volume(), 1E-3);
    }
Пример #2
0
void MeshLayerEditDialog::accept()
{
    if (this->_edits.isEmpty())
    {
        OGSError::box("Please specifiy the number and\n type of layers and press \"Next\"");
        return;
    }

    bool all_paths_set (true);
    if (_n_layers==0)
    {
        if (_edits[0]->text().isEmpty())
            all_paths_set = false;
    }
    else
    {
        int start_idx = (_use_rasters) ? 1:0;
        for (int i=start_idx; i<_edits.size(); ++i)
            if (_edits[i]->text().isEmpty())
                all_paths_set = false;
    }

    if (!all_paths_set)
    {
        OGSError::box("Please specifiy raster files for all layers.");
        return;
    }

    MeshLib::Mesh* new_mesh (nullptr);
    if (_ogsMeshButton->isChecked())
        new_mesh = createPrismMesh();
    else
        new_mesh = createTetMesh();

    if (new_mesh)
        emit mshEditFinished(new_mesh);
    else
        OGSError::box("Error creating mesh");

    this->done(QDialog::Accepted);
}