1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 Base class for convexSetAlgorithms
32 University of Massachusetts Amherst
38 \*---------------------------------------------------------------------------*/
40 #ifndef convexSetAlgorithm_H
41 #define convexSetAlgorithm_H
49 #include "objectMap.H"
50 #include "vectorField.H"
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 /*---------------------------------------------------------------------------*\
60 Class convexSetAlgorithm Declaration
61 \*---------------------------------------------------------------------------*/
63 class convexSetAlgorithm
70 const label nOldPoints_;
72 //- References to old-level connectivity
73 // [Before topo-changes, at old point-positions]
74 const polyMesh& mesh_;
76 //- References to new-level connectivity
77 // [After topo-changes, at old point-positions]
78 const pointField& newPoints_;
79 const UList<edge>& newEdges_;
80 const UList<face>& newFaces_;
81 const UList<cell>& newCells_;
82 const UList<label>& newOwner_;
83 const UList<label>& newNeighbour_;
86 mutable labelList parents_;
88 //- Internal data members
89 mutable boundBox box_;
90 mutable vector refNorm_;
91 mutable scalar normFactor_;
92 mutable vectorField centres_;
93 mutable scalarField weights_;
99 // Construct from components
102 const polyMesh& mesh,
103 const pointField& newPoints,
104 const UList<edge>& newEdges,
105 const UList<face>& newFaces,
106 const UList<cell>& newCells,
107 const UList<label>& newOwner,
108 const UList<label>& newNeighbour
113 virtual ~convexSetAlgorithm()
118 // Dimensions of the algorithm
119 virtual label dimension() const = 0;
121 // Return true if accumulated weights are consistent
122 virtual bool consistent(const scalar tolerance) const;
124 // Return the normFactor
125 virtual scalar normFactor() const;
127 // Normalize stored weights
128 virtual void normalize(bool normSum) const;
130 // Check whether the bounding box contains the entity
131 virtual bool contains(const label index) const = 0;
133 // Extract weights and centres to lists
134 virtual void populateLists
137 vectorField& centres,
141 // Compute normFactor
142 virtual void computeNormFactor(const label index) const = 0;
144 // Compute intersections
145 virtual bool computeIntersection
147 const label newIndex,
148 const label oldIndex,
153 // Obtain map weighting factors
154 virtual void computeWeights
158 const labelList& mapCandidates,
159 const labelListList& oldNeighbourList,
161 scalarField& weights,
162 vectorField& centres,
166 // Write out connectivity information to disk
169 // Output an entity as a VTK file
174 const label primitiveType = 3,
175 const bool useOldConnectivity = false
178 // Output a list of entities as a VTK file
182 const labelList& cList,
183 const label primitiveType = 3,
184 const bool useOldConnectivity = false
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 } // End namespace Foam
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 // ************************************************************************* //