cuttingSurfaceBase.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2018-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "cuttingSurfaceBase.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
33 (
34  Foam::debug::debugSwitch("cuttingSurfaceBase", 0)
35 );
36 
37 
38 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
39 
41 (
42  const primitiveMesh& mesh,
43  const bool triangulate,
44  const bitSet& cellIdLabels
45 )
46 {
47  bitSet subsetCells(cellIdLabels);
48 
49  performCut(mesh, triangulate, std::move(subsetCells));
50 }
51 
52 
54 (
55  const primitiveMesh& mesh,
56  const bool triangulate,
57  const labelUList& cellIdLabels
58 )
59 {
60  bitSet subsetCells;
61 
62  if (notNull(cellIdLabels))
63  {
64  // Pre-populate with restriction
65  subsetCells.resize(mesh.nCells());
66  subsetCells.set(cellIdLabels);
67  }
68 
69  performCut(mesh, triangulate, std::move(subsetCells));
70 }
71 
72 
74 {
75  if (!faceMap.empty())
76  {
78 
79  List<label> remappedCells(faceMap.size());
80  forAll(faceMap, facei)
81  {
82  remappedCells[facei] = meshCells_[faceMap[facei]];
83  }
84  meshCells_.transfer(remappedCells);
85  }
86 }
87 
88 
89 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
90 
92 {
93  if (this == &rhs)
94  {
95  return; // Self-assignment is a no-op
96  }
97 
98  static_cast<Mesh&>(*this) = rhs;
99  meshCells_ = rhs.meshCells();
100 }
101 
102 
103 // ************************************************************************* //
Foam::PackedList::resize
void resize(const label numElem, const unsigned int val=0u)
Reset addressable list size, does not shrink the allocated size.
Definition: PackedListI.H:409
Foam::cuttingSurfaceBase::meshCells
const labelList & meshCells() const
The mesh cells cut.
Definition: cuttingSurfaceBase.H:197
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeTopological.C:94
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
Foam::debug::debugSwitch
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
Definition: debug.C:225
Foam::bitSet::set
void set(const bitSet &bitset)
Set specified bits from another bitset.
Definition: bitSetI.H:574
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
cuttingSurfaceBase.H
Foam::cuttingSurfaceBase::remapFaces
virtual void remapFaces(const labelUList &faceMap)
Remap action on triangulation or cleanup.
Definition: cuttingSurfaceBase.C:73
Foam::List::transfer
void transfer(List< T > &list)
Definition: List.C:456
Foam::notNull
bool notNull(const T *ptr)
True if ptr is not a pointer (of type T) to the nullObject.
Definition: nullObject.H:207
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::List< label >
Foam::cuttingSurfaceBase::debug
static int debug
Debug information.
Definition: cuttingSurfaceBase.H:181
Foam::UList< label >
Foam::cuttingSurfaceBase
Base for creating a MeshedSurface by performing some type of cell cutting/intersection.
Definition: cuttingSurfaceBase.H:60
Foam::cuttingSurfaceBase::operator=
void operator=(const cuttingSurfaceBase &rhs)
Copy assignment.
Definition: cuttingSurfaceBase.C:91
Foam::MeshedSurface< face >
Foam::cuttingSurfaceBase::performCut
virtual void performCut(const primitiveMesh &mesh, const bool triangulate, const labelUList &cellIdLabels)
Cut mesh, restricted to a list of cells.
Definition: cuttingSurfaceBase.C:54
Foam::cuttingSurfaceBase::meshCells_
labelList meshCells_
List of the cells cut.
Definition: cuttingSurfaceBase.H:73
Foam::MeshedSurface< face >::remapFaces
virtual void remapFaces(const labelUList &faceMapNewToOld)
Set new zones from faceMap.
Definition: MeshedSurface.C:549
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78