mapNearestAMI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2016 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::mapNearestAMI
26 
27 Description
28  Nearest-mapping Arbitrary Mesh Interface (AMI) method
29 
30 SourceFiles
31  mapNearestAMI.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef mapNearestAMI_H
36 #define mapNearestAMI_H
37 
38 #include "AMIMethod.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class mapNearestAMI Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class SourcePatch, class TargetPatch>
50 class mapNearestAMI
51 :
52  public AMIMethod<SourcePatch, TargetPatch>
53 {
54 
55 private:
56 
57  // Private Member Functions
58 
59  //- Disallow default bitwise copy construct
61 
62  //- Disallow default bitwise assignment
63  void operator=(const mapNearestAMI&);
64 
65  // Marching front
66 
67  //- Find nearest target face for source face srcFacei
68  void findNearestFace
69  (
70  const SourcePatch& srcPatch,
71  const TargetPatch& tgtPatch,
72  const label& srcFacei,
73  label& tgtFacei
74  ) const;
75 
76  //- Determine next source-target face pair
77  void setNextNearestFaces
78  (
79  boolList& mapFlag,
80  label& startSeedI,
81  label& srcFacei,
82  label& tgtFacei
83  ) const;
84 
85  //- Find mapped source face
86  label findMappedSrcFace
87  (
88  const label tgtFacei,
89  const List<DynamicList<label>>& tgtToSrc
90  ) const;
91 
92 
93  // Evaluation
94 
95  //- Area of intersection between source and target faces
96  scalar interArea
97  (
98  const label srcFacei,
99  const label tgtFacei
100  ) const;
101 
102 
103 public:
104 
105  //- Runtime type information
106  TypeName("mapNearestAMI");
107 
108 
109  // Constructors
110 
111  //- Construct from components
113  (
114  const SourcePatch& srcPatch,
115  const TargetPatch& tgtPatch,
116  const scalarField& srcMagSf,
117  const scalarField& tgtMagSf,
119  const bool reverseTarget = false,
120  const bool requireMatch = true
121  );
122 
123 
124  //- Destructor
125  virtual ~mapNearestAMI();
126 
127 
128  // Member Functions
129 
130  // Manipulation
131 
132  //- Update addressing and weights
133  virtual void calculate
134  (
135  labelListList& srcAddress,
136  scalarListList& srcWeights,
137  labelListList& tgtAddress,
138  scalarListList& tgtWeights,
139  label srcFacei = -1,
140  label tgtFacei = -1
141  );
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #ifdef NoRepository
152  #include "mapNearestAMI.C"
153 #endif
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
Nearest-mapping Arbitrary Mesh Interface (AMI) method.
Definition: mapNearestAMI.H:49
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
virtual ~mapNearestAMI()
Destructor.
virtual void calculate(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label srcFacei=-1, label tgtFacei=-1)
Update addressing and weights.
TypeName("mapNearestAMI")
Runtime type information.
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: AMIMethod.H:55
Namespace for OpenFOAM.