tetOverlapVolume.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) 2012-2015 OpenFOAM Foundation
9 Copyright (C) 2016-2017 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "tetOverlapVolume.H"
30#include "tetrahedron.H"
31#include "tetPoints.H"
32#include "polyMesh.H"
33#include "OFstream.H"
34#include "treeBoundBox.H"
35#include "indexedOctree.H"
36#include "treeDataCell.H"
37
38// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
39
40namespace Foam
41{
43}
44
45
46// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47
49{}
50
51
52// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
53
54Foam::treeBoundBox Foam::tetOverlapVolume::pyrBb
55(
56 const pointField& points,
57 const face& f,
58 const point& fc
59)
60{
61 treeBoundBox bb(fc);
62 bb.add(points, f);
63
64 return bb;
65}
66
67
68// * * * * * * * * * * * Public Member Functions * * * * * * * * * * * * * //
69
70bool Foam::tetOverlapVolume::cellCellOverlapMinDecomp
71(
72 const primitiveMesh& meshA,
73 const label cellAI,
74 const primitiveMesh& meshB,
75 const label cellBI,
76 const treeBoundBox& cellBbB,
77 const scalar threshold
78) const
79{
80 hasOverlapOp overlapCheckOp(threshold);
81 cellCellOverlapMinDecomp<hasOverlapOp>
82 (
83 meshA,
84 cellAI,
85 meshB,
86 cellBI,
87 cellBbB,
88 overlapCheckOp
89 );
90
91 return overlapCheckOp.ok_;
92}
93
94
96(
97 const primitiveMesh& meshA,
98 const label cellAI,
99
100 const primitiveMesh& meshB,
101 const label cellBI,
102 const treeBoundBox& cellBbB
103) const
104{
105 sumOverlapOp overlapSumOp;
106 cellCellOverlapMinDecomp<sumOverlapOp>
107 (
108 meshA,
109 cellAI,
110 meshB,
111 cellBI,
112 cellBbB,
113 overlapSumOp
114 );
115
116 return overlapSumOp.iop_.vol_;
117}
118
119
122(
123 const primitiveMesh& meshA,
124 const label cellAI,
125
126 const primitiveMesh& meshB,
127 const label cellBI,
128 const treeBoundBox& cellBbB
129) const
130{
131 sumOverlapMomentOp overlapSumOp;
132 cellCellOverlapMinDecomp<sumOverlapMomentOp>
133 (
134 meshA,
135 cellAI,
136 meshB,
137 cellBI,
138 cellBbB,
139 overlapSumOp
140 );
141
142 return overlapSumOp.iop_.vol_;
143}
144
145
147(
148 const polyMesh& fromMesh,
149 const polyMesh& toMesh,
150 const label iTo
151) const
152{
153 const indexedOctree<treeDataCell>& treeA = fromMesh.cellTree();
154
155 treeBoundBox bbB(toMesh.points(), toMesh.cellPoints()[iTo]);
156
157 return treeA.findBox(bbB);
158}
159
160
161// ************************************************************************* //
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition: Tuple2.H:58
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Non-pointer based hierarchical recursive searching.
Definition: indexedOctree.H:74
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
virtual const pointField & points() const
Return raw points.
Definition: polyMesh.C:1083
const indexedOctree< treeDataCell > & cellTree() const
Return the cell search tree.
Definition: polyMesh.C:940
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:79
const labelListList & cellPoints() const
Calculates the overlap volume of two cells using tetrahedral decomposition.
scalar cellCellOverlapVolumeMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB) const
Calculates the overlap volume.
labelList overlappingCells(const polyMesh &meshA, const polyMesh &meshB, const label cellBI) const
Return a list of cells in meshA which overlaps with cellBI in.
tetOverlapVolume()
Null constructor.
Tuple2< scalar, point > cellCellOverlapMomentMinDecomp(const primitiveMesh &meshA, const label cellAI, const primitiveMesh &meshB, const label cellBI, const treeBoundBox &cellBbB) const
Calculates the overlap volume and moment.
Standard boundBox with extra functionality for use in octree.
Definition: treeBoundBox.H:89
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
const pointField & points
Namespace for OpenFOAM.
labelList f(nPoints)