Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / smoothers / geometry / meshSurfaceOptimizer / advancedSurfaceSmoothers / surfaceOptimizer / surfaceOptimizer.H
blob2bda709afb1131f4bebf69d17077e842582686ef
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | cfMesh: A library for mesh generation
4    \\    /   O peration     |
5     \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6      \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Class
25     surfaceOptimizer
27 Description
28     Performs optimisation of a central vertex in a simplex
30 SourceFiles
31     surfaceOptimizer.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef surfaceOptimizer_H
36 #define surfaceOptimizer_H
38 #include "point.H"
39 #include "triFace.H"
40 #include "DynList.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
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];
57     // Private data
58         //- reference to the simplex points
59         DynList<point>& pts_;
61         //- reference to the triangles forming a simplex
62         const DynList<triFace>& trias_;
64         //- min position of the bnd box
65         point pMin_;
67         //- max position of the bnd box
68         point pMax_;
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&);
92 public:
94     // Constructors
96         //- Construct from transformed points and triangles forming a simplex
97         surfaceOptimizer
98         (
99             DynList<point>& pts,
100             const DynList<triFace>& trias
101         );
104     // Destructor
106         ~surfaceOptimizer();
108     // Member Functions
110         //- optimizes position of a central point in the simplex
111         point optimizePoint(const scalar tol = 0.1);
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 } // End namespace Foam
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 #endif
123 // ************************************************************************* //