directMethod.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::directMethod
28 
29 Description
30  Direct (one-to-one cell correspondence) mesh-to-mesh interpolation class
31 
32  Volume conservative.
33 
34 SourceFiles
35  directMethod.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef directMethod_H
40 #define directMethod_H
41 
42 #include "meshToMeshMethod.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class directMethod Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class directMethod
54 :
55  public meshToMeshMethod
56 {
57 protected:
58 
59  // Protected Member Functions
60 
61  //- Return the true if cells intersect
62  virtual bool intersect
63  (
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  virtual bool findInitialSeeds
71  (
72  const labelList& srcCellIDs,
73  const boolList& mapFlag,
74  const label startSeedI,
75  label& srcSeedI,
76  label& tgtSeedI
77  ) const;
78 
79  //- Calculate the mesh-to-mesh addressing and weights
80  virtual void calculateAddressing
81  (
82  labelListList& srcToTgtCellAddr,
83  scalarListList& srcToTgtCellWght,
84  labelListList& tgtToSrcCellAddr,
85  scalarListList& tgtToSrcCellWght,
86  const label srcSeedI,
87  const label tgtSeedI,
88  const labelList& srcCellIDs,
89  boolList& mapFlag,
90  label& startSeedI
91  );
92 
93  //- Append to list of src mesh seed indices
94  virtual void appendToDirectSeeds
95  (
96  boolList& mapFlag,
97  labelList& srcTgtSeed,
98  DynamicList<label>& srcSeeds,
99  label& srcSeedI,
100  label& tgtSeedI
101  ) const;
102 
103 
104 private:
105 
106  // Private member functions
107 
108  //- No copy construct
109  directMethod(const directMethod&) = delete;
110 
111  //- No copy assignment
112  void operator=(const directMethod&) = delete;
113 
114 
115 public:
116 
117  //- Run-time type information
118  TypeName("direct");
119 
120  //- Construct from source and target meshes
121  directMethod(const polyMesh& src, const polyMesh& tgt);
122 
123  //- Destructor
124  virtual ~directMethod();
125 
126 
127  // Member Functions
128 
129  // Evaluate
130 
131  //- Calculate addressing and weights and optionally offset vectors
132  virtual void calculate
133  (
134  labelListList& srcToTgtAddr,
135  scalarListList& srcToTgtWght,
136  pointListList& srcToTgtVec,
137  labelListList& tgtToSrcAddr,
138  scalarListList& tgtToSrcWght,
139  pointListList& tgtToSrcVec
140  );
141 };
142 
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 } // End namespace Foam
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
Foam::directMethod::calculateAddressing
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:100
Foam::DynamicList< label >
Foam::directMethod::~directMethod
virtual ~directMethod()
Destructor.
Definition: directMethod.C:237
Foam::directMethod::appendToDirectSeeds
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:166
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::meshToMeshMethod
Base class for mesh-to-mesh calculation methods.
Definition: meshToMeshMethod.H:51
Foam::meshToMeshMethod::src
const polyMesh & src() const
Return const access to the source mesh.
Definition: meshToMeshMethodI.H:28
Foam::meshToMeshMethod::tgt
const polyMesh & tgt() const
Return const access to the target mesh.
Definition: meshToMeshMethodI.H:34
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
meshToMeshMethod.H
Foam::directMethod::calculate
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, pointListList &srcToTgtVec, labelListList &tgtToSrcAddr, scalarListList &tgtToSrcWght, pointListList &tgtToSrcVec)
Calculate addressing and weights and optionally offset vectors.
Definition: directMethod.C:244
Foam::directMethod::intersect
virtual bool intersect(const label srcCelli, const label tgtCelli) const
Return the true if cells intersect.
Definition: directMethod.C:44
Foam::List< label >
Foam::directMethod::findInitialSeeds
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:59
Foam::directMethod::TypeName
TypeName("direct")
Run-time type information.
Foam::directMethod
Direct (one-to-one cell correspondence) mesh-to-mesh interpolation class.
Definition: directMethod.H:52