partialFaceAreaWeightAMI.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) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  defineTypeNameAndDebug(partialFaceAreaWeightAMI, 0);
38  (
39  AMIInterpolation,
40  partialFaceAreaWeightAMI,
41  dict
42  );
44  (
45  AMIInterpolation,
46  partialFaceAreaWeightAMI,
47  component
48  );
49 }
50 
51 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
52 
54 (
55  label& startSeedi,
56  label& srcFacei,
57  label& tgtFacei,
58  const bitSet& mapFlag,
59  labelList& seedFaces,
60  const DynamicList<label>& visitedFaces,
61  const bool errorOnNotFound
62 ) const
63 {
64  return faceAreaWeightAMI::setNextFaces
65  (
66  startSeedi,
67  srcFacei,
68  tgtFacei,
69  mapFlag,
70  seedFaces,
71  visitedFaces,
72  false // no error on not found
73  );
74 }
75 
76 
77 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
78 
80 (
81  const dictionary& dict,
82  const bool reverseTarget
83 )
84 :
85  faceAreaWeightAMI(dict, reverseTarget)
86 {}
87 
88 
90 (
91  const bool requireMatch,
92  const bool reverseTarget,
93  const scalar lowWeightCorrection,
95  const bool restartUncoveredSourceFace
96 )
97 :
99  (
100  requireMatch,
101  reverseTarget,
102  lowWeightCorrection,
103  triMode,
104  restartUncoveredSourceFace
105  )
106 {}
107 
108 
110 (
111  const partialFaceAreaWeightAMI& ami
112 )
113 :
114  faceAreaWeightAMI(ami)
115 {}
116 
117 
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 
121 {
122  return false;
123 }
124 
125 
127 (
128  const primitivePatch& srcPatch,
129  const primitivePatch& tgtPatch,
130  const autoPtr<searchableSurface>& surfPtr
131 )
132 {
133  if (faceAreaWeightAMI::calculate(srcPatch, tgtPatch, surfPtr))
134  {
135  if (distributed())
136  {
137  scalarList newTgtMagSf(std::move(tgtMagSf_));
138 
139  // Assign default sizes. Override selected values with calculated
140  // values. This is to support ACMI where some of the target faces
141  // are never used (so never get sent over and hence never assigned
142  // to)
143  tgtMagSf_ = tgtPatch0().magFaceAreas();
144 
145  for (const labelList& smap : this->extendedTgtMapPtr_->subMap())
146  {
147  UIndirectList<scalar>(tgtMagSf_, smap) =
148  UIndirectList<scalar>(newTgtMagSf, smap);
149  }
150  }
151 
152  return true;
153  }
154 
155  return false;
156 }
157 
158 
159 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Foam::component
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
Definition: FieldFieldFunctions.C:44
Foam::partialFaceAreaWeightAMI::conformal
virtual bool conformal() const
Flag to indicate that interpolation patches are conformal.
Definition: partialFaceAreaWeightAMI.C:120
Foam::bitSet
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:63
Foam::faceAreaIntersect::triangulationMode
triangulationMode
Definition: faceAreaIntersect.H:63
Foam::DynamicList< label >
Foam::partialFaceAreaWeightAMI::setNextFaces
virtual bool setNextFaces(label &startSeedi, label &srcFacei, label &tgtFacei, const bitSet &mapFlag, labelList &seedFaces, const DynamicList< label > &visitedFaces, const bool errorOnNotFound=true) const
Set the source and target seed faces.
Definition: partialFaceAreaWeightAMI.C:54
Foam::faceAreaWeightAMI
Face area weighted Arbitrary Mesh Interface (AMI) method.
Definition: faceAreaWeightAMI.H:51
Foam::faceAreaWeightAMI::calculate
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
Definition: faceAreaWeightAMI.C:625
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::partialFaceAreaWeightAMI::calculate
virtual bool calculate(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const autoPtr< searchableSurface > &surfPtr=nullptr)
Update addressing, weights and (optional) centroids.
Definition: partialFaceAreaWeightAMI.C:127
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::partialFaceAreaWeightAMI::partialFaceAreaWeightAMI
partialFaceAreaWeightAMI(const dictionary &dict, const bool reverseTarget=false)
Construct from dictionary.
Definition: partialFaceAreaWeightAMI.C:80
Foam::List< label >
Foam::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::partialFaceAreaWeightAMI
Partial face area weighted Arbitrary Mesh Interface (AMI) method.
Definition: partialFaceAreaWeightAMI.H:51
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85
partialFaceAreaWeightAMI.H