partialFaceAreaWeightAMI.C
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-2018 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 \*---------------------------------------------------------------------------*/
25 
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33  defineTypeNameAndDebug(partialFaceAreaWeightAMI, 0);
34  addToRunTimeSelectionTable(AMIMethod, partialFaceAreaWeightAMI, components);
35 }
36 
37 
38 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
39 
40 void Foam::partialFaceAreaWeightAMI::setNextFaces
41 (
42  label& startSeedI,
43  label& srcFacei,
44  label& tgtFacei,
45  const boolList& mapFlag,
46  labelList& seedFaces,
47  const DynamicList<label>& visitedFaces,
48  const bool errorOnNotFound
49 ) const
50 {
52  (
53  startSeedI,
54  srcFacei,
55  tgtFacei,
56  mapFlag,
57  seedFaces,
58  visitedFaces,
59  false // no error on not found
60  );
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
67 (
68  const primitivePatch& srcPatch,
69  const primitivePatch& tgtPatch,
70  const scalarField& srcMagSf,
71  const scalarField& tgtMagSf,
73  const bool reverseTarget,
74  const bool requireMatch
75 )
76 :
78  (
79  srcPatch,
80  tgtPatch,
81  srcMagSf,
82  tgtMagSf,
83  triMode,
84  reverseTarget,
85  requireMatch
86  )
87 {}
88 
89 
90 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
91 
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
97 
99 {
100  return false;
101 }
102 
103 
105 (
106  labelListList& srcAddress,
107  scalarListList& srcWeights,
108  labelListList& tgtAddress,
109  scalarListList& tgtWeights,
110  label srcFacei,
111  label tgtFacei
112 )
113 {
114  bool ok =
115  this->initialise
116  (
117  srcAddress,
118  srcWeights,
119  tgtAddress,
120  tgtWeights,
121  srcFacei,
122  tgtFacei
123  );
124 
125  if (!ok)
126  {
127  return;
128  }
129 
130  // temporary storage for addressing and weights
131  List<DynamicList<label>> srcAddr(this->srcPatch_.size());
132  List<DynamicList<scalar>> srcWght(srcAddr.size());
133  List<DynamicList<label>> tgtAddr(this->tgtPatch_.size());
134  List<DynamicList<scalar>> tgtWght(tgtAddr.size());
135 
137  (
138  srcAddr,
139  srcWght,
140  tgtAddr,
141  tgtWght,
142  srcFacei,
143  tgtFacei
144  );
145 
146  // transfer data to persistent storage
147  forAll(srcAddr, i)
148  {
149  srcAddress[i].transfer(srcAddr[i]);
150  srcWeights[i].transfer(srcWght[i]);
151  }
152  forAll(tgtAddr, i)
153  {
154  tgtAddress[i].transfer(tgtAddr[i]);
155  tgtWeights[i].transfer(tgtWght[i]);
156  }
157 }
158 
159 
160 // ************************************************************************* //
virtual void calcAddressing(List< DynamicList< label >> &srcAddress, List< DynamicList< scalar >> &srcWeights, List< DynamicList< label >> &tgtAddress, List< DynamicList< scalar >> &tgtWeights, label srcFacei, label tgtFacei)
Calculate addressing and weights using temporary storage.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
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
partialFaceAreaWeightAMI(const primitivePatch &srcPatch, const primitivePatch &tgtPatch, const scalarField &srcMagSf, const scalarField &tgtMagSf, const faceAreaIntersect::triangulationMode &triMode, const bool reverseTarget=false, const bool requireMatch=true)
Construct from components.
virtual bool conformal() const
Flag to indicate that interpolation patches are conformal.
virtual ~partialFaceAreaWeightAMI()
Destructor.
Macros for easy insertion into run-time selection tables.
List< bool > boolList
Bool container classes.
Definition: boolList.H:50
Face area weighted Arbitrary Mesh Interface (AMI) method.
A list of faces which address into the list of points.
virtual void calculate(labelListList &srcAddress, scalarListList &srcWeights, labelListList &tgtAddress, scalarListList &tgtWeights, label srcFacei=-1, label tgtFacei=-1)
Update addressing and weights.
List< label > labelList
A List of labels.
Definition: labelList.H:56
virtual void setNextFaces(label &startSeedI, label &srcFacei, label &tgtFacei, const boolList &mapFlag, labelList &seedFaces, const DynamicList< label > &visitedFaces, bool errorOnNotFound=true) const
Set the source and target seed faces.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Definition: List.C:342
Namespace for OpenFOAM.