matchingCellsToCells.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::matching
26 
27 Description
28  Matching, one-to-one, cells-to-cells interpolation class.
29 
30 SourceFiles
31  matchingCellsToCells.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef matchingCellsToCells_H
36 #define matchingCellsToCells_H
37 
38 #include "cellsToCells.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 namespace cellsToCellss
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class matching Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class matching
52 :
53  public cellsToCells
54 {
55 private:
56 
57  // Private Member Functions
58 
59  //- Return the true if cells intersect
60  bool intersect
61  (
62  const polyMesh& srcMesh,
63  const polyMesh& tgtMesh,
64  const label srcCelli,
65  const label tgtCelli
66  ) const;
67 
68  //- Find indices of overlapping cells in src and tgt meshes - returns
69  // true if found a matching pair
70  bool findInitialSeeds
71  (
72  const polyMesh& srcMesh,
73  const polyMesh& tgtMesh,
74  const labelList& srcCellIDs,
75  const boolList& mapFlag,
76  const label startSeedI,
77  label& srcSeedI,
78  label& tgtSeedI
79  ) const;
80 
81  //- Calculate the mesh-to-mesh addressing and weights
82  scalar calculateAddressing
83  (
84  const polyMesh& srcMesh,
85  const polyMesh& tgtMesh,
86  labelListList& srcToTgtCellAddr,
87  scalarListList& srcToTgtCellWght,
88  labelListList& tgtToSrcCellAddr,
89  scalarListList& tgtToSrcCellWght,
90  const label srcSeedI,
91  const label tgtSeedI,
92  const labelList& srcCellIDs,
93  boolList& mapFlag,
94  label& startSeedI
95  );
96 
97  //- Append to list of src mesh seed indices
98  void appendToDirectSeeds
99  (
100  const polyMesh& srcMesh,
101  const polyMesh& tgtMesh,
102  boolList& mapFlag,
103  labelList& srcTgtSeed,
104  DynamicList<label>& srcSeeds,
105  label& srcSeedI,
106  label& tgtSeedI
107  ) const;
108 
109 
110 protected:
111 
112  // Protected Member Functions
113 
114  // Intersection
115 
116  //- Calculate the addressing and weights
117  virtual scalar calculate
118  (
119  const polyMesh& srcMesh,
120  const polyMesh& tgtMesh
121  );
122 
123  //- Normalise the weights for a given mesh
124  virtual void normalise
125  (
126  const polyMesh& mesh,
127  labelListList& localOtherCells,
128  scalarListList& weights
129  ) const;
130 
131 
132 public:
133 
134  //- Run-time type information
135  TypeName("matching");
136 
137 
138  // Constructors
139 
140  //- Construct null
141  matching();
142 
143 
144  //- Destructor
145  virtual ~matching();
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace cellsToCellss
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #endif
157 
158 // ************************************************************************* //
Class to calculate interpolative addressing and weights between the cells of two overlapping meshes.
Definition: cellsToCells.H:56
Matching, one-to-one, cells-to-cells interpolation class.
virtual scalar calculate(const polyMesh &srcMesh, const polyMesh &tgtMesh)
Calculate the addressing and weights.
TypeName("matching")
Run-time type information.
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