예제 #1
0
linearSpatial::linearSpatial
(
    const dictionary& initialPointsDict,
    const searchableSurface& surface,
    const scalar& defaultCellSize,
    const labelList regionIndices
)
:
    cellSizeFunction
    (
        typeName,
        initialPointsDict,
        surface,
        defaultCellSize,
        regionIndices
    ),
    referencePoint_(coeffsDict().lookup("referencePoint")),
    referenceCellSize_
    (
        readScalar(coeffsDict().lookup("referenceCellSizeCoeff"))
       *defaultCellSize
    ),
    direction_(coeffsDict().lookup("direction")),
    cellSizeGradient_(readScalar(coeffsDict().lookup("cellSizeGradient")))
{
    direction_ /= mag(direction_);
}
예제 #2
0
linearDistance::linearDistance
(
    const dictionary& initialPointsDict,
    const searchableSurface& surface,
    const scalar& defaultCellSize,
    const labelList regionIndices
)
    :
    cellSizeFunction
    (
       typeName,
       initialPointsDict,
       surface,
       defaultCellSize,
       regionIndices
    ),
    distanceCellSize_
    (
       readScalar(coeffsDict().lookup("distanceCellSizeCoeff"))
       *defaultCellSize
    ),
    distance_
    (
       readScalar(coeffsDict().lookup("distanceCoeff"))*defaultCellSize
    ),
    distanceSqr_(sqr(distance_))
{}
예제 #3
0
Foam::nonUniformField::nonUniformField
(
    const dictionary& cellSizeFunctionDict,
    const searchableSurface& surface,
    const scalar& defaultCellSize
)
:
    surfaceCellSizeFunction
    (
        typeName,
        cellSizeFunctionDict,
        surface,
        defaultCellSize
    ),
    surfaceTriMesh_(refCast<const triSurfaceMesh>(surface)),
    cellSizeCalculationType_
    (
        cellSizeCalculationType::New
        (
            coeffsDict(),
            surfaceTriMesh_,
            defaultCellSize
        )
    ),
    pointCellSize_
    (
        IOobject
        (
            "pointCellSize.cellSize",
            surfaceTriMesh_.searchableSurface::time().constant(),
            "triSurface",
            surfaceTriMesh_.searchableSurface::time(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        surfaceTriMesh_,
        dimLength,
        false
    )
{
    Info<< incrIndent;

    pointCellSize_ = cellSizeCalculationType_().load();

    Info<< indent << "Cell size field statistics:" << nl
        << indent << "    Minimum: " << min(pointCellSize_).value() << nl
        << indent << "    Average: " << average(pointCellSize_).value() << nl
        << indent << "    Maximum: " << max(pointCellSize_).value() << endl;

    Info<< decrIndent;
}
예제 #4
0
Foam::uniformValue::uniformValue
(
    const dictionary& cellSizeFunctionDict,
    const searchableSurface& surface,
    const scalar& defaultCellSize
)
:
    surfaceCellSizeFunction
    (
        typeName,
        cellSizeFunctionDict,
        surface,
        defaultCellSize
    ),
    surfaceCellSize_
    (
        readScalar(coeffsDict().lookup("surfaceCellSizeCoeff"))*defaultCellSize
    )
{}
surfaceOffsetLinearDistance::surfaceOffsetLinearDistance
(
    const dictionary& initialPointsDict,
    const searchableSurface& surface,
    const scalar& defaultCellSize,
    const labelList regionIndices
)
:
    cellSizeFunction
    (
        typeName,
        initialPointsDict,
        surface,
        defaultCellSize,
        regionIndices
    ),
    distanceCellSize_
    (
        readScalar(coeffsDict().lookup("distanceCellSizeCoeff"))
       *defaultCellSize
    ),
    surfaceOffset_
    (
        readScalar(coeffsDict().lookup("surfaceOffsetCoeff"))*defaultCellSize
    ),
    totalDistance_(),
    totalDistanceSqr_()
{
    if
    (
        coeffsDict().found("totalDistanceCoeff")
     || coeffsDict().found("linearDistanceCoeff")
    )
    {
        if
        (
            coeffsDict().found("totalDistanceCoeff")
         && coeffsDict().found("linearDistanceCoeff")
        )
        {
            FatalErrorInFunction
                << "totalDistanceCoeff and linearDistanceCoeff found, "
                << "specify one or other, not both."
                << nl << exit(FatalError) << endl;
        }

        if (coeffsDict().found("totalDistanceCoeff"))
        {
            totalDistance_ =
                readScalar(coeffsDict().lookup("totalDistanceCoeff"))
               *defaultCellSize;
        }
        else
        {
            totalDistance_ =
                readScalar(coeffsDict().lookup("linearDistanceCoeff"))
               *defaultCellSize
              + surfaceOffset_;
        }
    }
    else
    {
        FatalErrorInFunction
            << "totalDistanceCoeff or linearDistanceCoeff not found."
            << nl << exit(FatalError) << endl;
    }

    totalDistanceSqr_ = sqr(totalDistance_);
}