/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
Class
Foam::cellCuts
Description
Description of cuts across cells.
Description of cut is given as list of vertices and
list of edges to be cut (and position on edge).
Does some checking of correctness/non-overlapping of cuts. 2x2x2
refinement has to be done in three passes since cuts can not overlap
(would make addressing too complicated)
Introduces concept of 'cut' which is either an existing vertex
or a edge.
Input can either be
-# list of cut vertices and list of cut edges. Constructs cell
circumference walks ('cellLoops').
-# list of cell circumference walks. Will filter them so they
don't overlap.
-# cellWalker and list of cells to refine (refineCell). Constructs
cellLoops and does B. cellWalker is class which can cut a single
cell using a plane through the cell centre and in a certain normal
direction
CellCuts constructed from cellLoops (B, C) can have multiple cut-edges
and/or cut-point as long as there is per face only one (or none) cut across
a face, i.e. a face can only be split into two faces.
The information available after construction:
- pointIsCut, edgeIsCut.
- faceSplitCut : the cross-cut of a face.
- cellLoops : the loop which cuts across a cell
- cellAnchorPoints : per cell the vertices on one side which are
considered the anchor points.
AnchorPoints: connected loops have to be oriented in the same way to
be able to grow new internal faces out of the same bottom faces.
(limitation of the mapping procedure). The loop is cellLoop is oriented
such that the normal of it points towards the anchorPoints.
This is the only routine which uses geometric information.
Limitations:
- cut description is very precise. Hard to get right.
- do anchor points need to be unique per cell? Very inefficient.
- is orientation guaranteed to be correct? Uses geometric info so can go
wrong on highly distorted meshes.
- is memory inefficient. Probably need to use Maps instead of
labelLists.
SourceFiles
cellCuts.C
\*---------------------------------------------------------------------------*/
#ifndef cellCuts_H
#define cellCuts_H
#include "edgeVertex.H"
#include "labelList.H"
#include "boolList.H"
#include "scalarField.H"
#include "pointField.H"
#include "DynamicList.H"
#include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class polyMesh;
class cellLooper;
class refineCell;
class plane;
/*---------------------------------------------------------------------------*\
Class cellCuts Declaration
\*---------------------------------------------------------------------------*/
class cellCuts
:
public edgeVertex
{
// Private data
// Per point/edge status
//- Is mesh point cut
boolList pointIsCut_;
//- Is edge cut
boolList edgeIsCut_;
//- If edge is cut gives weight (0->start() to 1->end())
scalarField edgeWeight_;
// Cut addressing
//- Cuts per existing face (includes those along edge of face)
// Cuts in no particular order.
mutable labelListList* faceCutsPtr_;
//- Per face : cut across edge (so not along existing edge)
// (can only be one per face)
Map faceSplitCut_;
// Cell-cut addressing
//- Loop across cell circumference
labelListList cellLoops_;
//- Number of valid loops in cellLoops_
label nLoops_;
//- For each cut cell the points on the 'anchor' side of the cell.
labelListList cellAnchorPoints_;
// Private Static Functions
//- Find value in first n elements of list.
static label findPartIndex
(
const labelList&,
const label n,
const label val
);
//- Create boolList with all labels specified set to true
// (and rest to false)
static boolList expand(const label size, const labelList& labels);
//- Create scalarField with all specified labels set to corresponding
// value in scalarField.
static scalarField expand
(
const label,
const labelList&,
const scalarField&
);
//- Returns -1 or index of first element of lst that cannot be found
// in map.
static label firstUnique
(
const labelList& lst,
const Map