1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 cfMesh 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
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
28 Performs optimisation of a central vertex in a simplex
33 \*---------------------------------------------------------------------------*/
35 #ifndef surfaceOptimizer_H
36 #define surfaceOptimizer_H
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class surfaceOptimizer Declaration
49 \*---------------------------------------------------------------------------*/
51 class surfaceOptimizer
53 // Private static data
54 //- direction vectors for divide and conquer algorithm
55 static const vector dirVecs[4];
58 //- reference to the simplex points
61 //- reference to the triangles forming a simplex
62 const DynList<triFace>& trias_;
64 //- min position of the bnd box
67 //- max position of the bnd box
70 // Private member functions
71 //- evaluate stabilisation factor
72 scalar evaluateStabilisationFactor() const;
74 //- evaluate the functional
75 scalar evaluateFunc(const scalar& K) const;
77 //- evaluate gradients needed for optimisation
78 void evaluateGradients(const scalar&, vector&, tensor&) const;
80 //- optimise point position using the divide and conquer technique
81 scalar optimiseDivideAndConquer(const scalar tol);
83 //- optimise point position via the steepest descent method
84 scalar optimiseSteepestDescent(const scalar tol);
86 //- Disallow default bitwise copy construct
87 surfaceOptimizer(const surfaceOptimizer&);
89 //- Disallow default bitwise assignment
90 void operator=(const surfaceOptimizer&);
96 //- Construct from transformed points and triangles forming a simplex
100 const DynList<triFace>& trias
110 //- optimizes position of a central point in the simplex
111 point optimizePoint(const scalar tol = 0.1);
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 } // End namespace Foam
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 // ************************************************************************* //