directMethod.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-2021 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::directMethod
26 
27 Description
28  Direct (one-to-one cell correspondence) mesh-to-mesh interpolation class
29 
30  Volume conservative.
31 
32 SourceFiles
33  directMethod.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef directMethod_H
38 #define directMethod_H
39 
40 #include "meshToMeshMethod.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class directMethod Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class directMethod
52 :
53  public meshToMeshMethod
54 {
55 protected:
56 
57  // Protected Member Functions
58 
59  //- Return the true if cells intersect
60  virtual bool intersect
61  (
62  const label srcCelli,
63  const label tgtCelli
64  ) const;
65 
66  //- Find indices of overlapping cells in src and tgt meshes - returns
67  // true if found a matching pair
68  virtual bool findInitialSeeds
69  (
70  const labelList& srcCellIDs,
71  const boolList& mapFlag,
72  const label startSeedI,
73  label& srcSeedI,
74  label& tgtSeedI
75  ) const;
76 
77  //- Calculate the mesh-to-mesh addressing and weights
78  virtual void calculateAddressing
79  (
80  labelListList& srcToTgtCellAddr,
81  scalarListList& srcToTgtCellWght,
82  labelListList& tgtToSrcCellAddr,
83  scalarListList& tgtToSrcCellWght,
84  const label srcSeedI,
85  const label tgtSeedI,
86  const labelList& srcCellIDs,
87  boolList& mapFlag,
88  label& startSeedI
89  );
90 
91  //- Append to list of src mesh seed indices
92  virtual void appendToDirectSeeds
93  (
94  boolList& mapFlag,
95  labelList& srcTgtSeed,
96  DynamicList<label>& srcSeeds,
97  label& srcSeedI,
98  label& tgtSeedI
99  ) const;
100 
101 
102 public:
103 
104  //- Run-time type information
105  TypeName("direct");
106 
107  // Constructors
108 
109  //- Construct from source and target meshes
110  directMethod(const polyMesh& src, const polyMesh& tgt);
111 
112  //- Disallow default bitwise copy construction
113  directMethod(const directMethod&) = delete;
114 
115 
116  //- Destructor
117  virtual ~directMethod();
118 
119 
120  // Member Functions
121 
122  //- Return the corresponding AMI method for patch interpolation
123  virtual const word& AMImethod() const;
124 
125  // Evaluate
126 
127  //- Calculate addressing and weights
128  virtual void calculate
129  (
130  labelListList& srcToTgtAddr,
131  scalarListList& srcToTgtWght,
132  labelListList& tgtToTgtAddr,
133  scalarListList& tgtToTgtWght
134  );
135 
136 
137  // Member Operators
138 
139  //- Disallow default bitwise assignment
140  void operator=(const directMethod&) = delete;
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght)
Calculate addressing and weights.
Definition: directMethod.C:248
directMethod(const polyMesh &src, const polyMesh &tgt)
Construct from source and target meshes.
Definition: directMethod.C:225
const polyMesh & src() const
Return const access to the source mesh.
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
Definition: directMethod.C:43
virtual bool findInitialSeeds(const labelList &srcCellIDs, const boolList &mapFlag, const label startSeedI, label &srcSeedI, label &tgtSeedI) const
Find indices of overlapping cells in src and tgt meshes - returns.
Definition: directMethod.C:58
TypeName("direct")
Run-time type information.
const polyMesh & tgt() const
Return const access to the target mesh.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
A class for handling words, derived from string.
Definition: word.H:59
virtual void calculateAddressing(labelListList &srcToTgtCellAddr, scalarListList &srcToTgtCellWght, labelListList &tgtToSrcCellAddr, scalarListList &tgtToSrcCellWght, const label srcSeedI, const label tgtSeedI, const labelList &srcCellIDs, boolList &mapFlag, label &startSeedI)
Calculate the mesh-to-mesh addressing and weights.
Definition: directMethod.C:99
virtual void appendToDirectSeeds(boolList &mapFlag, labelList &srcTgtSeed, DynamicList< label > &srcSeeds, label &srcSeedI, label &tgtSeedI) const
Append to list of src mesh seed indices.
Definition: directMethod.C:165
virtual ~directMethod()
Destructor.
Definition: directMethod.C:236
Base class for mesh-to-mesh calculation methods.
Direct (one-to-one cell correspondence) mesh-to-mesh interpolation class.
Definition: directMethod.H:50
virtual const word & AMImethod() const
Return the corresponding AMI method for patch interpolation.
Definition: directMethod.C:241
void operator=(const directMethod &)=delete
Disallow default bitwise assignment.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
Namespace for OpenFOAM.