simplexSmoother::simplexSmoother(partTetMeshSimplex& simplex)
    :
    points_(simplex.pts()),
    tets_(simplex.tets()),
    pointI_(tets_[0][3]),
    bb_()
{
    point min(VGREAT, VGREAT, VGREAT), max(-VGREAT, -VGREAT, -VGREAT);
    forAll(tets_, tetI)
    {
        const partTet& pt = tets_[tetI];
        const tetrahedron<point, point> tet
        (
            points_[pt.a()],
            points_[pt.b()],
            points_[pt.c()],
            points_[pt.d()]
        );

        min = Foam::min(min, tet.a());
        max = Foam::max(max, tet.a());

        min = Foam::min(min, tet.b());
        max = Foam::max(max, tet.b());

        min = Foam::min(min, tet.c());
        max = Foam::max(max, tet.c());
    }

    bb_.max() = max;
    bb_.min() = min;
}
Exemple #2
0
knuppMetric::knuppMetric(partTetMeshSimplex& simplex)
:
    simplexSmoother(simplex),
    p_(simplex.pts()[simplex.tets()[0][3]]),
    normals_(),
    centres_(),
    beta_()
{
    forAll(tets_, tetI)
    {
    const partTet& pt = tets_[tetI];
    const triangle<point, point> tri
    (
        points_[pt.a()],
        points_[pt.b()],
        points_[pt.c()]
    );
        
    const vector n = tri.normal();
        const scalar d = mag(n);
        
        if( d > VSMALL )
        {
            centres_.append(tri.centre());
            normals_.append(n/d);
        }
    }
    
    beta_ = 0.01 * bb_.mag();
}