perfectInterface.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) 2011 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 Class
28  Foam::perfectInterface
29 
30 Description
31  Hack of attachDetach to couple patches when they perfectly align.
32  Does not decouple. Used by stitchMesh app. Does geometric matching.
33 
34 SourceFiles
35  perfectInterface.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef perfectInterface_H
40 #define perfectInterface_H
41 
42 #include "polyMeshModifier.H"
43 #include "polyPatchID.H"
44 #include "ZoneIDs.H"
45 #include "indirectPrimitivePatch.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class Time;
54 
55 /*---------------------------------------------------------------------------*\
56  Class perfectInterface Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class perfectInterface
60 :
61  public polyMeshModifier
62 {
63  // Private Data
64 
65  //- Master face zone ID
66  faceZoneID faceZoneID_;
67 
68  //- Master patch ID
69  polyPatchID masterPatchID_;
70 
71  //- Slave patch ID
72  polyPatchID slavePatchID_;
73 
74  //- Tolerance used for distance comparison
75  // (fraction of minimum edge length)
76  static const scalar tol_;
77 
78 
79  // Private Member Functions
80 
81  //- Calculate face centres on patch
82  static pointField calcFaceCentres(const indirectPrimitivePatch&);
83 
84 
85  //- No copy construct
86  perfectInterface(const perfectInterface&) = delete;
87 
88  //- No copy assignment
89  void operator=(const perfectInterface&) = delete;
90 
91 
92 public:
93 
94  //- Runtime type information
95  TypeName("perfectInterface");
96 
97 
98  // Constructors
99 
100  //- Construct from components
102  (
103  const word& name,
104  const label index,
105  const polyTopoChanger& mme,
106  const word& faceZoneName,
107  const word& masterPatchName,
108  const word& slavePatchName
109  );
110 
111  //- Construct from dictionary
113  (
114  const word& name,
115  const dictionary& dict,
116  const label index,
117  const polyTopoChanger& mme
118  );
119 
120 
121  //- Destructor
122  virtual ~perfectInterface() = default;
123 
124 
125  // Member Functions
126 
127  //- Check for topology change
128  virtual bool changeTopology() const;
129 
130  //- Insert the layer addition/removal instructions
131  // into the topological change
132  virtual void setRefinement(polyTopoChange&) const;
133 
134  //- Insert the layer addition/removal instructions
135  // into the topological change. Uses only mesh, not any of the
136  // patch and zone indices. Bit of a workaround - used in extruding
137  // a mesh.
138  virtual void setRefinement
139  (
140  const indirectPrimitivePatch& pp0,
141  const indirectPrimitivePatch& pp1,
143  ) const;
144 
145  //- Modify motion points to comply with the topological change
146  virtual void modifyMotionPoints(pointField& motionPoints) const;
147 
148  //- Force recalculation of locally stored data on topological change
149  virtual void updateMesh(const mapPolyMesh&);
150 
151  //- Write
152  virtual void write(Ostream&) const;
153 
154  //- Write dictionary
155  virtual void writeDict(Ostream&) const;
156 
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polyTopoChanger
List of mesh modifiers defining the mesh dynamics.
Definition: polyTopoChanger.H:62
Foam::perfectInterface::modifyMotionPoints
virtual void modifyMotionPoints(pointField &motionPoints) const
Modify motion points to comply with the topological change.
Definition: perfectInterface.C:467
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:99
Foam::polyMeshModifier::index
label index() const
Return the index of this modifier.
Definition: polyMeshModifier.H:156
Foam::perfectInterface::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: perfectInterface.C:474
ZoneIDs.H
Foam::perfectInterface::setRefinement
virtual void setRefinement(polyTopoChange &) const
Insert the layer addition/removal instructions.
Definition: perfectInterface.C:426
Foam::DynamicID< faceZoneMesh >
Foam::perfectInterface::writeDict
virtual void writeDict(Ostream &) const
Write dictionary.
Definition: perfectInterface.C:495
polyPatchID.H
Foam::perfectInterface::TypeName
TypeName("perfectInterface")
Runtime type information.
Foam::Field< vector >
Foam::perfectInterface::changeTopology
virtual bool changeTopology() const
Check for topology change.
Definition: perfectInterface.C:131
indirectPrimitivePatch.H
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:123
Foam::perfectInterface
Hack of attachDetach to couple patches when they perfectly align. Does not decouple....
Definition: perfectInterface.H:58
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::polyMeshModifier
Virtual base class for mesh modifiers.
Definition: polyMeshModifier.H:68
Foam::polyMeshModifier::name
const word & name() const
Return name of this modifier.
Definition: polyMeshModifier.H:150
Foam::perfectInterface::~perfectInterface
virtual ~perfectInterface()=default
Destructor.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
polyMeshModifier.H
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79
Foam::perfectInterface::write
virtual void write(Ostream &) const
Write.
Definition: perfectInterface.C:485