| 1947 | |
| 1948 | |
| 1949 | bool Foam::cellCuts::validLoop |
| 1950 | ( |
| 1951 | const label celli, |
| 1952 | const labelList& loop, |
| 1953 | const scalarField& loopWeights, |
| 1954 | |
| 1955 | Map<edge>& newFaceSplitCut, |
| 1956 | labelList& anchorPoints |
| 1957 | ) const |
| 1958 | { |
| 1959 | // Determine compatibility of loop with existing cut pattern. Does not use |
| 1960 | // derived cut-addressing (faceCuts), only pointIsCut, edgeIsCut. |
| 1961 | // Adds any cross-cuts found to newFaceSplitCut and sets cell points on |
| 1962 | // one side of the loop in anchorPoints. |
| 1963 | |
| 1964 | if (loop.size() < 2) |
| 1965 | { |
| 1966 | return false; |
| 1967 | } |
| 1968 | |
| 1969 | if (debug & 4) |
| 1970 | { |
| 1971 | // Allow as fallback the 'old' loop checking where only a single |
| 1972 | // cut per face is allowed. |
| 1973 | if (!conservativeValidLoop(celli, loop)) |
| 1974 | { |
| 1975 | Info << "Invalid conservative loop: " << loop << endl; |
| 1976 | return false; |
| 1977 | } |
| 1978 | } |
| 1979 | |
| 1980 | forAll(loop, fp) |
| 1981 | { |
| 1982 | label cut = loop[fp]; |
| 1983 | label nextCut = loop[(fp+1) % loop.size()]; |
| 1984 | |
| 1985 | // Label (if any) of face cut (so cut not along existing edge) |
| 1986 | label meshFacei = -1; |
| 1987 | |
| 1988 | if (isEdge(cut)) |
| 1989 | { |
| 1990 | label edgeI = getEdge(cut); |
| 1991 | |
| 1992 | // Look one cut ahead to find if it is along existing edge. |
| 1993 | |
| 1994 | if (isEdge(nextCut)) |
| 1995 | { |
| 1996 | // From edge to edge -> cross cut |
| 1997 | label nextEdgeI = getEdge(nextCut); |
| 1998 | |
| 1999 | // Find face and mark as to be split. |
| 2000 | meshFacei = edgeEdgeToFace(celli, edgeI, nextEdgeI); |
| 2001 | |
| 2002 | if (meshFacei == -1) |
| 2003 | { |
| 2004 | // Can't find face using both cut edges. |
| 2005 | return false; |
| 2006 | } |
no test coverage detected