intersectionCellsToCells.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::cellsToCellss::intersection
26 
27 Description
28  Intersection-based cells-to-cells interpolation class. Volume conservative.
29 
30 SourceFiles
31  intersectionCellsToCells.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef intersectionCellsToCells_H
36 #define intersectionCellsToCells_H
37 
38 #include "cellsToCells.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace cellsToCellss
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class intersection Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class intersection
52 :
53  public cellsToCells
54 {
55 private:
56 
57  // Private Static Data
58 
59  //- Tolerance used in volume overlap calculations
60  static const scalar tolerance_;
61 
62 
63  // Private Member Functions
64 
65  //- Return the true if cells intersect
66  bool intersect
67  (
68  const polyMesh& srcMesh,
69  const polyMesh& tgtMesh,
70  const label srcCelli,
71  const label tgtCelli
72  ) const;
73 
74  //- Return the intersection volume between two cells
75  scalar interVol
76  (
77  const polyMesh& srcMesh,
78  const polyMesh& tgtMesh,
79  const label srcCelli,
80  const label tgtCelli
81  ) const;
82 
83  //- Find indices of overlapping cells in src and tgt meshes - returns
84  // true if found a matching pair
85  bool findInitialSeeds
86  (
87  const polyMesh& srcMesh,
88  const polyMesh& tgtMesh,
89  const labelList& srcCellIDs,
90  const boolList& mapFlag,
91  const label startSeedI,
92  label& srcSeedI,
93  label& tgtSeedI
94  ) const;
95 
96  //- Calculate the mesh-to-mesh addressing and weights
97  scalar calculateAddressing
98  (
99  const polyMesh& srcMesh,
100  const polyMesh& tgtMesh,
101  labelListList& srcToTgtCellAddr,
102  scalarListList& srcToTgtCellWght,
103  labelListList& tgtToSrcCellAddr,
104  scalarListList& tgtToSrcCellWght,
105  const label srcSeedI,
106  const label tgtSeedI,
107  const labelList& srcCellIDs,
108  boolList& mapFlag,
109  label& startSeedI
110  );
111 
112  //- Set the next cells in the advancing front algorithm
113  void setNextCells
114  (
115  const polyMesh& srcMesh,
116  const polyMesh& tgtMesh,
117  label& startSeedI,
118  label& srcCelli,
119  label& tgtCelli,
120  const labelList& srcCellIDs,
121  const boolList& mapFlag,
122  const DynamicList<label>& visitedCells,
123  labelList& seedCells
124  ) const;
125 
126 
127 protected:
128 
129  // Protected Member Functions
130 
131  // Intersection
132 
133  //- Calculate the addressing and weights
134  virtual scalar calculate
135  (
136  const polyMesh& srcMesh,
137  const polyMesh& tgtMesh
138  );
139 
140  //- Normalise the weights for a given mesh
141  virtual void normalise
142  (
143  const polyMesh& mesh,
144  labelListList& localOtherCells,
145  scalarListList& weights
146  ) const;
147 
148 
149 public:
150 
151  //- Run-time type information
152  TypeName("intersection");
153 
154 
155  // Constructors
156 
157  //- Construct null
158  intersection();
159 
160 
161  //- Destructor
162  virtual ~intersection();
163 };
164 
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 } // End namespace cellsToCellss
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Class to calculate interpolative addressing and weights between the cells of two overlapping meshes.
Definition: cellsToCells.H:56
Intersection-based cells-to-cells interpolation class. Volume conservative.
TypeName("intersection")
Run-time type information.
virtual scalar calculate(const polyMesh &srcMesh, const polyMesh &tgtMesh)
Calculate the addressing and weights.
virtual void normalise(const polyMesh &mesh, labelListList &localOtherCells, scalarListList &weights) const
Normalise the weights for a given mesh.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59