Commit 53533a2d authored by laurence's avatar laurence
Browse files

ENH: cvMesh: split refinement and smoothing of background mesh

parent 07cb342a
......@@ -29,6 +29,10 @@ $(cellSizeAndAlignmentControl)/searchableSurfaceControl/searchableSurfaceControl
cellShapeControl/cellAspectRatioControl/cellAspectRatioControl.C
cellShapeControl/smoothAlignmentSolver/smoothAlignmentSolver.C
cellShapeControl/controlMeshRefinement/controlMeshRefinement.C
/*cellSizeControlSurfaces/cellSizeControlSurfaces.C*/
cellSizeFunctions = cellSizeControlSurfaces/cellSizeFunction
......
......@@ -84,33 +84,6 @@ class cellShapeControl
// Private Member Functions
template <class Triangulation, class Type>
tmp<Field<Type> > filterFarPoints
(
const Triangulation& mesh,
const Field<Type>& field
);
template <class Triangulation>
autoPtr<mapDistribute> buildMap
(
const Triangulation& mesh,
labelListList& pointPoints
);
template <class Triangulation>
autoPtr<mapDistribute> buildReferredMap
(
const Triangulation& mesh,
labelList& indices
);
template <class Triangulation>
tmp<triadField> buildAlignmentField(const Triangulation& mesh);
template <class Triangulation>
tmp<pointField> buildPointField(const Triangulation& mesh);
//- Disallow default bitwise copy construct
cellShapeControl(const cellShapeControl&);
......@@ -155,6 +128,8 @@ public:
inline const cellSizeAndAlignmentControls& sizeAndAlignment() const;
inline const scalar& minimumCellSize() const;
// Query
......@@ -172,29 +147,6 @@ public:
scalar& size,
tensor& alignment
) const;
// Edit
void initialMeshPopulation
(
const autoPtr<backgroundMeshDecomposition>& decomposition
);
label refineMesh
(
const autoPtr<backgroundMeshDecomposition>& decomposition
);
void smoothMesh();
//- Add a control point with a specified size and alignment
// virtual void addControlPoint
// (
// const point& pt,
// const scalar& size,
// const tensor& alignment
// );
};
......
......@@ -52,4 +52,17 @@ Foam::cellShapeControl::aspectRatio() const
}
inline const Foam::cellSizeAndAlignmentControls&
Foam::cellShapeControl::sizeAndAlignment() const
{
return sizeAndAlignment_;
}
inline const Foam::scalar& Foam::cellShapeControl::minimumCellSize() const
{
return minimumCellSize_;
}
// ************************************************************************* //
......@@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "cellShapeControlMesh.H"
#include "cellSizeAndAlignmentControls.H"
#include "pointIOField.H"
#include "scalarIOField.H"
#include "tensorIOField.H"
......@@ -36,9 +37,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(cellShapeControlMesh, 0);
}
......@@ -537,12 +536,9 @@ void Foam::cellShapeControlMesh::barycentricCoords
) const
{
// Use the previous cell handle as a hint on where to start searching
ch = locate
(
Point(pt.x(), pt.y(), pt.z())
);
ch = locate(toPoint<Point>(pt));
if (!is_infinite(ch))
if (dimension() > 2 && !is_infinite(ch))
{
oldCellHandle_ = ch;
......
......@@ -53,6 +53,8 @@ SourceFiles
namespace Foam
{
class cellSizeAndAlignmentControls;
/*---------------------------------------------------------------------------*\
Class cellShapeControlMesh Declaration
\*---------------------------------------------------------------------------*/
......
......@@ -48,7 +48,7 @@ Foam::cellSizeAndAlignmentControl::cellSizeAndAlignmentControl
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
)
:
runTime_(runTime),
......@@ -64,7 +64,7 @@ Foam::cellSizeAndAlignmentControl::New
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
)
{
word cellSizeAndAlignmentControlTypeName
......@@ -72,7 +72,7 @@ Foam::cellSizeAndAlignmentControl::New
controlFunctionDict.lookup("type")
);
Info<< nl << "Selecting cellSizeAndAlignmentControl "
Info<< " Selecting cellSizeAndAlignmentControl "
<< cellSizeAndAlignmentControlTypeName << endl;
dictionaryConstructorTable::iterator cstrIter =
......@@ -101,7 +101,7 @@ Foam::cellSizeAndAlignmentControl::New
runTime,
name,
controlFunctionDict,
allGeometry
geometryToConformTo
)
);
}
......
......@@ -91,9 +91,9 @@ public:
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
),
(runTime, name, controlFunctionDict, allGeometry)
(runTime, name, controlFunctionDict, geometryToConformTo)
);
......@@ -106,7 +106,7 @@ public:
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
);
......@@ -118,7 +118,7 @@ public:
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
);
......
......@@ -30,9 +30,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(cellSizeAndAlignmentControls, 0);
}
......@@ -116,12 +114,12 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
(
const Time& runTime,
const dictionary& shapeControlDict,
const conformationSurfaces& allGeometry,
const conformationSurfaces& geometryToConformTo,
const scalar defaultCellSize
)
:
shapeControlDict_(shapeControlDict),
allGeometry_(allGeometry),
geometryToConformTo_(geometryToConformTo),
controlFunctions_(shapeControlDict_.size()),
defaultCellSize_(defaultCellSize)
{
......@@ -136,6 +134,8 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
shapeControlDict_.subDict(shapeControlEntryName)
);
Info<< nl << "Shape Control : " << shapeControlEntryName << endl;
controlFunctions_.set
(
functionI,
......@@ -144,7 +144,7 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
runTime,
shapeControlEntryName,
controlFunctionDict,
allGeometry
geometryToConformTo
)
);
......
......@@ -52,7 +52,7 @@ class cellSizeAndAlignmentControls
const dictionary& shapeControlDict_;
const conformationSurfaces& allGeometry_;
const conformationSurfaces& geometryToConformTo_;
PtrList<cellSizeAndAlignmentControl> controlFunctions_;
......@@ -83,7 +83,7 @@ public:
(
const Time& runTime,
const dictionary& shapeControlDict,
const conformationSurfaces& allGeometry,
const conformationSurfaces& geometryToConformTo,
const scalar defaultCellSize
);
......@@ -96,11 +96,17 @@ public:
// Access
const PtrList<cellSizeAndAlignmentControl>& controlFunctions() const
inline const PtrList<cellSizeAndAlignmentControl>&
controlFunctions() const
{
return controlFunctions_;
}
inline const conformationSurfaces& geometryToConformTo() const
{
return geometryToConformTo_;
}
// Query
......
......@@ -58,7 +58,7 @@ Foam::fileControl::fileControl
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
)
:
cellSizeAndAlignmentControl
......@@ -66,7 +66,7 @@ Foam::fileControl::fileControl
runTime,
name,
controlFunctionDict,
allGeometry
geometryToConformTo
),
pointsFile_(controlFunctionDict.lookup("pointsFile")),
sizesFile_(controlFunctionDict.lookup("sizesFile")),
......
......@@ -85,7 +85,7 @@ public:
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
);
//- Destructor
......
......@@ -158,7 +158,7 @@ Foam::searchableSurfaceControl::searchableSurfaceControl
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
)
:
cellSizeAndAlignmentControl
......@@ -166,11 +166,11 @@ Foam::searchableSurfaceControl::searchableSurfaceControl
runTime,
name,
controlFunctionDict,
allGeometry
geometryToConformTo
),
surfaceName_(controlFunctionDict.lookupOrDefault<word>("surface", name)),
searchableSurface_(allGeometry.geometry()[surfaceName_]),
allGeometry_(allGeometry),
searchableSurface_(geometryToConformTo.geometry()[surfaceName_]),
geometryToConformTo_(geometryToConformTo),
cellSizeFunction_
(
cellSizeFunction::New(controlFunctionDict, searchableSurface_)
......@@ -579,7 +579,7 @@ void Foam::searchableSurfaceControl::initialVertices
pointIndexHit info;
label infoFeature;
allGeometry_.findFeaturePointNearest
geometryToConformTo_.findFeaturePointNearest
(
pts[pI],
nearFeatDistSqrCoeff,
......@@ -592,7 +592,7 @@ void Foam::searchableSurfaceControl::initialVertices
if (info.hit())
{
const extendedFeatureEdgeMesh& features =
allGeometry_.features()[infoFeature];
geometryToConformTo_.features()[infoFeature];
vectorField norms = features.featurePointNormals(info.index());
......@@ -608,7 +608,7 @@ void Foam::searchableSurfaceControl::initialVertices
}
else
{
allGeometry_.findEdgeNearest
geometryToConformTo_.findEdgeNearest
(
pts[pI],
nearFeatDistSqrCoeff,
......@@ -619,7 +619,7 @@ void Foam::searchableSurfaceControl::initialVertices
if (info.hit())
{
const extendedFeatureEdgeMesh& features =
allGeometry_.features()[infoFeature];
geometryToConformTo_.features()[infoFeature];
vectorField norms = features.edgeNormals(info.index());
......
......@@ -59,7 +59,7 @@ class searchableSurfaceControl
//- Reference to the searchableSurface object holding the geometry data
const searchableSurface& searchableSurface_;
const conformationSurfaces& allGeometry_;
const conformationSurfaces& geometryToConformTo_;
autoPtr<cellSizeFunction> cellSizeFunction_;
......@@ -106,7 +106,7 @@ public:
const Time& runTime,
const word& name,
const dictionary& controlFunctionDict,
const conformationSurfaces& allGeometry
const conformationSurfaces& geometryToConformTo
);
//- Destructor
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::controlMeshRefinement
Description
SourceFiles
controlMeshRefinementI.H
controlMeshRefinement.C
controlMeshRefinementIO.C
\*---------------------------------------------------------------------------*/
#ifndef controlMeshRefinement_H
#define controlMeshRefinement_H
#include "cellShapeControl.H"
#include "cellShapeControlMesh.H"
#include "cellSizeAndAlignmentControls.H"
#include "conformationSurfaces.H"
#include "backgroundMeshDecomposition.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class controlMeshRefinement Declaration
\*---------------------------------------------------------------------------*/
class controlMeshRefinement
{
// Private data
const cellShapeControl& shapeController_;
cellShapeControlMesh& mesh_;
const cellSizeAndAlignmentControls& sizeControls_;
const conformationSurfaces& geometryToConformTo_;
// Private Member Functions
bool detectEdge
(
point a,
point b,
DynamicList<Vb>& pointsFound
) const;
DynamicList<Vb> findDiscontinuities(const linePointRef& l) const;
//- Disallow default bitwise copy construct
controlMeshRefinement(const controlMeshRefinement&);
//- Disallow default bitwise assignment
void operator=(const controlMeshRefinement&);
public:
//- Runtime type information
ClassName("controlMeshRefinement");
// Constructors
//- Construct null
controlMeshRefinement(cellShapeControl& shapeController);
//- Destructor
~controlMeshRefinement();
// Member Functions
// Access
// Check
// Edit
void initialMeshPopulation
(
const autoPtr<backgroundMeshDecomposition>& decomposition
);
label refineMesh
(
const autoPtr<backgroundMeshDecomposition>& decomposition
);
// Write
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.