コード例 #1
0
void Foam::globalIndexAndTransform::determineTransforms()
{
    const polyBoundaryMesh& patches = mesh_.boundaryMesh();

    DynamicList<vectorTensorTransform> localTransforms;
    DynamicField<scalar> localTols;

    label dummyMatch = -1;

    forAll(patches, patchi)
    {
        const polyPatch& pp = patches[patchi];

        // Note: special check for unordered cyclics. These are in fact
        // transform bcs and should probably be split off.
        // Note: We don't want to be finding transforms for patches marked as
        // coincident full match. These should have no transform by definition.
        if
        (
            isA<coupledPolyPatch>(pp)
        && !(
                isA<cyclicPolyPatch>(pp)
             && refCast<const cyclicPolyPatch>(pp).transform()
             == cyclicPolyPatch::NOORDERING
            )
        && !(
                refCast<const coupledPolyPatch>(pp).transform()
             == coupledPolyPatch::COINCIDENTFULLMATCH
            )
        )
        {
            const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);

            if (cpp.separated())
            {
                const vectorField& sepVecs = cpp.separation();

                forAll(sepVecs, sVI)
                {
                    const vector& sepVec = sepVecs[sVI];

                    if (mag(sepVec) > small)
                    {
                        vectorTensorTransform transform(sepVec);

                        if
                        (
                            matchTransform
                            (
                                localTransforms,
                                dummyMatch,
                                transform,
                                cpp.matchTolerance(),
                                false
                            ) == 0
                        )
                        {
                            localTransforms.append(transform);
                            localTols.append(cpp.matchTolerance());
                        }
                    }
                }
            }
            else if (!cpp.parallel())
            {
                const tensorField& transTensors = cpp.reverseT();

                forAll(transTensors, tTI)
                {
                    const tensor& transT = transTensors[tTI];

                    if (mag(transT - I) > small)
                    {
                        vectorTensorTransform transform(transT);

                        if
                        (
                            matchTransform
                            (
                                localTransforms,
                                dummyMatch,
                                transform,
                                cpp.matchTolerance(),
                                false
                            ) == 0
                        )
                        {
                            localTransforms.append(transform);
                            localTols.append(cpp.matchTolerance());
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
void Foam::globalIndexAndTransform::determineTransforms()
{
    const polyBoundaryMesh& patches = mesh_.boundaryMesh();

    transforms_ = List<vectorTensorTransform>(6);
    scalarField maxTol(6);

    label nextTrans = 0;

    label dummyMatch = -1;

    forAll(patches, patchI)
    {
        const polyPatch& pp = patches[patchI];

        // Note: special check for unordered cyclics. These are in fact
        // transform bcs and should probably be split off.
        if
        (
            isA<coupledPolyPatch>(pp)
        && !(
                isA<cyclicPolyPatch>(pp)
             && (
                    refCast<const cyclicPolyPatch>(pp).transform()
                 == cyclicPolyPatch::NOORDERING
                )
            )
        )
        {
            const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);

            if (cpp.separated())
            {
                const vectorField& sepVecs = cpp.separation();

                forAll(sepVecs, sVI)
                {
                    const vector& sepVec = sepVecs[sVI];

                    if (mag(sepVec) > SMALL)
                    {
                        vectorTensorTransform transform(sepVec);

                        if
                        (
                            matchTransform
                            (
                                transforms_,
                                dummyMatch,
                                transform,
                                cpp.matchTolerance(),
                                false
                            ) == 0
                        )
                        {
                            if (nextTrans == 6)
                            {
                                FatalErrorIn
                                (
                                     "void Foam::globalIndexAndTransform::"
                                     "determineTransforms()"
                                )   << "More than six unsigned transforms"
                                    << " detected:" << nl << transforms_
                                    << exit(FatalError);
                            }
                            transforms_[nextTrans] = transform;
                            maxTol[nextTrans++] = cpp.matchTolerance();
                        }
                    }
                }
            }
            else if (!cpp.parallel())
            {
                const tensorField& transTensors = cpp.reverseT();

                forAll(transTensors, tTI)
                {
                    const tensor& transT = transTensors[tTI];

                    if (mag(transT - I) > SMALL)
                    {
                        vectorTensorTransform transform(transT);

                        if
                        (
                            matchTransform
                            (
                                transforms_,
                                dummyMatch,
                                transform,
                                cpp.matchTolerance(),
                                false
                            ) == 0
                        )
                        {
                            if (nextTrans == 6)
                            {
                                FatalErrorIn
                                (
                                    "void Foam::globalIndexAndTransform::"
                                    "determineTransforms()"
                                )   << "More than six unsigned transforms"
                                    << " detected:" << nl << transforms_
                                    << exit(FatalError);
                            }
                            transforms_[nextTrans] = transform;
                            maxTol[nextTrans++] = cpp.matchTolerance();
                        }
                    }
                }
            }
        }
    }